package com.jeequan.jeepay.core.interfaces.paychannel;

import com.jeequan.jeepay.core.entity.CashoutRecord;
import com.jeequan.jeepay.core.model.DBPaymentConfig;
import com.jeequan.jeepay.core.model.df.Account;
import com.jeequan.jeepay.core.model.df.PaymentSign;
import com.jeequan.jeepay.core.model.rqrs.msg.ChannelRetMsg;

/**
 * TODO
 * 代付接口
 * @author crystal
 * @date 2024/3/22 18:02
 */
public interface IRepayApiService {

    /** 获取到接口code **/
    String getIfCode();

    /**
     * 是否需要签约
     * @return
     */
    boolean isSign();

    /**
     * 前置校验
     */
    void preCheck(String mchNo,byte accountType,Long changeAmt);

    /**
     * 查询账户余额
     * @param mchNo 用户号
     * @param accountType 账户类型
     * @return
     */
    Account queryAccountBalance(String mchNo, byte accountType);

    /**
     * 签约
     * @param sign
     * @param config
     * @return
     */
    ChannelRetMsg sign(PaymentSign sign, DBPaymentConfig config);

    /**
     * 查询签约结果
     * @param sign
     * @param config
     * @return
     */
    ChannelRetMsg querySign(PaymentSign sign, DBPaymentConfig config);

    /**
     * 付款
     * @param record
     * @param config
     * @return
     */
    ChannelRetMsg payment(CashoutRecord record, DBPaymentConfig config);

    /**
     * 付款结果查询
     * @param outBizNo 外部请求流水号
     * @param config
     * @return
     */
    ChannelRetMsg queryPayment(String outBizNo, DBPaymentConfig config);

    /**
     * 校验账户余额
     * @param mchNo
     * @param accountType
     * @param changeAmt
     */
    void checkAccountBalance(String mchNo,byte accountType,Long changeAmt);
}
