资源简介
整合支付宝 登陆、支付、获取用户信息等功能的一个工具类,将参数放在properties配置文件中,所有功能统一调用。货真价实,绝对好用~~
代码片段和文件信息
package com.xhlc.pay.util;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConstants;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayTradeAppPayModel;
import com.alipay.api.request.AlipayOpenAuthTokenAppRequest;
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.request.AlipayTradeAppPayRequest;
import com.alipay.api.request.AlipayTradeQueryRequest;
import com.alipay.api.request.AlipayTradeRefundRequest;
import com.alipay.api.request.AlipayUserInfoShareRequest;
import com.alipay.api.response.AlipayOpenAuthTokenAppResponse;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.alipay.api.response.AlipayTradeAppPayResponse;
import com.alipay.api.response.AlipayTradeQueryResponse;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.alipay.api.response.AlipayUserInfoShareResponse;
import com.smy.framework.core.config.Property;
import com.xhlc.pay.dto.AliRefundRequestDto;
import com.xhlc.pay.dto.AliSignOrderRequestDto;
/**
* https://openauth.alipay.com/oauth2/appToAppAuth.htm?app_id=2017121300692655&
* redirect_uri=http://oliver.vicp.io:12886/alipayTest/return_url.jsp 支付宝 集成工具
*
* @since 2017-12-20
* @author oliver
*
*/
public class AlipayUtils {
private static String appId;
private static String privateKey;
public static String publicKey;
private static String redirectIp;
static {
appId = Property.getProperty(“alipay.appId“ ““);
privateKey = Property.getProperty(“alipay.privateKey“ ““);
publicKey = Property.getProperty(“alipay.publicKey“ ““);
redirectIp = Property.getProperty(“alipay.redirectIp“ ““);
}
private static Logger LOG = LoggerFactory.getLogger(AlipayUtils.class);
// 统一收单交易创建接口
private static AlipayClient alipayClient = null;
public static AlipayClient getAlipayClient() {
if (alipayClient == null) {
synchronized (AlipayUtils.class) {
if (null == alipayClient) {
alipayClient = new DefaultAlipayClient(“https://openapi.alipay.com/gateway.do“ appId privateKey
AlipayConstants.FORMAT_JSON AlipayConstants.CHARSET_UTF8 publicKey “RSA2“);
}
}
}
return alipayClient;
}
/**
* 用户同意授权,获取authCode
*
* @param url
* 回调地址
* @return
*/
public static String visitUrl(String url) {
String encodeUrl = ““;
try {
encodeUrl = URLEncoder.encode(url “UTF-8“);
} catch (UnsupportedEncodingException e) {
return null;
}
String scope = “auth_userauth_base“;
String visitUrl = “https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=“ + appId + “&s
相关资源
- Android实现支付宝支付从底部弹窗效果
- java接入微信APP支付/支付宝APP支付
- Android-个人免签支付微信.支付宝个人
- 监控 Android 支付宝与微信的收款通知
- 2019最新个人免签支付宝、微信、QQ钱
- 支付宝接口开发官方JAVA版
- 支付宝sdk工具jar包
- alipay-sdk-java目前最新的jar和source
- Android 仿「微信」「支付宝」的支付密
- Canvas仿支付宝芝麻信用仪表盘图表和
- 接支付宝支付,详细流程文档.docx
- android 分组 列表源码(仿支付宝交易
- android 支付宝抢红包雨 辅助工具
- Android 支付宝支付(第三方支持-04_0
- 支付宝App支付客户端 DEMOSDK(android+
- 仿支付宝咻一咻功能源码(波纹扩散
- java 支付宝在线支付(即时到帐接口)
- android支付宝源码
- jsp 支付宝移动调用即时到账接口调用
- java支付宝扫码支付代码
- jsp 支付宝pc网页支付
- android 支付宝 快捷支付(含文档)
- 支付宝移动接口(android版)
- 支付宝 移动快捷支付应用集成接入包
- 一行代码调用支付宝移动支付
- 支付宝接口实现快速支付功能
- 支付宝支付
- andorid支付宝支付程序eclipse
评论
共有 条评论