feat(payment): support Indonesia QRIS checkout

This commit is contained in:
Codex
2026-07-22 18:57:22 +08:00
parent a0b2d44ec6
commit 1e25279e8f
19 changed files with 806 additions and 42 deletions
@@ -5,6 +5,7 @@ import {
getStripeClientSecret,
isEzpayPayment,
launchEzpayRedirect,
resolveEzpayLaunchTarget,
} from "../payment_launch";
describe("payment launch helpers", () => {
@@ -42,6 +43,51 @@ describe("payment launch helpers", () => {
).toBeNull();
});
it("resolves Ezpay URL and QR launch parameters without treating QR data as a URL", () => {
expect(
resolveEzpayLaunchTarget({
provider: "ezpay",
channelType: "URL",
payData: "https://pay.example/qris",
}),
).toEqual({ kind: "url", paymentUrl: "https://pay.example/qris" });
expect(
resolveEzpayLaunchTarget({
provider: "ezpay",
channelType: "QR",
payData: "00020101021226670016COM.NOBUBANK.WWW",
}),
).toEqual({
kind: "qr",
qrData: "00020101021226670016COM.NOBUBANK.WWW",
});
expect(
resolveEzpayLaunchTarget({
provider: "ezpay",
channelType: "QR",
payData: "",
}),
).toEqual({
kind: "error",
errorMessage: "QRIS payment data is missing. Please try again.",
});
});
it("rejects VA and unknown Ezpay channel types with explicit errors", () => {
expect(
resolveEzpayLaunchTarget({ provider: "ezpay", channelType: "VA" }),
).toEqual({
kind: "error",
errorMessage: "Virtual account payments are not supported in this app.",
});
expect(
resolveEzpayLaunchTarget({ provider: "ezpay", channelType: "OTHER" }),
).toEqual({
kind: "error",
errorMessage: "Unsupported Ezpay payment channel: OTHER.",
});
});
it("reports a launch failure before redirecting without an order id", async () => {
const onOpened = vi.fn();
const onFailed = vi.fn();