package com.yn.bftl.thirdparty.modules.chinaums.service;

import com.yn.bftl.common.modules.account.dto.AccountPaymentsDTO;
import com.yn.bftl.common.modules.account.dto.ExternalIncomeDTO;
import com.yn.bftl.common.modules.account.dto.WithdrawalsDTO;
import com.yn.bftl.common.modules.account.vo.AccountPaymentsVO;
import com.yn.bftl.common.modules.account.vo.BalanceAcctsVO;
import com.yn.bftl.common.modules.account.vo.BalanceTransactionsPageVO;
import com.yn.bftl.common.modules.account.vo.WithdrawalsVO;
import com.yn.bftl.common.modules.order.dto.SubaccountRefundDTO;
import com.yn.bftl.common.modules.order.dto.WalletRefundDTO;
import com.yn.bftl.common.modules.order.entity.Order;
import com.yn.bftl.common.modules.order.vo.RefundVO;
import com.yn.bftl.common.modules.order.vo.SubaccountRefundVO;
import com.yn.bftl.common.modules.subaccount.entity.ChinaumsPayment;
import com.yn.bftl.thirdparty.modules.chinaums.dto.TradeResultDTO;
import com.yn.bftl.thirdparty.modules.chinaums.dto.WalletCreateByCompanyDTO;
import com.yn.bftl.thirdparty.modules.chinaums.dto.WalletOrderPayDTO;
import com.yn.bftl.thirdparty.modules.chinaums.dto.byx.ByxChinaumsGuaranteePayConfirmsDTO;
import com.yn.bftl.thirdparty.modules.chinaums.dto.chinaums.ChinaumsAllocationsDTO;
import com.yn.bftl.thirdparty.modules.chinaums.dto.chinaums.ChinaumsGuaranteePayConfirmsDTO;
import com.yn.bftl.thirdparty.modules.chinaums.vo.ChinaumsRechargeAccountVO;
import com.yn.bftl.thirdparty.modules.chinaums.vo.ElectronicReceiptVO;
import com.yn.bftl.thirdparty.modules.chinaums.vo.byx.ByxChinaumsGuaranteePayVO;
import com.yn.bftl.thirdparty.modules.chinaums.vo.chinaums.ChinaumsAllocationsVO;
import com.yn.bftl.thirdparty.modules.chinaums.vo.chinaums.ChinaumsGuaranteePayConfirmsVO;
import com.yn.bftl.thirdparty.modules.chinaums.vo.chinaums.ChinaumsGuaranteePayVO;

import java.util.List;

/**
 * 电子账簿服务
 *
 * @author huabiao
 * @create 2022/12/5  20:24
 **/
public interface WalletService {

    /**
     * 电子账簿查询（电子账簿 ID）
     *
     * @param balanceAcctId
     * @return
     */
    BalanceAcctsVO balanceAcctsQryByAcctId(String balanceAcctId);

    /**
     * 电子账簿流水查询
     *
     * @param balanceAcctId
     * @param startAt
     * @param endAt
     * @return
     */
    BalanceTransactionsPageVO balanceTransactions(String balanceAcctId, String startAt, String endAt);

    /**
     * 电子账簿-获取充值账号
     *
     * @return 充值账号
     * @author huabiao
     * @create 2022/12/8  15:13
     */
    ChinaumsRechargeAccountVO getWalletRechargeAccount();

    /**
     * 消费(转账)
     *
     * @param accountPaymentsDTO
     * @return
     */
    AccountPaymentsVO payments(AccountPaymentsDTO accountPaymentsDTO);

    /**
     * 交易结果通知
     *
     * @param tradeResultDTO
     * @return
     */
    boolean tradeResult(TradeResultDTO tradeResultDTO);

    /**
     * 消费订单查询（平台订单号）
     *
     * @param outOrderNo
     * @return
     */
    AccountPaymentsVO paymentsByOutOrderNo(String outOrderNo);

    /**
     * 提现创建
     *
     * @param withdrawalsDTO
     * @return
     */
    WithdrawalsVO withdrawals(WithdrawalsDTO withdrawalsDTO);

    /**
     * 提现订单查询（平台订单号）
     *
     * @param outOrderNo
     * @return
     */
    WithdrawalsVO withdrawalsByOutOrderNo(String outOrderNo);

    /**
     * 电子账簿-订单支付
     *
     * @param walletOrderPayDTO:订单支付DTO
     * @return 第三方支付单号
     * @author huabiao
     * @create 2022/12/9  16:01
     */
    String orderPay(WalletOrderPayDTO walletOrderPayDTO);

    /**
     * 电子账簿-分账确认
     *
     * @param chinaumsGuaranteePayConfirmsDTO:分账参数
     * @return 分账单号
     * @author huabiao
     * @create 2022/12/16  9:52
     */
    ChinaumsGuaranteePayConfirmsVO paySettlement(ChinaumsGuaranteePayConfirmsDTO chinaumsGuaranteePayConfirmsDTO);

    /**
     * 电子账簿-处理银联支付单
     *
     * @param order:订单
     * @author huabiao
     * @create 2022/12/16  16:47
     */
    List<ChinaumsPayment> handleChinaumsPayment(Order order);

    /**
     * 转账入金
     *
     * @param externalIncomeDTO
     * @return
     */
    Boolean transferDeposit(ExternalIncomeDTO externalIncomeDTO);

    /**
     * 电子账簿-退款
     *
     * @param walletRefundDTO 账簿退款DTO
     * @return 银联退款VO
     * @author huabiao
     * @create 2022/12/20  9:10
     */
    RefundVO refund(WalletRefundDTO walletRefundDTO);

    /**
     * 电子账簿-创建分账
     *
     * @param chinaumsAllocationsDTO:分账参数
     * @return
     * @author huabiao
     * @create 2023/2/10  9:50
     */
    ChinaumsAllocationsVO createSubaccount(ChinaumsAllocationsDTO chinaumsAllocationsDTO);

    /**
     * POS充值转账
     */
    void posTransfer();

    /**
     * 扫码充值转账
     */
    void scanTransfer();

    /**
     * 电子账簿-分账退款
     *
     * @param subaccountRefundDTO 分账退款DTO
     * @return SubaccountRefundVO
     * @author huabiao
     * @create 2023/4/26  10:46
     */
    SubaccountRefundVO subaccountRefund(SubaccountRefundDTO subaccountRefundDTO);

    /**
     * 电子回单
     *
     * @param tradeId
     * @return
     */
    ElectronicReceiptVO electronicReceipts(String tradeId);

    /**
     * 电子账簿-通过惬意创建
     *
     * @param walletCreateByCompanyDTO 电子账簿通过企业创建DTO
     * @author huabiao
     * @create 2023/5/25  19:28
     */
    void createWalletByCompany(WalletCreateByCompanyDTO walletCreateByCompanyDTO);

    /**
     * 创建授信还款电子账簿
     */
    void createWalletCreditRefund();

    /***
     * 通过支付单号查询银联支付信息
     *
     * @param mctOrderNo 支付单号
     * @return ByxChinaumsGuaranteePayVO
     * @author huabiao
     * @create 2023/10/18  15:45
     */
    ByxChinaumsGuaranteePayVO orderPaymentsByOutOrderNo(String mctOrderNo, String platformWalletId);

    /**
     * 担保支付消息推送
     * @param tradeResultDTO
     * @return
     */
    boolean payCallback(TradeResultDTO tradeResultDTO);

    /**
     * 担保支付确认结算
     * @param byxChinaumsGuaranteePayConfirmsDTO---byxChinaumsGuaranteePayConfirmsDTO
     * @return String----确认结算单号（也叫分账号）
     */
    String paySettlementConfirms(ByxChinaumsGuaranteePayConfirmsDTO byxChinaumsGuaranteePayConfirmsDTO);

    /**
     * 提现回调
     * @param transOrderNo 银联交易订单号
     */
    void withdrawalsCallBack(String transOrderNo);
}
