Skip to content

Commit

Permalink
rename to converter
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparkallas authored Oct 26, 2023
1 parent 51e3945 commit f77a4df
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 67 deletions.
4 changes: 2 additions & 2 deletions apps/backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -46,7 +46,7 @@ const registerBullModule = () =>
StripeListenerModule,
PaymentVerificationModule,
SuperTokenAccountingModule,
StripeToSuperfluidModule,
SuperfluidStripeConverterModule,
HealthModule,
],
controllers: [],
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/src/checkout-session/checkout-session.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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>(SuperfluidStripeConverterController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -29,7 +29,7 @@ export class StripeToSuperfluidController {
}),
]);

const config = this.stripeToSuperfluidService.mapStripeProductToWidgetConfig({
const config = this.superfluidStripeConverterService.mapStripeProductToWidgetConfig({
product: stripeProductsResponse,
prices: stripePricesResponse.data,
});
Expand All @@ -45,4 +45,4 @@ export class StripeToSuperfluidController {
}
}

const logger = new Logger(StripeToSuperfluidController.name);
const logger = new Logger(SuperfluidStripeConverterController.name);
Original file line number Diff line number Diff line change
@@ -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 {}
Original file line number Diff line number Diff line change
@@ -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>(SuperfluidStripeConverterService);
});

it('should be defined', () => {
expect(service).toBeDefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface SuperTokenToStripeCurrencyMapper {
}

@Injectable()
export class StripeToSuperfluidService
export class SuperfluidStripeConverterService
implements StripeProductToWidgetConfigMapper, SuperTokenToStripeCurrencyMapper
{
// TODO(KK): Inject
Expand Down Expand Up @@ -119,4 +119,4 @@ export class StripeToSuperfluidService
}
}

const logger = new Logger(StripeToSuperfluidService.name);
const logger = new Logger(SuperfluidStripeConverterService.name);
2 changes: 1 addition & 1 deletion apps/frontend/src/pages/[product].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit f77a4df

Please sign in to comment.