package com.yiqi.order.domain.dto;

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

/**
 * @author xiaohei
 * @date 2024/1/1
 */
@ApiModel("第三方退款结果返回")
@Data
public class RefundResponseDTO {

    /**
     * 订单编号
     */
    private String refundNo;

    /**
     * 外部订单编号
     */
    private String outTradeNo;

    /*
     * 退款时间
     */
    private String refundTime;

    /**
     * 是否成功  0未支付 100 退款中   101 ：退款失败   200 退款成功
     */
    private Integer refundResult = 0;

    /**
     *
     */
    private String payMsg = "退款成功";

    /**
     * 明确的支付失败
     * @param msg
     * @return
     */
    public static RefundResponseDTO refundError(String msg) {
        RefundResponseDTO orderPayResultVO = new RefundResponseDTO();
        orderPayResultVO.setPayMsg(msg);
        orderPayResultVO.setRefundResult(101);
        return orderPayResultVO;
    }

    public static RefundResponseDTO refundWait(String refundNo) {
        RefundResponseDTO orderPayResultVO = new RefundResponseDTO();
        orderPayResultVO.setRefundNo(refundNo);
        orderPayResultVO.setPayMsg("退款中，请稍后");
        orderPayResultVO.setRefundResult(100);
        return orderPayResultVO;
    }

    public static RefundResponseDTO refundSuccess(String refundNo, String outTradeNo) {
        RefundResponseDTO orderPayResultVO = new RefundResponseDTO();
        orderPayResultVO.setRefundNo(refundNo);
        orderPayResultVO.setOutTradeNo(outTradeNo);
        orderPayResultVO.setPayMsg("退款成功");
        orderPayResultVO.setRefundResult(200);
        return orderPayResultVO;
    }

}
