package com.tzy.framework.pay.dto;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 退款信息
 */
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class RefundRequestDto<T> implements Serializable {

        private static long serializableUid = 1l;

        public RefundRequestDto(String payWay, String orderNo, BigDecimal totalAmount, BigDecimal refundAmount, String refundMsg) {
                this.payWay = payWay;
                this.orderNo = orderNo;
                this.totalAmount = totalAmount;
                this.refundAmount = refundAmount;
                this.refundMsg = refundMsg;
        }

        //请求类型
        private String userType;
        //订单编码
        private String orderNo;
        //退款编码
        private String refundNo;
        //订单编码-商户订单号（全民付）
        private String merOrderId;
        //支付订单号
        private String tradeNo;
        //支付金额
        private BigDecimal totalAmount;
        //支付方式
        private String payWay;
        //云闪付-支付银行
        private String uacBank;
        //appid
        private String wxAppid;
        //openid
        private String wxOpenid;
        //返回地址
        private String returnUrl;
        //页面地址
        private String path_url;
        //订单创建时间
        private Date createOrderTime;
        //mid
        private String mid;
        //tid
        private String tid;
        //请求ip
        private String createip;
        //商户号
        private String appid;
        //子商户号
        private String subAppid;

        private BigDecimal orderPrice;

        private BigDecimal refundAmount;

        private String refundMsg;

        private JSONObject payConfig;
        //请求用户信息
        private RechargeUserInfoDto rechargeUserInfoDto;

        public T getPayConfigByClass( Class<T> clazz){
                return JSONObject.parseObject(payConfig.toJSONString(), clazz);
        }
}
