mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-13 09:18:37 +08:00
增加注释。
This commit is contained in:
@@ -16,22 +16,35 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
public abstract class BasePayConfigStorage implements PayConfigStorage{
|
||||
|
||||
|
||||
// ali rsa_private 商户私钥,pkcs8格式
|
||||
//wx api_key 应用私钥(生成签名时使用)
|
||||
private volatile String keyPrivate ;
|
||||
// 支付平台公钥(签名校验使用)
|
||||
/**
|
||||
* 应用私钥,rsa_private pkcs8格式 生成签名时使用
|
||||
*/
|
||||
private volatile String keyPrivate;
|
||||
/**
|
||||
* 支付平台公钥(签名校验使用)
|
||||
*/
|
||||
private volatile String keyPublic;
|
||||
//异步回调地址
|
||||
/**
|
||||
* 异步回调地址
|
||||
*/
|
||||
private volatile String notifyUrl;
|
||||
//同步回调地址
|
||||
/**
|
||||
* 同步回调地址,支付完成后展示的页面
|
||||
*/
|
||||
private volatile String returnUrl;;
|
||||
//签名加密类型
|
||||
/**
|
||||
* 签名加密类型
|
||||
*/
|
||||
private volatile String signType;
|
||||
//字符类型
|
||||
/**
|
||||
* 字符类型
|
||||
*/
|
||||
private volatile String inputCharset;
|
||||
|
||||
|
||||
//支付类型 aliPay 支付宝, wxPay微信..等等,开发者自定义,唯一
|
||||
/**
|
||||
* 支付类型 aliPay 支付宝, wxPay微信..等等,扩展支付模块定义唯一。
|
||||
*/
|
||||
private volatile String payType;
|
||||
|
||||
/**
|
||||
@@ -40,13 +53,21 @@ public abstract class BasePayConfigStorage implements PayConfigStorage{
|
||||
private volatile MsgType msgType;
|
||||
|
||||
|
||||
// 访问令牌 每次请求其他方法都要传入的值
|
||||
/**
|
||||
* 访问令牌 每次请求其他方法都要传入的值
|
||||
*/
|
||||
private volatile String accessToken;
|
||||
// access token 到期时间时间戳
|
||||
/**
|
||||
* access token 到期时间时间戳
|
||||
*/
|
||||
private volatile long expiresTime;
|
||||
//授权码锁
|
||||
/**
|
||||
* 授权码锁
|
||||
*/
|
||||
private Lock accessTokenLock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* 是否为沙箱环境,默认为正式环境
|
||||
*/
|
||||
private boolean isTest = false;
|
||||
|
||||
|
||||
@@ -77,6 +98,7 @@ public abstract class BasePayConfigStorage implements PayConfigStorage{
|
||||
this.notifyUrl = notifyUrl;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getReturnUrl() {
|
||||
return returnUrl;
|
||||
|
||||
@@ -14,21 +14,14 @@ import java.util.concurrent.locks.Lock;
|
||||
*/
|
||||
public interface PayConfigStorage {
|
||||
|
||||
/*
|
||||
/**
|
||||
* 应用id
|
||||
* @return 应用id
|
||||
*/
|
||||
String getAppid();
|
||||
|
||||
/**
|
||||
* 合作商唯一标识
|
||||
* @see #getPid() 代替者
|
||||
* @return 合作商唯一标识
|
||||
*/
|
||||
@Deprecated
|
||||
String getPartner();
|
||||
/**
|
||||
* 合作商唯一标识
|
||||
* @see #getPartner() 代替者
|
||||
* @return 合作商唯一标识
|
||||
*/
|
||||
String getPid();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.egzosn.pay.common.api;
|
||||
|
||||
import com.egzosn.pay.common.bean.PayMessage;
|
||||
import com.egzosn.pay.common.bean.PayOutMessage;
|
||||
|
||||
import com.egzosn.pay.common.util.LogExceptionHandler;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -144,6 +145,7 @@ public class PayMessageRouter {
|
||||
if(rule.isAsync()) {
|
||||
futures.add(
|
||||
executorService.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rule.service(payMessage, payService, exceptionHandler);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original huodull or egan.
|
||||
* Copyright 2002-2017 the original egan.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ package com.egzosn.pay.common.bean;
|
||||
* email egzosn@gmail.com
|
||||
* date 2017/2/7 9:52
|
||||
* </pre>
|
||||
* 请求方式
|
||||
*/
|
||||
public enum MethodType {
|
||||
GET, POST
|
||||
|
||||
@@ -32,9 +32,13 @@ import static com.egzosn.pay.common.http.UriVariables.getMapToParameters;
|
||||
* </pre>
|
||||
*/
|
||||
public class ClientHttpRequest<T> extends HttpEntityEnclosingRequestBase implements org.apache.http.client.ResponseHandler<T>{
|
||||
//http请求
|
||||
/**
|
||||
* http请求方式 get pos
|
||||
*/
|
||||
private MethodType method;
|
||||
//响应类型
|
||||
/**
|
||||
* 响应类型
|
||||
*/
|
||||
private Class<T> responseType;
|
||||
|
||||
|
||||
@@ -43,40 +47,80 @@ public class ClientHttpRequest<T> extends HttpEntityEnclosingRequestBase impleme
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 空构造
|
||||
*/
|
||||
public ClientHttpRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据请求地址 请求方法,请求内容对象
|
||||
* @param uri 请求地址
|
||||
* @param method 请求方法
|
||||
* @param request 请求内容
|
||||
*/
|
||||
public ClientHttpRequest(URI uri, MethodType method, Object request) {
|
||||
this.setURI(uri);
|
||||
this.method = method;
|
||||
this(uri, method);
|
||||
setParameters(request);
|
||||
}
|
||||
/**
|
||||
* 根据请求地址 请求方法
|
||||
* @param uri 请求地址
|
||||
* @param method 请求方法
|
||||
*/
|
||||
public ClientHttpRequest(URI uri, MethodType method) {
|
||||
this.setURI(uri);
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据请求地址
|
||||
* @param uri 请求地址
|
||||
*/
|
||||
public ClientHttpRequest(URI uri) {
|
||||
this.setURI(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据请求地址
|
||||
* @param uri 请求地址
|
||||
*/
|
||||
public ClientHttpRequest(String uri) {
|
||||
this.setURI(URI.create(uri));
|
||||
}
|
||||
/**
|
||||
* 根据请求地址 请求方法
|
||||
* @param uri 请求地址
|
||||
* @param method 请求方法
|
||||
*/
|
||||
public ClientHttpRequest(String uri, MethodType method) {
|
||||
this.setURI(URI.create(uri));
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据请求地址 请求方法,请求内容对象
|
||||
* @param uri 请求地址
|
||||
* @param method 请求方法
|
||||
* @param request 请求内容
|
||||
*/
|
||||
public ClientHttpRequest(String uri, MethodType method, Object request) {
|
||||
this.setURI(URI.create(uri));
|
||||
this.method = method;
|
||||
this(uri, method);
|
||||
setParameters(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求方式
|
||||
*
|
||||
* @param method 请求方式
|
||||
* {@link com.egzosn.pay.common.bean.MethodType} 请求方式
|
||||
*/
|
||||
public void setMethod(MethodType method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求方式
|
||||
* @return 请求方式
|
||||
*/
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return method.name();
|
||||
|
||||
@@ -39,6 +39,7 @@ public enum SignUtils {
|
||||
* @param characterEncoding 编码格式
|
||||
* @return 签名结果
|
||||
*/
|
||||
@Override
|
||||
public boolean verify(String text, String sign, String key, String characterEncoding) {
|
||||
return com.egzosn.pay.common.util.sign.encrypt.MD5.verify(text, sign, key, characterEncoding);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user