Skip to content
Merged
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 @@ -83,10 +83,15 @@ public void validate(Validation validationType) throws FieldBadFormatException {
Validate.notNull(this, this.createdAt, "Created At");
Validate.notNull(this, this.updatedAt, "Updated At");
Validate.notNullOrEmpty(this, this.gateway, "Gateway");
Validate.notNullOrEmpty(this, this.browserIp, "Browser IP");
if (this.source != null && !this.source.equalsIgnoreCase("phone")){
Validate.notNullOrEmpty(this, this.browserIp, "Browser IP");
}

Validate.notNull(this, this.totalPrice, "Total Price");
Validate.notNull(this, this.lineItems, "Line Items");
Validate.notNull(this, this.paymentDetails, "Payment Details");
if (this.gateway != null && !this.gateway.equalsIgnoreCase("giftcard")){
Validate.notNull(this, this.paymentDetails, "Payment Details");
}
Validate.notNull(this, this.customer, "Customer");
Validate.notNull(this, this.billingAddress, "Billing Address");
}
Expand Down
10 changes: 6 additions & 4 deletions riskified-sdk/src/main/java/com/riskified/models/Customer.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ public Customer(String email, String firstName, String lastName, String id, Date
public void validate(Validation validationType) throws FieldBadFormatException {

if (validationType == Validation.ALL) {
Validate.notNullOrEmpty(this, this.email, "Email");
Validate.notNullOrEmpty(this, this.firstName, "First Name");
Validate.notNullOrEmpty(this, this.lastName, "Last Name");
Validate.notNullOrEmpty(this, this.id, "Id");
Validate.notNull(this, this.createdAt, "Created At");
Validate.notNull(this, this.verifiedEmail, "Verified Email");
if (this.accountType != null && !this.accountType.equalsIgnoreCase("guest")){
Validate.notNullOrEmpty(this, this.email, "Email");
Validate.notNullOrEmpty(this, this.id, "Id");
Validate.notNull(this, this.createdAt, "Created At");
Validate.notNull(this, this.verifiedEmail, "Verified Email");
}
}

if (this.email != null) {
Expand Down