feat: clean up the style of public payment page.

This commit is contained in:
Ahmed Bouhuolia
2024-09-21 09:53:00 +02:00
parent 11c56c75a4
commit 8de8695b25
6 changed files with 52 additions and 48 deletions

View File

@@ -1,18 +1,10 @@
import { NextFunction, Request, Response, Router } from 'express';
import { Service, Inject } from 'typedi';
import { StripePaymentService } from '@/services/StripePayment/StripePaymentService';
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
import { StripeIntegrationApplication } from './StripeIntegrationApplication';
import { StripePaymentApplication } from '@/services/StripePayment/StripePaymentApplication';
@Service()
export class StripeIntegrationController {
@Inject()
private stripePaymentService: StripePaymentService;
@Inject()
private stripeIntegrationApp: StripeIntegrationApplication;
@Inject()
private stripePaymentApp: StripePaymentApplication;
@@ -70,7 +62,7 @@ export class StripeIntegrationController {
const { tenantId } = req;
try {
const accountId = await this.stripeIntegrationApp.createStripeAccount(
const accountId = await this.stripePaymentApp.createStripeAccount(
tenantId
);
@@ -95,9 +87,12 @@ export class StripeIntegrationController {
res: Response,
next: NextFunction
) {
const { tenantId } = req;
const { account } = req.body;
try {
const clientSecret = await this.stripePaymentService.createAccountSession(
const clientSecret = await this.stripePaymentApp.createStripeAccount(
tenantId,
account
);
res.status(200).json({ clientSecret });

View File

@@ -31,8 +31,8 @@ export class CreateStripeAccountService {
const stripeAccountId = stripeAccount.id;
const parsedStripeAccountDTO = {
...stripeAccountDTO,
name: 'Stripe',
...stripeAccountDTO,
};
// Stores the details of the Stripe account.
await PaymentIntegration.query().insert({

View File

@@ -9,7 +9,7 @@ export class StripePaymentApplication {
private createStripeAccountService: CreateStripeAccountService;
@Inject()
private createSaleInvoiceCheckoutSessionService: CreateInvoiceCheckoutSession;
private createInvoiceCheckoutSessionService: CreateInvoiceCheckoutSession;
/**
* Creates a new Stripe account for Bigcapital.
@@ -18,7 +18,7 @@ export class StripePaymentApplication {
*/
public createStripeAccount(
tenantId: number,
createStripeAccountDTO: CreateStripeAccountDTO
createStripeAccountDTO: CreateStripeAccountDTO = {}
) {
return this.createStripeAccountService.createStripeAccount(
tenantId,
@@ -36,7 +36,7 @@ export class StripePaymentApplication {
tenantId: number,
paymentLinkId: number
): Promise<StripeInvoiceCheckoutSessionPOJO> {
return this.createSaleInvoiceCheckoutSessionService.createInvoiceCheckoutSession(
return this.createInvoiceCheckoutSessionService.createInvoiceCheckoutSession(
tenantId,
paymentLinkId
);

View File

@@ -2,5 +2,5 @@
export interface CreateStripeAccountDTO {
name: string;
name?: string;
}