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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,17 @@
.rootBodyPage {
background: #0c103f;
}
.root {
border-radius: 10px;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
width: 600px;
margin: 40px auto;
color: #222;
background-color: #fff;
}
.companyLogoWrap { .companyLogoWrap {
height: 50px; height: 50px;
width :50px; width :50px;
@@ -10,19 +24,6 @@
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
} }
.rootBodyPage {
background: #181a30;
}
.root {
border-radius: 10px;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
width: 600px;
margin: 40px auto;
color: #222;
background-color: #fff;
}
.bigTitle{ .bigTitle{
margin: 0; margin: 0;
font-weight: 500; font-weight: 500;
@@ -31,7 +32,7 @@
} }
.invoiceDueDate{ .invoiceDueDate{
font-size: 16px; font-size: 14px;
} }
.invoiceNumber { .invoiceNumber {
@@ -53,12 +54,14 @@
font-size: 12px; font-size: 12px;
} }
.address{
color: #5f6b7c;
}
.customerName{ .customerName{
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
} color: #222;
.totals {
color: #000;
} }
.totalItem { .totalItem {
@@ -72,6 +75,26 @@
} }
} }
.downloadInvoiceButton:global(.bp4-button.bp4-minimal){
box-shadow: 0 0 0 1px #DCE0E5;
}
.viewInvoiceButton:global(.bp4-button:not([class*=bp4-intent-]):not(.bp4-minimal)){
background-color: #EDEFF2;
}
.buyNote{
margin-top: 16px;
font-size: 12px;
}
// Footer
// -------------------
.totals {
color: #000;
}
.footerButtons{ .footerButtons{
margin-top: 20px; margin-top: 20px;
} }
@@ -81,21 +104,7 @@
line-height: 40px; line-height: 40px;
font-size: 16px; font-size: 16px;
} }
.downloadInvoiceButton:global(.bp4-button.bp4-minimal){
box-shadow: 0 0 0 1px #DCE0E5;
}
.viewInvoiceButton:global(.bp4-button:not([class*=bp4-intent-]):not(.bp4-minimal)){
background-color: #EDEFF2;
}
.buyButton{
}
.footerText{ .footerText{
color: #666; color: #666;
} }
.buyNote{
margin-top: 16px;
font-size: 12px;
}

View File

@@ -25,7 +25,7 @@ export function PaymentPortal() {
.then((session) => { .then((session) => {
window.open(session.redirectTo); window.open(session.redirectTo);
}) })
.catch(() => { .catch((error) => {
AppToaster.show({ AppToaster.show({
intent: Intent.DANGER, intent: Intent.DANGER,
message: 'Something went wrong.', message: 'Something went wrong.',
@@ -52,7 +52,7 @@ export function PaymentPortal() {
</Text> </Text>
</Stack> </Stack>
<Stack spacing={2}> <Stack className={styles.address} spacing={2}>
<Box className={styles.customerName}> <Box className={styles.customerName}>
{sharableLinkMeta?.customerName} {sharableLinkMeta?.customerName}
</Box> </Box>