新增订单有效时间

This commit is contained in:
egan
2018-08-04 22:51:46 +08:00
parent 81b44146ff
commit cb792db07e
4 changed files with 18 additions and 9 deletions

View File

@@ -200,8 +200,9 @@ public class AliPayService extends BasePayService {
bizContent.put("product_code", "QUICK_MSECURITY_PAY");
}
}
//TODO 过期时间
// bizContent.put("timeout_express", )
if (null != order.getExpirationTime()){
bizContent.put("timeout_express", ((order.getExpirationTime().getTime() - System.currentTimeMillis())/1000/60 + "m"));
}
orderInfo.put("biz_content", JSON.toJSONString(bizContent));
return orderInfo;
}

View File

@@ -38,7 +38,10 @@ public class AliPayService extends BasePayService {
private static final String HTTPS_REQ_URL = "https://mapi.alipay.com/gateway.do";
private static final String QUERY_REQ_URL = "https://openapi.alipay.com/gateway.do";
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
{
df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
}
public AliPayService(PayConfigStorage payConfigStorage) {
super(payConfigStorage);
}
@@ -428,8 +431,7 @@ public class AliPayService extends BasePayService {
Map<String, Object> bizContent = new TreeMap<>();
bizContent.put("bill_type", billType);
//目前只支持日账单
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
bizContent.put("bill_date", df.format(billDate));
//设置请求参数的集合
parameters.put("biz_content", JSON.toJSONString(bizContent));

View File

@@ -55,7 +55,10 @@ public class UnionPayService extends BasePayService {
private static final String FILE_TRANS_URL= "https://filedownload.%s/";
private static final String APP_TRANS_URL= "https://gateway.%s/gateway/api/appTransReq.do";
private static final String CARD_TRANS_URL= "https://gateway.%s/gateway/api/cardTransReq.do";
public final static DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
{
df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
}
/**
* 构造函数
@@ -207,12 +210,15 @@ public class UnionPayService extends BasePayService {
case B2B:
params.put(SDKConstants.param_txnAmt, order.getPrice().multiply(new BigDecimal(100)));
params.put("orderDesc", order.getSubject());
DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
// 订单超时时间。
// 超过此时间后,除网银交易外,其他交易银联系统会拒绝受理,提示超时。 跳转银行网银交易如果超时后交易成功会自动退款大约5个工作日金额返还到持卡人账户。
// 此时间建议取支付时的北京时间加15分钟。
// 超过超时时间调查询接口应答origRespCode不是A6或者00的就可以判断为失败。
params.put(SDKConstants.param_payTimeout, df.format(System.currentTimeMillis() + 30 * 60 * 1000));
if (null != order.getExpirationTime()){
params.put(SDKConstants.param_payTimeout, order.getExpirationTime());
}else {
params.put(SDKConstants.param_payTimeout, df.format(System.currentTimeMillis() + 30 * 60 * 1000));
}
params.put(SDKConstants.param_frontUrl, payConfigStorage.getReturnUrl());
break;
case CONSUME:

View File

@@ -56,7 +56,7 @@ public class WxPayService extends BasePayService {
public final static String FAILURE = "failure";
public final static String APPID = "appid";
private final static DateFormat downloadbillDf = new SimpleDateFormat("yyyyMMdd");
public final static DateFormat df = new SimpleDateFormat("yyyyMMddHHmms");
private final static DateFormat df = new SimpleDateFormat("yyyyMMddHHmms");
{
TimeZone timeZone = TimeZone.getTimeZone("GMT+8");