mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-06-01 05:19:47 +08:00
退款附加参数
This commit is contained in:
@@ -34,7 +34,7 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Actinia
|
||||
* <pre>
|
||||
* <pre>
|
||||
* email hayesfu@qq.com
|
||||
* create 2017 2017/11/5
|
||||
* </pre>
|
||||
@@ -62,6 +62,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
* 证书解释器
|
||||
*/
|
||||
private CertDescriptor certDescriptor;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
@@ -100,6 +101,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付请求地址
|
||||
*
|
||||
@@ -110,6 +112,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
public String getReqUrl(TransactionType transactionType) {
|
||||
return (payConfigStorage.isTest() ? TEST_BASE_DOMAIN : RELEASE_BASE_DOMAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否为沙箱环境进行获取请求地址
|
||||
*
|
||||
@@ -227,6 +230,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
* 超过此时间后,除网银交易外,其他交易银联系统会拒绝受理,提示超时。 跳转银行网银交易如果超时后交易成功,会自动退款,大约5个工作日金额返还到持卡人账户。
|
||||
* 此时间建议取支付时的北京时间加15分钟。
|
||||
* 超过超时时间调查询接口应答origRespCode不是A6或者00的就可以判断为失败。
|
||||
*
|
||||
* @param expirationTime 超时时间
|
||||
* @return 具体的时间字符串
|
||||
*/
|
||||
@@ -237,6 +241,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
}
|
||||
return DateUtils.formatDate(new Timestamp(System.currentTimeMillis() + 30 * 60 * 1000), DateUtils.YYYYMMDDHHMMSS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回创建的订单信息
|
||||
*
|
||||
@@ -256,7 +261,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
|
||||
params.put(SDKConstants.param_orderId, order.getOutTradeNo());
|
||||
|
||||
if (StringUtils.isNotEmpty(order.getAddition())){
|
||||
if (StringUtils.isNotEmpty(order.getAddition())) {
|
||||
params.put(SDKConstants.param_reqReserved, order.getAddition());
|
||||
}
|
||||
switch (type) {
|
||||
@@ -286,7 +291,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
params.put("orderDesc", order.getSubject());
|
||||
}
|
||||
params.putAll(order.getAttrs());
|
||||
params = preOrderHandler(params, order);
|
||||
params = preOrderHandler(params, order);
|
||||
return setSign(params);
|
||||
}
|
||||
|
||||
@@ -362,7 +367,8 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
|
||||
CertPathBuilder builder = CertPathBuilder.getInstance("PKIX");
|
||||
|
||||
/*PKIXCertPathBuilderResult result = (PKIXCertPathBuilderResult)*/ builder.build(pkixParams);
|
||||
/*PKIXCertPathBuilderResult result = (PKIXCertPathBuilderResult)*/
|
||||
builder.build(pkixParams);
|
||||
return cert;
|
||||
} catch (java.security.cert.CertPathBuilderException e) {
|
||||
LOG.error("verify certificate chain fail.", e);
|
||||
@@ -384,7 +390,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
public JSONObject postOrder(PayOrder order) {
|
||||
Map<String, Object> params = orderInfo(order);
|
||||
String responseStr = getHttpRequestTemplate().postForObject(this.getBackTransUrl(), params, String.class);
|
||||
JSONObject response = UriVariables.getParametersToMap(responseStr);
|
||||
JSONObject response = UriVariables.getParametersToMap(responseStr);
|
||||
if (response.isEmpty()) {
|
||||
throw new PayErrorException(new PayException("failure", "响应内容有误!", responseStr));
|
||||
}
|
||||
@@ -394,9 +400,9 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
@Override
|
||||
public String toPay(PayOrder order) {
|
||||
|
||||
if (null == order.getTransactionType()){
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(UnionTransactionType.WEB);
|
||||
}else if (UnionTransactionType.WEB != order.getTransactionType() && UnionTransactionType.WAP != order.getTransactionType() && UnionTransactionType.B2B != order.getTransactionType()){
|
||||
} else if (UnionTransactionType.WEB != order.getTransactionType() && UnionTransactionType.WAP != order.getTransactionType() && UnionTransactionType.B2B != order.getTransactionType()) {
|
||||
throw new PayErrorException(new PayException("-1", "错误的交易类型:" + order.getTransactionType()));
|
||||
}
|
||||
|
||||
@@ -511,12 +517,13 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
/**
|
||||
* 功能:将订单信息进行签名并提交请求
|
||||
* 业务范围:手机支付控件(含安卓Pay)
|
||||
* @param order 订单信息
|
||||
* @return 成功:返回支付结果 失败:返回
|
||||
*
|
||||
* @param order 订单信息
|
||||
* @return 成功:返回支付结果 失败:返回
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> app(PayOrder order){
|
||||
if (null == order.getTransactionType()){
|
||||
public Map<String, Object> app(PayOrder order) {
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(UnionTransactionType.APP);
|
||||
}
|
||||
JSONObject response = postOrder(order);
|
||||
@@ -590,6 +597,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
params.put(SDKConstants.param_orderId, refundOrder.getRefundNo());
|
||||
params.put(SDKConstants.param_txnAmt, Util.conversionCentAmount(refundOrder.getRefundAmount()));
|
||||
params.put(SDKConstants.param_origQryId, refundOrder.getTradeNo());
|
||||
params.putAll(refundOrder.getAttrs());
|
||||
this.setSign(params);
|
||||
String responseStr = getHttpRequestTemplate().postForObject(this.getBackTransUrl(), params, String.class);
|
||||
JSONObject response = UriVariables.getParametersToMap(responseStr);
|
||||
|
||||
Reference in New Issue
Block a user