Skip to content

Instantly share code, notes, and snippets.

@IsaacGonzalez
Created July 3, 2015 01:22
Show Gist options
  • Save IsaacGonzalez/a89634e05a76fa1dbea0 to your computer and use it in GitHub Desktop.
Save IsaacGonzalez/a89634e05a76fa1dbea0 to your computer and use it in GitHub Desktop.
//@Test
public void testSuccesfulSPEIPMCreate() throws Exception {
valid_payment_method = new JSONObject(
"{'description':'Stogies',"
+ "'reference_id':'9839-wolf_pack',"
+ "'amount':20000,"
+ "'currency':'MXN',"
+ "'details':"
+ "{"
+ "'name':'Wolverine',"
+ " 'billing_address': {"
+ "'street1':'tamesis'"
+ "}, "
+ "line_items: [{"
+ "'name':'Box of Cohiba S1s', "
+ "'sku':'cohb_s1',"
+ "'unit_price': 20000,"
+ "'description':'Imported from Mex.',"
+ "'quantity':1,"
+ "'type':'other_human_consumption'}]"
+ "}"
+ "}");
JSONObject bank = new JSONObject("{'bank':{'type':'spei'}}");
JSONObject params = valid_payment_method.put("bank", bank.get("bank"));
Charge charge = Charge.create(params);
System.out.println("Banco : " + ((SpeiPayment) charge.payment_method).bank);
System.out.println("CLABE: " + ((SpeiPayment) charge.payment_method).clabe);
assertTrue(charge.payment_method instanceof SpeiPayment);
assertTrue(charge.status.equals("pending_payment"));
assertTrue(
!((SpeiPayment) charge.payment_method).clabe.isEmpty()
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment