新增toPay方法,以便于简化跳转支付;对支付对接地址抽象出接口方法

This commit is contained in:
egan
2019-04-15 23:52:20 +08:00
parent 0ebb5e48f6
commit c5ce9edf1f
12 changed files with 124 additions and 100 deletions

View File

@@ -122,6 +122,18 @@ public abstract class BasePayService<PC extends PayConfigStorage> implements Pay
return SignUtils.valueOf(payConfigStorage.getSignType()).sign(content, payConfigStorage.getKeyPrivate(),characterEncoding);
}
/**
* 页面转跳支付, 返回对应页面重定向信息
*
* @param order 订单信息
* @return 对应页面重定向信息
*/
@Override
public String toPay(PayOrder order) {
Map orderInfo = orderInfo(order);
return buildRequest(orderInfo, MethodType.POST);
}
/**
* 将请求参数或者请求流转化为 Map
*

View File

@@ -87,6 +87,12 @@ public interface PayService<PC extends PayConfigStorage> {
*/
Map<String, Object> orderInfo(PayOrder order);
/**
* 页面转跳支付, 返回对应页面重定向信息
* @param order 订单信息
* @return 对应页面重定向信息
*/
String toPay(PayOrder order);
/**
* 创建签名
*
@@ -141,6 +147,8 @@ public interface PayService<PC extends PayConfigStorage> {
*/
String buildRequest(Map<String, Object> orderInfo, MethodType method);
/**
* 获取输出二维码,用户返回给支付端,
*
@@ -410,4 +418,11 @@ public interface PayService<PC extends PayConfigStorage> {
*/
void addPayMessageInterceptor(PayMessageInterceptor interceptor);
/**
* 获取支付请求地址
* @param transactionType 交易类型
* @return 请求地址
*/
String getReqUrl(TransactionType transactionType);
}

View File

@@ -29,6 +29,10 @@ public class PayOrder {
* 价格
*/
private BigDecimal price;
/**
* 支付平台订单号,交易号
*/
private String tradeNo;
/**
* 商户订单号
*/
@@ -122,24 +126,18 @@ public class PayOrder {
}
/**
* 获取商户订单
* @return 商户订单
* @see #getOutTradeNo()
* 支付平台订单号,交易
* @return 支付平台订单号,交易
*/
@Deprecated
public String getTradeNo() {
return outTradeNo;
return tradeNo;
}
/**
*
* @param tradeNo 商户订单
* @see #setOutTradeNo(String)
* 支付平台订单号,交易号
* @param tradeNo 支付平台订单号,交易
*/
@Deprecated
public void setTradeNo(String tradeNo) {
this.outTradeNo = tradeNo;
this.tradeNo = tradeNo;
}
/**