package com.ruoyi.bst.refund.domain;

import java.math.BigDecimal;

import com.ruoyi.common.pay.Refundable;
import com.wechat.pay.java.service.refund.model.AmountReq;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class RefundVO extends Refund implements Refundable {

    @ApiModelProperty("渠道ID")
    private Long channelId;

    @ApiModelProperty("APPID")
    private Long appId;

    @ApiModelProperty("支付单号")
    private String payNo;
    
    @ApiModelProperty("支付金额")
    private BigDecimal payAmount;

    @ApiModelProperty("支付业务ID")
    private Long payBstId;

    @ApiModelProperty("支付业务类型")
    private String payBstType;

    @ApiModelProperty("运营区ID")
    private Long payAreaId;

    @Override
        public String refundOutTradeNo() {
        return getPayNo();
    }

    @Override
    public String refundOutRefundNo() {
        return this.getNo();
    }

    @Override
    public String refundReason() {
        return this.getReason();
    }

    @Override
    public AmountReq refundAmount() {
        BigDecimal decimal100 = new BigDecimal(100);
        AmountReq amount = new AmountReq();
        amount.setRefund(this.getAmount().multiply(decimal100).longValue());
        amount.setTotal(getPayAmount().multiply(decimal100).longValue());
        amount.setCurrency("CNY");
        return amount;
    }
}
