コード例 #1
0
  @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"));
  }
コード例 #2
0
  @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"));
  }