@Test @Play({"order_response", "payment_credit_card_response"}) public void testCreatePaymentCreditCard() { Order order = moip.orders().get("ORD-JY95N80TXHXV"); Payment createdPayment = order .payments() .setInstallmentCount(1) .setCreditCard( new CreditCard() .setNumber("4012001038443335") .setCvc("123") .setExpirationMonth("04") .setExpirationYear("18") .setHolder( new Holder() .setFullname("Jose Portador da Silva") .setBirthdate("1988-10-10") .setPhone(new Phone().setAreaCode("11").setNumber("55667788")) .setTaxDocument(TaxDocument.cpf("22222222222")))) .execute(); assertThat(createdPayment.getId(), startsWith("PAY-")); assertThat(createdPayment.getStatus(), equalTo("IN_ANALYSIS")); }
// TODO FIXME public void testCreateOrderMinimun() { Order createdOrder = moip.orders() .setOwnId("cooking_store-12345") .addItem("Methylamine - 1 Barrel", 1, "The best ingredient for Blue Sky", 1000) .setShippingAmount(100) .setCustomer( moip.customers() .setOwnId("walter-123") .setFullname("Walter White") .setEmail("*****@*****.**")) .create(); Payment createdPayment = createdOrder .payments() .setInstallmentCount(1) .setCreditCard( new CreditCard() .setNumber("4024007199037499") .setCvc("123") .setExpirationMonth("12") .setExpirationYear("20") .setHolder( new Holder() .setFullname("Walter White") .setBirthdate("1959-08-07") .setPhone(new Phone().setAreaCode("11").setNumber("66778899")) .setTaxDocument(TaxDocument.cpf("22222222222")))) .execute(); }
@Test @Play({"order_response", "payment_boleto_response"}) public void testCreatePaymentBoleto() { Order order = moip.orders().get("ORD-FWR7V5ZC0414"); Payment createdPayment = order .payments() .setBoleto( new Boleto() .setExpirationDate("2015-09-30") .setLogoUri("https://") .setFirstInstructionLine("Primeira linha do boleto") .setSecondInstructionLine("Segunda linha do boleto") .setThirdInstructionLine("Terceira linha do boleto")) .execute(); assertThat(createdPayment.getId(), startsWith("PAY-")); assertThat(createdPayment.getStatus(), equalTo("WAITING")); }
@Test @Play({"order_response", "payment_credit_card_response"}) public void testCreatePaymentCreditCardHash() { Order order = moip.orders().get("ORD-XDH04PIVWOVR"); Payment createdPayment = order .payments() .setInstallmentCount(1) .setCreditCard( new CreditCard() .setHash( "JARQtjm/AJN4s6W00V2IZ+xHTW8zFNu1mWyW3RR21Z05h0LFSFLRH8yumqaktPXU49Ku/InBPCM+l85NYsNJiPD7BjybOW1g6HPZEjpz7krUtvHh4gqXRlLxL66D7Uf5CQ5dFeeyb6OgSoDpYBDlbhtpuSBTqYKHdHSK7xMebnPZvLamKiLFa/TVbUno9qAkLTB4NXdfcSzlq0YbgpEaUHA9oRaiH/n0Vt/NJDVQsb+SxeiJnO9WFzzC5adcSPn5p821uRFcyvykA3LloqbKhQemDghuP51bb0vuRQtmq6YKqT8eYc3DTlrlB8J2tX4PBplFCu1FyWSpeaiWB33zUg==") .setHolder( new Holder() .setFullname("Jose Portador da Silva") .setBirthdate("1988-10-10") .setPhone(new Phone().setAreaCode("11").setNumber("55667788")) .setTaxDocument(TaxDocument.cpf("22222222222")))) .execute(); }