package com.yonge.toolset.payment.base;

import com.yonge.toolset.base.result.BaseResult;
import com.yonge.toolset.payment.base.enums.MethodNameEnum;
import com.yonge.toolset.payment.base.enums.OpenEnum;
import com.yonge.toolset.payment.base.enums.PayChannelEnum;
import com.yonge.toolset.payment.base.enums.PaymentClientEnum;
import com.yonge.toolset.payment.base.model.ClosePayment;
import com.yonge.toolset.payment.base.model.OpenAuth;
import com.yonge.toolset.payment.base.model.Payment;
import com.yonge.toolset.payment.base.model.RefundBill;
import com.yonge.toolset.payment.base.model.callback.PaymentCallBack;
import org.springframework.web.bind.annotation.PathVariable;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @Author: liweifan
 * @Data: 2022/5/10 15:00
 */
public interface PaymentTemplate {
    /***
     * 统一获取授权
     * @author liweifan
     * @param: openAuth
     * @updateTime 2022/5/12 10:43
     * @return: com.yonge.toolset.base.result.BaseResult<java.util.Map < java.lang.String, java.lang.Object>>
     */
    BaseResult<Map<String, Object>> getOpenAuthMsg(OpenAuth openAuth);

    /***
     * 统一下单接口
     * @author liweifan
     * @param: product 订单对象
     * @updateTime 2022/3/4 15:12
     * @return: com.daya.payment.model.AbstractRS
     */
    BaseResult<Payment> executePayment(Payment payment);

    /***
     * 查询交易订单
     * @author liweifan
     * @param: product 订单对象
     * @updateTime 2022/3/4 15:12
     * @return: com.daya.payment.model.AbstractRS
     */
    BaseResult<Payment> queryPayment(Payment payment);

    /***
     * 统一关单接口
     * @author liweifan
     * @param: closePayment
     * @updateTime 2022/5/10 15:34
     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.base.model.res.ClosePaymentRes>
     */
    BaseResult<ClosePayment> closePayment(ClosePayment closePayment);

    /***
     * 统一退款接口
     * @author liweifan
     * @param: closePayment
     * @updateTime 2022/5/10 15:34
     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.base.model.res.ClosePaymentRes>
     */
    BaseResult<RefundBill> refundPayment(RefundBill refundBill);

    /**
     * 解析异步通知
     * @param openType
     * @param paymentClient
     * @param payChannel
     * @param methodName
     * @param request
     * @return
     */
    BaseResult<PaymentCallBack> analysisNotice(OpenEnum openType, PaymentClientEnum paymentClient, PayChannelEnum payChannel, MethodNameEnum methodName, HttpServletRequest request);
}
