package com.yonge.cooleshow.biz.dal.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yonge.cooleshow.auth.api.entity.SysUser;
import com.yonge.cooleshow.biz.dal.dto.req.AuthOperaReq;
import com.yonge.cooleshow.biz.dal.dto.req.OrderRefundReq;
import com.yonge.cooleshow.biz.dal.dto.search.UserOrderRefundSearch;
import com.yonge.cooleshow.biz.dal.entity.UserOrderRefund;
import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill;
import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundVo;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.toolset.payment.base.model.RefundBill;
import com.yonge.toolset.payment.base.model.callback.PaymentCallBack;

/**
 * 用户退款表 服务类
 * @author liweifan
 * @date 2022-03-30
 */
public interface UserOrderRefundService extends IService<UserOrderRefund>  {
	/**
     * 查询详情
     * @author liweifan
 	 * @date 2022-03-30
     */
	UserOrderRefundVo detail(Long id);
	/**
	 * 查询详情
	 * @author liweifan
	 * @date 2022-03-30
	 */
	UserOrderRefundVo detail(Long id,Long userId);
    /**
     * 分页查询
     * @author liweifan
 	 * @date 2022-03-30
     */
    IPage<UserOrderRefundVo> selectPage(IPage<UserOrderRefundVo> page, UserOrderRefundSearch query);
	/***
	 * 订单退款
	 * @author liweifan
	 * @param: payReq
	 * @updateTime 2022/4/21 19:39
	 * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.lang.Boolean>
	 */
	HttpResponseResult<Boolean> orderRefund(OrderRefundReq refundReq);
	/***
	 * 审批退款申请
	 * @author liweifan
	 * @param: authOperaReq
	 * @param: user
	 * @updateTime 2022/5/9 16:25
	 * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.lang.Boolean>
	 */
    HttpResponseResult<Boolean> doAuth(AuthOperaReq authOperaReq, SysUser user);

	/**
	 * 系統自動退款(退已完成的订单)
	 * @param orderNo
	 * @param reason
	 * @return
	 */
	HttpResponseResult<UserOrderRefundBill> orderRefund(String orderNo, String reason);

	/**
	 * 交易失败退款(交易原路退还)
	 * @param data
	 * @param reason
	 * @return
	 */
	HttpResponseResult<UserOrderRefundBill> orderFailRefund(PaymentCallBack data, String orderNo, String reason);

	/**
	 * 退款回调
	 * @param data
	 */
	void refundPaymentCallBack(PaymentCallBack data);

	/**
	 * 直接退款（测试）
	 * @param orderNo
	 */
	HttpResponseResult<UserOrderRefundBill> orderRefound(String orderNo);

	void orderRefundSuccessBizHandle(Long refundId);
}