|
|
@@ -210,8 +210,14 @@ public class OmgPay {
|
|
|
}
|
|
|
String key = URLDecoder.decode(pair.substring(0, idx), StandardCharsets.UTF_8);
|
|
|
String value = URLDecoder.decode(pair.substring(idx + 1), StandardCharsets.UTF_8);
|
|
|
- if (key.isEmpty() || map.putIfAbsent(key, value) != null) {
|
|
|
- throw new IllegalArgumentException("Duplicate or empty OMG response field");
|
|
|
+ if (key.isEmpty()) {
|
|
|
+ throw new IllegalArgumentException("Empty OMG response field");
|
|
|
+ }
|
|
|
+ // 重复键 last-wins(不抛):OMG 大响应(NeedExtraPaidInfo=Y)若含重复键,
|
|
|
+ // 不让 queryTrade 在此直接失败;log.warn 记录便于排查,验签用同一 map 重算把关。
|
|
|
+ String prev = map.put(key, value);
|
|
|
+ if (prev != null) {
|
|
|
+ log.warn("[OMG] 响应含重复键(取 last-wins): key={}, prev={}, cur={}", key, prev, value);
|
|
|
}
|
|
|
if (map.size() > 100) {
|
|
|
throw new IllegalArgumentException("Too many OMG response fields");
|