|
@@ -208,9 +208,7 @@ public class LsyOrderService {
|
|
|
if (order.getAttach() != null) {
|
|
if (order.getAttach() != null) {
|
|
|
p.put("attach", order.getAttach());
|
|
p.put("attach", order.getAttach());
|
|
|
}
|
|
}
|
|
|
- if (order.getNotifyUrl() != null) {
|
|
|
|
|
- p.put("notify_url", order.getNotifyUrl());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ putUpstreamNotifyUrl(p);
|
|
|
|
|
|
|
|
Map<String, Object> resp = client.post("/v3/pay", p);
|
|
Map<String, Object> resp = client.post("/v3/pay", p);
|
|
|
return settleAfterPay(order, resp, true);
|
|
return settleAfterPay(order, resp, true);
|
|
@@ -244,9 +242,7 @@ public class LsyOrderService {
|
|
|
if (order.getAttach() != null) {
|
|
if (order.getAttach() != null) {
|
|
|
p.put("attach", order.getAttach());
|
|
p.put("attach", order.getAttach());
|
|
|
}
|
|
}
|
|
|
- if (order.getNotifyUrl() != null) {
|
|
|
|
|
- p.put("notify_url", order.getNotifyUrl());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ putUpstreamNotifyUrl(p);
|
|
|
// 注意:聚合码不传 pay_type,上游自动识别支付宝/微信
|
|
// 注意:聚合码不传 pay_type,上游自动识别支付宝/微信
|
|
|
|
|
|
|
|
Map<String, Object> resp = client.post("/v3/qrpay", p);
|
|
Map<String, Object> resp = client.post("/v3/qrpay", p);
|
|
@@ -359,9 +355,7 @@ public class LsyOrderService {
|
|
|
if (order.getAttach() != null) {
|
|
if (order.getAttach() != null) {
|
|
|
p.put("attach", order.getAttach());
|
|
p.put("attach", order.getAttach());
|
|
|
}
|
|
}
|
|
|
- if (order.getNotifyUrl() != null) {
|
|
|
|
|
- p.put("notify_url", order.getNotifyUrl());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ putUpstreamNotifyUrl(p);
|
|
|
|
|
|
|
|
Map<String, Object> resp = client.post("/v3/h5pay", p);
|
|
Map<String, Object> resp = client.post("/v3/h5pay", p);
|
|
|
|
|
|
|
@@ -566,6 +560,45 @@ public class LsyOrderService {
|
|
|
return o == null ? null : String.valueOf(o);
|
|
return o == null ? null : String.valueOf(o);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 把**平台自己的**回调入口填进上送报文 —— 三条下单腿(被扫 / 聚合码 / H5)共用这一处。
|
|
|
|
|
+ *
|
|
|
|
|
+ * <h2>★ 为什么不是 {@code order.getNotifyUrl()}</h2>
|
|
|
|
|
+ * {@code pay_lsy_order.notify_url} 这一列在库里只有一列,却被两种语义共用,方向正好相反:
|
|
|
|
|
+ * <ul>
|
|
|
|
|
+ * <li><b>出站</b>(本方法):上送给上游,语义是「**上游**支付完成后回调谁」;</li>
|
|
|
|
|
+ * <li><b>下游</b>:{@code LsyCallbackService.resolveUrl} 把它当作「**我们**推给调用方」的
|
|
|
|
|
+ * 目标,且是**第一优先级**({@code open} 那三个 DTO 的 {@code notifyUrl} 就落在这一列)。</li>
|
|
|
|
|
+ * </ul>
|
|
|
|
|
+ * 改前实现把这一列原样上送 ⇒ 上游会**绕过我们直连调用方**,后果两条:
|
|
|
|
|
+ * <ol>
|
|
|
|
|
+ * <li>调用方收到的是上游原文格式,而不是我们对外文档写的下游格式
|
|
|
|
|
+ * ({@code LsyCallbackService.notifyOrder} 的 {@code out_trade_no}/{@code status}/…);</li>
|
|
|
|
|
+ * <li>我们那三个 {@code /payment/collection/notify/**} 端点永远收不到支付回调 ⇒
|
|
|
|
|
+ * {@code LsyNotifyService.handlePayNotify} 事实上是死代码,下单腿只剩轮询兜底
|
|
|
|
|
+ * (而回收银台的设计恰恰<b>只</b>有轮询 —— 见 {@code LeshouyingCashierController} 的类注释)。</li>
|
|
|
|
|
+ * </ol>
|
|
|
|
|
+ *
|
|
|
|
|
+ * <h2>★ 为什么空值就**不发这个键**,而不是退回订单快照里的地址</h2>
|
|
|
|
|
+ * 上游文档对这两个接口各写了一句:付款码支付「回调地址,对于轮询超时订单,系统自动对单后会推送
|
|
|
|
|
+ * 订单支付结果」、聚合码支付「后端回调地址(<b>不传取机构默认配置回调</b>)」⇒ 不发是**合法**形态,
|
|
|
|
|
+ * 上游会走机构默认配置。而「退回订单快照」等于把这个缺陷原样装回去,
|
|
|
|
|
+ * 所以这里刻意**没有** fallback。<br>
|
|
|
|
|
+ * 另:{@code leshouying.notify-url} 由 {@code LeshouyingProperties.validate()} 在启动时校验非空
|
|
|
|
|
+ * (开关关掉时两道闸都不跑),所以正常运行中这个分支不会走到。
|
|
|
|
|
+ *
|
|
|
|
|
+ * <h2>★ 它不会造出「自己回调自己」的环</h2>
|
|
|
|
|
+ * 环的成因是**快照列**里存了我们自己的入口({@code resolveUrl} 第一优先级取它)。
|
|
|
|
|
+ * 本方法一个字节都不写库,快照列仍由 {@code LeshouyingOpenController} 从 DTO 落、
|
|
|
|
|
+ * 收银台仍留 null ⇒ {@code resolveUrl} 的后两级(api_key.return_url → open_conf.return_url)
|
|
|
|
|
+ * 不变,行为与改前一致。
|
|
|
|
|
+ */
|
|
|
|
|
+ private void putUpstreamNotifyUrl(Map<String, Object> p) {
|
|
|
|
|
+ if (StrUtil.isNotBlank(props.getNotifyUrl())) {
|
|
|
|
|
+ p.put("notify_url", props.getNotifyUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private Long parseAmount(Object v, Long fallback) {
|
|
private Long parseAmount(Object v, Long fallback) {
|
|
|
if (v == null) {
|
|
if (v == null) {
|
|
|
return fallback;
|
|
return fallback;
|