package com.yonge.cooleshow.biz.dal.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yonge.cooleshow.biz.dal.dto.req.OrderPayReq;
import com.yonge.cooleshow.biz.dal.entity.UserOrderPayment;
import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
import com.yonge.cooleshow.biz.dal.vo.res.OrderPayRes;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.toolset.payment.base.enums.PayChannelEnum;
import com.yonge.toolset.payment.base.enums.TradeStatusEnum;
import com.yonge.toolset.payment.base.model.callback.PaymentCallBack;

/**
 * 平台订单支付表 服务类
 *
 * @author liweifan
 * @date 2022-04-01
 */
public interface UserOrderPaymentService extends IService<UserOrderPayment> {
    /***
     * 通过订单号查询付款单
     * @author liweifan
     * @param: orderNo
     * @param: payChannel
     * @param: status
     * @updateTime 2022/5/7 14:09
     * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
     */
    UserOrderPayment detailByOrderNo(String orderNo, PayChannelEnum payChannel, TradeStatusEnum status);

    /***
     * 通过交易流水号或付款订单号查询付款单
     * @author liweifan
     * @param: orderNo
     * @updateTime 2022/4/13 16:09
     * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
     */
    UserOrderPayment detailByTransNoOrPaymentNo(String transNo, String paymentNo);
    /***
     * 关闭付款单
     * @author liweifan
     * @param: orderNo
     * @param: reason
     * @updateTime 2022/5/6 14:49
     * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
     */
    Boolean onlyClosePayment(String orderNo, String reason);
    /***
     * 关闭付款单
     * @author liweifan
     * @param: orderNo
     * @param: reason
     * @updateTime 2022/5/6 14:49
     * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
     */
    Boolean closePaymentAndReqOpen(String orderNo, String reason);


    /***
     * 创建付款单
     * @author liweifan
     * @param: payReq
     * @param: detail
     * @updateTime 2022/5/7 13:56
     */
    HttpResponseResult<OrderPayRes> createOrderPayment(OrderPayReq payReq, UserOrderVo detail) throws Exception;

    /**
     * 支付请求回调
     * @param data
     */
    void executePaymentCallBack(PaymentCallBack data);

    /**
     * 关闭订单回调
     * @param data
     */
    void closePaymentCallBack(PaymentCallBack data);


    /**
     * 签协议
     *
     * @param  type 类型
     * @param userId 用户id
     */
    void setContractRecord(String type, Long userId);
}