fix: make the base url of payment link configurable

This commit is contained in:
Ahmed Bouhuolia
2024-09-18 23:53:46 +02:00
parent d2cd32a735
commit 77f628509c
2 changed files with 8 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
import { Transformer } from '@/lib/Transformer/Transformer';
import { PUBLIC_PAYMENT_LINK } from './constants';
export class GeneratePaymentLinkTransformer extends Transformer {
/**
@@ -18,11 +19,10 @@ export class GeneratePaymentLinkTransformer extends Transformer {
};
/**
*
* @param link
* @returns
* Retrieves the public/private payment linl
* @returns {string}
*/
public link(link) {
return `http://localhost:3000/payment/${link.linkId}`;
return PUBLIC_PAYMENT_LINK?.replace('{PAYMENT_LINK_ID}', link.linkId);
}
}

View File

@@ -1,3 +1,5 @@
import config from '@/config';
export const DEFAULT_INVOICE_MAIL_SUBJECT =
'Invoice {InvoiceNumber} from {CompanyName}';
export const DEFAULT_INVOICE_MAIL_CONTENT = `
@@ -30,6 +32,8 @@ Amount : <strong>{InvoiceAmount}</strong></p>
</p>
`;
export const PUBLIC_PAYMENT_LINK = `${config.baseURL}/payment/{PAYMENT_LINK_ID}`;
export const ERRORS = {
INVOICE_NUMBER_NOT_UNIQUE: 'INVOICE_NUMBER_NOT_UNIQUE',
SALE_INVOICE_NOT_FOUND: 'SALE_INVOICE_NOT_FOUND',