package com.yida.data.school.transaction.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.apply.EduApplyProductOrder;
import com.yida.data.common.core.entity.apply.EduApplyProductRefund;
import com.yida.data.school.dto.transaction.EduApplyProductOrderDTO;
import com.yida.data.school.vo.transcation.PayInfoVO;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

public interface EduProductOrderService extends IService<EduApplyProductOrder> {


    /**
     * 生成订单
     *
     * @return
     */
    PayInfoVO createOrder(Long productId, Long[] studentId, Integer payType, CurrentUser currentUser,
                          String ip);

    /**
     * 修改订单状态
     *
     * @return
     */
    ResultBean updateProductOder(EduApplyProductOrder eduApplyProductOrder);

    /**
     * 订单后台分页查询
     *
     * @return
     */
    IPage<EduApplyProductOrder> selectPageListProductOrderService(Page page, EduApplyProductOrderDTO eduApplyProductOrder);


    /**
     * 退款
     */
    void refund(EduApplyProductRefund refund, CurrentUser currentUser);

    /**
     * 微信通知回调
     */
    void wxCall(Map<String, Object> res);

    /**
     * 手机查询订单列表
     *
     * @param phone
     * @return
     */
    List selectListProductOrder(Long schoolId, String phone, Long studentId);

    EduApplyProductOrder selectEduProductOrder(Long orderId);

    /**
     * 订单完成
     */
    void orderSuccess(String orderCode);

    /**
     * 处理订单支付完成
     *
     * @param orderCode
     * @param successTime
     */
    void paySuccessUpdate(String orderCode, LocalDateTime successTime);

    /**
     * 微信js支付签名
     */
    PayInfoVO getWxJsSign(String orderCode, String prepayId);

    /**
     * 更新订单状态
     */
    void updateOrderStatus();

    /**
     * 更新退款订单状态
     */
    void updateRefundStatus();

}
