package co.yixiang.yshop.module.pay.strategy.weixin.service;

import co.yixiang.yshop.module.pay.dal.dataobject.merchantdetails.MerchantDetailsDO;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Map;

public interface WxPayService {

    /**
     * 微信支付
     *
     * @param orderTradeNo 订单编号
     * @param money        订单金额
     * @param openid       客户openid
     * @param ip           服务ip地址
     * @param type         小程序或app
     */
    Map<String, String> gotoPay(String orderTradeNo, BigDecimal money, String openid, String ip, String type, MerchantDetailsDO merchantDetailsDO) throws Exception;

    /**
     * 微信退款
     *
     * @param transactionId 支付单号
     * @param outRefundNo   支付生成的退款单号
     * @param total         订单总金额
     * @param refund        退款金额
     * @throws Exception
     */
    public Map<String, String> refund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund, MerchantDetailsDO merchantDetailsDO) throws Exception;

    /**
     * 保证金退款
     *
     * @param transactionId 支付单号
     * @param outRefundNo   支付生成的退款单号
     * @param total         订单总金额
     * @param refund        退款金额
     */
    public Map<String, String> refundBond(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws Exception;


    /**
     * 生成收款码返回
     *
     * @param orderFormid 订单编号
     * @param money       金额
     * @param ip          IP地址
     * @param tradeType   支付类型
     * @throws Exception
     */
    public String getCollectionCode(String orderFormid, BigDecimal money, String ip, String tradeType) throws Exception;

    /**
     * 验签
     */
    public boolean verifyNotify(Map<String, String> params);

}
