feat(subscription): default pay channel by country

This commit is contained in:
2026-06-30 16:49:47 +08:00
parent 9cff16e2d9
commit e254c93078
9 changed files with 63 additions and 5 deletions
@@ -4,6 +4,7 @@ import { PaymentPlan } from "@/data/dto/payment";
import {
findSelectedSubscriptionPlan,
getDefaultPayChannelForCountryCode,
getDefaultSubscriptionPlanId,
toCoinsOfferPlanViews,
toVipOfferPlanViews,
@@ -28,6 +29,14 @@ function makePlan(
}
describe("subscription screen helpers", () => {
it("defaults Philippines users to Ezpay and other countries to Stripe", () => {
expect(getDefaultPayChannelForCountryCode("PH")).toBe("ezpay");
expect(getDefaultPayChannelForCountryCode("ph")).toBe("ezpay");
expect(getDefaultPayChannelForCountryCode("HK")).toBe("stripe");
expect(getDefaultPayChannelForCountryCode("")).toBe("stripe");
expect(getDefaultPayChannelForCountryCode(null)).toBe("stripe");
});
it("maps at most three VIP plans and all coin plans", () => {
const plans = [
makePlan({ planId: "vip_monthly", planName: "Monthly" }),