Skip to content
Merged
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 @@ -568,6 +568,9 @@ public static class PaymentInfoDto extends SelfValidating<PaymentInfoDto> {
@NotNull
private final Integer deliveryPrice;

@JsonProperty("coupon_id")
private final Long couponId;

@JsonProperty("coupon_name")
private final String couponName;

Expand All @@ -581,13 +584,14 @@ public static class PaymentInfoDto extends SelfValidating<PaymentInfoDto> {

@Builder
public PaymentInfoDto(Integer documentsPrice, Integer cuttingPrice, Boolean isOneDayScan,
Integer oneDayScanPrice, Integer deliveryPrice, Integer couponDiscount,
Integer oneDayScanPrice, Integer deliveryPrice, Long couponId, Integer couponDiscount,
Integer totalPrice, String couponName) {
this.documentsPrice = documentsPrice;
this.cuttingPrice = cuttingPrice;
this.isOneDayScan = isOneDayScan;
this.oneDayScanPrice = oneDayScanPrice;
this.deliveryPrice = deliveryPrice;
this.couponId = couponId;
this.couponDiscount = couponDiscount;
this.couponName = couponName;
this.totalPrice = totalPrice;
Expand All @@ -607,6 +611,7 @@ public static PaymentInfoDto fromEntity(Order order) {
.map(Document::getOneDayScanPrice)
.reduce(0, Integer::sum))
.deliveryPrice(order.getDelivery().getDeliveryPrice())
.couponId(order.getUsedCoupon() != null ? order.getUsedCoupon().getId() : null)
.couponName(order.getUsedCoupon() != null ? order.getUsedCoupon().getIssuedCoupon().getCouponTemplate().getName() : null)
.couponDiscount(order.getUsedCoupon() != null ?
order.getUsedCoupon().getIssuedCoupon().getDiscountPrice(order.getDocumentsTotalAmount(), order.getDocuments().stream().mapToInt(Document::getOcrPrice).sum(), order.getDelivery().getDeliveryPrice()) : 0)
Expand Down