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
2 changes: 1 addition & 1 deletion riskified-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.riskified</groupId>
<artifactId>riskified-sdk</artifactId>
<version>v3.1.0</version>
<version>v3.2.0</version>
<name>Riskified SDK</name>
<description>Riskified rest api SDK for java</description>
<url>https://www.riskified.com</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ private HttpPost createPostRequest(String url) {
postRequest.setHeader(HttpHeaders.ACCEPT, "application/vnd.riskified.com; version=2");
postRequest.setHeader(HttpHeaders.ACCEPT, "application/json");
postRequest.setHeader("X-RISKIFIED-SHOP-DOMAIN", shopUrl);
postRequest.setHeader("User-Agent","riskified_java_sdk/3.1.0"); // TODO: take the version automatically
postRequest.setHeader("User-Agent","riskified_java_sdk/3.2.0"); // TODO: take the version automatically
postRequest.setHeader("Version",versionHeaderValue);
return postRequest;
}
Expand Down
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.riskified.models;

import java.util.List;

public class PolicyProtect {
private List<UseCase> useCases;
public List<UseCase> getUseCases() {
return useCases;
}
public void setUseCases(List<UseCase> useCases) {
this.useCases = useCases;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ResOrder {
private Advice advice;
private RecoveryEligibility recoveryEligibility;
private Double riskScore;
private PolicyProtect policyProtect;


public String getId() {
Expand Down Expand Up @@ -105,4 +106,11 @@ public void setAction(String action) {

public Double getRiskScore(){return riskScore;}

public PolicyProtect getPolicyProtect() {
return policyProtect;
}
public void setPolicyProtect(PolicyProtect policyProtect) {
this.policyProtect = policyProtect;
}

}
16 changes: 16 additions & 0 deletions riskified-sdk/src/main/java/com/riskified/models/UseCase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.riskified.models;

public class UseCase {
private String useCase;
private String decision;

public String getUseCase() {
return useCase;
}
public void setUseCase(String useCase) {
this.useCase = useCase;
}
public String getDecision() {
return decision;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.riskified.models.Context;
import com.riskified.models.Custom;
import com.riskified.models.PolicyProtect;
import com.riskified.models.RecoveryEligibility;

// Shop URL may also be added to the API notifications from Riskified depending on your
Expand Down Expand Up @@ -32,6 +33,7 @@ public static class NotificationOrder {
private RecoveryEligibility recoveryEligibility;
private Context context;
private String[] decision_reasons;
private PolicyProtect policyProtect;

public String getId() {
return id;
Expand Down Expand Up @@ -106,5 +108,10 @@ public String[] getDecisionReasons() {
public void setDecisionReasons(String[] decisionReasons) {
this.decision_reasons = decisionReasons;
}

public PolicyProtect getPolicyProtect() {
return policyProtect;
}
public void setPolicyProtect(PolicyProtect policyProtect) {}
}
}
Loading