package com.bohuikeji.delivery.backstage.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bohuikeji.delivery.backstage.entity.discount.TDiscountMall;
import com.bohuikeji.delivery.backstage.entity.discount.TDiscountPay;
import com.bohuikeji.delivery.backstage.entity.discount.TDiscountRecord;
import com.bohuikeji.frame.module.admin.entity.back.APIEntity;
import com.bohuikeji.frame.module.admin.entity.vo.AliReturnPayVo;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * <p>
 * 支付交易信息表 服务类
 * </p>
 *
 * @author 10552
 * @since 2019-12-27
 */
public interface ITDiscountPayService extends IService<TDiscountPay> {

    /**
     * 订单业务创建预支付单（微信，支付宝）
     * @return
     */
    TDiscountPay createBeforePay(TDiscountMall discountMall, Integer customerId, String scenario, String payMethod, String payWay);

    /**
     * 购买优惠预支付订单
     * @param discountMall
     * @param customerId
     * @param request
     * @return
     * @throws Exception
     */
    APIEntity getPayByDis(TDiscountMall discountMall, Integer customerId, HttpServletRequest request) throws Exception;

    /**
     * 免费领取优惠服务
     * @param jsonObject
     * @param discountPay
     * @param disId
     * @param customerId
     * @return
     */
    TDiscountRecord handleDiscountService(JSONObject jsonObject, AliReturnPayVo req ,TDiscountPay discountPay, Integer disId, Integer customerId) throws Exception;
}
