From a4e001c3ec91bee612c133f5a6b79115aff7ebe4 Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Wed, 4 Dec 2019 11:09:19 +0800 Subject: [PATCH] =?UTF-8?q?[Y]=20R=20service=20=E5=8A=A0=E5=AF=86=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/appclient/core/impls/RetailRSvcServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java index 6ad758ca6..7a1f873ef 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java @@ -10,6 +10,7 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import org.apache.commons.lang3.StringUtils; import org.apache.commons.net.util.Base64; import org.springframework.stereotype.Service; @@ -40,9 +41,9 @@ public class RetailRSvcServiceImpl implements RetailRSvcService { RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id")); String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded()); 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("enc_data", new JSONObject(true) { + result.put("enc_data", new JSONObject() { { put("credentialCode", encData(svcMchBean.getCredentialCode(), 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("timestamp", System.currentTimeMillis()); + result = JSONObject.parseObject(JSON.toJSONString(result), Feature.OrderedField); result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key"))); return result; }