|
@@ -62,6 +62,32 @@ public class UnionPayRequestApiComponent {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 运营商二要素验证接口
|
|
* 运营商二要素验证接口
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ */
|
|
|
|
|
+ public UnionPayResponse twoFactorVerifyRequest(UnionPayRequest request) {
|
|
|
|
|
+ String url = unionPayApiConfigurationProperties.getTwoFactorVerifyUrl();
|
|
|
|
|
+ JSONObject params=new JSONObject();
|
|
|
|
|
+ if (StringUtils.isBlank(request.getPhoneNo())) {
|
|
|
|
|
+ throw new InvalidParameterException("手机号不允许为空!");
|
|
|
|
|
+ }
|
|
|
|
|
+ params.put("phoneNo", request.getPhoneNo());
|
|
|
|
|
+
|
|
|
|
|
+ //01:验证姓名+手机号,此时用户姓名必输 02:身份证+手机号,此时证件类型、证件
|
|
|
|
|
+ if (StringUtils.isNotBlank(request.getCertNo())) {
|
|
|
|
|
+ params.put("verifyType", "02");
|
|
|
|
|
+ params.put("certType", "01");//证件类型 01:身份证
|
|
|
|
|
+ params.put("certNo", request.getCertNo());
|
|
|
|
|
+ } else if (StringUtils.isNotBlank(request.getName())) {
|
|
|
|
|
+ params.put("verifyType", "01");
|
|
|
|
|
+ params.put("name", request.getName());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new InvalidParameterException("身份证、用户姓名至少传值一个!");
|
|
|
|
|
+ }
|
|
|
|
|
+ return commonRequest(url, params);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 运营商三要素验证接口
|
|
|
*
|
|
*
|
|
|
* @param request
|
|
* @param request
|
|
|
*/
|
|
*/
|
|
@@ -259,10 +285,11 @@ public class UnionPayRequestApiComponent {
|
|
|
String token = resp.getString("accessToken");
|
|
String token = resp.getString("accessToken");
|
|
|
int expiresIn = resp.getIntValue("expiresIn"); //失效时间
|
|
int expiresIn = resp.getIntValue("expiresIn"); //失效时间
|
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
|
- map.put(UNION_PAY_ACCESS_TOKEN_KEY, "OPEN-ACCESS-TOKEN AccessToken=" + token + ", AppId=" + appId );
|
|
|
|
|
|
|
+ String tokenValue = "OPEN-ACCESS-TOKEN AccessToken=" + token + ", AppId=" + appId;
|
|
|
|
|
+ map.put(UNION_PAY_ACCESS_TOKEN_KEY, tokenValue );
|
|
|
redisTemplate.opsForHash().putAll(UNION_PAY_MAP, map);
|
|
redisTemplate.opsForHash().putAll(UNION_PAY_MAP, map);
|
|
|
- redisTemplate.expire(UNION_PAY_ACCESS_TOKEN_KEY, expiresIn - 30, TimeUnit.SECONDS);
|
|
|
|
|
- return token;
|
|
|
|
|
|
|
+ redisTemplate.expire(UNION_PAY_MAP, expiresIn - 30, TimeUnit.SECONDS);
|
|
|
|
|
+ return tokenValue;
|
|
|
} else {
|
|
} else {
|
|
|
throw new SystemException("获取银联Token异常[" + resp.getString("errCode") + ":" +
|
|
throw new SystemException("获取银联Token异常[" + resp.getString("errCode") + ":" +
|
|
|
resp.getString("errInfo") + "]");
|
|
resp.getString("errInfo") + "]");
|