package com.red.circle.order.domain.order;

import com.google.gson.Gson;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * payermax 支付返回回调响应类
 * 参考地址：https://docs.payermax.com/api.html?docName=New%20Version&docVer=v1.0&docLang=cn#/paths/collectResultNotifyUrl/post
 */

@Data
public class PayerMaxReceivePaymentNotice {
    private static final Logger log = LoggerFactory.getLogger(PayerMaxReceivePaymentNotice.class);
    private static final long serialVersionUID = 1L;

    private Data data;

    private String keyVersion;
    private String merchantNo;
    private String msg;
    private String appId;
    private String code;
    private String notifyTime;
    private String notifyType;

    @lombok.Data
    public static class Data {
        private String reference;
        private String country;
        private Integer totalAmount;
        private String channelNo;
        private String outTradeNo;
        private String completeTime;
        private String currency;
        private String tradeToken;
        private List<PaymentDetails> paymentDetails;
        private MerFee fees;
        private String thirdChannelNo;
        private String status;
    }

    @lombok.Data
    public static class PaymentDetails {
        private CardInfo cardInfo;
        private String paymentMethodType;
    }

    @lombok.Data
    public static class MerFee {
        private String url;
        private String amount;
        private String currency;
    }

    @lombok.Data
    public static class CardInfo {
        private String cardOrg;
        private String country;
        private String cardIdentifierNo;
        private String cardIdentifierName;
    }

    public static PayerMaxReceivePaymentNotice serializable(String json) {
        return new Gson().fromJson(json, PayerMaxReceivePaymentNotice.class);
    }
}
