package com.younike.wxpay.service;

import com.younike.wxpay.enums.TransactionType;
import com.younike.wxpay.params.*;
import com.younike.wxpay.responses.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 微信支付服务
 */
public interface IBasePayService {

    /**
     * 基础支付接口
     * @param type
     * @param params
     * @return
     */
    TransactionResponse transaction(TransactionType type, TransactionParams params);

    /**
     * 退款申请
     * @param params
     * @return
     */
    RefundResponse refund(RefundParams params);

    /**
     * 获取加密的支付结果数据
     * @param request 请求头，包含需要的验签及解密信息
     * @return
     */
    String decrypt(HttpServletRequest request) throws Exception;

    /**
     * 查询订单
     * @param outTradeNo
     * @return
     */
    QueryResponse query(String outTradeNo, QueryParams params);

    /**
     * 关闭
     * @param outTradeNo
     * @return
     */
    CloseResponse close(String outTradeNo, CloseParams params);

    /**
     * 微信订单支付成功后，服务商代特约商户发起分账请求，将结算后的资金分到分账接收方
     * @param outTradeNo
     * @return
     */
    ProfitSharingResponse profitSharing(ProfitSharingParams params);

    /**
     * 查询分账结果
     * @param outTradeNo 商户分账单号
     */
    QuerySharingResponse querySharing(String outTradeNo, String transactionId, String subMchid);

}
