package org.springblade.modules.finance.service;

import org.springblade.modules.finance.entity.Order;

import java.math.BigDecimal;

/**
 * Author pangqijun
 * Date 2022/10/12
 * Description
 */
public interface IWxPayService {

	/**
	 * 获取证书序列号
	 * @return
	 */
	String getSerialNumber();

	/**
	 * 获取平台证书序列号
	 * @return
	 */
	String getPlatSerialNumber();

	/**
	 * 获取商户号
	 * @return
	 */
	String getMchId();

	/**
	 * 订单退款
	 * @param order 订单
	 * @return
	 */
	Boolean orderRefund(Order order, Long afterSalesId);

	/**
	 * 指定金额退款
	 * @param orderNo
	 * @param orderId
	 * @param refundAmount
	 * @param totalAmount
	 * @param afterSalesId
	 * @return
	 */
	Boolean orderRefund(String orderNo, Long orderId, BigDecimal refundAmount, BigDecimal totalAmount, Long afterSalesId);

	void refundByFlow(String trNO, Double amount, Double refundAmount) throws Exception;

	/**
	 * 保存平台证书
	 * @param associatedData
	 * @param nonce
	 * @param cipherText
	 * @param certPath
	 * @return
	 */
	String savePlatformCert(String associatedData, String nonce, String cipherText, String certPath);

	/**
	 * 添加分账接收方
	 * @param openId
	 */
	void profitSharingAddReceiver(String openId);

	/**
	 * 请求单次分账
	 * @param transactionId 微信交易ID
	 * @param outOrderNo 订单号
	 * @param openId openId
	 * @param amount 分账金额
	 * @param description 分账描述
	 * @return
	 */
	boolean profitSharing(String transactionId, String outOrderNo, String openId, int amount, String description);

	/**
	 * 查询分账结果
	 * @param transactionId 微信交易ID
	 * @param outOrderNo 订单号
	 * @return
	 */
	boolean profitSharingQuery(String transactionId, String outOrderNo);


	/**
	 * 解冻剩余资金
	 * @param transactionId 微信交易ID
	 * @param outOrderNo 订单号
	 * @return
	 */
	void unfreeze(String transactionId, String outOrderNo);
}
