疯体ios支付修改,添加下单接口

master
duhui 2022-07-14 10:52:19 +08:00
parent e5abf0c7f0
commit e41251e415
2 changed files with 61 additions and 5 deletions

View File

@ -0,0 +1,56 @@
package com.jmfy.controller;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.jmfy.paramBean.PaySdkEnum;
import com.jmfy.util.JsonUtil;
import com.jmfy.util.MD5Util;
import net.sf.json.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.security.KeyFactory;
import java.security.Signature;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.*;
/**
* ios
*/
@RestController
public class OhayooGetExternalController {
@Resource
private PayLogic payLogic;
private static final Logger LOGGER = LoggerFactory.getLogger(OhayooGetExternalController.class);
@RequestMapping(value = "/ohayooGetExternal")
public String ohayooGetExternal(HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap2(request);
TreeMap<String, String> map = new TreeMap<>(parameterMap);
LOGGER.info("ohayoo获取前端参数{}",map);
if (map == null || map.isEmpty()) {
return null;
}
StringBuilder builder = new StringBuilder();
for (Map.Entry<String, String> entry : map.entrySet()) {
builder.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
String externalOrder = builder.substring(0, builder.length() - 1);
String payKey = OhayooRechargeController.payKey;
String sign = MD5Util.encrypByMd5(payKey + externalOrder + payKey);
map.put("sign",sign);
Gson gson = new Gson();
LOGGER.info("ohayoo返回前端参数{}",gson.toJson(map));
return gson.toJson(map);
}
}

View File

@ -19,16 +19,16 @@ import java.util.*;
* ios
*/
@RestController
public class FengTiIosRechargeController {
public class OhayooRechargeController {
@Resource
private PayLogic payLogic;
private static final Logger LOGGER = LoggerFactory.getLogger(FengTiIosRechargeController.class);
private static final Logger LOGGER = LoggerFactory.getLogger(OhayooRechargeController.class);
private static final String callbackkey = "53780900079388195716762718742907";
private static final String payKey = "2e92cbb7faa7e37e0c5a38723b1d2acd";
public static final String payKey = "2e92cbb7faa7e37e0c5a38723b1d2acd";
@RequestMapping(value = "/FengTiIosCallback")
public String FengTiIoCallback(HttpServletRequest request) throws Exception {
@RequestMapping(value = "/OhayooCallback")
public String OhayooCallback(HttpServletRequest request) throws Exception {
return process(request,callbackkey);
}