|
|
@@ -73,6 +73,7 @@ import java.lang.reflect.Method;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
@@ -651,9 +652,10 @@ public class CommonTest {
|
|
|
public void alih5() throws IOException, AlipayApiException {
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
String mer_no = "664403000025502";
|
|
|
+ String mer_order_no = new SnowflakeIdWorker(1, 1).nextId() + "";
|
|
|
String create_time = DateTimeUtils.format(LocalDateTime.now(), "yyyyMMddHHmmss");
|
|
|
String expire_time = DateTimeUtils.format(LocalDateTime.now().plusMinutes(3), "yyyyMMddHHmmss");
|
|
|
- String create_ip = "172_12_12_2";
|
|
|
+ String create_ip = "58_213_205_43";
|
|
|
String goods_name = "话费充值";
|
|
|
String store_id = "100001";
|
|
|
String product_code = "01020002";
|
|
|
@@ -666,37 +668,36 @@ public class CommonTest {
|
|
|
String return_url = "https://test.raex.vip/9th/home";
|
|
|
|
|
|
params.put("mer_no", mer_no);
|
|
|
+ params.put("mer_order_no", mer_order_no);
|
|
|
params.put("create_time", create_time);
|
|
|
- params.put("expire_time", expire_time);
|
|
|
params.put("create_ip", create_ip);
|
|
|
- params.put("goods_name", goods_name);
|
|
|
params.put("store_id", store_id);
|
|
|
- params.put("product_code", product_code);
|
|
|
- params.put("jump_scheme", jump_scheme);
|
|
|
params.put("sign_type", sign_type);
|
|
|
params.put("order_amt", order_amt);
|
|
|
params.put("notify_url", notify_url);
|
|
|
params.put("return_url", return_url);
|
|
|
|
|
|
- AlipaySignature.rsaSign(params, Files.readString(Path.of("/Users/drew/Downloads/应用公钥1024.txt")), "UTF-8");
|
|
|
-
|
|
|
- String url = "https://cash.sandgate.cn/h5/?version=10&mer_no=664403000025502" +
|
|
|
- "&mer_order_no=" + new SnowflakeIdWorker(1, 1).nextId() +
|
|
|
- "&create_time=20220431134259" +
|
|
|
- "&expire_time=20200924164259" +
|
|
|
- "&order_amt=0.03" +
|
|
|
- "¬ify_url=http%3A%2F%2Ftest%2Fnotify" +
|
|
|
- "&return_url=http%3A%2F%2F192.168.13.104%3A8081%2Ftest%2Freturn" +
|
|
|
- "&create_ip=172_12_12_2" +
|
|
|
- "&goods_name=alipay" +
|
|
|
- "&store_id=100001" +
|
|
|
- "&product_code=01020002" +
|
|
|
- "&clear_cycle=0" +
|
|
|
+ String sign = AlipaySignature.rsaSign(params, Files.readString(Path.of("/Users/drew/Downloads/应用私钥1024.txt")), "UTF-8");
|
|
|
+ System.out.println(sign);
|
|
|
+
|
|
|
+ String url = "https://cash.sandgate.cn/h5/?version=10&mer_no=" + mer_no +
|
|
|
+ "&mer_order_no=" + mer_order_no +
|
|
|
+ "&create_time=" + create_time +
|
|
|
+ "&expire_time=" + expire_time +
|
|
|
+ "&order_amt=" + order_amt +
|
|
|
+ "¬ify_url=" + URLEncoder.encode(notify_url, StandardCharsets.UTF_8) +
|
|
|
+ "&return_url=" + URLEncoder.encode(return_url, StandardCharsets.UTF_8) +
|
|
|
+ "&create_ip=" + create_ip +
|
|
|
+ "&goods_name=" + URLEncoder.encode(goods_name, StandardCharsets.UTF_8) +
|
|
|
+ "&store_id=" + store_id +
|
|
|
+ "&product_code=" + product_code +
|
|
|
+ "&clear_cycle=" + clear_cycle +
|
|
|
"&pay_extra=" +
|
|
|
- "&meta_option=%5B%7B%22s%22%3A%22Android%22%2C%22n%22%3A%22wxDemo%22%2C%22id%22%3A%22com.pay.paytypetest%22%2C%22sc%22%3A%22com.pay.paytypetest%22%7D%5D" +
|
|
|
- "&accsplit_info=N" +
|
|
|
- "&jump_scheme=sandcash://scpay" +
|
|
|
- "&sign_type=RSA&sign=DD9F3FF71AC20647C9A1F50EDA24AC94#/hippoh5";
|
|
|
+ "&meta_option=" + URLEncoder.encode(meta_option, StandardCharsets.UTF_8) +
|
|
|
+ "&jump_scheme=" + jump_scheme +
|
|
|
+ "&sign_type=RSA&sign=" + URLEncoder.encode(sign, StandardCharsets.UTF_8) +
|
|
|
+ "#/hippoh5";
|
|
|
+ System.out.println(url);
|
|
|
|
|
|
}
|
|
|
}
|