package com.jeequan.jeepay.core.model.autopos;

import com.jeequan.jeepay.core.entity.MchStoreDevice;
import lombok.Data;

/**
 * 智能POS  通知
 *
 * @since 2021-09-28
 */
@Data
public class ChannelOrderAcceptParams {

    public static String TRADE_TYPE_PAYMENT = "PAYMENT"; // 收款通知
    public static String TRADE_TYPE_REFUND = "REFUND"; // 退款通知

    // 通知唯一索引类型
    public static byte NOTIFY_TYPE_DEVICE_NO = 1; // 设备号

    /** 交易类型，PAYMENT-收款  REFUND-退款 */
    private String tradeType;

    /** 设备类型 */
    private Byte deviceType;

    /** 设备号 */
    private String deviceNo;

    /** 通知数据 */
    private Object acceptData;

    public ChannelOrderAcceptParams(Byte deviceType, String tradeType, String deviceNo, Object acceptData) {
        this.deviceType = deviceType;
        this.tradeType = tradeType;
        this.deviceNo = deviceNo;
        this.acceptData = acceptData;
    }

    /**
     * 构建智能POS通知数据
    */
    public static ChannelOrderAcceptParams buildAutoPosParams(String tradeType, String deviceNo, Object acceptData) {
        return new ChannelOrderAcceptParams(MchStoreDevice.DEVICE_TYPE_AUTO_POS, tradeType, deviceNo, acceptData);
    }

}
