SudoSOS Back-end API / invoicing / Invoice
Class: Invoice ​
Extends ​
PdfAbleClass<typeofBaseEntity,this> &BaseEntity<this>
Constructors ​
Constructor ​
ts
new Invoice(): Invoice;Returns ​
Invoice
Inherited from ​
ts
PdfAble(BaseEntity).constructorProperties ​
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
addressee | public | string | Name of the addressed | - | - |
attention | public | string | Special attention to the addressee | - | - |
city | public | string | City to use on the invoice | - | - |
country | public | string | Country to use on the invoice | - | - |
createdAt | readonly | Date | - | - | PdfAble(BaseEntity).createdAt |
creditTransfer? | public | Transfer | If this invoice is deleted, this will be credit transfer. | - | - |
creditTransferId? | public | number | - | - | - |
date | public | Date | Date of the invoice | - | - |
description | public | string | The description of the invoice | - | - |
id | readonly | number | - | - | PdfAble(BaseEntity).id |
invoiceStatus | public | InvoiceStatus[] | The status history of the invoice | - | - |
pdf? | public | InvoicePdf | The PDF file onDelete: 'CASCADE' is not possible here, because removing the pdf from the database will not remove it from storage | PdfAble(BaseEntity).pdf | - |
pdfId? | public | number | The ID of the PDF file | PdfAble(BaseEntity).pdfId | - |
pdfService | public | InvoicePdfService | The service that creates the Pdf file. Can be either a byte-producing service plus optionally a stored-entity service. | PdfAble(BaseEntity).pdfService | - |
postalCode | public | string | Postal code to use on the invoice | - | - |
reference | public | string | The reference of the invoice | - | - |
street | public | string | Street to use on the invoice | - | - |
subTransactionRows | public | SubTransactionRow[] | - | - | - |
subTransactionRowsDeletedInvoice | public | SubTransactionRow[] | - | - | - |
to | public | User | The account for whom the invoice is | - | - |
toId | public | number | The ID of the account for whom the invoice is | - | - |
transfer | public | Transfer | The transfer entity representing the invoice. | - | - |
updatedAt | readonly | Date | - | - | PdfAble(BaseEntity).updatedAt |
version | readonly | number | - | - | 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).createPdfgetOrCreatePdf() ​
ts
getOrCreatePdf(force?): Promise<Pdf>;Get the Pdf file. If the Pdf file is not current, create it.
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
force | boolean | false | If true, always create the Pdf file. |
Returns ​
Promise<Pdf>
Inherited from ​
ts
PdfAble(BaseEntity).getOrCreatePdfgetOwner() ​
ts
getOwner(): Promise<User>;Get the owner of the Pdf file.
Returns ​
Promise<User>
Overrides ​
ts
PdfAble(BaseEntity).getOwnergetPdfParamHash() ​
ts
getPdfParamHash(): Promise<string>;Get the hash of the parameters of the Pdf file.
Returns ​
Promise<string>
Inherited from ​
ts
PdfAble(BaseEntity).getPdfParamHashvalidatePdfHash() ​
ts
validatePdfHash(): Promise<boolean>;Validates if the Pdf matches the stored hash.
Returns ​
Promise<boolean>
Inherited from ​
ts
PdfAble(BaseEntity).validatePdfHash