feat(payment): support Indonesia QRIS checkout
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user