d3ro-voice/server/supabase/functions/_shared/billing-catalog.ts
Yun Chan eedd127ea7
Some checks failed
ci / 정본·보안·린트·타입·테스트 (push) Failing after 1m13s
ci / 워크스페이스 빌드 검증 (push) Has been skipped
ci / 모바일 린트·타입·Jest (push) Failing after 1m4s
ci / Supabase Edge Functions + Cloudflare Worker (push) Successful in 37s
ci / .NET API 서버 테스트 (push) Successful in 27s
deploy-site / deploy (push) Failing after 20s
refactor(billing): remove Stripe; payments are Payple (web) and Google Play (mobile)
Stripe is not used. Keeping its checkout, portal and webhook paths meant a
second payment provider, a second return-URL format and dead UI.

- Delete the stripe-checkout, stripe-portal and stripe-webhook functions and
  their config; billing-catalog serves Payple prices only, and the web parser
  rejects a catalog that still mixes in Stripe prices.
- Web: drop the Stripe checkout/portal buttons, provider toggle and return
  notices; billing shows Payple only. Past rows with provider='stripe' are
  still displayed ("Stripe (종료)") with a support contact instead of a portal.
- Desktop: delete the Stripe checkout modal, payment IPC channels, preload
  namespace and their types; "Remove ads with Pro" opens the web billing page
  via license.openBilling. Support/refund copy names Payple.
- billingUrl() loses the Stripe-only success/canceled result option; the
  Deno contract is regenerated.
- Migrations and the DB's accepted provider values are untouched (history).
- Docs and the backlog record the removal (MON-04, EXT-STRIPE-01, GAP-BILL-03).

Verified: typecheck (desktop/web/admin/api-client/mobile), contract:check,
deno check all functions, deno test 80/80, desktop 1478/1480 on the Electron
runtime (2 known environment failures), web and admin builds, release
metadata and mobile boundary self-tests, eslint on changed files.
2026-09-26 20:56:18 +09:00

44 lines
1.3 KiB
TypeScript

export type BillingCatalogTier = 'pro' | 'pro_plus'
/** 웹 결제는 Payple(KRW) 하나다. 모바일은 Google Play 스토어 가격을 쓰고 이 카탈로그에 오지 않는다. */
export type BillingCatalogProvider = 'payple'
export interface BillingCatalogPrice {
provider: BillingCatalogProvider
unit_amount: number
currency: string
interval: 'day' | 'week' | 'month' | 'year'
interval_count: number
}
export interface BillingCatalogPlan {
tier: BillingCatalogTier
prices: BillingCatalogPrice[]
}
export interface BillingCatalogResponse {
schema_version: '1'
plans: BillingCatalogPlan[]
}
export function createBillingCatalog(input: {
payple?: Record<BillingCatalogTier, number> | null
}): BillingCatalogResponse {
const tiers: BillingCatalogTier[] = ['pro', 'pro_plus']
return {
schema_version: '1',
plans: tiers.map((tier) => {
const prices: BillingCatalogPrice[] = []
const paypleAmount = input.payple?.[tier]
if (Number.isSafeInteger(paypleAmount) && (paypleAmount as number) > 0) {
prices.push({
provider: 'payple',
unit_amount: paypleAmount as number,
currency: 'KRW',
interval: 'month',
interval_count: 1,
})
}
return { tier, prices }
}),
}
}