callback);
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/BasePayType.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/BasePayType.java
index 88f4b6b8..fcfe7e7c 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/BasePayType.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/BasePayType.java
@@ -3,8 +3,10 @@
/**
* 基础的支付类型
* @author egan
- * @email egzosn@gmail.com
- * @date 2016/11/20 0:47
+ *
+ * email egzosn@gmail.com
+ * date 2016/11/20 0:47
+ *
*/
public interface BasePayType {
@@ -12,7 +14,7 @@ public interface BasePayType {
/**
* 根据支付类型获取交易类型
* @param transactionType 类型值
- * @return
+ * @return 交易类型
*/
TransactionType getTransactionType(String transactionType);
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/CurType.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/CurType.java
index 0d91cea3..e58f8cf4 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/CurType.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/CurType.java
@@ -4,9 +4,13 @@
/**
* @author Fuzx 货币类型
- * @create 2017 2017/1/24 0024
+ * create 2017 2017/1/24 0024
*/
public interface CurType {
+ /**
+ * 货币类型
+ * @return 货币类型
+ */
String getCurType();
}
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MethodType.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MethodType.java
index 02149103..387bd635 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MethodType.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MethodType.java
@@ -19,8 +19,10 @@
/**
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/2/7 9:52
+ *
+ * email egzosn@gmail.com
+ * date 2017/2/7 9:52
+ *
*/
public enum MethodType {
GET, POST
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MsgType.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MsgType.java
index f79aa3a5..c0030409 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MsgType.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/MsgType.java
@@ -20,8 +20,10 @@
/**
* 消息类型
* @author: egan
- * @email egzosn@gmail.com
- * @date 2016/11/18 0:59
+ *
+ * email egzosn@gmail.com
+ * date 2016/11/18 0:59
+ *
*/
public enum MsgType {
text, xml,json
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayMessage.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayMessage.java
index 3cf6e160..c6eceb18 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayMessage.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayMessage.java
@@ -12,8 +12,10 @@
* 支付回调消息
* 基础实现,具体可根据具体支付回调的消息去实现
* @author egan
- * @email egzosn@gmail.com
- * @date 2017/3/7 16:37
+ *
+ * email egzosn@gmail.com
+ * date 2017/3/7 16:37
+ *
*/
public class PayMessage implements Serializable {
private Map payMessage = null;
@@ -87,161 +89,6 @@ public String getDiscount(){
public String getSubject(){
return payMessage.get("subject");
}
- //////////////////支付宝
-/* public Date getNotifyTime(){
- return parseDate(payMessage.get("notify_time"));
- }
-
- public String getNotifyType(){
- return payMessage.get("notify_type");
- }
- public String getNotifyId(){
- return payMessage.get("notify_id");
- }
-
- public String getSignType(){
- return payMessage.get("sign_type");
- }
-
-
-
-
-
- public String getPaymentType(){
- return payMessage.get("payment_type");
- }
-
- public String getTradeNo(){
- return payMessage.get("trade_no");
- }
-
- public String getTradeStatus(){
- return payMessage.get("trade_status");
- }
- public String getSellerId(){
- return payMessage.get("seller_id");
- }
- public String getSellerEmail(){
- return payMessage.get("seller_email");
- }
- public String getBuyerId(){
- return payMessage.get("buyer_id");
- }
-
- public String getBuyerEmail(){
- return payMessage.get("buyer_email");
- }
-
-
- public Number getQuantity(){
- String quantity = payMessage.get("quantity");
- if (null == quantity || "".equals(quantity)){ return 1; }
- if (isNumber(quantity)){
- return Integer.parseInt(quantity);
- }
- return 1;
- }
-
- public Number getPrice(){
- String price = payMessage.get("price");
- if (null == price || "".equals(price)){ return 1; }
- if (isNumber(price)){
- return new BigDecimal(price);
- }
- return 1;
- }
-
- public String getBody(){
- return payMessage.get("body");
- }
-
- public Date getGmtCreate(){
-
- return parseDate(payMessage.get("gmt_create"));
- }
-
- public Date getGmtPayment(){
-
- return parseDate(payMessage.get("gmt_payment"));
- }
- public String getIsTotalFeeAdjust (){
- return payMessage.get("is_total_fee_adjust");
-
- }
-
-
- public String getUseCoupon(){
- return payMessage.get("use_coupon");
-
- }
-
- public String getRefundStatus(){
- return payMessage.get("refund_status");
-
- }
- public Date getGmtRefund(){
- return parseDate(payMessage.get("gmt_refund"));
-
- }*/
- /////////////////支付宝
-
-
-
- //////////////////微信
- /* public String getIsSubscribe(){
- return payMessage.get("is_subscribe");
- }
- public String getAppid(){
- return payMessage.get("appid");
- }
-
- public String getFeeType(){
- return payMessage.get("fee_type");
- }
- public String getNonceStr(){
- return payMessage.get("nonce_str");
- }
- public String getTransactionId(){
- return payMessage.get("transaction_id");
- }
-
- public String getTradeType(){
- return payMessage.get("trade_type");
- }
-
- public String getResultCode(){
- return payMessage.get("result_code");
- }
-
- public String getMchId(){
- return payMessage.get("mch_id");
- }
-
- public String getAttach(){
- return payMessage.get("attach");
- }
-
- public String getTimeEnd(){
- return payMessage.get("time_end");
- }
- public String getBankType(){
- return payMessage.get("bank_type");
- }
- public String getOpenid(){
- return payMessage.get("openid");
- }
- public String getReturnCode(){
- return payMessage.get("return_code");
- }
- public Number getCashFee(){
- String cashFee = payMessage.get("cash_fee");
- if (null == cashFee || "".equals(cashFee)){ return 0; }
- if (isNumber(cashFee)){
- return new BigDecimal(cashFee).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
- }
- return 0;
- }*/
- //////////////////微信
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOrder.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOrder.java
index 0ee1b60d..6e1cb0a7 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOrder.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOrder.java
@@ -6,8 +6,10 @@
* 支付订单信息
*
* @author egan
- * @email egzosn@gmail.com
- * @date 2016/10/19 22:34
+ *
+ * email egzosn@gmail.com
+ * date 2016/10/19 22:34
+ *
*/
public class PayOrder {
//商品名称
@@ -64,7 +66,7 @@ public void setPrice(BigDecimal price) {
/**
* 获取商户订单号
- * @return
+ * @return 商户订单号
* @see #getOutTradeNo()
*/
@Deprecated
@@ -72,8 +74,10 @@ public String getTradeNo() {
return outTradeNo;
}
+
/**
- * 设置商户订单号
+ *
+ * @param tradeNo 商户订单号
* @see #setOutTradeNo(String)
*/
@Deprecated
@@ -83,14 +87,15 @@ public void setTradeNo(String tradeNo) {
/**
* 获取商户订单号
- * @return
+ * @return 商户订单号
*/
public String getOutTradeNo() {
return outTradeNo;
}
+
/**
- * 设置商户订单号
- * @return
+ * 设置商户订单号
+ * @param outTradeNo 商户订单号
*/
public void setOutTradeNo(String outTradeNo) {
this.outTradeNo = outTradeNo;
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOutMessage.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOutMessage.java
index f4e52ae0..97f686fe 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOutMessage.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/PayOutMessage.java
@@ -10,9 +10,10 @@
/**
* 支付回调通知返回消息
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 11:40:30
- * @source chanjarster/weixin-java-tools
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 11:40:30
+ *
*/
public abstract class PayOutMessage implements Serializable {
protected String content;
@@ -37,21 +38,21 @@ public void setMsgType(String msgType) {
/**
* 获得文本消息builder
- * @return
+ * @return 文本消息builder
*/
public static TextBuilder TEXT() {
return new TextBuilder();
}
/**
* 获得XML消息builder
- * @return
+ * @return XML消息builder
*/
public static XmlBuilder XML() {
return new XmlBuilder();
}
/**
* 获得Json消息builder
- * @return
+ * @return Json消息builder
*/
public static JsonBuilder JSON() {
return new JsonBuilder(new JSONObject());
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/TransactionType.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/TransactionType.java
index 49df677d..a17258a5 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/TransactionType.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/TransactionType.java
@@ -3,19 +3,21 @@
/**
* 交易类型
* @author egan
- * @email egzosn@gmail.com
- * @date 2016/10/19 22:30
+ *
+ * email egzosn@gmail.com
+ * date 2016/10/19 22:30
+ *
*/
public interface TransactionType {
/**
* 获取交易类型
- * @return
+ * @return 交易类型
*/
String getType();
/**
* 获取接口
- * @return
+ * @return 接口
*/
String getMethod();
}
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/BaseBuilder.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/BaseBuilder.java
index 274886e6..5206146e 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/BaseBuilder.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/BaseBuilder.java
@@ -3,10 +3,13 @@
import com.egzosn.pay.common.bean.PayOutMessage;
/**
- * @source chanjarster/weixin-java-tools
+ * source chanjarster/weixin-java-tools
+ *
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 11:40:30
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 11:40:30
+ *
*/
public abstract class BaseBuilder {
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/JsonBuilder.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/JsonBuilder.java
index 9deca90c..726a2ed3 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/JsonBuilder.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/JsonBuilder.java
@@ -6,8 +6,10 @@
/**
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/1/13 14:30
+ *
+ * email egzosn@gmail.com
+ * date 2017/1/13 14:30
+ *
*/
public class JsonBuilder extends BaseBuilder{
JSONObject json = null;
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayJsonOutMessage.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayJsonOutMessage.java
index ff554c0b..576134b2 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayJsonOutMessage.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayJsonOutMessage.java
@@ -5,8 +5,10 @@
/**
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 11:40:30
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 11:40:30
+ *
*/
public class PayJsonOutMessage extends PayOutMessage{
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayTextOutMessage.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayTextOutMessage.java
index 20af4602..7d311962 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayTextOutMessage.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayTextOutMessage.java
@@ -5,8 +5,10 @@
/**
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 11:40:30
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 11:40:30
+ *
*/
public class PayTextOutMessage extends PayOutMessage{
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayXmlOutMessage.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayXmlOutMessage.java
index 5f196f8a..c4b96bda 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayXmlOutMessage.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/PayXmlOutMessage.java
@@ -5,8 +5,10 @@
/**
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 13:53:3
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 13:53:3
+ *
*/
public class PayXmlOutMessage extends PayOutMessage{
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/TextBuilder.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/TextBuilder.java
index 59b5ef51..16895baf 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/TextBuilder.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/TextBuilder.java
@@ -3,10 +3,12 @@
import com.egzosn.pay.common.bean.PayOutMessage;
/**
- * @source chanjarster/weixin-java-tools
+ * source chanjarster/weixin-java-tools
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 11:40:30
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 11:40:30
+ *
*/
public class TextBuilder extends BaseBuilder {
private String content;
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/XmlBuilder.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/XmlBuilder.java
index c0f67b62..3314b756 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/XmlBuilder.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/outbuilder/XmlBuilder.java
@@ -2,10 +2,12 @@
import com.egzosn.pay.common.bean.PayOutMessage;
/**
- * @source chanjarster/weixin-java-tools
+ * source chanjarster/weixin-java-tools
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 11:40:30
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 11:40:30
+ *
*/
public class XmlBuilder extends BaseBuilder {
private String content;
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayError.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayError.java
index 5166e34e..d392d587 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayError.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayError.java
@@ -4,28 +4,30 @@
* 支付错误码说明
*
* @author egan
- * @email egzosn@gmail.com
- * @date 2017-03-02 22:28:01
+ *
+ * email egzosn@gmail.com
+ * date 2017-03-02 22:28:01
+ *
*/
public interface PayError {
/**
* 获取错误码
*
- * @return
+ * @return 错误码
*/
String getErrorCode();
/**
* 获取错误消息
*
- * @return
+ * @return 错误消息
*/
String getErrorMsg();
/**
* 获取异常信息
- * @return
+ * @return 异常信息
*/
String getString();
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayException.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayException.java
index 887bada0..db26fba2 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayException.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/result/PayException.java
@@ -18,9 +18,12 @@
package com.egzosn.pay.common.bean.result;
/**
+ * 支付异常
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/3/7 12:32
+ *
+ * email egzosn@gmail.com
+ * date 2017/3/7 12:32
+ *
*/
public class PayException implements PayError {
private String errorCode;
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/exception/PayErrorException.java b/pay-java-common/src/main/java/com/egzosn/pay/common/exception/PayErrorException.java
index 0eac659b..3b077b4b 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/exception/PayErrorException.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/exception/PayErrorException.java
@@ -4,8 +4,10 @@
/**
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-5-18 14:09:01
+ *
+ * email egzosn@gmail.com
+ * date 2016-5-18 14:09:01
+ *
*/
public class PayErrorException extends RuntimeException {
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java b/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java
index 30a5b88a..29b7eae7 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java
@@ -26,8 +26,10 @@
/**
* 一个HTTP请求的客户端
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/3/4 17:56
+ *
+ * email egzosn@gmail.com
+ * date 2017/3/4 17:56
+ *
*/
public class ClientHttpRequest extends HttpEntityEnclosingRequestBase implements org.apache.http.client.ResponseHandler{
//http请求
@@ -83,7 +85,7 @@ public String getMethod() {
/**
* 设置代理
* @param httpProxy http代理配置信息
- * @return
+ * @return 当前HTTP请求的客户端
*/
public ClientHttpRequest setProxy(HttpHost httpProxy){
if (httpProxy != null) {
@@ -98,7 +100,7 @@ public ClientHttpRequest setProxy(HttpHost httpProxy){
* 设置请求参数
*
* @param request 请求参数
- * @return
+ * @return 当前HTTP请求的客户端
*/
public ClientHttpRequest setParameters(Object request) {
if (null == request){
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpConfigStorage.java b/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpConfigStorage.java
index 1e8f9161..8bc93f00 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpConfigStorage.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpConfigStorage.java
@@ -4,8 +4,10 @@
/**
* HTTP 配置
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/3/3 20:48
+ *
+ * email egzosn@gmail.com
+ * date 2017/3/3 20:48
+ *
*/
public class HttpConfigStorage {
//http代理地址
@@ -20,7 +22,7 @@ public class HttpConfigStorage {
/**
* http代理地址
- * @return
+ * @return http代理地址
*/
public String getHttpProxyHost() {
return httpProxyHost;
@@ -33,7 +35,7 @@ public void setHttpProxyHost(String httpProxyHost) {
/**
* 代理端口
- * @return
+ * @return 代理端口
*/
public int getHttpProxyPort() {
return httpProxyPort;
@@ -44,7 +46,7 @@ public void setHttpProxyPort(int httpProxyPort) {
}
/**
* 代理用户名
- * @return
+ * @return 代理用户名
*/
public String getHttpProxyUsername() {
return httpProxyUsername;
@@ -56,7 +58,7 @@ public void setHttpProxyUsername(String httpProxyUsername) {
/**
* 代理密码
- * @return
+ * @return 代理密码
*/
public String getHttpProxyPassword() {
return httpProxyPassword;
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpRequestTemplate.java b/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpRequestTemplate.java
index ff3831c4..1043fb1c 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpRequestTemplate.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/http/HttpRequestTemplate.java
@@ -18,8 +18,10 @@
/**
* http请求工具
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/3/3 21:33
+ *
+ * email egzosn@gmail.com
+ * date 2017/3/3 21:33
+ *
*/
public class HttpRequestTemplate {
@@ -43,6 +45,11 @@ public HttpRequestTemplate() {
setHttpConfigStorage(null);
}
+ /**
+ * 设置HTTP请求的配置
+ * @param configStorage 请求配置
+ * @return 当前HTTP请求的客户端模板
+ */
public HttpRequestTemplate setHttpConfigStorage(HttpConfigStorage configStorage){
if (null == configStorage){
@@ -79,11 +86,11 @@ public HttpRequestTemplate setHttpConfigStorage(HttpConfigStorage configStorage)
*
* post
* @param uri 请求地址
- * @param request
+ * @param request 请求参数
* @param responseType 为响应类(需要自己依据响应格式来确定)
- * @param
- * @return
- * @throws IOException
+ * @param uriVariables 地址通配符对应的值
+ * @param 响应类型
+ * @return 类型对象
*/
public T postForObject(String uri, Object request, Class responseType, Object... uriVariables){
return doExecute(URI.create(UriVariables.getUri(uri, uriVariables)), request, responseType, MethodType.POST);
@@ -105,10 +112,10 @@ public T postForObject(URI uri, Object request, Class responseType){
* @param responseType 响应类型
* @param uriVariables 用于匹配表达式
* @param 响应类型
- * @return
+ * @return 类型对象
*
*
- * getForObject("http://egan.in/pay/{id}/f/{type}", String.class, "1", "APP")
+ * getForObject("http://egan.in/pay/{id}/f/{type}", String.class, "1", "APP")
*
*/
public T getForObject(String uri, Class responseType, Object... uriVariables){
@@ -123,12 +130,12 @@ public T getForObject(String uri, Class responseType, Object... uriVariab
* @param responseType 响应类型
* @param uriVariables 用于匹配表达式
* @param 响应类型
- * @return
+ * @return 类型对象
*
- * Map uriVariables = new HashMap();
- * uriVariables.put("id", "1");
- * uriVariables.put("type", "APP");
- * getForObject("http://egan.in/pay/{id}/f/{type}", String.class, uriVariables)
+ * Map<String, String> uriVariables = new HashMap<String, String>();
+ * uriVariables.put("id", "1");
+ * uriVariables.put("type", "APP");
+ * getForObject("http://egan.in/pay/{id}/f/{type}", String.class, uriVariables)
*
*/
public T getForObject(String uri, Class responseType, Map uriVariables){
@@ -142,9 +149,8 @@ public T getForObject(String uri, Class responseType, Map uriV
* @param request 请求数据
* @param responseType 响应类型
* @param method 请求方法
- * @param
- * @return
- * @throws IOException
+ * @param 响应类型
+ * @return 类型对象
*/
public T doExecute(URI uri, Object request, Class responseType, MethodType method){
ClientHttpRequest httpRequest = new ClientHttpRequest(uri ,method, request);
@@ -165,9 +171,8 @@ public T doExecute(URI uri, Object request, Class responseType, MethodType
* @param request 请求数据
* @param responseType 响应类型
* @param method 请求方法
- * @param
- * @return
- * @throws IOException
+ * @param 响应类型
+ * @return 类型对象
*/
public T doExecute(String uri, Object request, Class responseType, MethodType method){
return doExecute(URI.create(uri), request, responseType, method);
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/http/UriVariables.java b/pay-java-common/src/main/java/com/egzosn/pay/common/http/UriVariables.java
index e3cd8af9..68aa6535 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/http/UriVariables.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/http/UriVariables.java
@@ -17,18 +17,20 @@
* URL表达式处理器
*
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/3/5 10:07
+ *
+ * email egzosn@gmail.com
+ * date 2017/3/5 10:07
+ *
*/
public class UriVariables {
/**
* 依次匹配
- * @param uri
- * @param uriVariables
- * @return
+ * @param uri 匹配的uri,带代表式
+ * @param uriVariables 匹配表达式的值
+ * @return 匹配完的url
*
- * System.out.println(getUri("http://egan.in/{a}/ba/{a1}?{bb}={a1}", "no1", "no2", "no3", "no4"));
+ * System.out.println(getUri("http://egan.in/{a}/ba/{a1}?{bb}={a1}", "no1", "no2", "no3", "no4"));
* 结果 http://egan.in/no1/ba/no2?no3=no4
*
*
@@ -51,15 +53,15 @@ public static String getUri(String uri, Object... uriVariables) {
/**
* 匹配Map.key
- * @param uri
- * @param uriVariables
- * @return
+ * @param uri 匹配的uri,带代表式
+ * @param uriVariables 匹配表达式的值
+ * @return 匹配完的url
*
- * Map uriVariable = new HashMap<>();
- * uriVariable.put("a", "no1");
- * uriVariable.put("a1", "no2");
- * uriVariable.put("bb", "no3");
- * System.out.println(getUri("http://egan.in/{a}/ba/{a1}?{bb}={a1}", uriVariable));
+ * Map<String, Object> uriVariable = new HashMap<String, Object>();
+ * uriVariable.put("a", "no1");
+ * uriVariable.put("a1", "no2");
+ * uriVariable.put("bb", "no3");
+ * System.out.println(getUri("http://egan.in/{a}/ba/{a1}?{bb}={a1}", uriVariable));
* 结果 http://egan.in/no1/ba/no2?no3=no2
*
*/
@@ -83,8 +85,8 @@ public static String getUri(String uri, Map uriVariables) {
/**
* Map转化为对应得参数字符串
- * @param pe
- * @return
+ * @param pe 参数
+ * @return 参数字符串
*/
public static String getMapToParameters(Map pe){
StringBuilder builder = new StringBuilder();
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/LogExceptionHandler.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/LogExceptionHandler.java
index 297d05b3..35550c5f 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/LogExceptionHandler.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/LogExceptionHandler.java
@@ -10,9 +10,13 @@
/**
* LogExceptionHandler 日志处理器
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-1 11:28:01
- * @source chanjarster/weixin-java-tools
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-1 11:28:01
+ *
+ *
+ * source chanjarster/weixin-java-tools
+ *
*/
public class LogExceptionHandler implements PayErrorExceptionHandler {
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/MatrixToImageWriter.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/MatrixToImageWriter.java
index d72c10d2..fc320497 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/MatrixToImageWriter.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/MatrixToImageWriter.java
@@ -17,8 +17,10 @@
/**
* 二维码生成工具
* @author egan
- * @email egzosn@gmail.com
- * @date 2017/2/7 10:35
+ *
+ * email egzosn@gmail.com
+ * date 2017/2/7 10:35
+ *
*/
public class MatrixToImageWriter {
@@ -32,7 +34,7 @@ private MatrixToImageWriter() {}
* 根据二维矩阵的碎片 生成对应的二维码图像缓冲
* @param matrix 二维矩阵的碎片 包含 宽高 行,字节
* @see com.google.zxing.common.BitMatrix
- * @return
+ * @return 二维码图像缓冲
*/
public static BufferedImage toBufferedImage(BitMatrix matrix) {
int width = matrix.getWidth();
@@ -49,10 +51,10 @@ public static BufferedImage toBufferedImage(BitMatrix matrix) {
/**
* 二维码生成文件
- * @param matrix
- * @param format
- * @param file
- * @throws IOException
+ * @param matrix 二维矩阵的碎片 包含 宽高 行,字节
+ * @param format 格式
+ * @param file 保持的文件地址
+ * @throws IOException 文件保存异常
*/
public static void writeToFile(BitMatrix matrix, String format, File file)
throws IOException {
@@ -65,10 +67,10 @@ public static void writeToFile(BitMatrix matrix, String format, File file)
/**
* 二维码生成流
- * @param matrix
- * @param format
- * @param stream
- * @throws IOException
+ * @param matrix 二维矩阵的碎片 包含 宽高 行,字节
+ * @param format 格式
+ * @param stream 保持的文件输出流
+ * @throws IOException 文件保存异常
*/
public static void writeToStream(BitMatrix matrix, String format, OutputStream stream)
throws IOException {
@@ -81,8 +83,8 @@ public static void writeToStream(BitMatrix matrix, String format, OutputStream s
/**
* 二维码信息写成JPG文件
- * @param content
- * @param fileUrl
+ * @param content 二维码信息
+ * @param fileUrl 文件地址
*/
public static void writeInfoToJpgFile(String content, String fileUrl){
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
@@ -101,8 +103,8 @@ public static void writeInfoToJpgFile(String content, String fileUrl){
/**
* 二维码信息写成JPG BufferedImage
- * @param content
- * @return
+ * @param content 二维码信息
+ * @return JPG BufferedImage
*/
public static BufferedImage writeInfoToJpgBuff(String content){
BufferedImage re=null;
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/XML.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/XML.java
index 1dfa49db..214610bc 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/XML.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/XML.java
@@ -18,14 +18,16 @@
/**
* XML工具
* @author egan
- * @email egzosn@gmail.com
- * @date 2016-6-2 19:45:06
+ *
+ * email egzosn@gmail.com
+ * date 2016-6-2 19:45:06
+ *
*/
public class XML {
/**
* 解析xml并转化为Json值
* @param content json字符串
- * @return
+ * @return Json值
*/
public static JSONObject toJSONObject(String content){
@@ -45,7 +47,7 @@ public static JSONObject toJSONObject(String content){
/**
* 解析xml并转化为json值
* @param in 输入流
- * @return
+ * @return Json值
*/
public static JSONObject toJSONObject(InputStream in) {
@@ -63,7 +65,13 @@ public static JSONObject toJSONObject(InputStream in) {
}
-
+ /**
+ *
+ * @param in xml输入流
+ * @param m 参数集
+ * @return 整理完成的参数集
+ * @throws IOException xml io转化异常
+ */
public static Map inputStream2Map(InputStream in, Map m) throws IOException {
if (null == m){
m = new JSONObject();
@@ -97,8 +105,8 @@ public static Map inputStream2Map(InputStream in, Map m) throws IOException {
/**
* 获取子结点的xml
*
- * @param children
- * @return String
+ * @param children 集合
+ * @return String 子结点的xml
*/
public static String getChildrenText(List children) {
StringBuffer sb = new StringBuffer();
@@ -122,9 +130,9 @@ public static String getChildrenText(List children) {
}
/**
- * @Description:将请求参数转换为xml格式的string
+ * 将请求参数转换为xml格式的string
* @param parameters 请求参数
- * @return
+ * @return xml
*/
public static String getMap2Xml(Map parameters) {
StringBuffer sb = new StringBuffer();
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/SignUtils.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/SignUtils.java
index 2b224b07..ef8ed829 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/SignUtils.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/SignUtils.java
@@ -10,8 +10,10 @@
* 签名 工具
*
* @author: egan
- * @email egzosn@gmail.com
- * @date 2016/11/9 17:45
+ *
+ * email egzosn@gmail.com
+ * date 2016/11/9 17:45
+ *
*/
public enum SignUtils {
@@ -21,7 +23,7 @@ public enum SignUtils {
* @param content 需要签名的内容
* @param key 密钥
* @param characterEncoding 字符编码
- * @return
+ * @return 签名值
*/
@Override
public String createSign(String content, String key, String characterEncoding) {
@@ -76,64 +78,6 @@ public static String parameterText(Map parameters) {
return parameterText(parameters, "&");
}
- /**
- *
- * 把数组所有元素排序,并按照“参数=参数值”的模式用“@param separator”字符拼接成字符串
- * @param parameters 参数
- * @param separator 分隔符
- * @return 去掉空值与签名参数后的新签名,拼接后字符串
- */
- /* public static String parameterText(Map parameters, String separator) {
- if(parameters == null){
- return "";
- }
- StringBuffer sb = new StringBuffer();
-
- // TODO 2016/11/11 10:14 author: egan 已经排序好处理
- if (parameters instanceof SortedMap) {
- for (String k : ((Set) parameters.keySet())) {
- Object v = parameters.get(k);
- if (null == v || "".equals(v.toString().trim()) || "sign".equals(k) || "key".equals(k) || "appId".equals(k) || "sign_type".equalsIgnoreCase(k)) {
- continue;
- }
- sb.append(k ).append("=").append( v.toString().trim()).append(separator);
- }
- if (sb.length() > 0 && !"".equals(separator)) {
- sb.deleteCharAt(sb.length() - 1);
- }
- return sb.toString();
-
- }
-
-
- // TODO 2016/11/11 10:14 author: egan 未排序须处理
- List keys = new ArrayList(parameters.keySet());
- //排序
- Collections.sort(keys);
- for (String k : keys) {
- String valueStr = "";
- Object o = parameters.get(k);
- if (o instanceof String[]) {
- String[] values = (String[]) o;
- if (null == values){continue;}
- for (int i = 0; i < values.length; i++) {
- String value = values[i].trim();
- if ("".equals(value)){ continue;}
- valueStr += (i == values.length - 1) ? value : value + ",";
- }
- } else if (o != null) {
- valueStr = o.toString();
- }
- if (null == valueStr || "".equals(valueStr.toString().trim()) || "sign".equals(k) || "key".equals(k) || "appId".equals(k) || "sign_type".equalsIgnoreCase(k)) {
- continue;
- }
- sb.append(k ).append("=").append( valueStr).append(separator);
- }
- if (sb.length() > 0) {
- sb.deleteCharAt(sb.length() - 1);
- }
- return sb.toString();
- }*/
/**
*
@@ -211,9 +155,9 @@ public static String parameterText(Map parameters, String separator, String... i
/**
* 将参数集合(事前做好排序)按分割符号拼凑字符串并加密为MD5
* example: mchnt_cd+"|" +order_id+"|"+order_amt+"|"+order_pay_type+"|"+page_notify_url+"|"+back_notify_url+"|"+order_valid_time+"|"+iss_ins_cd+"|"+goods_name+"|"+"+goods_display_url+"|"+rem+"|"+ver+"|"+mchnt_key
- * @param parameters
- * @param separator
- * @return
+ * @param parameters 参数集合
+ * @param separator 分隔符
+ * @return 参数排序好的值
*/
public static String parameters2MD5Str(Object parameters, String separator){
StringBuffer sb = new StringBuffer();
@@ -240,7 +184,7 @@ public static String parameters2MD5Str(Object parameters, String separator){
/**
* 获取随机字符串
- * @return
+ * @return 随机字符串
*/
public static String randomStr(){
return UUID.randomUUID().toString().replace("-", "");
@@ -252,7 +196,7 @@ public static String randomStr(){
* @param parameters 需要进行排序签名的参数
* @param key 密钥
* @param characterEncoding 编码格式
- * @return
+ * @return 签名值
*/
public String sign(Map parameters, String key, String characterEncoding) {
@@ -262,9 +206,9 @@ public String sign(Map parameters, String key, String characterEncoding) {
* 签名
* @param parameters 需要进行排序签名的参数
* @param key 密钥
- * @param separator 分隔符 默认 &
+ * @param separator 分隔符 默认 &
* @param characterEncoding 编码格式
- * @return
+ * @return 签名值
*/
public String sign(Map parameters, String key, String separator, String characterEncoding) {
@@ -278,7 +222,7 @@ public String sign(Map parameters, String key, String separator, String charact
* @param content 需要签名的内容
* @param key 密钥
* @param characterEncoding 字符编码
- * @return
+ * @return 签名值
*/
public abstract String createSign(String content, String key, String characterEncoding);
@@ -293,7 +237,6 @@ public String sign(Map parameters, String key, String separator, String charact
*/
public boolean verify(Map params, String sign, String key, String characterEncoding){
//判断是否一样
-// return StringUtils.equals(sign(params, key, characterEncoding), sign);
return this.verify(parameterText(params), sign, key, characterEncoding);
}
@@ -309,8 +252,4 @@ public boolean verify(Map params, String sign, String key, String characterEnco
*/
public abstract boolean verify(String text, String sign, String key, String characterEncoding);
-
-
- //签名错误代码
- public static final int SIGN_ERROR = 91;
}
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/MD5.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/MD5.java
index 848b91ff..5db35acc 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/MD5.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/MD5.java
@@ -45,9 +45,7 @@ public static boolean verify(String text, String sign, String key, String input_
/**
* @param content 需要加密串
* @param charset 字符集
- * @return
- * @throws SignatureException
- * @throws UnsupportedEncodingException
+ * @return 加密后的字节数组
*/
public static byte[] getContentBytes(String content, String charset) {
if (StringUtils.isEmpty(charset)) {
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA.java
index 98190a57..32a50c0d 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA.java
@@ -101,6 +101,7 @@ public static boolean verify(String content, String sign, String publicKey, Stri
* @param privateKey 商户私钥
* @param characterEncoding 编码格式
* @return 解密后的字符串
+ * @throws Exception 解密异常
*/
public static String decrypt(String content, String privateKey, String characterEncoding) throws Exception {
PrivateKey prikey = getPrivateKey(privateKey);
@@ -132,7 +133,8 @@ public static String decrypt(String content, String privateKey, String character
/**
* 得到私钥
* @param key 密钥字符串(经过base64编码)
- * @throws Exception
+ * @throws Exception 加密异常
+ * @return 私钥
*/
public static PrivateKey getPrivateKey(String key) throws Exception {
diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA2.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA2.java
index b5b93a89..3caac65c 100644
--- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA2.java
+++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/sign/encrypt/RSA2.java
@@ -36,6 +36,7 @@ public static boolean verify(String content, String sign, String publicKey, Stri
* @param privateKey 商户私钥
* @param characterEncoding 编码格式
* @return 解密后的字符串
+ * @throws Exception 解密异常
*/
public static String decrypt(String content, String privateKey, String characterEncoding) throws Exception {
return RSA.decrypt(content, privateKey, characterEncoding);
@@ -45,7 +46,8 @@ public static String decrypt(String content, String privateKey, String character
/**
* 得到私钥
* @param key 密钥字符串(经过base64编码)
- * @throws Exception
+ * @throws Exception 加密异常
+ * @return 私钥
*/
public static PrivateKey getPrivateKey(String key) throws Exception {
return RSA.getPrivateKey(key);
diff --git a/pay-java-demo/pom.xml b/pay-java-demo/pom.xml
index 299e1235..50342177 100644
--- a/pay-java-demo/pom.xml
+++ b/pay-java-demo/pom.xml
@@ -118,6 +118,15 @@
pay-java-demo
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.7
+ UTF-8
+
+
org.apache.tomcat.maven
tomcat7-maven-plugin
diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java
index 9ec0f6c9..d53562c6 100644
--- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java
+++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java
@@ -46,7 +46,7 @@ public class PayController {
* 这里模拟账户信息增加
*
* @param account
- * @return
+ * @return 支付账户信息
*/
@RequestMapping("add")
public Map add(ApyAccount account) {
@@ -66,7 +66,7 @@ public Map add(ApyAccount account) {
* @param payId 账户id
* @param transactionType 交易类型, 这个针对于每一个 支付类型的对应的几种交易方式
* @param bankType 针对刷卡支付,卡的类型,类型值
- * @return
+ * @return 跳到支付页面
*/
@RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8")
public String toPay(Integer payId, String transactionType, String bankType, BigDecimal price) {
@@ -88,7 +88,7 @@ public String toPay(Integer payId, String transactionType, String bankType, BigD
* 获取二维码图像
* 二维码支付
*
- * @return
+ * @return 二维码图像
*/
@RequestMapping(value = "toQrPay.jpg", produces = "image/jpeg;charset=UTF-8")
public byte[] toWxQrPay(Integer payId, String transactionType, BigDecimal price) throws IOException {
@@ -96,7 +96,7 @@ public byte[] toWxQrPay(Integer payId, String transactionType, BigDecimal price)
PayResponse payResponse = service.getPayResponse(payId);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ImageIO.write(payResponse.getService().genQrPay(new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, "9d1c43152c304ed2b9d2db320ef0a742", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos);
+ ImageIO.write(payResponse.getService().genQrPay(new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos);
return baos.toByteArray();
}
@@ -106,7 +106,7 @@ public byte[] toWxQrPay(Integer payId, String transactionType, BigDecimal price)
*
* @param payId 支付账户id
* @param transactionType 交易类型
- * @return
+ * @return 支付预订单信息
*/
@RequestMapping("getOrderInfo")
public Map getOrderInfo(Integer payId, String transactionType, BigDecimal price) {
@@ -121,10 +121,10 @@ public Map getOrderInfo(Integer payId, String transactionType, B
/**
- * 微信或者支付宝回调地址
+ * 支付回调地址
*
* @param request
- * @return
+ * @return 支付是否成功
*/
@RequestMapping(value = "payBack{payId}.json")
public String payBack(HttpServletRequest request, @PathVariable Integer payId) throws IOException {
@@ -151,7 +151,7 @@ public String payBack(HttpServletRequest request, @PathVariable Integer payId) t
* 查询
*
* @param order 订单的请求体
- * @return
+ * @return 返回查询回来的结果集,支付方原值返回
*/
@RequestMapping("query")
public Map query(QueryOrder order) {
@@ -163,7 +163,7 @@ public Map query(QueryOrder order) {
* 交易关闭接口
*
* @param order 订单的请求体
- * @return
+ * @return 返回支付方交易关闭后的结果
*/
@RequestMapping("close")
public Map close(QueryOrder order) {
@@ -175,7 +175,7 @@ public Map close(QueryOrder order) {
* 申请退款接口
*
* @param order 订单的请求体
- * @return
+ * @return 返回支付方申请退款后的结果
*/
@RequestMapping("refund")
public Map refund(QueryOrder order) {
@@ -189,7 +189,7 @@ public Map refund(QueryOrder order) {
* 查询退款
*
* @param order 订单的请求体
- * @return
+ * @return 返回支付方查询退款后的结果
*/
@RequestMapping("refundquery")
public Map refundquery(QueryOrder order) {
@@ -201,7 +201,7 @@ public Map refundquery(QueryOrder order) {
* 下载对账单
*
* @param order 订单的请求体
- * @return
+ * @return 返回支付方下载对账单的结果
*/
@RequestMapping("downloadbill")
public Object downloadbill(QueryOrder order) {
@@ -215,7 +215,7 @@ public Object downloadbill(QueryOrder order) {
* 通用查询接口,根据 TransactionType 类型进行实现,此接口不包括退款
*
* @param order 订单的请求体
- * @return
+ * @return 返回支付方对应接口的结果
*/
@RequestMapping("secondaryInterface")
public Map secondaryInterface(QueryOrder order) {
diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/dao/ApyAccountRepository.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/dao/ApyAccountRepository.java
index 56b60aea..c470817a 100644
--- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/dao/ApyAccountRepository.java
+++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/dao/ApyAccountRepository.java
@@ -42,6 +42,7 @@ public class ApyAccountRepository {
apyAccount1.setSignType(SignUtils.RSA.name());
apyAccount1.setPayType(PayType.aliPay);
apyAccount1.setMsgType(MsgType.text);
+ //设置测试环境
apyAccount1.setTest(true);
apyAccounts.put(apyAccount1.getPayId(), apyAccount1);
diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java
index 5872929b..23bbd9af 100644
--- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java
+++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java
@@ -1,10 +1,17 @@
package com.egzosn.pay.demo.entity;
import com.egzosn.pay.ali.api.AliPayConfigStorage;
+import com.egzosn.pay.ali.api.AliPayService;
import com.egzosn.pay.ali.bean.AliTransactionType;
import com.egzosn.pay.common.api.PayService;
import com.egzosn.pay.common.bean.BasePayType;
import com.egzosn.pay.common.bean.TransactionType;
+import com.egzosn.pay.demo.service.handler.FuiouPayMessageHandler;
+import com.egzosn.pay.fuiou.api.FuiouPayConfigStorage;
+import com.egzosn.pay.fuiou.api.FuiouPayService;
+import com.egzosn.pay.fuiou.bean.FuiouTransactionType;
+import com.egzosn.pay.fuiou.api.FuiouPayConfigStorage;
+import com.egzosn.pay.fuiou.api.FuiouPayService;
import com.egzosn.pay.wx.api.WxPayConfigStorage;
import com.egzosn.pay.wx.api.WxPayService;
import com.egzosn.pay.wx.bean.WxTransactionType;
@@ -13,18 +20,20 @@
import com.egzosn.pay.wx.youdian.bean.YoudianTransactionType;
+
/**
* 支付类型
+ *
* @author egan
- * @email egzosn@gmail.com
- * @date 2016/11/20 0:30
+ * email egzosn@gmail.com
+ * date 2016/11/20 0:30
*/
public enum PayType implements BasePayType {
aliPay{
/**
- * @see AliPayService 17年更新的版本,旧版本请自行切换
+ * @see com.egzosn.pay.ali.api.AliPayService 17年更新的版本,旧版本请自行切换
* @param apyAccount
* @return
*/
@@ -43,11 +52,13 @@ public PayService getPayService(ApyAccount apyAccount) {
aliPayConfigStorage.setMsgType(apyAccount.getMsgType());
aliPayConfigStorage.setInputCharset(apyAccount.getInputCharset());
aliPayConfigStorage.setTest(apyAccount.isTest());
- return new com.egzosn.pay.ali.api.AliPayService(aliPayConfigStorage);
+ return new AliPayService(aliPayConfigStorage);
}
@Override
public TransactionType getTransactionType(String transactionType) {
+ // com.egzosn.pay.ali.before.bean.AliTransactionType 17年更新的版本,旧版本请自行切换
+
// AliTransactionType 17年更新的版本,旧版本请自行切换
return AliTransactionType.valueOf(transactionType);
}
@@ -111,6 +122,29 @@ public TransactionType getTransactionType(String transactionType) {
return YoudianTransactionType.valueOf(transactionType);
}
+ },fuiou{
+
+ @Override
+ public PayService getPayService(ApyAccount apyAccount) {
+ FuiouPayConfigStorage fuiouPayConfigStorage = new FuiouPayConfigStorage();
+ fuiouPayConfigStorage.setKeyPrivate(apyAccount.getPrivateKey());
+ fuiouPayConfigStorage.setNotifyUrl(apyAccount.getNotifyUrl());
+ fuiouPayConfigStorage.setReturnUrl(apyAccount.getReturnUrl());
+ fuiouPayConfigStorage.setSignType(apyAccount.getSignType());
+ fuiouPayConfigStorage.setPayType(apyAccount.getPayType().toString());
+ fuiouPayConfigStorage.setMsgType(apyAccount.getMsgType());
+ fuiouPayConfigStorage.setInputCharset(apyAccount.getInputCharset());
+ fuiouPayConfigStorage.setTest(apyAccount.isTest());
+ return new FuiouPayService(fuiouPayConfigStorage);
+ }
+
+ @Override
+ public TransactionType getTransactionType(String transactionType) {
+ // in.egan.pay.ali.before.bean.AliTransactionType 17年更新的版本,旧版本请自行切换
+ return FuiouTransactionType.valueOf(transactionType);
+ }
+
+
};
public abstract PayService getPayService(ApyAccount apyAccount);
diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java
index a84c7e18..738e5b9f 100644
--- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java
+++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java
@@ -1,18 +1,19 @@
-
-
package com.egzosn.pay.demo.service;
-import com.egzosn.pay.ali.bean.AliTransactionType;
+import com.egzosn.pay.common.api.PayMessageRouter;
import com.egzosn.pay.common.http.HttpConfigStorage;
+import com.egzosn.pay.demo.service.handler.FuiouPayMessageHandler;
import com.egzosn.pay.demo.service.handler.YouDianPayMessageHandler;
import com.egzosn.pay.demo.service.interceptor.AliPayMessageInterceptor;
import com.egzosn.pay.demo.entity.ApyAccount;
import com.egzosn.pay.demo.entity.PayType;
import com.egzosn.pay.demo.service.handler.AliPayMessageHandler;
+import com.egzosn.pay.demo.service.handler.FuiouPayMessageHandler;
import com.egzosn.pay.demo.service.handler.WxPayMessageHandler;
+import com.egzosn.pay.demo.service.handler.YouDianPayMessageHandler;
+import com.egzosn.pay.demo.service.interceptor.AliPayMessageInterceptor;
import com.egzosn.pay.common.api.PayConfigStorage;
import com.egzosn.pay.common.api.PayMessageHandler;
-import com.egzosn.pay.common.api.PayMessageRouter;
import com.egzosn.pay.common.api.PayService;
import com.egzosn.pay.common.bean.MsgType;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
@@ -84,7 +85,7 @@ private void buildRouter(Integer payId) {
.async(false)
.msgType(MsgType.text.name()) //消息类型
.payType(PayType.aliPay.name()) //支付账户事件类型
- .transactionType(AliTransactionType.UNAWARE.name())//交易类型,有关回调的可在这处理
+// .transactionType(AliTransactionType.UNAWARE.name())//交易类型,有关回调的可在这处理
.interceptor(new AliPayMessageInterceptor(payId)) //拦截器
.handler(autowire(new AliPayMessageHandler(payId))) //处理器
.end()
@@ -100,6 +101,12 @@ private void buildRouter(Integer payId) {
.payType(PayType.youdianPay.name())
.handler(autowire(new YouDianPayMessageHandler(payId)))
.end()
+ .rule()
+ .async(false)
+ .msgType(MsgType.xml.name())
+ .payType(PayType.fuiou.name())
+ .handler(autowire(new FuiouPayMessageHandler(payId)))
+ .end()
;
}
diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/interceptor/AliPayMessageInterceptor.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/interceptor/AliPayMessageInterceptor.java
index b5258d1c..7f27f51b 100644
--- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/interceptor/AliPayMessageInterceptor.java
+++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/interceptor/AliPayMessageInterceptor.java
@@ -12,8 +12,8 @@
/**
* 支付宝回调信息拦截器
* @author: egan
- * @email egzosn@gmail.com
- * @date 2017/1/18 19:28
+ * email egzosn@gmail.com
+ * date 2017/1/18 19:28
*/
public class AliPayMessageInterceptor implements PayMessageInterceptor {
diff --git a/pay-java-fuiou/pom.xml b/pay-java-fuiou/pom.xml
index dad1c72d..ee437eab 100644
--- a/pay-java-fuiou/pom.xml
+++ b/pay-java-fuiou/pom.xml
@@ -5,7 +5,7 @@
pay-java-parent
com.egzosn
- 2.0.SNAPSHOT
+ 2.0.1
4.0.0
pay-java-fuiou
diff --git a/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayConfigStorage.java b/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayConfigStorage.java
index b24d6f36..c09f5602 100644
--- a/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayConfigStorage.java
+++ b/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayConfigStorage.java
@@ -1,31 +1,52 @@
-package com.egzosn.pay.fuiou.api;/**
- * Created by Fuzx on 2017/1/16 0016.
- */
-
-import com.egzosn.pay.common.before.api.BasePayConfigStorage;
+package com.egzosn.pay.fuiou.api;
+import com.egzosn.pay.common.api.BasePayConfigStorage;
/**
* @author Fuzx
- * @create 2017 2017/1/16 0016
+ *
+ * create 2017 2017/1/16 0016
+ *
*/
public class FuiouPayConfigStorage extends BasePayConfigStorage {
public String mchntCd;//商户代码
public String mchntKey;//商户密钥
-
+ /**
+ * 应用id
+ * @return 空
+ */
@Override
public String getAppid() {
return null;
}
+ /**
+ * 合作商唯一标识
+ *
+ * @see #getPid() 代替者
+ */
+ @Override
+ public String getPartner () {
+ return mchntCd;
+ }
+
+ /**
+ * 合作商唯一标识
+ *
+ * @see #getPartner() 代替者
+ */
@Override
- public String getPartner() {
+ public String getPid () {
+ return mchntCd;
+ }
+
+ public String getMchntCd () {
return mchntCd;
}
- public void setPartner(String partner) {
- this.mchntCd = partner;
+ public void setMchntCd (String mchntCd) {
+ this.mchntCd = mchntCd;
}
@Override
@@ -35,7 +56,7 @@ public String getSeller() {
@Override
public String getSecretKey() {
- return mchntKey;
+ return super.getKeyPrivate();
}
public void setSecretKey(String mchntKey){
diff --git a/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java b/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java
index 6538ef2c..6403930a 100644
--- a/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java
+++ b/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java
@@ -1,59 +1,73 @@
-package com.egzosn.pay.fuiou.api;/**
- * Created by Fuzx on 2017/1/16 0016.
- */
-
-import com.egzosn.pay.common.before.api.BasePayService;
-import com.egzosn.pay.common.before.api.PayConfigStorage;
-import com.egzosn.pay.common.before.api.RequestExecutor;
+package com.egzosn.pay.fuiou.api;
+import com.alibaba.fastjson.JSONObject;
+import com.egzosn.pay.common.api.BasePayService;
+import com.egzosn.pay.common.api.Callback;
+import com.egzosn.pay.common.api.PayConfigStorage;
import com.egzosn.pay.common.bean.MethodType;
import com.egzosn.pay.common.bean.PayOrder;
import com.egzosn.pay.common.bean.PayOutMessage;
-import com.egzosn.pay.common.before.bean.result.PayError;
+import com.egzosn.pay.common.bean.TransactionType;
import com.egzosn.pay.common.exception.PayErrorException;
+import com.egzosn.pay.common.http.HttpConfigStorage;
import com.egzosn.pay.common.util.sign.SignUtils;
import com.egzosn.pay.common.util.str.StringUtils;
-import com.egzosn.pay.fuiou.utils.SimplePostRequestExecutor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.message.BasicNameValuePair;
import java.awt.image.BufferedImage;
import java.io.InputStream;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author Fuzx
- * @create 2017 2017/1/16 0016
+ *
+ * create 2017 2017/1/16 0016
+ *
*/
public class FuiouPayService extends BasePayService {
-
+ //日志
protected final Log log = LogFactory.getLog(FuiouPayService.class);
+ //正式域名
+ public final static String URL_FuiouBaseDomain = "https://pay.fuiou.com/";
+ //测试域名
+// public final static String URL_FuiouBaseDomain = "http://www-1.fuiou.com:8888/wg1_run/";
+ //B2C/B2B支付
+ public final static String URL_FuiouSmpGate = URL_FuiouBaseDomain + "smpGate.do";
+ //B2C/B2B支付(跨境支付)
+ public final static String URL_FuiouNewSmpGate = URL_FuiouBaseDomain + "newSmpGate.do";
+ //订单退款
+ public final static String URL_FuiouSmpRefundGate = URL_FuiouBaseDomain + "newSmpRefundGate.do";
+ //3.2 支付结果查询
+ public final static String URL_FuiouSmpQueryGate = URL_FuiouBaseDomain + "smpQueryGate.do";
+ //3.3 支付结果查询(直接返回)
+ public final static String URL_FuiouSmpAQueryGate = URL_FuiouBaseDomain + "smpAQueryGate.do";
+ //3.4订单退款
+ public final static String URL_NewSmpRefundGate = URL_FuiouBaseDomain + "newSmpRefundGate.do";
- public final static String fuiouBaseDomain = "https://pay.fuiou.com/";//正式域名
-// public final static String fuiouBaseDomain = "http://www-1.fuiou.com:8888/wg1_run/";//测试域名
-
- public final static String fuiouSmpGate = fuiouBaseDomain + "smpGate.do";//B2C/B2B支付
-
- public final static String fuiouNewSmpGate = fuiouBaseDomain + "newSmpGate.do";//B2C/B2B支付(跨境支付)
- public final static String fuiouSmpRefundGate = fuiouBaseDomain + "newSmpRefundGate.do";//订单退款
-
- public final static String fuiouSmpQueryGate = fuiouBaseDomain + "smpQueryGate.do";//3.2 支付结果查询
- public final static String fuiouSmpAQueryGate = fuiouBaseDomain + "smpAQueryGate.do";//3.3 支付结果查询(直接返回)
-
- public FuiouPayService(PayConfigStorage payConfigStorage) {
- setPayConfigStorage(payConfigStorage);
+ /**
+ * 构造函数,初始化时候使用
+ * @param payConfigStorage 支付账户配置信息
+ * @param configStorage 网络代理配置
+ */
+ public FuiouPayService (PayConfigStorage payConfigStorage, HttpConfigStorage configStorage) {
+ super(payConfigStorage, configStorage);
}
-
-
- @Override
- public String getHttpsVerifyUrl() {
- return null;
+ /**
+ * 构造函数,初始化时候使用
+ * @param payConfigStorage 支付账户配置信息
+ */
+ public FuiouPayService (PayConfigStorage payConfigStorage) {
+ super(payConfigStorage);
}
+
/**
* 回调校验
* @param params 回调回来的参数集
- * @return
+ * @return 返回检验结果 0000 成功 其他失败
*/
@Override
public boolean verify(Map params) {
@@ -62,7 +76,8 @@ public boolean verify(Map params) {
return false;
}
try {
- return getSignVerify(params, params.get("md5")) && "0000".equals(verifyUrl(params.get("order_id")));//返回参数校验 和 重新请求订单检查数据是否合法
+ //返回参数校验 和 重新请求订单检查数据是否合法
+ return (signVerify(params, params.get("md5")) && verifySource(params.get("order_id")));
} catch (PayErrorException e) {
e.printStackTrace();
}
@@ -70,13 +85,14 @@ public boolean verify(Map params) {
}
/**
- * 校验回调参数是否合法
+ * 回调签名校验
+ *
* @param params 参数集
- * @param returnSign
- * @return
+ * @param responseSign 响应的签名串
+ * @return 校验结果
*/
@Override
- public boolean getSignVerify(Map params, String returnSign) {
+ public boolean signVerify (Map params, String responseSign ) {
LinkedHashSet keySet = new LinkedHashSet<>();
keySet.add("mchnt_cd");//商户代码
keySet.add("order_id");//商户订单号
@@ -97,63 +113,29 @@ public boolean getSignVerify(Map params, String returnSign) {
}
String sign = createSign(verifyMD5Str.deleteCharAt(verifyMD5Str.length() -1).toString(),payConfigStorage.getInputCharset());
// System.out.println("加密串"+verifyMD5Str+",,返回参数生成MD5="+sign+",,返回MD5摘要值"+returnSign);
- if(returnSign.equals(sign)){
- return true;
- }
- return false;
+ return responseSign.equals(sign);
}
/**
- * 发起请求校验订单是否支付成功
- * @param order_id
- * @return
- * @throws PayErrorException
+ * 校验回调数据来源是否合法
+ *
+ * @param order_id 业务id, 数据的真实性.
+ * @return 返回校验结果
*/
@Override
- public String verifyUrl(String order_id) throws PayErrorException {
-// LinkedHashMap param = new LinkedHashMap();
-// param.put("mchnt_cd",payConfigStorage.getPartner());
-// param.put("order_id",order_id);
-// param.put("md5",createSign(SignUtils.parameters2MD5Str(param,"|"),payConfigStorage.getInputCharset()));
- List pairList = new ArrayList();
- pairList.add(new BasicNameValuePair("mchnt_cd",payConfigStorage.getPartner()));
- pairList.add(new BasicNameValuePair("order_id",order_id));
- pairList.add(new BasicNameValuePair("md5",createSign(SignUtils.parameters2MD5Str(pairList,"|"),payConfigStorage.getInputCharset())));
- return execute(new SimplePostRequestExecutor(), fuiouSmpAQueryGate,pairList);
-// JSONObject jsonObject = XML.toJSONObject(responseContent);
-
-// return getFormString(param,MethodType.POST,fuiouSmpAQueryGate);
- }
-
- @Override
- public T execute(RequestExecutor executor, String uri, E data) throws PayErrorException {
- int retryTimes = 0;
- do {
- try {
- return executeInternal(executor, uri, data);
- } catch (PayErrorException e) {
- PayError error = (PayError) e.getPayError();
- if ("404".equals(error.getErrorCode()) ) {
- int sleepMillis = retrySleepMillis * (1 << retryTimes);
- try {
- log.debug(String.format("富友支付系统错误,错误信息:<%s>,(%s)ms 后重试(第%s次)",e.getMessage(),sleepMillis, retryTimes + 1));
- Thread.sleep(sleepMillis);
- } catch (InterruptedException e1) {
- throw new RuntimeException(e1);
- }
- } else {
- throw e;
- }
- }
- } while (++retryTimes < maxRetryTimes);
-
- throw new RuntimeException("富友支付服务端异常,超出重试次数");
+ public boolean verifySource (String order_id) {
+ LinkedHashMap params = new LinkedHashMap<>();
+ params.put("mchnt_cd",payConfigStorage.getPid());
+ params.put("order_id",order_id);
+ params.put("md5",createSign(SignUtils.parameters2MD5Str(params,"|"),payConfigStorage.getInputCharset()));
+ JSONObject resultJson = getHttpRequestTemplate().postForObject(URL_FuiouSmpAQueryGate,params,JSONObject.class);
+ return resultJson.getString("order_pay_code").equals("0000");
}
/**
- * 对支付请求参数进行加密,排序
+ * 将支付请求参数加密成md5
* @param order 支付订单
- * @return
+ * @return 返回支付请求参数集合
*/
@Override
public Map orderInfo(PayOrder order) {
@@ -163,6 +145,11 @@ public Map orderInfo(PayOrder order) {
return parameters;
}
+ /**
+ * 按序添加请求参数
+ * @param order 支付订单
+ * @return 返回支付请求参数集合
+ */
private LinkedHashMap getOrderInfo(PayOrder order) {
LinkedHashMap parameters = new LinkedHashMap();
parameters.put("mchnt_cd", payConfigStorage.getPartner());//商户代码
@@ -183,9 +170,9 @@ private LinkedHashMap getOrderInfo(PayOrder order) {
/**
* 对内容进行加密
- * @param content 需要签名的内容
+ * @param content 需要加密的内容
* @param characterEncoding 字符编码
- * @return
+ * @return 加密后的字符串
*/
@Override
public String createSign(String content, String characterEncoding) {
@@ -193,45 +180,57 @@ public String createSign(String content, String characterEncoding) {
}
/**
- * 将参数拼凑成String
+ * 将请求参数或者请求流转化为 Map
* @param parameterMap 请求参数
* @param is 请求流
- * @return
+ * @return 返回参数集合
*/
@Override
public Map getParameter2Map(Map parameterMap, InputStream is) {
- Map params = new TreeMap();
- for (Iterator iter = parameterMap.keySet().iterator(); iter.hasNext(); ) {
- String name = (String) iter.next();
- String[] values = parameterMap.get(name);
- String valueStr = "";
- for (int i = 0; i < values.length; i++) {
- valueStr = (i == values.length - 1) ? valueStr + values[i]
- : valueStr + values[i] + ",";
- }
- //乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
- //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk");
- params.put(name, valueStr);
- }
- return params;
+ return null;
}
+ /**
+ * 获取输出消息,用户返回给支付端
+ * @param code 返回代码
+ * @param message 返回信息
+ * @return 消息实体
+ */
+
@Override
public PayOutMessage getPayOutMessage(String code, String message) {
return PayOutMessage.TEXT().content(code.toLowerCase()).build();
}
+ /**
+ * 发送支付请求(form表单)
+ * @param orderInfo 发起支付的订单信息
+ * @param method 请求方式 "post" "get",
+ * @return form表单提交的html字符串
+ */
+
@Override
public String buildRequest(Map orderInfo, MethodType method) {
- return getFormString(orderInfo, method,fuiouSmpGate);
+ return getFormString(orderInfo, method,URL_FuiouSmpGate );
}
/**
- * 根据参数行程form表单
+ * 获取输出二维码,用户返回给支付端,
+ *
+ * @param order 发起支付的订单信息
+ * @return 空
+ */
+ @Override
+ public BufferedImage genQrPay (PayOrder order) {
+ return null;
+ }
+
+ /**
+ * 根据参数形成form表单
* @param param 参数
* @param method 请求方式 get_post
- * @param url
- * @return
+ * @param url 支付请求url地址
+ * @return form表单html代码
*/
private String getFormString(Map param, MethodType method,String url) {
StringBuffer formHtml = new StringBuffer();
@@ -261,41 +260,158 @@ private String getFormString(Map param, MethodType method,String
}
/**
- * 生成二维码支付
- * 暂未实现或无此功能
- *
- * @param orderInfo 发起支付的订单信息
- * @return
+ * 交易查询接口
+ * @param tradeNo 支付平台订单号
+ * @param outTradeNo 商户单号
+ * @return 空
*/
@Override
- public BufferedImage genQrPay(Map