mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-09 22:00:49 +08:00
新增toPay方法,以便于简化跳转支付;对支付对接地址抽象出接口方法
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user