package com.tzy.framework.pay.dto;

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

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 支付 dto
 */
@Data
@ToString
public class PaymentRequestDto<T> implements Serializable {

    private static long serializableUid = 1l;
    //请求类型
    @NotEmpty
    private String userType;
    //订单编码
    @NotEmpty
    private String orderNo;
    //订单编码-商户订单号(第三方平台订单号)
    private String merOrderId;
    //订单金额
    private BigDecimal orderAmount;
    //支付金额
    @NotEmpty
    private BigDecimal totalAmount;
    //支付商品描述
    @NotEmpty
    private String body;
    //支付方式
    @NotEmpty
    private String payWay;
    //订单类型：group
    private String orderCategory;

    private String category;
    private String paySubWay;
    //云闪付-支付银行
    private String uacBank;
    //云闪付-卡号
    private String bankCardNo;
    //appid
    private String wxAppid;
    //openid
    private String wxOpenid;
    //返回地址
    private String returnUrl;
    //页面地址
    private String path_url;
    //订单创建时间
    private Date createOrderTime;
    //订单expireTime
    private Date expireTime=new Date();
    //mid
    private String mid;
    //tid
    private String tid;
    //请求ip
    private String createip;
    //商户号
    private String appid;
    //子商户号
    private String subAppid;
    /**指定路由*/
    private Boolean assignPayType;
    //操作描述
    private String msg;

    private JSONObject payConfig;

    //组团商户id
    private Long merchantId;
    //分账编码(宝付为客户账户号)
    private String contractNo;

    private String accountType;

    private String phoneCode;

    private BankInfo bankInfo;

    private PaymentUserInfo paymentUserInfo;
    //请求用户信息
    private RechargeUserInfoDto rechargeUserInfoDto;

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

}
