Skip to content

Commit

Permalink
Merge pull request #32 from konduto/add-new-fields-735836
Browse files Browse the repository at this point in the history
adding missing fields to the Customer object
  • Loading branch information
danilocarmoBVS authored Dec 6, 2023
2 parents 3928eee + 73227bb commit 48e0661
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 23 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To get started add our SDK as a dependency in your **pom.xml**:
<dependency>
<groupId>com.konduto.sdk</groupId>
<artifactId>java-sdk</artifactId>
<version>2.17.2 </version>
<version>2.17.4</version>
</dependency>
```

Expand Down Expand Up @@ -100,7 +100,7 @@ To get started add our SDK as a dependency in your **pom.xml**:
<dependency>
<groupId>com.konduto.sdk</groupId>
<artifactId>java-sdk</artifactId>
<version>2.17.2</version>
<version>2.17.4</version>
</dependency>
```

Expand Down Expand Up @@ -184,7 +184,7 @@ KondutoOrder order = (KondutoOrder) KondutoModel.fromMap(attributes, KondutoOrde
#### Customer information

| Parameter | Description |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| id | _(required)_ **Unique** identifier for each customer. Can be anything you like (counter, id, e-mail address) as long as it's consistent in future orders. |
| name | _(required)_ Customer's full name. |
| email | _(required)_ Customer's e-mail address |
Expand All @@ -194,6 +194,10 @@ KondutoOrder order = (KondutoOrder) KondutoModel.fromMap(attributes, KondutoOrde
| new | _(optional)_ Boolean indicating if the customer is using a newly created account for this purchase. |
| vip | _(optional)_ Boolean indicating if the customer is a VIP or frequent buyer. |
| created_at | _(optional)_ Date when customer was created. |
| type | _(optional)_ Identifier of the customer type. |
| risk_level | _(optional)_ Level of risk identifier. Currently we support low, medium, high. |
| risk_score | _(optional)_ Customer risk score identifier. |
| mother_name | _(optional)_ Full name of the client’s mother. |


#### Payment information
Expand Down
95 changes: 77 additions & 18 deletions src/main/java/com/konduto/sdk/models/KondutoCustomer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@ public final class KondutoCustomer extends KondutoModel {

@Required private String id = "1";
@Required private String name;
@Required private String email;
private String taxId;
private String phone1;
private String phone2;
@SerializedName("vip") private Boolean isVip;
@Required private String email;
@SerializedName("new") private Boolean isNew;
@SerializedName("vip") private Boolean isVip;

private Date created_at;
private Date dob;
@SerializedName("created_at") private Date createdAt;

private String type;
@SerializedName("risk_level") private String riskLevel;
@SerializedName("risk_score") private Integer riskScore;
@SerializedName("mother_name") private String motherName;

/* Constructors */

Expand All @@ -51,23 +56,21 @@ public boolean equals(Object o) {

KondutoCustomer that = (KondutoCustomer) o;

// required

if (!id.equals(that.id)) return false;
if (!email.equals(that.email)) return false;
if (!name.equals(that.name)) return false;

// optional
if (isNew != null ? !isNew.equals(that.isNew) : that.isNew != null) return false;
if (isVip != null ? !isVip.equals(that.isVip) : that.isVip != null) return false;
if (taxId != null ? !taxId.equals(that.taxId) : that.taxId != null) return false;
if (phone1 != null ? !phone1.equals(that.phone1) : that.phone1 != null) return false;
if (phone2 != null ? !phone2.equals(that.phone2) : that.phone2 != null) return false;
if (taxId != null ? !taxId.equals(that.taxId) : that.taxId != null) return false;
if (!nullSafeAreDatesEqual(created_at, that.created_at)){
return false;
}
if (!nullSafeAreDatesEqual(dob, that.dob)){
return false;
}
if (!email.equals(that.email)) return false;
if (isNew != null ? !isNew.equals(that.isNew) : that.isNew != null) return false;
if (isVip != null ? !isVip.equals(that.isVip) : that.isVip != null) return false;
if (!nullSafeAreDatesEqual(dob, that.dob)) return false;
if (!nullSafeAreDatesEqual(createdAt, that.createdAt)) return false;
if (type != null ? !type.equals(that.type) : that.type != null) return false;
if (riskLevel != null ? !riskLevel.equals(that.riskLevel) : that.riskLevel != null) return false;
if (riskScore != null ? !riskScore.equals(that.riskScore) : that.riskScore != null) return false;
if (motherName != null ? !motherName.equals(that.motherName) : that.motherName != null) return false;

return true;
}
Expand Down Expand Up @@ -138,11 +141,67 @@ public void setIsNew(Boolean isNew) {
this.isNew = isNew;
}

public Date getCreated_at() { return created_at; }
public Date getCreatedAt() { return createdAt; }

public void setCreated_at(Date created_at) { this.created_at = created_at; }
public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; }

public Date getDOB() { return dob; }

public void setDOB(Date dob) { this.dob = dob; }

public Boolean getNew() {
return isNew;
}

public void setNew(Boolean aNew) {
isNew = aNew;
}

public Boolean getVip() {
return isVip;
}

public void setVip(Boolean vip) {
isVip = vip;
}

public Date getDob() {
return dob;
}

public void setDob(Date dob) {
this.dob = dob;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getRiskLevel() {
return riskLevel;
}

public void setRiskLevel(String riskLevel) {
this.riskLevel = riskLevel;
}

public Integer getRiskScore() {
return riskScore;
}

public void setRiskScore(Integer riskScore) {
this.riskScore = riskScore;
}

public String getMotherName() {
return motherName;
}

public void setMotherName(String motherName) {
this.motherName = motherName;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/konduto.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 2.17.3
version = 2.17.4
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static KondutoCustomer completeCustomer() throws ParseException {
customer.setPhone1("11987654321");
customer.setPhone2("1133333333");
customer.setTaxId("01234567890");
customer.setCreated_at(new Date(1433818800000L));
customer.setCreatedAt(new Date(1433818800000L));

SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dob = sdf.parse("27/12/1989");
Expand Down

0 comments on commit 48e0661

Please sign in to comment.