package com.izouma.nineth.dto.pay;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 支付请求
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UniformPayRequest {

    /**
     * 数据库OrderInfo订单ID
     */
    private Long orderId;

    /**
     * 转赠订单GiftOrder
     */
    private Long giftOrderId;

    /**
     * 交易类型 tradeType, 对应设置支付的支付渠道
     */
    private TradeType tradeType;

    /**
     * 附加参数微信的openId
     */
    private String openId;

    /**
     * 指定支付平台
     */
    private String payPlatform;


    /**
     * 拼接唯一ID
     * @return
     */
    public String getUniqueId(){
        StringBuilder str = new StringBuilder();
        str.append("oId_" + Objects.toString(this.orderId, ""));
        str.append("gId_" + Objects.toString(this.giftOrderId, ""));
        str.append("_" + Objects.toString(this.tradeType, ""));
        return str.toString();
    }



}
