|
|
@@ -11,6 +11,8 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
@@ -55,6 +57,8 @@ import java.util.Map;
|
|
|
@Component
|
|
|
public class EzPay {
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(EzPay.class);
|
|
|
+
|
|
|
/** 正式环境根地址。 */
|
|
|
public static final String BASE_PROD = "https://inv.ezpay.com.tw";
|
|
|
/** 测试环境根地址。 */
|
|
|
@@ -170,6 +174,8 @@ public class EzPay {
|
|
|
String postDataHex = EzPayEncryptUtil.encrypt(query, config.getHashKey(), config.getHashIV());
|
|
|
String checkValue = EzPayEncryptUtil.genCheckValue(postDataHex, config.getHashKey(), config.getHashIV());
|
|
|
String resp = postFormWithCheck(baseUrl + URL_CHECK_BARCODE, config.getMerchantId(), postDataHex, checkValue);
|
|
|
+ log.info("[EzPay] checkBarCode barCode={}, resp={}", barCode, resp);
|
|
|
+
|
|
|
JSONObject json = JSON.parseObject(resp);
|
|
|
if (json == null || !"SUCCESS".equals(json.getString("Status"))) {
|
|
|
return false;
|