fix(payment): show selector only for Philippines
This commit is contained in:
@@ -10,6 +10,7 @@ describe("PaymentMethodSelector", () => {
|
||||
config={{
|
||||
canChoosePaymentMethod: true,
|
||||
initialPayChannel: "ezpay",
|
||||
showPaymentMethodSelector: true,
|
||||
}}
|
||||
value="ezpay"
|
||||
caption="GCash by default"
|
||||
@@ -46,6 +47,7 @@ describe("PaymentMethodSelector", () => {
|
||||
config={{
|
||||
canChoosePaymentMethod: true,
|
||||
initialPayChannel: "stripe",
|
||||
showPaymentMethodSelector: true,
|
||||
}}
|
||||
value="stripe"
|
||||
disabled
|
||||
@@ -64,8 +66,9 @@ describe("PaymentMethodSelector", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<PaymentMethodSelector
|
||||
config={{
|
||||
canChoosePaymentMethod: false,
|
||||
canChoosePaymentMethod: true,
|
||||
initialPayChannel: "stripe",
|
||||
showPaymentMethodSelector: false,
|
||||
}}
|
||||
value="stripe"
|
||||
analyticsKey="tip.payment_method"
|
||||
|
||||
@@ -40,7 +40,7 @@ export function PaymentMethodSelector({
|
||||
analyticsKey,
|
||||
onChange,
|
||||
}: PaymentMethodSelectorProps) {
|
||||
if (!config.canChoosePaymentMethod) return null;
|
||||
if (!config.showPaymentMethodSelector) return null;
|
||||
|
||||
const paymentMethods =
|
||||
config.initialPayChannel === "ezpay"
|
||||
|
||||
@@ -27,7 +27,11 @@ describe("usePaymentMethodSelection", () => {
|
||||
it("forces Stripe when payment method selection is unavailable", () => {
|
||||
const onChange = vi.fn();
|
||||
renderHarness(root, {
|
||||
config: { canChoosePaymentMethod: false, initialPayChannel: "stripe" },
|
||||
config: {
|
||||
canChoosePaymentMethod: false,
|
||||
initialPayChannel: "stripe",
|
||||
showPaymentMethodSelector: false,
|
||||
},
|
||||
currentPayChannel: "ezpay",
|
||||
onChange,
|
||||
});
|
||||
@@ -40,6 +44,7 @@ describe("usePaymentMethodSelection", () => {
|
||||
const config = {
|
||||
canChoosePaymentMethod: true,
|
||||
initialPayChannel: "ezpay",
|
||||
showPaymentMethodSelector: true,
|
||||
} as const;
|
||||
renderHarness(root, {
|
||||
config,
|
||||
@@ -59,13 +64,21 @@ describe("usePaymentMethodSelection", () => {
|
||||
it("preserves an explicit return channel and pauses while payment is busy", () => {
|
||||
const onChange = vi.fn();
|
||||
renderHarness(root, {
|
||||
config: { canChoosePaymentMethod: true, initialPayChannel: "ezpay" },
|
||||
config: {
|
||||
canChoosePaymentMethod: true,
|
||||
initialPayChannel: "ezpay",
|
||||
showPaymentMethodSelector: true,
|
||||
},
|
||||
currentPayChannel: "stripe",
|
||||
requestedPayChannel: "stripe",
|
||||
onChange,
|
||||
});
|
||||
renderHarness(root, {
|
||||
config: { canChoosePaymentMethod: false, initialPayChannel: "stripe" },
|
||||
config: {
|
||||
canChoosePaymentMethod: false,
|
||||
initialPayChannel: "stripe",
|
||||
showPaymentMethodSelector: false,
|
||||
},
|
||||
currentPayChannel: "ezpay",
|
||||
isPaymentBusy: true,
|
||||
onChange,
|
||||
|
||||
Reference in New Issue
Block a user