package com.jeequan.jeepay.core.model.openapi.biz;

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

/**
 * TODO
 *
 * @author deng
 * @since 2024/5/16
 */
@Data
public class TransferResultResp {

    /**
     * 转账订单号
     */
    private String transferId;

    /**
     * 商户号
     */
    private String mchNo;

    /**
     * 应用ID
     */
    private String appId;

    /**
     * 商户订单号
     */
    private String mchOrderNo;

    /**
     * 支付接口代码
     */
    private String ifCode;

    /**
     * 入账方式： WX_CASH-微信零钱; ALIPAY_CASH-支付宝转账; BANK_CARD-银行卡
     */
    private String entryType;

    /**
     * 转账金额,单位分
     */
    private Long amount;

    /**
     * 三位货币代码,人民币:cny
     */
    private String currency;

    /**
     * 收款账号
     */
    private String accountNo;

    /**
     * 收款人姓名
     */
    private String accountName;

    /**
     * 收款人开户行名称
     */
    private String bankName;

    /**
     * 转账备注信息
     */
    private String transferDesc;

    /**
     * 支付状态: 0-订单生成, 1-转账中, 2-转账成功, 3-转账失败, 4-订单关闭
     */
    private Byte state;

    /**
     * 特定渠道发起额外参数
     */
    private String channelExtra;

    /**
     * 渠道订单号
     */
    private String channelOrderNo;

    /**
     * 渠道支付错误码
     */
    private String errCode;

    /**
     * 渠道支付错误描述
     */
    private String errMsg;

    /**
     * 商户扩展参数
     */
    private String extParam;

    /**
     * 转账成功时间
     */
    private Long successTime;

    /**
     * 创建时间
     */
    private Long createdAt;

    public TransferResultResp(TransferOrder transferOrder) {
        this.transferId = transferOrder.getTransferId();
        this.mchNo = transferOrder.getMchNo();
        this.appId = transferOrder.getAppId();
        this.mchOrderNo = transferOrder.getMchOrderNo();
        this.ifCode = transferOrder.getIfCode();
        this.entryType = transferOrder.getEntryType();
        this.amount = transferOrder.getAmount();
        this.currency = transferOrder.getCurrency();
        this.accountNo = transferOrder.getAccountNo();
        this.accountName = transferOrder.getAccountName();
        this.bankName = transferOrder.getBankName();
        this.transferDesc = transferOrder.getTransferDesc();
        this.state = transferOrder.getState();
        this.channelOrderNo = transferOrder.getChannelOrderNo();
        this.errCode = transferOrder.getErrCode();
        this.errMsg = transferOrder.getErrMsg();
        this.extParam = transferOrder.getExtParam();
        this.successTime = transferOrder.getSuccessTime().getTime();
        this.createdAt = transferOrder.getCreatedAt().getTime();
    }
}
