|
|
@ -2,12 +2,14 @@ package com.hai.config; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
|
|
|
|
import com.hai.common.utils.RequestUtils; |
|
|
|
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; |
|
|
|
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; |
|
|
|
import org.apache.commons.codec.binary.Base64; |
|
|
|
import org.apache.commons.codec.binary.Base64; |
|
|
|
import com.hai.common.pay.util.sdk.WXPayConstants; |
|
|
|
import com.hai.common.pay.util.sdk.WXPayConstants; |
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.io.*; |
|
|
|
import java.io.*; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Files; |
|
|
@ -26,27 +28,29 @@ public class UnionStagingPayConfig { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 银联分期支付,H5预下单-标准 |
|
|
|
* 银联分期支付,H5预下单-标准 |
|
|
|
* 文档地址: https://doc.eycard.cn/web/#/222?page_id=3183
|
|
|
|
* 文档地址: https://doc.eycard.cn/web/#/222?page_id=3183
|
|
|
|
* @param orderNo 订单号 |
|
|
|
* @param prodTrace 产品流水 可重复,记录订单生命周期,无特殊需求同交易流水号 |
|
|
|
* @param orgTrace 订单号 |
|
|
|
* @param orgTrace 订单号 |
|
|
|
* @param appId 支付宝、微信、云闪付商户应用ID(一般情况下与获取’openId’时的应用一致) |
|
|
|
* @param openId 支付宝、微信、云闪付用户授权唯一标识(如果没有,送:-) |
|
|
|
* @param openId 支付宝、微信、云闪付用户授权唯一标识(如果没有,送:-) |
|
|
|
|
|
|
|
* @param payPrice 支付金额 【单位:分】 |
|
|
|
* @param payPrice 支付金额 【单位:分】 |
|
|
|
* @return 响应信息 |
|
|
|
* @return 响应信息 |
|
|
|
* @throws Exception |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static JSONObject advancePay(String orderNo, String orgTrace, BigDecimal payPrice, String appId,String openId, String notifyUrl) throws Exception { |
|
|
|
public static JSONObject advancePay(String prodTrace, String orgTrace, BigDecimal payPrice, String openId, String notifyUrl, HttpServletRequest request) throws Exception { |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
|
paramMap.put("orgTermNo", CommonSysConst.getSysConfig().getUnionStagingPayOrgTermNo()); |
|
|
|
paramMap.put("orgTermNo", CommonSysConst.getSysConfig().getUnionStagingPayOrgTermNo()); |
|
|
|
paramMap.put("prodTrace", orderNo); |
|
|
|
paramMap.put("prodTrace", prodTrace); |
|
|
|
paramMap.put("orgTrace", orgTrace); |
|
|
|
paramMap.put("orgTrace", orgTrace); |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject terminalInfo = new JSONObject(); |
|
|
|
|
|
|
|
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request)); |
|
|
|
|
|
|
|
paramMap.put("terminalinfo", terminalInfo.toJSONString()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue()); |
|
|
|
bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue()); |
|
|
|
bizDataMap.put("appId", appId); |
|
|
|
|
|
|
|
bizDataMap.put("openId", openId); |
|
|
|
bizDataMap.put("openId", openId); |
|
|
|
bizDataMap.put("notifyUrl", notifyUrl); |
|
|
|
bizDataMap.put("notifyUrl", notifyUrl); |
|
|
|
paramMap.put("bizData", bizDataMap); |
|
|
|
paramMap.put("bizData", bizDataMap); |
|
|
@ -65,7 +69,7 @@ public class UnionStagingPayConfig { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
* @throws Exception |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static JSONObject query(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate) throws Exception { |
|
|
|
public static JSONObject query(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception { |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
@ -74,6 +78,10 @@ public class UnionStagingPayConfig { |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject terminalInfo = new JSONObject(); |
|
|
|
|
|
|
|
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request)); |
|
|
|
|
|
|
|
paramMap.put("terminalinfo", terminalInfo.toJSONString()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); |
|
|
|
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); |
|
|
@ -93,7 +101,7 @@ public class UnionStagingPayConfig { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
* @throws Exception |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static JSONObject queryStaging(String orgTrace, String oriOrgTrace, String prodCode,Date oriBizDate) throws Exception { |
|
|
|
public static JSONObject queryStaging(String orgTrace, String oriOrgTrace, String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception { |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
@ -102,6 +110,10 @@ public class UnionStagingPayConfig { |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject terminalInfo = new JSONObject(); |
|
|
|
|
|
|
|
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request)); |
|
|
|
|
|
|
|
paramMap.put("terminalinfo", terminalInfo.toJSONString()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); |
|
|
|
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); |
|
|
@ -122,7 +134,7 @@ public class UnionStagingPayConfig { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
* @throws Exception |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static JSONObject standardRefund(String orgTrace, String oriOrgTrace, BigDecimal transAmt,String prodCode,Date oriBizDate) throws Exception { |
|
|
|
public static JSONObject standardRefund(String orgTrace, String oriOrgTrace, BigDecimal transAmt,String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception { |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
@ -131,6 +143,10 @@ public class UnionStagingPayConfig { |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject terminalInfo = new JSONObject(); |
|
|
|
|
|
|
|
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request)); |
|
|
|
|
|
|
|
paramMap.put("terminalinfo", terminalInfo.toJSONString()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); |
|
|
|
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); |
|
|
@ -151,7 +167,7 @@ public class UnionStagingPayConfig { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
* @throws Exception |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static JSONObject mposfindrefund(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate) throws Exception { |
|
|
|
public static JSONObject mposfindrefund(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception { |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
|
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); |
|
|
@ -160,6 +176,10 @@ public class UnionStagingPayConfig { |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("prodCode", "ISYH"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
paramMap.put("signType", "RSA"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject terminalInfo = new JSONObject(); |
|
|
|
|
|
|
|
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request)); |
|
|
|
|
|
|
|
paramMap.put("terminalinfo", terminalInfo.toJSONString()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
Map<String, Object> bizDataMap = new HashMap<>(); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
bizDataMap.put("oriOrgTrace", oriOrgTrace); |
|
|
|
paramMap.put("bizData", bizDataMap); |
|
|
|
paramMap.put("bizData", bizDataMap); |
|
|
|