feat(payment): 虎皮椒聚合支付 - 官方插件与跨平台可执行文件
新增 xunhupay 官方包,支付 RPC 与宿主只保留订单和验签边界;官方支付包同时带上各系统 provider,避免把 Linux ELF 当成本机入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
19
web/src/lib/payment-checkout-code.test.ts
Normal file
19
web/src/lib/payment-checkout-code.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { isPaymentQrImageURL } from "./payment-checkout-code";
|
||||
|
||||
test("isPaymentQrImageURL 识别虎皮椒二维码图片地址", () => {
|
||||
assert.equal(isPaymentQrImageURL("https://api.xunhupay.com/qrcode.png"), true);
|
||||
assert.equal(isPaymentQrImageURL(" https://api.dpweixin.com/qrcode.png "), true);
|
||||
assert.equal(isPaymentQrImageURL("https://pay.example/qrcode"), true);
|
||||
assert.equal(isPaymentQrImageURL("http://pay.example/images/order-qr.jpg"), true);
|
||||
});
|
||||
|
||||
test("isPaymentQrImageURL 不把待编码载荷或收银页当成图片", () => {
|
||||
assert.equal(isPaymentQrImageURL("weixin://wxpay/bizpayurl?pr=abc"), false);
|
||||
assert.equal(isPaymentQrImageURL("https://api.xunhupay.com/pay/jump"), false);
|
||||
assert.equal(isPaymentQrImageURL("https://pay.example/checkout?qrcode=1"), false);
|
||||
assert.equal(isPaymentQrImageURL(""), false);
|
||||
assert.equal(isPaymentQrImageURL("/qrcode.png"), false);
|
||||
});
|
||||
Reference in New Issue
Block a user