package org.jeecg.modules.pay.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class TransactionInfo {
 
    @JsonProperty("transaction_id")
    private String transactionId;
 
    private Amount amount;
 
    @JsonProperty("sub_mchid")
    private String subMchId;
 
    @JsonProperty("trade_state")
    private String tradeState;
 
    @JsonProperty("bank_type")
    private String bankType;
 
    @JsonProperty("promotion_detail")
    private List<PromotionDetail> promotionDetail;
 
    @JsonProperty("success_time")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX")
    private Date successTime;
 
    private Payer payer;
 
    @JsonProperty("out_trade_no")
    private String outTradeNo;
 
    private String appid;
 
    @JsonProperty("trade_state_desc")
    private String tradeStateDesc;
 
    @JsonProperty("trade_type")
    private String tradeType;
 
    private String attach;
 
    @JsonProperty("scene_info")
    private SceneInfo sceneInfo;
 
    @Data
    public static class Amount {
        @JsonProperty("payer_total")
        private Integer payerTotal;
 
        private Integer total;
 
        private String currency;
 
        @JsonProperty("payer_currency")
        private String payerCurrency;
    }
 
    @Data
    public static class PromotionDetail {
        private Integer amount;
 
        @JsonProperty("wechatpay_contribute")
        private Integer wechatpayContribute;
 
        @JsonProperty("coupon_id")
        private String couponId;
 
        private String scope;
 
        @JsonProperty("merchant_contribute")
        private Integer merchantContribute;
 
        private String name;
 
        @JsonProperty("other_contribute")
        private Integer otherContribute;
 
        private String currency;
 
        @JsonProperty("stock_id")
        private String stockId;
 
        @JsonProperty("goods_detail")
        private List<GoodsDetail> goodsDetail;
    }
 
    @Data
    public static class GoodsDetail {
        @JsonProperty("goods_remark")
        private String goodsRemark;
 
        private Integer quantity;
 
        @JsonProperty("discount_amount")
        private Integer discountAmount;
 
        @JsonProperty("goods_id")
        private String goodsId;
 
        @JsonProperty("unit_price")
        private Integer unitPrice;
    }
 
    @Data
    public static class Payer {
        private String openid;
    }
 
    @Data
    public static class SceneInfo {
        @JsonProperty("device_id")
        private String deviceId;
    }
}