mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: Hook orgnization name and logo to payment page
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { Transform } from 'form-data';
|
||||
import { ItemEntryTransformer } from './ItemEntryTransformer';
|
||||
import { SaleInvoiceTaxEntryTransformer } from './SaleInvoiceTaxEntryTransformer';
|
||||
import { SaleInvoiceTransformer } from './SaleInvoiceTransformer';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
|
||||
export class GetInvoicePaymentLinkMetaTransformer extends SaleInvoiceTransformer {
|
||||
/**
|
||||
@@ -17,7 +19,6 @@ export class GetInvoicePaymentLinkMetaTransformer extends SaleInvoiceTransformer
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return [
|
||||
'companyName',
|
||||
'customerName',
|
||||
'dueAmount',
|
||||
'dueDateFormatted',
|
||||
@@ -39,6 +40,7 @@ export class GetInvoicePaymentLinkMetaTransformer extends SaleInvoiceTransformer
|
||||
'termsConditions',
|
||||
'entries',
|
||||
'taxes',
|
||||
'organization',
|
||||
];
|
||||
};
|
||||
|
||||
@@ -46,8 +48,15 @@ export class GetInvoicePaymentLinkMetaTransformer extends SaleInvoiceTransformer
|
||||
return invoice.customer.displayName;
|
||||
}
|
||||
|
||||
public companyName() {
|
||||
return 'Bigcapital Technology, Inc.';
|
||||
/**
|
||||
* Retrieves the organization metadata for the payment link.
|
||||
* @returns
|
||||
*/
|
||||
public organization(invoice) {
|
||||
return this.item(
|
||||
this.context.organization,
|
||||
new GetPaymentLinkOrganizationMetaTransformer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +91,20 @@ export class GetInvoicePaymentLinkMetaTransformer extends SaleInvoiceTransformer
|
||||
};
|
||||
}
|
||||
|
||||
class GetPaymentLinkOrganizationMetaTransformer extends Transformer {
|
||||
/**
|
||||
* Include these attributes to item entry object.
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['primaryColor', 'name', 'address', 'logoUri'];
|
||||
};
|
||||
|
||||
public excludeAttributes = (): string[] => {
|
||||
return ['*'];
|
||||
};
|
||||
}
|
||||
|
||||
class GetInvoicePaymentLinkEntryMetaTransformer extends ItemEntryTransformer {
|
||||
/**
|
||||
* Include these attributes to item entry object.
|
||||
|
||||
Reference in New Issue
Block a user