Created
July 3, 2015 01:22
-
-
Save IsaacGonzalez/a89634e05a76fa1dbea0 to your computer and use it in GitHub Desktop.
Sacado de aquí: https://github.com/conekta/conekta-java/blob/dbf7fe0a21157ef224a9f10093f0c7f21c6b2076/test/com/conekta/ChargeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@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