From 374af898201fd2f9600143e8db05bc850f0ef84d Mon Sep 17 00:00:00 2001 From: Alexandre Camilo Date: Thu, 26 Mar 2020 18:02:55 -0300 Subject: [PATCH] Attribute cnpj created in Customer Test case CustomerClientTest.shouldCreateANewCustomerWithCnpj created --- .../clients/attributes/Customer.java | 10 ++++++++ .../clients/CustomerClientTest.java | 24 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/main/java/br/com/moip/jassinaturas/clients/attributes/Customer.java b/src/main/java/br/com/moip/jassinaturas/clients/attributes/Customer.java index fbf5b42..5f16542 100644 --- a/src/main/java/br/com/moip/jassinaturas/clients/attributes/Customer.java +++ b/src/main/java/br/com/moip/jassinaturas/clients/attributes/Customer.java @@ -9,6 +9,7 @@ public class Customer { private Birthdate birthdate; private String code; private String cpf; + private String cnpj; private List customers; private String email; private String fullname; @@ -48,6 +49,10 @@ public String getCpf() { return cpf; } + public String getCnpj() { + return cnpj; + } + public List getCustomers() { return customers; } @@ -99,6 +104,11 @@ public Customer withCpf(final String cpf) { return this; } + public Customer withCnpj(final String cnpj) { + this.cnpj = cnpj; + return this; + } + public Customer withEmail(final String email) { this.email = email; return this; diff --git a/src/test/java/br/com/moip/jassinaturas/clients/CustomerClientTest.java b/src/test/java/br/com/moip/jassinaturas/clients/CustomerClientTest.java index 618506a..f89a3d3 100644 --- a/src/test/java/br/com/moip/jassinaturas/clients/CustomerClientTest.java +++ b/src/test/java/br/com/moip/jassinaturas/clients/CustomerClientTest.java @@ -49,6 +49,30 @@ public void shouldCreateANewCustomer() { assertEquals("Cliente criado com sucesso", created.getMessage()); } + @Test + public void shouldCreateANewCustomerWithCnpj() { + Customer toCreate = new Customer(); + toCreate.withCode("customer000000001" + System.currentTimeMillis()) + .withBirthdate(new Birthdate().withDay(13).withMonth(Month.OCTOBER).withYear(1989)) + .withCnpj("12345678901234") + .withEmail("teste@teste.com") + .withFullname("Danillo Souza") + .withPhoneAreaCode("11") + .withPhoneNumber("912341234") + .withAddress( + new Address().withCity("São Paulo").withComplement("Apto").withCountry(Country.BRA) + .withDistrict("Centro").withNumber("1000").withState(State.SP).withStreet("9 de Julho") + .withZipcode("10012345")) + .withBillingInfo( + new BillingInfo().withCreditCard(new CreditCard().withExpirationMonth("10") + .withExpirationYear("18").withHolderName("Danillo Souza") + .withNumber("4111111111111111"))); + + Customer created = assinaturas.customers().create(toCreate); + + assertEquals("Cliente criado com sucesso", created.getMessage()); + } + @Test public void shouldCreateANewCustomerWithoutCreditCard() { Customer toCreate = new Customer();