package com.wzj.soopin.transaction.service;


import com.wzj.soopin.transaction.domain.bo.MerchantAddBO;
import com.wzj.soopin.transaction.domain.bo.PaymentBO;
import com.wzj.soopin.order.domain.bo.RefundBO;
import com.wzj.soopin.transaction.domain.bo.SeparateApplyBO;
import com.wzj.soopin.transaction.domain.bo.SeparateRefundBO;
import com.wzj.soopin.transaction.domain.bo.easypay.EasyPayRequest;
import com.wzj.soopin.transaction.domain.bo.easypay.separate.apply.resp.SeparateRespOrderInfo;
import com.wzj.soopin.transaction.domain.vo.EasypayAccountVO;
import com.wzj.soopin.transaction.domain.vo.EasypayTransResultVO;
import com.wzj.soopin.transaction.domain.vo.EasypayPrePayVO;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.math.BigDecimal;
import java.rmi.ServerException;

public interface IEasypayService {

    /**
     * 发起支付
     * @param paymentBO
     * @return
     */
    EasypayPrePayVO payment(PaymentBO paymentBO) throws ServerException;

    /**
     * 查询订单支付结果
     * @param orderId
     * @return
     */
    EasypayTransResultVO paymentQuery(Long orderId) throws ServerException;

    /**
     * 处理易生支付结果通知回调
     * @param easyPayRequest
     */
    void handleTradeCallback(EasyPayRequest easyPayRequest);

    /**
     * 易生退款
     * @param refundBO
     */
    void refund(RefundBO refundBO);

    /**
     * 退款查询
     * @param orderId
     * @return
     */
    EasypayTransResultVO refundQuery(Long orderId);


    /**
     * 发起分账
     * @param separateApplyBO
     * @return
     */
    SeparateApplyBO separateApply(SeparateApplyBO separateApplyBO);

    String merchantPicUpload(MultipartFile pic) throws IOException;

    void merchantAdd(MerchantAddBO merchantAddBO);

    void merchantBinding(String mchtCode);

    /**
     * 分账查询
     *
     * @param orderId
     * @return
     */
    SeparateRespOrderInfo separateqQuery(Long orderItemId);

    /**
     * 分账回退
     * @param separateRefundBO
     * @return
     */
    boolean separateRefund(SeparateRefundBO separateRefundBO);

    /**
     * 微信商户新增APPID
     * @param subMchtCode
     */
    void addSubAppidConfig(String subMchtCode);

    /**
     * 获取易生账户
     * @param memberId
     * @return
     */
    EasypayAccountVO getEasypayAccount(Long memberId);

    /**
     * 提现
     * @param memberId
     * @param money
     * @return
     */
    boolean  withdraw(Long memberId, BigDecimal money);


    /**
     * 同步会员账户
     * @return
     */
    boolean syncMemberAccount();

    /**
     * 开通商户
     */
    void openMerchant(Long memberId);

    /**
     * 获取商户账户
     */
    EasypayAccountVO getMerchantAccount(Long memberId);

    /**
     * 分账
     */
    boolean split(Long memberId, BigDecimal money);


    /**
     * 商户审核通知
     * */

    boolean merchantAuditNotice(String request);


}
