Merge remote-tracking branch 'origin/develop' into develop

master
liuxinxin 5 years ago
commit 87b472f489

@ -10,6 +10,7 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper; import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.util.Base64; import org.apache.commons.net.util.Base64;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -40,9 +41,9 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id")); RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id"));
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded()); String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr)); Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
JSONObject result = (JSONObject) JSON.toJSON(svcMchBean); JSONObject result = (JSONObject) JSONObject.toJSON(svcMchBean);
result.put("sign_type", "RSA2"); result.put("sign_type", "RSA2");
result.put("enc_data", new JSONObject(true) { result.put("enc_data", new JSONObject() {
{ {
put("credentialCode", encData(svcMchBean.getCredentialCode(), key, svcInfo.getString("channel_pub_key"))); put("credentialCode", encData(svcMchBean.getCredentialCode(), key, svcInfo.getString("channel_pub_key")));
put("payHost", encData(svcMchBean.getPayHost(), key, svcInfo.getString("channel_pub_key"))); put("payHost", encData(svcMchBean.getPayHost(), key, svcInfo.getString("channel_pub_key")));
@ -52,6 +53,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
}); });
result.put("nonce_str", aesKeyStr); result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis()); result.put("timestamp", System.currentTimeMillis());
result = JSONObject.parseObject(JSON.toJSONString(result), Feature.OrderedField);
result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key"))); result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key")));
return result; return result;
} }

Loading…
Cancel
Save