mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-21 00:16:13 +08:00
发起支付简化交易类型,方法能够确定交易类型的全部以方法为基准,如果自行设置了但发现不一样就报错提示
This commit is contained in:
@@ -200,7 +200,6 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> {
|
||||
bizContent.put("total_amount", Util.conversionAmount(order.getPrice()).toString());
|
||||
switch ((AliTransactionType) order.getTransactionType()) {
|
||||
case PAGE:
|
||||
case DIRECT:
|
||||
bizContent.put(PASSBACK_PARAMS, order.getAddition());
|
||||
bizContent.put(PRODUCT_CODE, "FAST_INSTANT_TRADE_PAY");
|
||||
orderInfo.put(RETURN_URL, payConfigStorage.getReturnUrl());
|
||||
@@ -272,6 +271,16 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> {
|
||||
return PayOutMessage.TEXT().content("success").build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toPay(PayOrder order) {
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(AliTransactionType.PAGE);
|
||||
} else if (order.getTransactionType() != AliTransactionType.PAGE && order.getTransactionType() != AliTransactionType.WAP) {
|
||||
throw new PayErrorException(new PayException("-1", "错误的交易类型:" + order.getTransactionType()));
|
||||
}
|
||||
return super.toPay(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param orderInfo 发起支付的订单信息
|
||||
* @param method 请求方式 "post" "get",
|
||||
@@ -301,6 +310,7 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> {
|
||||
*/
|
||||
@Override
|
||||
public String getQrPay(PayOrder order){
|
||||
order.setTransactionType(AliTransactionType.SWEEPPAY);
|
||||
Map<String, Object> orderInfo = orderInfo(order);
|
||||
//预订单
|
||||
JSONObject result = getHttpRequestTemplate().postForObject(getReqUrl() + "?" + UriVariables.getMapToParameters(orderInfo), null, JSONObject.class);
|
||||
@@ -320,6 +330,12 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> microPay(PayOrder order) {
|
||||
if (null == order.getTransactionType()){
|
||||
order.setTransactionType(AliTransactionType.BAR_CODE);
|
||||
}else if (order.getTransactionType() != AliTransactionType.BAR_CODE && order.getTransactionType() != AliTransactionType.WAVE_CODE && order.getTransactionType() != AliTransactionType.SECURITY_CODE){
|
||||
throw new PayErrorException(new PayException("-1", "错误的交易类型:" + order.getTransactionType()));
|
||||
}
|
||||
|
||||
Map<String, Object> orderInfo = orderInfo(order);
|
||||
//预订单
|
||||
JSONObject result = getHttpRequestTemplate().postForObject(getReqUrl() + "?" + UriVariables.getMapToParameters(orderInfo), null, JSONObject.class);
|
||||
|
||||
@@ -18,12 +18,7 @@ import com.egzosn.pay.common.bean.TransactionType;
|
||||
* date 2016/10/19 22:58
|
||||
*/
|
||||
public enum AliTransactionType implements TransactionType {
|
||||
/**
|
||||
* 即时到帐
|
||||
* 过时的名称,请换至 {@link #PAGE}
|
||||
*/
|
||||
@Deprecated
|
||||
DIRECT("alipay.trade.page.pay"),
|
||||
|
||||
/**
|
||||
* 网页支付
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user