Skip to content

Commit

Permalink
Update Order.java
Browse files Browse the repository at this point in the history
Adding idempotencyKey property to Order.
  • Loading branch information
oddprints-karl committed Jan 5, 2023
1 parent e372e53 commit d5c21e9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/oddprints/prodigi/pojos/Order.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public class Order {
private List<Charge> charges;
private List<Shipment> shipments;
private String merchantReference;
private String idempotencyKey;

public static class Builder {
private List<Item> builderItems;
private ShippingMethod builderShippingMethod;
private Recipient builderRecipient;
private String builderMerchantReference;
private String builderIdempotencyReference;

public Builder(ShippingMethod shippingMethod, Recipient recipient) {
builderItems = new ArrayList<>();
Expand All @@ -53,12 +55,18 @@ public Builder merchantReference(String merchantReference) {
return this;
}

public Builder idempotencyReference(String idempotencyReference) {
builderIdempotencyReference = idempotencyReference;
return this;
}

public Order build() {
Order order = new Order();
order.setItems(builderItems);
order.setShippingMethod(builderShippingMethod);
order.setRecipient(builderRecipient);
order.setMerchantReference(builderMerchantReference);
order.setIdempotencyKey(builderIdempotencyReference);
return order;
}
}
Expand Down Expand Up @@ -106,6 +114,14 @@ public void setMerchantReference(String merchantReference) {
this.merchantReference = merchantReference;
}

public String getIdempotencyKey() {
return idempotencyKey;
}

public void setIdempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
}

@JsonIgnore // don't serialise...
public Status getStatus() {
return status;
Expand Down

0 comments on commit d5c21e9

Please sign in to comment.