package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxRefundOrder;
import com.iformall.enums.EnumPayType;
import com.iformall.enums.EnumPayWay;

import java.util.Map;


public interface WxRefundOrderService {

    /**
     * 创建退款订单
     * @param appInfo
     * @param couponOrderId    券包Id
     * @param payType        退款来源
     * @param bUserId          b端退款Id，auto,admin,self可为null
     * @return
     */
    ResultData createRefundOrder(WxAppinfo appInfo, Long couponOrderId, EnumPayType payType, Long bUserId);

    /**
     * 创建退款订单
     * @param appInfo
     * @param orderId          订单Id
     * @param payType          退款来源
     * @param bUserId          b端退款Id，auto,admin,self可为null
     * @return
     */
    ResultData createRefundOrderFromMicroPay(WxAppinfo appInfo, Long orderId, EnumPayType payType, Long bUserId);

    /**
     * 退款订单查询
     * @param appInfo
     * @param record
     * @return
     */
    ResultData queryRefundOrder(WxAppinfo appInfo, WxRefundOrder record);
    /**
     * 异步通知
     * @param paramMap          异步通知参数
     * @param payWay            支付方式
     * @return
     */
    String notify(Map<String, String> paramMap, EnumPayWay payWay);

    /**
     * 处理退款成功
     * @param record
     * @param transactionId
     * @param refundId
     */
    void handleRefundSuccess(WxRefundOrder record, String transactionId, String refundId);

    /**
     * 页面回调
     * @param paramMap          页面通知参数
     * @param payWay            支付方式
     * @return
     */
    void callback(Map<String, String> paramMap, EnumPayWay payWay);
	/**
     * 根据实体查询分页列表
     *
     * @param record
     * @param pageIndex
     * @param pageSize
     * @return
     */
	PageInfo<WxRefundOrder> listAsPage(WxRefundOrder record, Integer pageIndex, Integer pageSize);
	
	/**
     * 根据Id获得实体
     *
     * @param id
     * @return
     */
    WxRefundOrder getById(Long id);
    
        /**
     * 保存或更新实体
     *
     * @param record
     */
    void saveOrUpdate(WxRefundOrder record);

    /**
     * 根据Id删除实体
     *
     * @param id
     */
    void deleteById(Long id);


    ResultData returnMoney(WxAppinfo appInfo, Long orderId);

    boolean hasRefundOrder(Long orderId, Integer status);

}
