package com.bohuikeji.delivery.backstage.service;

import com.alibaba.fastjson.JSONObject;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.bohuikeji.delivery.backstage.entity.*;
import com.bohuikeji.delivery.backstage.entity.baidu.BaiduRefundInfo;
import com.bohuikeji.delivery.backstage.entity.rental.TRentalCarOrder;
import com.bohuikeji.delivery.backstage.entity.rental.TRentalPay;
import com.bohuikeji.frame.module.admin.base.ServiceBase;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 退款记录表 服务类
 * </p>
 *
 * @author 10552
 * @since 2019-12-27
 */
public interface ITRefundService extends ServiceBase<TRefund> {


    /**
     * 派送员App入驻缴费退款
     * @param response
     * @param tOrder
     * @param courier
     * @param tCourierPay
     * @return
     */
    TRefund courierTRefund(AlipayTradeRefundResponse response, TOrder tOrder,TCourier courier, TCourierPay tCourierPay);

    /**
     * 预取消退款明细
     * @return
     */
    JSONObject getPreCancelInfo(TOrder order);

    /**
     * 新版微信退款（小程序支付和扫码补充退款）
     * @param tOrder 订单信息
     * @param tPays 支付记录
     * @return
     */
    TRefund cancel(TOrder tOrder, List<TPay> tPays);

    /**
     * 租车退款
     * @param rentalCarOrder
     * @param rentalPays
     * @return
     */
    TRefund rentalCarCancel(TRentalCarOrder rentalCarOrder, List<TRentalPay> rentalPays);

    /**
     * 微信/支付宝入住缴费退款
     * @param tCourierPays
     * @param courier
     * @return
     */
    TRefund ettlecCancel(List<TCourierPay> tCourierPays,TCourier  courier);


    /**
     * 微信/支付退款接口
     * @param response
     * @param tOrder
     * @param courier
     * @param tPay
     * @return
     */
    TRefund wxAltRefund(Map<String, String> rs, AlipayTradeRefundResponse response,JSONObject aliClientJson, BaiduRefundInfo baiduRefundInfo, JSONObject jsonObject,TOrder tOrder, TPay tPay, TCourier courier, String refundModel);

    /**
     * 微信/支付入驻退款业务处理
     * @param rs
     * @param response
     * @param tCourierPay
     * @param courier
     * @param refundModel
     * @return
     */
    TRefund ettlecRefund(Map<String, String> rs,AlipayTradeRefundResponse response,TCourierPay tCourierPay,TCourier courier,String refundModel);

    BigDecimal deduct(TOrder order);
}
