mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-20 07:56:38 +08:00
整理并声明有关的代码。
This commit is contained in:
@@ -2,6 +2,7 @@ package in.egan.pay.ali.api;
|
||||
|
||||
import in.egan.pay.ali.bean.AliTransactionType;
|
||||
import in.egan.pay.ali.util.SimpleGetRequestExecutor;
|
||||
import in.egan.pay.common.api.BasePayService;
|
||||
import in.egan.pay.common.api.PayConfigStorage;
|
||||
import in.egan.pay.common.api.PayService;
|
||||
import in.egan.pay.common.api.RequestExecutor;
|
||||
@@ -39,18 +40,9 @@ import java.util.TreeMap;
|
||||
* @email egzosn@gmail.com
|
||||
* @date 2016-5-18 14:09:01
|
||||
*/
|
||||
public class AliPayService implements PayService {
|
||||
public class AliPayService extends BasePayService {
|
||||
protected final Log log = LogFactory.getLog(AliPayService.class);
|
||||
|
||||
protected PayConfigStorage payConfigStorage;
|
||||
|
||||
protected CloseableHttpClient httpClient;
|
||||
|
||||
protected HttpHost httpProxy;
|
||||
|
||||
private int retrySleepMillis = 1000;
|
||||
|
||||
private int maxRetryTimes = 5;
|
||||
|
||||
private String httpsReqUrl = "https://mapi.alipay.com/gateway.do";
|
||||
|
||||
@@ -104,6 +96,7 @@ public class AliPayService implements PayService {
|
||||
* @param data
|
||||
* @return
|
||||
* @throws PayErrorException
|
||||
* @source chanjarster/weixin-java-tools
|
||||
*/
|
||||
@Override
|
||||
public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws PayErrorException {
|
||||
@@ -365,7 +358,16 @@ public class AliPayService implements PayService {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param executor
|
||||
* @param uri
|
||||
* @param data
|
||||
* @param <T>
|
||||
* @param <E>
|
||||
* @return
|
||||
* @throws PayErrorException
|
||||
*/
|
||||
protected <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws PayErrorException {
|
||||
|
||||
try {
|
||||
@@ -375,43 +377,7 @@ public class AliPayService implements PayService {
|
||||
}
|
||||
}
|
||||
|
||||
public HttpHost getHttpProxy() {
|
||||
return httpProxy;
|
||||
}
|
||||
|
||||
public CloseableHttpClient getHttpClient() {
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
public void setPayConfigStorage(PayConfigStorage payConfigStorage) {
|
||||
this.payConfigStorage = payConfigStorage;
|
||||
|
||||
String http_proxy_host = payConfigStorage.getHttpProxyHost();
|
||||
int http_proxy_port = payConfigStorage.getHttpProxyPort();
|
||||
String http_proxy_username = payConfigStorage.getHttpProxyUsername();
|
||||
String http_proxy_password = payConfigStorage.getHttpProxyPassword();
|
||||
|
||||
if (StringUtils.isNotBlank(http_proxy_host)) {
|
||||
// 使用代理服务器
|
||||
if (StringUtils.isNotBlank(http_proxy_username)) {
|
||||
// 需要用户认证的代理服务器
|
||||
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
||||
credsProvider.setCredentials(
|
||||
new AuthScope(http_proxy_host, http_proxy_port),
|
||||
new UsernamePasswordCredentials(http_proxy_username, http_proxy_password));
|
||||
httpClient = HttpClients
|
||||
.custom()
|
||||
.setDefaultCredentialsProvider(credsProvider)
|
||||
.build();
|
||||
} else {
|
||||
// 无需用户认证的代理服务器
|
||||
httpClient = HttpClients.createDefault();
|
||||
}
|
||||
httpProxy = new HttpHost(http_proxy_host, http_proxy_port);
|
||||
} else {
|
||||
httpClient = HttpClients.createDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayConfigStorage getPayConfigStorage() {
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
package in.egan.pay.ali.bean;
|
||||
|
||||
import in.egan.pay.common.bean.PayCallMessage;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 阿里支付回调消息
|
||||
* @author egan
|
||||
* @email egzosn@gmail.com
|
||||
* @date 2016-5-18 14:09:01
|
||||
*/
|
||||
public class AliPayCallMessage extends PayCallMessage {
|
||||
|
||||
private Date notify_time;
|
||||
private String notify_type;
|
||||
private String notify_id ;
|
||||
private String subject;
|
||||
private String payment_type;
|
||||
private String trade_no;
|
||||
private String trade_status;
|
||||
private String seller_id;
|
||||
private String seller_email;
|
||||
private String buyer_id;
|
||||
private String buyer_email;
|
||||
private Integer quantity;
|
||||
private BigDecimal price;
|
||||
private String body;
|
||||
private Date gmt_create;
|
||||
private Date gmt_payment;
|
||||
private String is_total_fee_adjust;
|
||||
private String use_coupon;
|
||||
private String discount;
|
||||
private String refund_status;
|
||||
private String gmt_refund;
|
||||
|
||||
public Date getNotify_time() {
|
||||
return notify_time;
|
||||
}
|
||||
|
||||
public void setNotify_time(Date notify_time) {
|
||||
this.notify_time = notify_time;
|
||||
}
|
||||
|
||||
public String getNotify_type() {
|
||||
return notify_type;
|
||||
}
|
||||
|
||||
public void setNotify_type(String notify_type) {
|
||||
this.notify_type = notify_type;
|
||||
}
|
||||
|
||||
public String getNotify_id() {
|
||||
return notify_id;
|
||||
}
|
||||
|
||||
public void setNotify_id(String notify_id) {
|
||||
this.notify_id = notify_id;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getPayment_type() {
|
||||
return payment_type;
|
||||
}
|
||||
|
||||
public void setPayment_type(String payment_type) {
|
||||
this.payment_type = payment_type;
|
||||
}
|
||||
|
||||
public String getTrade_no() {
|
||||
return trade_no;
|
||||
}
|
||||
|
||||
public void setTrade_no(String trade_no) {
|
||||
this.trade_no = trade_no;
|
||||
}
|
||||
|
||||
public String getTrade_status() {
|
||||
return trade_status;
|
||||
}
|
||||
|
||||
public void setTrade_status(String trade_status) {
|
||||
this.trade_status = trade_status;
|
||||
}
|
||||
|
||||
public String getSeller_id() {
|
||||
return seller_id;
|
||||
}
|
||||
|
||||
public void setSeller_id(String seller_id) {
|
||||
this.seller_id = seller_id;
|
||||
}
|
||||
|
||||
public String getSeller_email() {
|
||||
return seller_email;
|
||||
}
|
||||
|
||||
public void setSeller_email(String seller_email) {
|
||||
this.seller_email = seller_email;
|
||||
}
|
||||
|
||||
public String getBuyer_id() {
|
||||
return buyer_id;
|
||||
}
|
||||
|
||||
public void setBuyer_id(String buyer_id) {
|
||||
this.buyer_id = buyer_id;
|
||||
}
|
||||
|
||||
public String getBuyer_email() {
|
||||
return buyer_email;
|
||||
}
|
||||
|
||||
public void setBuyer_email(String buyer_email) {
|
||||
this.buyer_email = buyer_email;
|
||||
}
|
||||
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public Date getGmt_create() {
|
||||
return gmt_create;
|
||||
}
|
||||
|
||||
public void setGmt_create(Date gmt_create) {
|
||||
this.gmt_create = gmt_create;
|
||||
}
|
||||
|
||||
public Date getGmt_payment() {
|
||||
return gmt_payment;
|
||||
}
|
||||
|
||||
public void setGmt_payment(Date gmt_payment) {
|
||||
this.gmt_payment = gmt_payment;
|
||||
}
|
||||
|
||||
public String getIs_total_fee_adjust() {
|
||||
return is_total_fee_adjust;
|
||||
}
|
||||
|
||||
public void setIs_total_fee_adjust(String is_total_fee_adjust) {
|
||||
this.is_total_fee_adjust = is_total_fee_adjust;
|
||||
}
|
||||
|
||||
public String getUse_coupon() {
|
||||
return use_coupon;
|
||||
}
|
||||
|
||||
public void setUse_coupon(String use_coupon) {
|
||||
this.use_coupon = use_coupon;
|
||||
}
|
||||
|
||||
public String getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(String discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public String getRefund_status() {
|
||||
return refund_status;
|
||||
}
|
||||
|
||||
public void setRefund_status(String refund_status) {
|
||||
this.refund_status = refund_status;
|
||||
}
|
||||
|
||||
public String getGmt_refund() {
|
||||
return gmt_refund;
|
||||
}
|
||||
|
||||
public void setGmt_refund(String gmt_refund) {
|
||||
this.gmt_refund = gmt_refund;
|
||||
}
|
||||
|
||||
|
||||
public AliPayCallMessage() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import java.io.IOException;
|
||||
/**
|
||||
* 简单的GET请求执行器,请求的参数是String, 返回的结果也是String
|
||||
* @author Daniel Qian
|
||||
* @source chanjarster/weixin-java-tools
|
||||
*
|
||||
*/
|
||||
public class SimpleGetRequestExecutor implements RequestExecutor<String, String> {
|
||||
|
||||
Reference in New Issue
Block a user