|
|
@@ -100,10 +100,7 @@ public class EzPay {
|
|
|
postData.put("RespondType", "JSON");
|
|
|
postData.put("Version", "1.5");
|
|
|
postData.put("Status", "1"); // 1=即时开立
|
|
|
- log.info("[EzPay] invoice_issue 请求明文参数: {}", postData);
|
|
|
- JSONObject resp = doPost(baseUrl + URL_ISSUE, config, postData);
|
|
|
- log.info("[EzPay] invoice_issue 回应: {}", resp);
|
|
|
- return resp;
|
|
|
+ return doPost(baseUrl + URL_ISSUE, config, postData);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -174,8 +171,10 @@ public class EzPay {
|
|
|
String query = buildQuery(postData);
|
|
|
String postDataHex = EzPayEncryptUtil.encrypt(query, config.getHashKey(), config.getHashIV());
|
|
|
String checkValue = EzPayEncryptUtil.genCheckValue(postDataHex, config.getHashKey(), config.getHashIV());
|
|
|
+ log.info("[EzPay] checkBarCode 全量参数 >>> MerchantID={}, Version=1.0, RespondType=JSON, "
|
|
|
+ + "PostData明文={}, PostData密文={}, CheckValue={}",
|
|
|
+ config.getMerchantId(), postData, postDataHex, checkValue);
|
|
|
String resp = postFormWithCheck(baseUrl + URL_CHECK_BARCODE, config.getMerchantId(), "1.0", "JSON", postDataHex, checkValue);
|
|
|
- log.info("[EzPay] checkBarCode barCode={}, resp={}", barCode, resp);
|
|
|
|
|
|
JSONObject json = JSON.parseObject(resp);
|
|
|
if (json == null || !"SUCCESS".equals(json.getString("Status"))) {
|
|
|
@@ -204,6 +203,7 @@ public class EzPay {
|
|
|
*/
|
|
|
public JSONObject doPost(String fullUrl, EzPayConfig config, Map<String, Object> postData) throws Exception {
|
|
|
postData.put("TimeStamp", String.valueOf(System.currentTimeMillis() / 1000L));
|
|
|
+ log.info("[EzPay] doPost 明文 >>> url={}, 明文参数={}", fullUrl, postData);
|
|
|
String query = buildQuery(postData);
|
|
|
String postDataEncrypted = EzPayEncryptUtil.encrypt(query, config.getHashKey(), config.getHashIV());
|
|
|
String resp = postForm(fullUrl, config.getMerchantId(), postDataEncrypted);
|
|
|
@@ -239,9 +239,12 @@ public class EzPay {
|
|
|
params.add(new BasicNameValuePair("PostData_", postData));
|
|
|
HttpPost post = new HttpPost(url);
|
|
|
post.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8));
|
|
|
+ log.info("[EzPay] postForm >>> url={}, body={}", url, EntityUtils.toString(post.getEntity(), StandardCharsets.UTF_8));
|
|
|
try (CloseableHttpClient client = HttpClients.createDefault();
|
|
|
CloseableHttpResponse res = client.execute(post)) {
|
|
|
- return EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
|
|
|
+ String resp = EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
|
|
|
+ log.info("[EzPay] postForm <<< resp={}", resp);
|
|
|
+ return resp;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -259,9 +262,12 @@ public class EzPay {
|
|
|
params.add(new BasicNameValuePair("CheckValue", checkValue));
|
|
|
HttpPost post = new HttpPost(url);
|
|
|
post.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8));
|
|
|
+ log.info("[EzPay] postFormWithCheck >>> url={}, body={}", url, EntityUtils.toString(post.getEntity(), StandardCharsets.UTF_8));
|
|
|
try (CloseableHttpClient client = HttpClients.createDefault();
|
|
|
CloseableHttpResponse res = client.execute(post)) {
|
|
|
- return EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
|
|
|
+ String resp = EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
|
|
|
+ log.info("[EzPay] postFormWithCheck <<< resp={}", resp);
|
|
|
+ return resp;
|
|
|
}
|
|
|
}
|
|
|
}
|