根据交易类型进行调整

This commit is contained in:
zzs
2017-03-08 20:37:29 +08:00
parent e171f33ebd
commit a0d161b08b
6 changed files with 66 additions and 17 deletions

View File

@@ -165,7 +165,7 @@ public class AliPayService extends BasePayService {
orderInfo.put("notify_url", payConfigStorage.getNotifyUrl());
Map<String, Object> bizContent = new TreeMap<>();
if ("alipay.trade.pay".equals(order.getTransactionType().getType())){
if ("alipay.trade.pay".equals(order.getTransactionType().getMethod())){
bizContent.put("scene", order.getTransactionType().toString().toLowerCase());
bizContent.put("product_code", "FACE_TO_FACE_PAYMENT");
bizContent.put("auth_code", order.getAuthCode());
@@ -189,7 +189,7 @@ public class AliPayService extends BasePayService {
private Map<String, Object> getPublicParameters(TransactionType transactionType ){
Map<String, Object> orderInfo = new TreeMap<>();
orderInfo.put("app_id", payConfigStorage.getAppid());
orderInfo.put("method", transactionType.getType());
orderInfo.put("method", transactionType.getMethod());
orderInfo.put("charset", payConfigStorage.getInputCharset());
DateFormat formatter = DateFormat.getDateTimeInstance();
orderInfo.put("timestamp", formatter.format( new Date()));

View File

@@ -32,14 +32,24 @@ public enum AliTransactionType implements TransactionType {
private String type;
private String method;
private AliTransactionType(String type) {
this.type = type;
private AliTransactionType(String method) {
this.method = method;
}
@Override
public String getType() {
return type;
return this.name();
}
/**
* 获取接口名称
* @return
*/
@Override
public String getMethod() {
return this.method;
}
}

View File

@@ -114,7 +114,7 @@ public class AliPayService extends BasePayService {
private Map<String, Object> getPublicParameters(TransactionType transactionType ){
Map<String, Object> orderInfo = new TreeMap<>();
orderInfo.put("app_id", payConfigStorage.getAppid());
orderInfo.put("method", transactionType.getType());
orderInfo.put("method", transactionType.getMethod());
orderInfo.put("format", "json");
orderInfo.put("charset", payConfigStorage.getInputCharset());
@@ -166,7 +166,7 @@ public class AliPayService extends BasePayService {
// 签约卖家支付宝账号
orderInfo.put("seller_id", payConfigStorage.getSeller());
// 商户网站唯一订单号
orderInfo.put("out_trade_no", order.getTradeNo());
orderInfo.put("out_trade_no", order.getOutTradeNo());
// 商品名称
orderInfo.put("subject", order.getSubject());
// 商品详情
@@ -176,7 +176,7 @@ public class AliPayService extends BasePayService {
// 服务器异步通知页面路径
orderInfo.put("notify_url", payConfigStorage.getNotifyUrl() );
// 服务接口名称, 固定值
orderInfo.put("service", order.getTransactionType().getType() );
orderInfo.put("service", order.getTransactionType().getMethod() );
// 支付类型, 固定值
orderInfo.put("payment_type", "1" );
// 参数编码, 固定值

View File

@@ -29,14 +29,23 @@ public enum AliTransactionType implements TransactionType {
,UNAWARE("UNAWARE")
;
private String type;
private String method;
private AliTransactionType(String type) {
this.type = type;
private AliTransactionType(String method) {
this.method = method;
}
@Override
public String getType() {
return type;
return this.name();
}
/**
* 获取接口名称
* @return
*/
@Override
public String getMethod() {
return this.method;
}
}