package com.yiqi.order.domain.dto;

import com.yiqi.common.enums.OrderType;
import com.yiqi.common.enums.PayWayType;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.order.domain.OrderCloth;
import com.yiqi.order.domain.OrderGoods;
import com.yiqi.order.domain.OrderRecharge;
import com.yiqi.order.domain.OrderRechargeInstalment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author xiaohei
 * @date 2024/1/1
 */
@ApiModel("第三方支付信息")
@Data
public class PayOrderFaceToFaceDTO extends PayOrderDTO {

    @ApiModelProperty("用户付款码")
    private String authCode;

    /**
     * 支付充值订单
     *
     * @param rechargeSn 传的都是每次支付的订单编号，非主订单编号
     * @param authCode   付款码
     * @return
     */
    public static PayOrderFaceToFaceDTO createRechargeOrderPayData(String rechargeSn, BigDecimal payAmount, String payType, String authCode) {
        PayOrderFaceToFaceDTO payOrderFaceToFaceDTO = new PayOrderFaceToFaceDTO();
        payOrderFaceToFaceDTO.setOrderNo(rechargeSn);
        payOrderFaceToFaceDTO.setPayAmount(payAmount);
        payOrderFaceToFaceDTO.setSubjectTitle(OrderType.recharge.getInfo());
        payOrderFaceToFaceDTO.setPayType(payType);
        payOrderFaceToFaceDTO.setExpireTime(DateUtils.addMinutes(DateUtils.getNowDate(), 5));
        payOrderFaceToFaceDTO.setAuthCode(authCode);
        return payOrderFaceToFaceDTO;
    }

    /**
     * 支付充值订单
     *
     * @param rechargeSn 传的都是每次支付的订单编号，非主订单编号
     * @param authCode   付款码
     * @return
     */
    public static PayOrderFaceToFaceDTO createRechargeOrderPayData(Long storeId, String rechargeSn, BigDecimal payAmount, String payType, String authCode) {
        PayOrderFaceToFaceDTO payOrderFaceToFaceDTO = new PayOrderFaceToFaceDTO();
        payOrderFaceToFaceDTO.setStoreId(storeId);
        payOrderFaceToFaceDTO.setOrderNo(rechargeSn);
        payOrderFaceToFaceDTO.setPayAmount(payAmount);
        payOrderFaceToFaceDTO.setSubjectTitle(OrderType.recharge.getInfo());
        payOrderFaceToFaceDTO.setPayType(payType);
        payOrderFaceToFaceDTO.setExpireTime(DateUtils.addMinutes(DateUtils.getNowDate(), 5));
        payOrderFaceToFaceDTO.setAuthCode(authCode);
        return payOrderFaceToFaceDTO;
    }

}
