创建充值单后立即调用 /api/v1/order/create-transaction。

成功后自动跳转 public/usdtCheckout?tradeId=...。
收银台按交易号展示网络、金额、二维码、地址及支付状态。
失败时显示处理阶段,支持使用原单重试,避免重复创建。
This commit is contained in:
lu7213 committed 2026-10-29 03:46:59 -04:00
1 parent 76f9e62253
commit b6b9120b85
8 files changed
+203 -6

No files matched your search

@@ -56,7 +56,7 @@ public class PaymentOrderOpenApiService {
@Value("${payment.usdt-exchange-rate:1}")
private BigDecimal usdtExchangeRate;
/** 对外创建订单成功后返回的公共收银台入口。 */
@Value("${payment.checkout-url:http://192.168.3.103/public/usdtCheckout}")
@Value("${payment.checkout-url:http://192.168.3.103/public/usdtPay}")
private String checkoutUrl;
@Autowired private TronServiceProvider tronServiceProvider;
@@ -235,9 +235,16 @@ public class PaymentOrderOpenApiService {
}
private PaymentOrderCreateResult result(UsdtOrdersPlus order) {
// 兼容已配置的旧收银台路径;支付订单应直接进入付款页,保留域名及代理前缀。
org.springframework.web.util.UriComponentsBuilder paymentPage =
org.springframework.web.util.UriComponentsBuilder.fromUriString(checkoutUrl);
String path = URI.create(checkoutUrl).getPath();
if (path != null && path.endsWith("/public/usdtCheckout")) {
paymentPage.replacePath(path.substring(0, path.length() - "usdtCheckout".length()) + "usdtPay");
}
return new PaymentOrderCreateResult(order.getOrderId(), order.getTradeId(), order.getToken(),
order.getActualAmount(), new Date(order.getCreatedAt().getTime() + ORDER_TTL_MILLIS),
checkoutUrl+"?tradeId="+order.getTradeId());
paymentPage.replaceQueryParam("tradeId", order.getTradeId()).build().toUriString());
}
private Map<String, String> parseParameters(String plainData) {