mirror of https://github.com/jeecgboot/jeecg-boot
Update Shopify Order model
parent
fab81cd905
commit
97d547463f
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.modules.business.domain.api.shopify;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
class DiscountCode{
|
||||
@JsonProperty("code")
|
||||
private String code;
|
||||
|
||||
public DiscountCode() {}
|
||||
}
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
|
@ -17,10 +19,24 @@ public class Order {
|
|||
@JsonProperty("note")
|
||||
private String note;
|
||||
|
||||
@JsonProperty("discount_codes")
|
||||
private List<DiscountCode> discountCodes;
|
||||
|
||||
public Order() {
|
||||
}
|
||||
|
||||
public boolean hasNote() {
|
||||
return note != null;
|
||||
}
|
||||
|
||||
public boolean hasDiscountCodes() {
|
||||
return discountCodes != null && !discountCodes.isEmpty();
|
||||
}
|
||||
|
||||
public String getDiscountCode() {
|
||||
if (discountCodes != null && !discountCodes.isEmpty()) {
|
||||
return discountCodes.stream().map(DiscountCode::getCode).collect(Collectors.joining(","));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue