package cn.pluss.platform.merchant;

import cn.pluss.platform.api.Result;
import cn.pluss.platform.entity.MerchantBaseInfo;
import cn.pluss.platform.exception.PayRiskException;
import cn.pluss.platform.wap.LevelDTO;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author DJH
 * 商户的部分业务逻辑
 */
public interface MerchantService {

    /**
     * app退款回调
     */
    String appRefundCallback(HttpServletRequest request);

    /**
     * 检查支付地点
     */
    void checkPayLocation(HttpServletRequest request, MerchantBaseInfo merchantBaseInfo ) throws PayRiskException;

    /**
     * 检查付款人ip地址
     * @param ip
     * @param merchantBaseInfo
     * @param province
     * @throws PayRiskException
     */
    void checkPayLocation(String ip, MerchantBaseInfo merchantBaseInfo,String province) throws PayRiskException;

    /**
     * 统一支付入口
     * @param params
     * @return
     */
    Result<Map<String,Object>> tradePay(Map<String, Object> params);

    /**
     * 会员升级充值入口
     * @param levelDTO
     * @return
     */
    Map<String, Object> tradePay(LevelDTO levelDTO,HttpServletRequest request) throws Exception;

    /**
     * 被扫小程序会员充值
     * @param json
     * @return
     */
    Result<JSONObject> memberRecharge(JSONObject json);

    /**
     * @description:临时码支付
     * @date: 2021/8/2 11:01
     * @param params:
     * @return cn.pluss.platform.api.Result<java.util.Map<java.lang.String,java.lang.Object>>
     */
    Result<Object> moveTradePay(Map<String, Object> params);

    /**
     * 阿里云设备授权支付页面
     * @date: 2021/12/28 13:56
     * @param request:
     * @param response
     * @param orderNumber:
     * @return
     */
    ModelAndView scanPayAuth(HttpServletRequest request, HttpServletResponse response , String orderNumber);

    /**
     * 扫码订单支付
     * @date: 2021/12/28 17:36
     * @param request:
     * @param response:
     * @param tk:
     * @param code:
     * @param auth_code:
     * @param userAuthCode:
     * @param userId:
     * @param payType:
     * @return org.springframework.web.servlet.ModelAndView
     */
    ModelAndView scanPay(HttpServletRequest request, HttpServletResponse response , String tk, String code, String auth_code, String userAuthCode,String userId,String payType);
}
