package com.xingxi.unifiedpay.service;

import com.xingxi.unifiedpay.bean.*;
import com.xingxi.unifiedpay.domain.MercUnifiedpayDTO;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

interface UnifiedpayServiceI {

    BiandanUnifiedpayOrderResponse unifiedpay(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayOrderRequest request) throws Exception;

    BiandanUnifiedpayContinue2payResponse continue2pay(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayContinue2payRequest request) throws Exception;

    BiandanUnifiedpayCallbackResponse callback(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayCallbackRequest request) throws Exception;

    BiandanUnifiedpayRefundResponse refund(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayRefundRequest request) throws Exception;

    BiandanUnifiedpayQueryRefundResponse queryRefund(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQueryRefundRequest request) throws Exception;

    default  BiandanUnifiedpaySubWithdrawResponse subWithdraw(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpaySubWithdrawRequest request) throws Exception{
        Long mercId = mercUnifiedpayDTO.getMercId();
        throw new RuntimeException("商户[" + mercId + "]不支持");
    }


    default BiandanUnifiedpayCreateSubMchApplyResponse createSubMchApply(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayCreateSubMchApplyRequest request) throws Exception {

        return null;
    }


    default BiandanUnifiedpayFinishProfitSharingResponse finishProfitSharing(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayFinishProfitSharingRequest request) throws Exception {
        Long mercId = mercUnifiedpayDTO.getMercId();
        throw new RuntimeException("商户[" + mercId + "]不支持");
    }


    default BiandanUnifiedpayProfitSharingResponse profitSharing(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayProfitSharingRequest request) throws Exception {
        Long mercId = mercUnifiedpayDTO.getMercId();
        throw new RuntimeException("商户[" + mercId + "]不支持");
    }


    default BiandanUnifiedpayRedpackResponse sendMiniProgramRedpackV2(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayRedpackRequest request) throws Exception {
        Long mercId = mercUnifiedpayDTO.getMercId();
        throw new RuntimeException("商户[" + mercId + "]不支持");
    }



    default BiandanUnifiedpayQueryApplyStatusResponse queryApplyStatusByApplymentId(MercUnifiedpayDTO mercUnifiedpayDTO,  BiandanUnifiedpayQueryApplyStatusRequest request) throws Exception {


        return null;
    }



    default BiandanUnifiedpayQueryOrderResponse queryOrder(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQueryOrderRequest request) throws Exception {
        Long mercId = mercUnifiedpayDTO.getMercId();
        throw new RuntimeException("商户[" + mercId + "]不支持");
    }



    default BiandanUnifiedpayQuerySubWithdrawResponse querySubWithdraw(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQuerySubWithdrawRequest request) throws Exception {
            return null;
    }


    default BiandanUnifiedpayDelProfitsharingReceiversResponse delProfitsharingReceivers(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayDelProfitsharingReceiversRequest request) throws Exception{

        return null;
    }



    default BiandanUnifiedpayQuerySubMchCurrBalanceResponse querySubMchCurrBalance(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQuerySubMchCurrBalanceRequest request) throws Exception{
        throw new RuntimeException("商户不支持");
    }


    default BiandanUnifiedpayQueryProfitSharingResponse queryProfitSharing(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQueryProfitSharingRequest request) throws Exception {
        return null;
    }


    default BiandanUnifiedpayProfitSharingOrdersUnSplitAmountResponse queryProfitSharingOrdersUnsplitAmount(MercUnifiedpayDTO mercUnifiedpayDTO,  BiandanUnifiedpayProfitSharingOrdersUnSplitAmountRequest request) throws Exception{

        return null;
    }





    default BiandanUnifiedpayAddProfitsharingReceiversResponse addProfitsharingReceivers(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayAddProfitsharingReceiversRequest request) throws Exception{

        return null;
    }



    default String timeExpire() {
        LocalDateTime localDateTime = LocalDateTime.now().plusMinutes(10);
        return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss+08:00"));
    }


    default LocalDateTime parseTimeExpire(String timeExpire) {
        return LocalDateTime.parse(timeExpire, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss+08:00"));
    }



}
