|
|
|
@@ -93,7 +93,7 @@ public class AliPayUtil { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
private static JSONObject getGenericResponse(String result,String key) { |
|
|
|
private static JSONObject getGenericResponseWithCodes(String result,String key,String[] successCodes) { |
|
|
|
if (StringUtils.isBlank(result)) { |
|
|
|
log.error("alipay apiresponse ["+key+"] error. no result."+result); |
|
|
|
return null; |
|
|
|
@@ -103,8 +103,10 @@ public class AliPayUtil { |
|
|
|
JSONObject resultObject = object.getJSONObject(key); |
|
|
|
if (null != resultObject ) { |
|
|
|
String code = resultObject.getString("code"); |
|
|
|
if (("10000".equals(code))) { |
|
|
|
return resultObject; |
|
|
|
for (String successCode : successCodes) { |
|
|
|
if ((successCode.equals(code))) { |
|
|
|
return resultObject; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -112,6 +114,10 @@ public class AliPayUtil { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
private static JSONObject getGenericResponse(String result,String key) { |
|
|
|
return getGenericResponseWithCodes(result,key,new String[] {"10000"}); |
|
|
|
} |
|
|
|
|
|
|
|
//门店照片上传 |
|
|
|
public String merchantImageUpload(String appAuthToken,String imageName,byte[] file) { |
|
|
|
String temfolder = "/alipaytempfile/"+UUID.randomUUID(); |
|
|
|
@@ -302,7 +308,7 @@ public class AliPayUtil { |
|
|
|
public boolean smartDistrictTopicSubscribe(String appAuthToken,String topic) { |
|
|
|
try { |
|
|
|
AlipayOpenApiGenericResponse response = AliPayApi.topicSubscribe(getConfig(),appAuthToken, "app_auth", topic, "HTTP", "BIZ_TAG"); |
|
|
|
JSONObject result = getGenericResponse(response.getHttpBody(),"alipay_open_app_message_topic_subscribe_response"); |
|
|
|
JSONObject result = getGenericResponseWithCodes(response.getHttpBody(),"alipay_open_app_message_topic_subscribe_response",new String[] {"40004","10000"}); |
|
|
|
if (null != result) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|