Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Attribute cnpj created in Customer #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Customer {
private Birthdate birthdate;
private String code;
private String cpf;
private String cnpj;
private List<Customer> customers;
private String email;
private String fullname;
Expand Down Expand Up @@ -48,6 +49,10 @@ public String getCpf() {
return cpf;
}

public String getCnpj() {
return cnpj;
}

public List<Customer> getCustomers() {
return customers;
}
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("[email protected]")
.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();
Expand Down