refactor(billing): remove Stripe; payments are Payple (web) and Google Play (mobile)
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
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
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.
This commit is contained in:
parent
7224e43bfb
commit
eedd127ea7
50 changed files with 97 additions and 2600 deletions
|
|
@ -2,8 +2,6 @@ import { corsHeaders, handleCorsPreflightRequest } from '../_shared/cors.ts'
|
|||
import { requireUser, authErrorResponse, type AuthError } from '../_shared/auth.ts'
|
||||
import {
|
||||
createBillingCatalog,
|
||||
parseStripeCatalogPrice,
|
||||
type BillingCatalogPrice,
|
||||
type BillingCatalogTier,
|
||||
} from '../_shared/billing-catalog.ts'
|
||||
import {
|
||||
|
|
@ -23,20 +21,6 @@ function jsonResponse(body: unknown, status = 200): Response {
|
|||
return new Response(JSON.stringify(body), { status, headers: NO_STORE_HEADERS })
|
||||
}
|
||||
|
||||
async function loadStripePrice(
|
||||
secretKey: string,
|
||||
priceId: string,
|
||||
): Promise<Omit<BillingCatalogPrice, 'provider'> | null> {
|
||||
const response = await fetch(`https://api.stripe.com/v1/prices/${encodeURIComponent(priceId)}`, {
|
||||
method: 'GET',
|
||||
headers: { Authorization: `Bearer ${secretKey}` },
|
||||
signal: AbortSignal.timeout(8_000),
|
||||
})
|
||||
if (!response.ok) return null
|
||||
const payload = await response.json().catch(() => null)
|
||||
return parseStripeCatalogPrice(payload, priceId)
|
||||
}
|
||||
|
||||
Deno.serve(async (req: Request) => {
|
||||
const preflight = handleCorsPreflightRequest(req)
|
||||
if (preflight) return preflight
|
||||
|
|
@ -56,24 +40,7 @@ Deno.serve(async (req: Request) => {
|
|||
if (!(error instanceof PaypleConfigurationError)) throw error
|
||||
}
|
||||
|
||||
const stripeSecret = Deno.env.get('STRIPE_SECRET_KEY')?.trim() ?? ''
|
||||
const stripeIds: Record<BillingCatalogTier, string> = {
|
||||
pro: Deno.env.get('STRIPE_PRICE_PRO')?.trim() ?? '',
|
||||
pro_plus: (Deno.env.get('STRIPE_PRICE_PRO_PLUS')
|
||||
?? Deno.env.get('STRIPE_PRICE_TEAM'))?.trim() ?? '',
|
||||
}
|
||||
const stripe: Partial<Record<BillingCatalogTier, Omit<BillingCatalogPrice, 'provider'>>> = {}
|
||||
if (stripeSecret) {
|
||||
const tiers: BillingCatalogTier[] = ['pro', 'pro_plus']
|
||||
await Promise.all(tiers.map(async (tier) => {
|
||||
const priceId = stripeIds[tier]
|
||||
if (!priceId) return
|
||||
const price = await loadStripePrice(stripeSecret, priceId).catch(() => null)
|
||||
if (price) stripe[tier] = price
|
||||
}))
|
||||
}
|
||||
|
||||
return jsonResponse(createBillingCatalog({ payple, stripe }))
|
||||
return jsonResponse(createBillingCatalog({ payple }))
|
||||
} catch (error) {
|
||||
if (error && typeof error === 'object' && 'status' in error && 'message' in error) {
|
||||
return authErrorResponse(error as AuthError, NO_STORE_HEADERS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue