Search in sources :

Example 1 with AlipayUserInfoShareResponse

use of com.alipay.api.response.AlipayUserInfoShareResponse in project dq-easy-cloud by dq-open-cloud.

the class EcZfbOauthToken method doGetOauthResource.

@Override
public EcBaseOauthResourceDTO doGetOauthResource(Map<String, Object> oAuthResponseParam) throws Exception {
    AlipayUserInfoShareRequest userInfoShareRequest = new AlipayUserInfoShareRequest();
    String accessToken = EcMapUtils.getString(oAuthResponseParam, EcOauthAccessToken.ACCESS_TOKEN);
    AlipayUserInfoShareResponse shareResponse = alipayClient.execute(userInfoShareRequest, accessToken);
    EcAssert.verifyObjNull(shareResponse, "shareResponse");
    if (shareResponse != null && shareResponse.isSuccess()) {
        EcBaseOauthResourceResponse resourceResponse = EcBeanFactory.newInstance(getResourceRequestBuilder().getResourceResponseClass());
        EcBaseOauthResourceDTO resourceDTO = EcJSONUtils.parseObject(shareResponse, resourceResponse.getResourceDTOClass());
        EcLogUtils.info("授权获取到的用户信息", resourceDTO, logger);
        return resourceDTO;
    } else {
        throw new EcBaseBusinessException(shareResponse.getCode(), shareResponse.getMsg()).buildExceptionDetail(shareResponse);
    }
}
Also used : EcBaseOauthResourceResponse(com.easy.cloud.core.oauth.client.base.response.token.EcBaseOauthResourceResponse) AlipayUserInfoShareRequest(com.alipay.api.request.AlipayUserInfoShareRequest) AlipayUserInfoShareResponse(com.alipay.api.response.AlipayUserInfoShareResponse) EcBaseBusinessException(com.easy.cloud.core.exception.bo.EcBaseBusinessException) EcBaseOauthResourceDTO(com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthResourceDTO)

Aggregations

AlipayUserInfoShareRequest (com.alipay.api.request.AlipayUserInfoShareRequest)1 AlipayUserInfoShareResponse (com.alipay.api.response.AlipayUserInfoShareResponse)1 EcBaseBusinessException (com.easy.cloud.core.exception.bo.EcBaseBusinessException)1 EcBaseOauthResourceDTO (com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthResourceDTO)1 EcBaseOauthResourceResponse (com.easy.cloud.core.oauth.client.base.response.token.EcBaseOauthResourceResponse)1