package com.jeequan.jeepay.core.interfaces.paychannel;

import com.jeequan.jeepay.core.entity.MchApplyment;
import org.apache.commons.lang3.tuple.MutablePair;
import org.springframework.http.ResponseEntity;

import javax.servlet.http.HttpServletRequest;

/**
* 进件通知接口
*
* @author terrfly
*
* @date 2022/1/6 14:12
*/
public interface IIsvmchApplymentNotifyService {

    /**
     * 解析参数 返回申请单号和参数对象 (与业务无关)
     * left 入网订单号
     * right 入网回调参数
     */
    MutablePair<String, Object> parseParams(HttpServletRequest request, String urlApplyId);

    /**
     * 返回需要更新的订单状态 和响应数据 （验签等操作）
     * @param request
     * @param params    解密后的回调参数
     * @param mchApplyment  商户信息, 必须包含完整的数据
     * @return
     */
    MutablePair<MchApplyment, ResponseEntity> doNotify(HttpServletRequest request, Object params, MchApplyment mchApplyment);

    default ResponseEntity<?> retOk(Object params) {
        return ResponseEntity.ok(params);
    }
}
