@@ -22,20 +22,14 @@ import {
2222 type NormalizedPaymentEvent ,
2323 type PaymentProviderId ,
2424} from '@vmp/payments' ;
25- import { handlePaymentInvoicePaid } from './eInvoicing.js' ;
2625import {
2726 CUSTOMER_SAFE_BANK_PAYMENTS_UNAVAILABLE ,
2827 looksLikePaymentConfigLeak ,
2928} from './customerSafePaymentErrors.js' ;
29+ import { handlePaymentInvoicePaid } from './eInvoicing.js' ;
3030import { isLegacyCheckoutConfigured , isLegacyWebhookConfigured } from './legacyProvider.js' ;
3131import { revokeOfflineLicensesForUser } from './offlineDownloads.js' ;
3232import { parseLocaleNumber } from './parseLocaleNumber.js' ;
33- import {
34- captureMappedPostHogEvent ,
35- capturePostHogException ,
36- posthogEventFromStripeWebhook ,
37- type PostHogWaitUntilCtx ,
38- } from './posthog.js' ;
3933import {
4034 buildPaymentsConfig ,
4135 dbProviderToRegistryId ,
@@ -49,6 +43,12 @@ import {
4943 toApiProviderId ,
5044 toSupportedApiProviderIds ,
5145} from './paymentProviders.js' ;
46+ import {
47+ captureMappedPostHogEvent ,
48+ capturePostHogException ,
49+ type PostHogWaitUntilCtx ,
50+ posthogEventFromStripeWebhook ,
51+ } from './posthog.js' ;
5252
5353export { parseLocaleNumber } from './parseLocaleNumber.js' ;
5454
@@ -123,10 +123,7 @@ function parseConfiguredPrice(value: unknown): number | null {
123123 return parseLocaleNumber ( value ) ;
124124}
125125
126- async function getPricingSettings (
127- env : any ,
128- provider ?: 'stripe' | 'legacy' | 'gopay' | 'comgate' ,
129- ) {
126+ async function getPricingSettings ( env : any , provider ?: 'stripe' | 'legacy' | 'gopay' | 'comgate' ) {
130127 if ( provider === 'gopay' || provider === 'comgate' ) {
131128 const [ monthly , yearly , club ] = await Promise . all ( [
132129 getSetting ( env , `${ provider } _monthly_price` , { ttlSeconds : 300 } ) ,
@@ -573,8 +570,7 @@ async function updateSubscriptionStatusByProviderRef(
573570 if ( refs . length === 0 ) return ;
574571
575572 const where = refs . map ( ( ref ) => `${ ref . column } = ?` ) . join ( ' OR ' ) ;
576- const cancelClause =
577- nextStatus === 'cancelled' ? ', cancel_at_period_end = 0' : '' ;
573+ const cancelClause = nextStatus === 'cancelled' ? ', cancel_at_period_end = 0' : '' ;
578574 await db
579575 . prepare (
580576 `UPDATE subscriptions
@@ -1330,11 +1326,7 @@ export async function handleCheckout(request: any, env: any, corsHeaders: any) {
13301326 }
13311327 const rawMessage = err instanceof Error ? err . message : '' ;
13321328 const configLeak = looksLikePaymentConfigLeak ( rawMessage ) ;
1333- if (
1334- code === 'legacy_not_configured' ||
1335- code === 'provider_not_configured' ||
1336- configLeak
1337- ) {
1329+ if ( code === 'legacy_not_configured' || code === 'provider_not_configured' || configLeak ) {
13381330 return jsonResponse (
13391331 {
13401332 error : CUSTOMER_SAFE_BANK_PAYMENTS_UNAVAILABLE ,
0 commit comments