mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-10 23:47:44 +08:00
支付宝2016版APP支付修复签名问题
This commit is contained in:
@@ -133,6 +133,7 @@ public class AliPayService extends BasePayService {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 返回创建的订单信息
|
||||
*
|
||||
@@ -145,7 +146,12 @@ public class AliPayService extends BasePayService {
|
||||
|
||||
Map<String, Object> orderInfo = getOrder(order);
|
||||
|
||||
String sign = createSign(orderInfo, "UTF-8");
|
||||
String sign = null;
|
||||
if (AliTransactionType.APP == order.getTransactionType() ){
|
||||
sign = createSign(getOrderInfo(order), payConfigStorage.getInputCharset());
|
||||
}else {
|
||||
sign = createSign(orderInfo, payConfigStorage.getInputCharset());
|
||||
}
|
||||
|
||||
try {
|
||||
sign = URLEncoder.encode(sign, "UTF-8");
|
||||
@@ -157,6 +163,22 @@ public class AliPayService extends BasePayService {
|
||||
return orderInfo;
|
||||
}
|
||||
|
||||
private String getOrderInfo(PayOrder order) {
|
||||
String orderInfo = "partner=\"" + this.payConfigStorage.getPartner() + "\"";
|
||||
orderInfo = orderInfo + "&seller_id=\"" + this.payConfigStorage.getSeller() + "\"";
|
||||
orderInfo = orderInfo + "&out_trade_no=\"" + order.getOutTradeNo() + "\"";
|
||||
orderInfo = orderInfo + "&subject=\"" + order.getSubject() + "\"";
|
||||
orderInfo = orderInfo + "&body=\"" + order.getBody() + "\"";
|
||||
orderInfo = orderInfo + "&total_fee=\"" + order.getPrice().setScale(2, BigDecimal.ROUND_HALF_UP).toString() + "\"";
|
||||
orderInfo = orderInfo + "¬ify_url=\"" + this.payConfigStorage.getNotifyUrl() + "\"";
|
||||
orderInfo = orderInfo + "&service=\"mobile.securitypay.pay\"";
|
||||
orderInfo = orderInfo + "&payment_type=\"1\"";
|
||||
orderInfo = orderInfo + "&_input_charset=\""+ payConfigStorage.getInputCharset()+"\"";
|
||||
orderInfo = orderInfo + "&it_b_pay=\"30m\"";
|
||||
orderInfo = orderInfo + "&return_url=\""+payConfigStorage.getReturnUrl()+"\"";
|
||||
return orderInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝创建订单信息
|
||||
* create the order info
|
||||
|
||||
Reference in New Issue
Block a user