diff --git a/apps/backend/src/app.module.ts b/apps/backend/src/app.module.ts index 25ff5a4..f2349a7 100644 --- a/apps/backend/src/app.module.ts +++ b/apps/backend/src/app.module.ts @@ -7,7 +7,7 @@ import { CheckoutSessionModule } from './checkout-session/checkout-session.modul import { StripeListenerModule } from './stripe-listener/stripe-listener.module'; import { PaymentVerificationModule } from './payment-verification/payment-verification.module'; import { SuperTokenAccountingModule } from './super-token-accounting/super-token-accounting.module'; -import { StripeToSuperfluidModule } from './stripe-to-superfluid/stripe-to-superfluid.module'; +import { SuperfluidStripeConverterModule } from './superfluid-stripe-converter/superfluid-stripe-converter.module'; import { HealthModule } from './health/health.module'; import { registerStripeModule } from './stripeModuleConfig'; @@ -46,7 +46,7 @@ const registerBullModule = () => StripeListenerModule, PaymentVerificationModule, SuperTokenAccountingModule, - StripeToSuperfluidModule, + SuperfluidStripeConverterModule, HealthModule, ], controllers: [], diff --git a/apps/backend/src/checkout-session/checkout-session.module.ts b/apps/backend/src/checkout-session/checkout-session.module.ts index 2cfc170..8b0410a 100644 --- a/apps/backend/src/checkout-session/checkout-session.module.ts +++ b/apps/backend/src/checkout-session/checkout-session.module.ts @@ -3,10 +3,10 @@ import { CheckoutSessionController } from './checkout-session.controller'; import { CheckoutSessionProcesser } from './checkout-session.processer'; import { registerQueueModule } from './checkout-session.queue'; import { registerStripeModule } from 'src/stripeModuleConfig'; -import { StripeToSuperfluidModule } from 'src/stripe-to-superfluid/stripe-to-superfluid.module'; +import { SuperfluidStripeConverterModule } from 'src/superfluid-stripe-converter/superfluid-stripe-converter.module'; @Module({ - imports: [registerQueueModule(), registerStripeModule(), StripeToSuperfluidModule], + imports: [registerQueueModule(), registerStripeModule(), SuperfluidStripeConverterModule], controllers: [CheckoutSessionController], providers: [CheckoutSessionProcesser], }) diff --git a/apps/backend/src/checkout-session/checkout-session.processer.ts b/apps/backend/src/checkout-session/checkout-session.processer.ts index 1f32900..499f78e 100644 --- a/apps/backend/src/checkout-session/checkout-session.processer.ts +++ b/apps/backend/src/checkout-session/checkout-session.processer.ts @@ -5,7 +5,7 @@ import { QUEUE_NAME } from './checkout-session.queue'; import { InjectStripeClient } from '@golevelup/nestjs-stripe'; import Stripe from 'stripe'; import { AddressSchema, CreateSessionData } from './checkout-session.controller'; -import { StripeToSuperfluidService } from 'src/stripe-to-superfluid/stripe-to-superfluid.service'; +import { SuperfluidStripeConverterService } from 'src/superfluid-stripe-converter/superfluid-stripe-converter.service'; import { DEFAULT_PAGING } from 'src/stripeModuleConfig'; import { z } from 'zod'; @@ -61,7 +61,7 @@ export class CheckoutSessionProcesser extends WorkerHost { constructor( @InjectQueue(QUEUE_NAME) private readonly queue: Queue, @InjectStripeClient() private readonly stripeClient: Stripe, - private readonly stripeToSupefluidService: StripeToSuperfluidService, // Bad name... + private readonly stripeToSupefluidService: SuperfluidStripeConverterService, // Bad name... ) { super(); } diff --git a/apps/backend/src/payment-verification/payment-verification.module.ts b/apps/backend/src/payment-verification/payment-verification.module.ts index 8095a8d..dc8587b 100644 --- a/apps/backend/src/payment-verification/payment-verification.module.ts +++ b/apps/backend/src/payment-verification/payment-verification.module.ts @@ -4,14 +4,14 @@ import { PaymentVerificationService } from './payment-verification.service'; import { registerQueueModules } from './payment-verification.queue'; import { registerStripeModule } from 'src/stripeModuleConfig'; import { SuperTokenAccountingModule } from 'src/super-token-accounting/super-token-accounting.module'; -import { StripeToSuperfluidModule } from 'src/stripe-to-superfluid/stripe-to-superfluid.module'; +import { SuperfluidStripeConverterModule } from 'src/superfluid-stripe-converter/superfluid-stripe-converter.module'; @Module({ imports: [ ...registerQueueModules(), registerStripeModule(), SuperTokenAccountingModule, - StripeToSuperfluidModule, + SuperfluidStripeConverterModule, ], providers: [PaymentVerificationProcessor, PaymentVerificationService], exports: [PaymentVerificationService], diff --git a/apps/backend/src/payment-verification/payment-verification.processor.ts b/apps/backend/src/payment-verification/payment-verification.processor.ts index 1228ddb..e45270f 100644 --- a/apps/backend/src/payment-verification/payment-verification.processor.ts +++ b/apps/backend/src/payment-verification/payment-verification.processor.ts @@ -5,7 +5,7 @@ import { InjectStripeClient } from '@golevelup/nestjs-stripe'; import Stripe from 'stripe'; import _ from 'lodash'; import { SuperTokenAccountingService } from 'src/super-token-accounting/super-token-accounting.service'; -import { StripeToSuperfluidService } from 'src/stripe-to-superfluid/stripe-to-superfluid.service'; +import { SuperfluidStripeConverterService } from 'src/superfluid-stripe-converter/superfluid-stripe-converter.service'; import { DEFAULT_PAGING } from 'src/stripeModuleConfig'; import { SuperfluidStripeSubscriptionsMetadata, @@ -38,7 +38,7 @@ export class PaymentVerificationProcessor extends WorkerHost { @InjectFlowProducer(FLOW_PRODUCER_NAME) private readonly flowProducer: FlowProducer, @InjectStripeClient() private readonly stripeClient: Stripe, - private readonly stripeToSuperfluidService: StripeToSuperfluidService, + private readonly superfluidStripeConverterService: SuperfluidStripeConverterService, private readonly superTokenAccountingService: SuperTokenAccountingService, ) { super(); diff --git a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.controller.spec.ts b/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.controller.spec.ts deleted file mode 100644 index b866fa3..0000000 --- a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.controller.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { StripeToSuperfluidController } from './stripe-to-superfluid.controller'; - -describe('StripeToSuperfluidController', () => { - let controller: StripeToSuperfluidController; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [StripeToSuperfluidController], - }).compile(); - - controller = module.get(StripeToSuperfluidController); - }); - - it('should be defined', () => { - expect(controller).toBeDefined(); - }); -}); diff --git a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.module.ts b/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.module.ts deleted file mode 100644 index 8f3d328..0000000 --- a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Module } from '@nestjs/common'; -import { StripeToSuperfluidController } from './stripe-to-superfluid.controller'; -import { StripeToSuperfluidService } from './stripe-to-superfluid.service'; -import { registerStripeModule } from 'src/stripeModuleConfig'; - -@Module({ - imports: [registerStripeModule()], - controllers: [StripeToSuperfluidController], - providers: [StripeToSuperfluidService], - exports: [StripeToSuperfluidService], -}) -export class StripeToSuperfluidModule {} diff --git a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.service.spec.ts b/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.service.spec.ts deleted file mode 100644 index f45440b..0000000 --- a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.service.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { StripeToSuperfluidService } from './stripe-to-superfluid.service'; - -describe('StripeToSuperfluidService', () => { - let service: StripeToSuperfluidService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [StripeToSuperfluidService], - }).compile(); - - service = module.get(StripeToSuperfluidService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); diff --git a/apps/backend/src/stripe-to-superfluid/price-conversion-strategy/ChainToSuperTokenReceiverMap.ts b/apps/backend/src/superfluid-stripe-converter/price-conversion-strategy/ChainToSuperTokenReceiverMap.ts similarity index 100% rename from apps/backend/src/stripe-to-superfluid/price-conversion-strategy/ChainToSuperTokenReceiverMap.ts rename to apps/backend/src/superfluid-stripe-converter/price-conversion-strategy/ChainToSuperTokenReceiverMap.ts diff --git a/apps/backend/src/stripe-to-superfluid/price-conversion-strategy/StripeCurrencyToSuperTokenMap.ts b/apps/backend/src/superfluid-stripe-converter/price-conversion-strategy/StripeCurrencyToSuperTokenMap.ts similarity index 100% rename from apps/backend/src/stripe-to-superfluid/price-conversion-strategy/StripeCurrencyToSuperTokenMap.ts rename to apps/backend/src/superfluid-stripe-converter/price-conversion-strategy/StripeCurrencyToSuperTokenMap.ts diff --git a/apps/backend/src/stripe-to-superfluid/price-conversion-strategy/basic-types.ts b/apps/backend/src/superfluid-stripe-converter/price-conversion-strategy/basic-types.ts similarity index 100% rename from apps/backend/src/stripe-to-superfluid/price-conversion-strategy/basic-types.ts rename to apps/backend/src/superfluid-stripe-converter/price-conversion-strategy/basic-types.ts diff --git a/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.controller.spec.ts b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.controller.spec.ts new file mode 100644 index 0000000..527111f --- /dev/null +++ b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.controller.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { SuperfluidStripeConverterController } from './superfluid-stripe-converter.controller'; + +describe('SuperfluidStripeConverterController', () => { + let controller: SuperfluidStripeConverterController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [SuperfluidStripeConverterController], + }).compile(); + + controller = module.get(SuperfluidStripeConverterController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.controller.ts b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.controller.ts similarity index 71% rename from apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.controller.ts rename to apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.controller.ts index 89afd75..623e5c2 100644 --- a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.controller.ts +++ b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.controller.ts @@ -2,18 +2,18 @@ import { InjectStripeClient } from '@golevelup/nestjs-stripe'; import { Controller, Get, Logger, Query } from '@nestjs/common'; import { WidgetProps } from '@superfluid-finance/widget'; import Stripe from 'stripe'; -import { StripeToSuperfluidService } from './stripe-to-superfluid.service'; +import { SuperfluidStripeConverterService } from './superfluid-stripe-converter.service'; type Response = { productDetails: WidgetProps['productDetails']; paymentDetails: WidgetProps['paymentDetails']; }; -@Controller('stripe-to-superfluid') -export class StripeToSuperfluidController { +@Controller('superfluid-stripe-converter') +export class SuperfluidStripeConverterController { constructor( @InjectStripeClient() private readonly stripeClient: Stripe, - private readonly stripeToSuperfluidService: StripeToSuperfluidService, + private readonly superfluidStripeConverterService: SuperfluidStripeConverterService, ) {} // TODO: Does this need auth? @@ -29,7 +29,7 @@ export class StripeToSuperfluidController { }), ]); - const config = this.stripeToSuperfluidService.mapStripeProductToWidgetConfig({ + const config = this.superfluidStripeConverterService.mapStripeProductToWidgetConfig({ product: stripeProductsResponse, prices: stripePricesResponse.data, }); @@ -45,4 +45,4 @@ export class StripeToSuperfluidController { } } -const logger = new Logger(StripeToSuperfluidController.name); +const logger = new Logger(SuperfluidStripeConverterController.name); diff --git a/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.module.ts b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.module.ts new file mode 100644 index 0000000..633ac19 --- /dev/null +++ b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.module.ts @@ -0,0 +1,12 @@ +import { Module } from '@nestjs/common'; +import { SuperfluidStripeConverterController } from './superfluid-stripe-converter.controller'; +import { SuperfluidStripeConverterService } from './superfluid-stripe-converter.service'; +import { registerStripeModule } from 'src/stripeModuleConfig'; + +@Module({ + imports: [registerStripeModule()], + controllers: [SuperfluidStripeConverterController], + providers: [SuperfluidStripeConverterService], + exports: [SuperfluidStripeConverterService], +}) +export class SuperfluidStripeConverterModule {} diff --git a/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.service.spec.ts b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.service.spec.ts new file mode 100644 index 0000000..037e9a1 --- /dev/null +++ b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { SuperfluidStripeConverterService } from './superfluid-stripe-converter.service'; + +describe('SuperfluidStripeConverterService', () => { + let service: SuperfluidStripeConverterService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [SuperfluidStripeConverterService], + }).compile(); + + service = module.get(SuperfluidStripeConverterService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.service.ts b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.service.ts similarity index 97% rename from apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.service.ts rename to apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.service.ts index 6fe9964..5c64770 100644 --- a/apps/backend/src/stripe-to-superfluid/stripe-to-superfluid.service.ts +++ b/apps/backend/src/superfluid-stripe-converter/superfluid-stripe-converter.service.ts @@ -35,7 +35,7 @@ interface SuperTokenToStripeCurrencyMapper { } @Injectable() -export class StripeToSuperfluidService +export class SuperfluidStripeConverterService implements StripeProductToWidgetConfigMapper, SuperTokenToStripeCurrencyMapper { // TODO(KK): Inject @@ -119,4 +119,4 @@ export class StripeToSuperfluidService } } -const logger = new Logger(StripeToSuperfluidService.name); +const logger = new Logger(SuperfluidStripeConverterService.name); diff --git a/apps/frontend/src/pages/[product].tsx b/apps/frontend/src/pages/[product].tsx index 03795db..45975b9 100644 --- a/apps/frontend/src/pages/[product].tsx +++ b/apps/frontend/src/pages/[product].tsx @@ -49,7 +49,7 @@ export default function Product({ product: productId, ...config }: Props) { export const getServerSideProps = (async (context) => { const productId = context.query.product as string; - const url = new URL(`/stripe-to-superfluid/checkout-widget?product-id=${productId}`, internalConfig.getBackendBaseUrl()); + const url = new URL(`/superfluid-stripe-converter/checkout-widget?product-id=${productId}`, internalConfig.getBackendBaseUrl()); const response = await fetch(url, { method: 'GET', headers: {