Skip to content

SudoSOS Back-end API / invoicing / Invoice

Class: Invoice ​

Extends ​

Constructors ​

Constructor ​

ts
new Invoice(): Invoice;

Returns ​

Invoice

Inherited from ​

ts
PdfAble(BaseEntity).constructor

Properties ​

PropertyModifierTypeDescriptionOverridesInherited from
addresseepublicstringName of the addressed--
attentionpublicstringSpecial attention to the addressee--
citypublicstringCity to use on the invoice--
countrypublicstringCountry to use on the invoice--
createdAtreadonlyDate--PdfAble(BaseEntity).createdAt
creditTransfer?publicTransferIf this invoice is deleted, this will be credit transfer.--
creditTransferId?publicnumber---
datepublicDateDate of the invoice--
descriptionpublicstringThe description of the invoice--
idreadonlynumber--PdfAble(BaseEntity).id
invoiceStatuspublicInvoiceStatus[]The status history of the invoice--
pdf?publicInvoicePdfThe PDF file onDelete: 'CASCADE' is not possible here, because removing the pdf from the database will not remove it from storagePdfAble(BaseEntity).pdf-
pdfId?publicnumberThe ID of the PDF filePdfAble(BaseEntity).pdfId-
pdfServicepublicInvoicePdfServiceThe service that creates the Pdf file. Can be either a byte-producing service plus optionally a stored-entity service.PdfAble(BaseEntity).pdfService-
postalCodepublicstringPostal code to use on the invoice--
referencepublicstringThe reference of the invoice--
streetpublicstringStreet to use on the invoice--
subTransactionRowspublicSubTransactionRow[]---
subTransactionRowsDeletedInvoicepublicSubTransactionRow[]---
topublicUserThe account for whom the invoice is--
toIdpublicnumberThe ID of the account for whom the invoice is--
transferpublicTransferThe transfer entity representing the invoice.--
updatedAtreadonlyDate--PdfAble(BaseEntity).updatedAt
versionreadonlynumber--PdfAble(BaseEntity).version

Methods ​

createPdf() ​

ts
createPdf(): Promise<Pdf>;

Create and persist the Pdf file, returning the Pdf entity. The configured pdfService must implement createPdfWithEntity, otherwise this throws.

Returns ​

Promise<Pdf>

Inherited from ​

ts
PdfAble(BaseEntity).createPdf

getOrCreatePdf() ​

ts
getOrCreatePdf(force?): Promise<Pdf>;

Get the Pdf file. If the Pdf file is not current, create it.

Parameters ​

ParameterTypeDefault valueDescription
forcebooleanfalseIf true, always create the Pdf file.

Returns ​

Promise<Pdf>

Inherited from ​

ts
PdfAble(BaseEntity).getOrCreatePdf

getOwner() ​

ts
getOwner(): Promise<User>;

Get the owner of the Pdf file.

Returns ​

Promise<User>

Overrides ​

ts
PdfAble(BaseEntity).getOwner

getPdfParamHash() ​

ts
getPdfParamHash(): Promise<string>;

Get the hash of the parameters of the Pdf file.

Returns ​

Promise<string>

Inherited from ​

ts
PdfAble(BaseEntity).getPdfParamHash

validatePdfHash() ​

ts
validatePdfHash(): Promise<boolean>;

Validates if the Pdf matches the stored hash.

Returns ​

Promise<boolean>

Inherited from ​

ts
PdfAble(BaseEntity).validatePdfHash