mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.alipay;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConfig;
|
||||
@@ -8,12 +9,16 @@ import com.alipay.api.request.AlipaySystemOauthTokenRequest;
|
||||
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.wxpay.service.WxAppletRemoteService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -25,7 +30,7 @@ public class AliAppletRemoteService {
|
||||
private Logger log = LoggerFactory.getLogger(AliAppletRemoteService.class);
|
||||
|
||||
private static AlipayConfig getAlipayConfig() {
|
||||
String privateKey = "<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->";
|
||||
String privateKey = "<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->";
|
||||
String alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->";
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
|
||||
@@ -38,18 +43,17 @@ public class AliAppletRemoteService {
|
||||
return alipayConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务端获取 access_token、user_id
|
||||
* 服务端调用 alipay.system.oauth.token(换取授权访问令牌接口)换取授权访问令牌,开发者可通过获取到的 auth_code 换取 access_token(授权令牌) 和 user_id (用户支付宝 ID)。
|
||||
* auth_code 作为换取 access_token 的票据,每次用户授权完成,回调地址中的 auth_code 将不一样,auth_code 只能使用一次,一天未被使用自动过期。
|
||||
*/
|
||||
public String getMobileNumberByCode(String code) {
|
||||
if (StringUtils.isBlank(code)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* (支付宝) 换取授权访问令牌
|
||||
* alipay.system.oauth.token(换取授权访问令牌)
|
||||
* @param grantType 必选 授权方式
|
||||
* @param code 可选 授权码
|
||||
* @param refreshToken 可选 刷新令牌
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user