feat(payment): expand Stripe methods and checkout handoff
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
getPaymentUrl,
|
||||
getStripeCustomerSessionClientSecret,
|
||||
getStripeClientSecret,
|
||||
isEzpayPayment,
|
||||
launchEzpayRedirect,
|
||||
@@ -43,6 +44,28 @@ describe("payment launch helpers", () => {
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("enables saved cards only with an explicit flag and a Customer Session secret", () => {
|
||||
expect(
|
||||
getStripeCustomerSessionClientSecret({
|
||||
provider: "stripe",
|
||||
customerSessionClientSecret: "cuss_123_secret_456",
|
||||
savedPaymentMethodsEnabled: true,
|
||||
}),
|
||||
).toBe("cuss_123_secret_456");
|
||||
expect(
|
||||
getStripeCustomerSessionClientSecret({
|
||||
customerSessionClientSecret: "cuss_123_secret_456",
|
||||
savedPaymentMethodsEnabled: false,
|
||||
}),
|
||||
).toBeNull();
|
||||
expect(
|
||||
getStripeCustomerSessionClientSecret({
|
||||
customerSessionClientSecret: "invalid-customer-session",
|
||||
savedPaymentMethodsEnabled: true,
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("resolves Ezpay URL and QR launch parameters without treating QR data as a URL", () => {
|
||||
expect(
|
||||
resolveEzpayLaunchTarget({
|
||||
|
||||
Reference in New Issue
Block a user