d
This commit is contained in:
@@ -23,21 +23,31 @@ public class OrderInfoUtil2_0 {
|
||||
Map<String, String> keyValues = new HashMap<String, String>();
|
||||
|
||||
keyValues.put("app_id", app_id);
|
||||
|
||||
keyValues.put("biz_content", "{\"timeout_express\":\"30m\",\"product_code\":\"QUICK_MSECURITY_PAY\",\"total_amount\":\"" + totalAmount + "\",\"subject\":\"" + subject + "\",\"body\":\"" + body + "\",\"out_trade_no\":\"" + tradeNo + "\"}");
|
||||
|
||||
keyValues.put("biz_content", "{\"timeout_express\":\"30m\",\"product_code\":\"QUICK_MSECURITY_PAY\",\"total_amount\":\"" + totalAmount + "\",\"subject\":\"1\",\"body\":\"我是测试数据\",\"out_trade_no\":\"" + tradeNo + "\"}");
|
||||
// keyValues.put("biz_content", "{\"timeout_express\":\"30m\",\"product_code\":\"QUICK_MSECURITY_PAY\",\"total_amount\":\"0.01\",\"subject\":\"1\",\"body\":\"我是测试数据\",\"out_trade_no\":\"" + getOutTradeNo() + "\"}");
|
||||
keyValues.put("charset", "utf-8");
|
||||
|
||||
keyValues.put("method", "alipay.trade.app.pay");
|
||||
|
||||
keyValues.put("sign_type", rsa2 ? "RSA2" : "RSA");
|
||||
|
||||
keyValues.put("timestamp", getCurFormatTime());
|
||||
|
||||
keyValues.put("notify_url", notifyurl);
|
||||
|
||||
keyValues.put("version", "1.0");
|
||||
|
||||
//+++++++++++++++++++++
|
||||
|
||||
// keyValues.put("app_id", app_id);
|
||||
//
|
||||
// keyValues.put("biz_content", "{\"timeout_express\":\"30m\",\"product_code\":\"QUICK_MSECURITY_PAY\",\"total_amount\":\"0.01\",\"subject\":\"1\",\"body\":\"我是测试数据\",\"out_trade_no\":\"" + getOutTradeNo() + "\"}");
|
||||
//
|
||||
// keyValues.put("charset", "utf-8");
|
||||
//
|
||||
// keyValues.put("method", "alipay.trade.app.pay");
|
||||
//
|
||||
// keyValues.put("sign_type", rsa2 ? "RSA2" : "RSA");
|
||||
//
|
||||
// keyValues.put("timestamp", getCurFormatTime());
|
||||
//
|
||||
// keyValues.put("version", "1.0");
|
||||
|
||||
return keyValues;
|
||||
}
|
||||
|
||||
@@ -64,7 +74,20 @@ public class OrderInfoUtil2_0 {
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
/**
|
||||
* 要求外部订单号必须唯一。
|
||||
* @return
|
||||
*/
|
||||
private static String getOutTradeNo() {
|
||||
SimpleDateFormat format = new SimpleDateFormat("MMddHHmmss", Locale.getDefault());
|
||||
Date date = new Date();
|
||||
String key = format.format(date);
|
||||
|
||||
Random r = new Random();
|
||||
key = key + r.nextInt();
|
||||
key = key.substring(0, 15);
|
||||
return key;
|
||||
}
|
||||
/**
|
||||
* 拼接键值对
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user