Skip to content

Commit d1ca7b2

Browse files
committed
chore: remove growthbook from payment functions
1 parent 7fafaec commit d1ca7b2

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

src/app/modules/payments/payments.service.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { GrowthBook } from '@growthbook/growthbook'
21
import { isEqual, omit } from 'lodash'
32
import moment from 'moment-timezone'
43
import mongoose, { Types } from 'mongoose'
@@ -209,7 +208,6 @@ export const confirmPaymentPendingSubmission = (
209208
*/
210209
export const performPaymentPostSubmissionActions = (
211210
paymentId: IPaymentSchema['_id'],
212-
growthbook: GrowthBook | undefined,
213211
): ResultAsync<
214212
void,
215213
| PaymentNotFoundError
@@ -244,7 +242,6 @@ export const performPaymentPostSubmissionActions = (
244242
performEncryptPostSubmissionActions({
245243
submission,
246244
responses: payment.responses,
247-
growthbook,
248245
})
249246
.andThen(() =>
250247
// If successfully sent email confirmations, delete response data from payment document.

src/app/modules/payments/stripe.controller.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,7 @@ export const reconcileAccount: ControllerHandler<
304304
meta: { ...logMeta, event },
305305
})
306306

307-
await StripeService.handleStripeEvent(
308-
event as Stripe.DiscriminatedEvent,
309-
req.growthbook,
310-
)
307+
await StripeService.handleStripeEvent(event as Stripe.DiscriminatedEvent)
311308
.andThen(() => {
312309
logger.warn({
313310
message:

src/app/modules/payments/stripe.events.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const _handleStripeEventUpdates: ControllerHandler<
8989

9090
// Step 3: Process the event
9191
return (
92-
StripeService.handleStripeEvent(event, req.growthbook)
92+
StripeService.handleStripeEvent(event)
9393
// Step 4: Return response to Stripe based on result
9494
.match(
9595
() => res.sendStatus(StatusCodes.OK),

src/app/modules/payments/stripe.service.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Use 'stripe-event-types' for better type discrimination.
22
/// <reference types="stripe-event-types" />
3-
import { GrowthBook } from '@growthbook/growthbook'
43
import cuid from 'cuid'
54
import mongoose from 'mongoose'
65
import { errAsync, ok, okAsync, ResultAsync } from 'neverthrow'
@@ -451,7 +450,6 @@ type HandleStripeEventResultError =
451450
*/
452451
export const handleStripeEvent = (
453452
event: Stripe.DiscriminatedEvent,
454-
growthbook: GrowthBook | undefined,
455453
): ResultAsync<void, HandleStripeEventResultError> => {
456454
const logMeta = {
457455
action: 'handleStripeEvent',
@@ -498,7 +496,6 @@ export const handleStripeEvent = (
498496

499497
return PaymentsService.performPaymentPostSubmissionActions(
500498
paymentId,
501-
growthbook,
502499
)
503500
.andThen(() => okAsync(undefined))
504501
.orElse((e) => {

0 commit comments

Comments
 (0)