@royalinvest/dto 0.69.20 → 0.71.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,10 +3,10 @@ export interface IInvoiceRenderData {
3
3
  title: string;
4
4
  details: IInvoiceRenderField[][];
5
5
  contacts: IInvoiceRenderField[];
6
- items_table: IInvoiceRenderItemsTable;
7
- subtotal: IInvoiceRenderField;
6
+ items_table: TableData<InvoiceTableDataJSON>;
7
+ subtotal?: IInvoiceRenderField;
8
8
  discount?: IInvoiceRenderField;
9
- taxes: IInvoiceRenderField[];
9
+ taxes?: IInvoiceRenderField[];
10
10
  total: IInvoiceRenderField;
11
11
  message: string[];
12
12
  }
@@ -15,10 +15,6 @@ export interface IInvoiceRenderField {
15
15
  value: string;
16
16
  other_values?: string[];
17
17
  }
18
- export type IInvoiceRenderItemsTable = TableData<IInvoiceItem>;
19
- export interface IInvoiceItem {
20
- description: string[];
21
- quantity: string;
22
- unit_price: string;
23
- total_price: string;
24
- }
18
+ export type InvoiceTableDataJSON = {
19
+ [key: string]: string | string[];
20
+ };
@@ -17,6 +17,7 @@ export declare const RABBITMQ_EXCHANGES: {
17
17
  readonly voided: "notification.voided";
18
18
  readonly generated_certificate: "notification.generated_certificate";
19
19
  readonly generated_invoice: "notification.generated_invoice";
20
+ readonly generated_rent_payment_invoice: "notification.generated_rent_payment_invoice";
20
21
  readonly generated_credit_check_report: "notification.generated_credit_check_report";
21
22
  readonly credit_check_completed: "notification.credit_check_completed";
22
23
  readonly credit_check_failed: "notification.credit_check_failed";
@@ -33,6 +34,7 @@ export declare const RABBITMQ_EXCHANGES: {
33
34
  readonly void: "void";
34
35
  readonly generate_certificate: "generate_certificate";
35
36
  readonly generate_invoice: "generate_invoice";
37
+ readonly generate_invoice_new: "generate_invoice_new";
36
38
  readonly generated_credit_check_report: "generate_credit_check_report";
37
39
  };
38
40
  readonly queues: {
@@ -20,6 +20,7 @@ exports.RABBITMQ_EXCHANGES = {
20
20
  voided: "notification.voided",
21
21
  generated_certificate: "notification.generated_certificate",
22
22
  generated_invoice: "notification.generated_invoice",
23
+ generated_rent_payment_invoice: "notification.generated_rent_payment_invoice",
23
24
  generated_credit_check_report: "notification.generated_credit_check_report",
24
25
  credit_check_completed: "notification.credit_check_completed",
25
26
  credit_check_failed: "notification.credit_check_failed",
@@ -36,6 +37,7 @@ exports.RABBITMQ_EXCHANGES = {
36
37
  void: "void",
37
38
  generate_certificate: "generate_certificate",
38
39
  generate_invoice: "generate_invoice",
40
+ generate_invoice_new: "generate_invoice_new",
39
41
  generated_credit_check_report: "generate_credit_check_report",
40
42
  },
41
43
  queues: {
@@ -41,11 +41,18 @@ export interface IMessageGenerateCertificate {
41
41
  }
42
42
  export interface IMessageGenerateInvoice {
43
43
  billing_id: string;
44
+ billing_name: string;
45
+ billing_email: string;
44
46
  blob_path: string;
45
47
  invoice_number: string;
46
48
  language: string;
47
49
  data: IInvoiceRenderData;
48
50
  }
51
+ export interface IMessageGenerateInvoiceNew {
52
+ blob_path: string;
53
+ data: IInvoiceRenderData;
54
+ language: string;
55
+ }
49
56
  export interface IMessageGenerateCreditCheckReport {
50
57
  report_data: ICreditCheckReportData;
51
58
  subject_id: string;
@@ -30,6 +30,8 @@ export interface IGeneratedCertificateNotification {
30
30
  }
31
31
  export interface IGeneratedInvoiceNotification {
32
32
  billing_id: string;
33
+ billing_name: string;
34
+ billing_email: string;
33
35
  blob_path: string;
34
36
  invoice_number: string;
35
37
  language: string;
@@ -40,3 +42,8 @@ export interface IGeneratedCreditCheckReportNotification {
40
42
  hash: string;
41
43
  language: string;
42
44
  }
45
+ /**
46
+ IMPORTANT
47
+ Please use IMessageBrokerEventWithResponse for communicating data back to sender
48
+ or further the message chain. Add respective notification interface as a local type.
49
+ */
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ IMPORTANT
5
+ Please use IMessageBrokerEventWithResponse for communicating data back to sender
6
+ or further the message chain. Add respective notification interface as a local type.
7
+ */
package/dist/utils.d.ts CHANGED
@@ -5,3 +5,5 @@ export declare function fromMinorUnitsExact(amountMinor: string, currency: Curre
5
5
  export declare function parseMajorToMinor(value: string, currency: CurrencyEnum): string;
6
6
  export declare function resolveLocale(uiLanguage: LocaleType, country?: CountryEnum | null): string;
7
7
  export declare function formatMoney(amountMinor: string, currency: CurrencyEnum, locale: string): string;
8
+ export type DateFormatStyle = "short" | "medium" | "long";
9
+ export declare function formatDate(date: Date | string | number | null | undefined, locale: string, style?: DateFormatStyle): string;
package/dist/utils.js CHANGED
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.fromMinorUnits = fromMinorUnits;
4
7
  exports.fromMinorUnitsExact = fromMinorUnitsExact;
5
8
  exports.parseMajorToMinor = parseMajorToMinor;
6
9
  exports.resolveLocale = resolveLocale;
7
10
  exports.formatMoney = formatMoney;
11
+ exports.formatDate = formatDate;
12
+ const dayjs_1 = __importDefault(require("dayjs"));
8
13
  const config_1 = require("./config");
9
14
  // This is going to be used for web app to show amount in minor taking into account units configured for the currency
10
15
  function fromMinorUnits(amountMinor, currency) {
@@ -60,3 +65,18 @@ function formatMoney(amountMinor, currency, locale) {
60
65
  currencyDisplay: "symbol",
61
66
  }).format(amountMajor);
62
67
  }
68
+ //////// Datetime Utils ////////
69
+ const DATE_FORMATS = {
70
+ short: { year: "numeric", month: "2-digit", day: "2-digit" },
71
+ medium: { year: "numeric", month: "short", day: "2-digit" },
72
+ long: { year: "numeric", month: "long", day: "2-digit" },
73
+ };
74
+ function formatDate(date, locale, style = "medium") {
75
+ if (!date)
76
+ return "—";
77
+ const d = (0, dayjs_1.default)(date);
78
+ if (!d.isValid())
79
+ return "—";
80
+ return new Intl.DateTimeFormat(locale, DATE_FORMATS[style]).format(d.toDate());
81
+ }
82
+ ////////////////////////////////
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@royalinvest/dto",
3
- "version": "0.69.20",
3
+ "version": "0.71.1",
4
4
  "description": "Data Transfer Objects (DTOs) to carry data between frontend and backend processes.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -78,6 +78,7 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "amqplib": "^0.10.3",
81
+ "dayjs": "^1.11.19",
81
82
  "pino": "^9.7.0",
82
83
  "pino-pretty": "^13.0.0",
83
84
  "prom-client": "^15.1.3"
@@ -1 +0,0 @@
1
- export type UILanguage = "en" | "fr" | "de" | "es" | "nl";
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export interface IMessageBrokerEvent<TPayload> {
2
- http_request_id: string;
3
- user_id: string;
4
- payload: TPayload;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,57 +0,0 @@
1
- import { LeaseTypeEnum } from "./enum";
2
- import { ICertificateFormData } from "./certificateFormData";
3
- import { IContractParty } from "./contractParty";
4
- import { IDocumentDrawingInstructions } from "./documentDrawingInstructions";
5
- import { IFileMetadata } from "./fileMetadata";
6
- import { ISignaturePartySigned } from "./signaturePartySigned";
7
- import { IInvoiceRenderData } from "./invoiceRenderData";
8
- import { ICreditCheckReportData } from "./creditCheckReport";
9
- export interface IMessageGenerate {
10
- contract_id: string;
11
- details: JSON;
12
- user_id: string;
13
- template_variant_file_name: string;
14
- template_variant_name: string;
15
- template_variant_language: string;
16
- template_variant_mime_type: string;
17
- template_variant_id: string;
18
- template_name: LeaseTypeEnum;
19
- file_id?: string;
20
- isEdit?: boolean;
21
- contract_parties?: IContractParty[];
22
- drawing_instructions?: IDocumentDrawingInstructions;
23
- metadata?: IFileMetadata;
24
- }
25
- export interface IMessageGenerateSigned {
26
- party: ISignaturePartySigned;
27
- generate_hash?: boolean;
28
- }
29
- export interface IMessageGenerateVoided {
30
- user_id: string;
31
- contract_id: string;
32
- file_id: string;
33
- file_name: string;
34
- notify_party_email: boolean;
35
- generate_hash?: boolean;
36
- }
37
- export interface IMessageGenerateCertificate {
38
- file_id: string;
39
- blob_path: string;
40
- form_data: ICertificateFormData;
41
- form_instructions: JSON;
42
- language: string;
43
- }
44
- export interface IMessageGenerateInvoice {
45
- user_id: string;
46
- billing_id: string;
47
- blob_path: string;
48
- invoice_number: string;
49
- language: string;
50
- data: IInvoiceRenderData;
51
- }
52
- export interface IMessageGenerateCreditCheckReport {
53
- report_data: ICreditCheckReportData;
54
- subject_id: string;
55
- blob_path: string;
56
- language: string;
57
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,45 +0,0 @@
1
- import { IPhysicalFileDetails } from "./physicalFileDetails";
2
- import { IPlaceholderCollection } from "./placeholderCollection";
3
- import { ISignaturePartyBasic } from "./signaturePartyBasic";
4
- export interface IGeneratedNotification {
5
- contract_id: string;
6
- user_id: string;
7
- file_name: string;
8
- file_language: string;
9
- mime_type: string;
10
- template_name: string;
11
- template_variant_id: string;
12
- file_id?: string;
13
- isEdit?: boolean;
14
- generated_placeholders?: IPlaceholderCollection;
15
- generated_file_details?: IPhysicalFileDetails;
16
- }
17
- export interface ISignedNotification {
18
- file_id: string;
19
- party: ISignaturePartyBasic;
20
- generated_file_details?: IPhysicalFileDetails;
21
- }
22
- export interface IVoidedNotification {
23
- user_id: string;
24
- file_id: string;
25
- contract_id: string;
26
- notify_party_email: boolean;
27
- generated_file_details?: IPhysicalFileDetails;
28
- }
29
- export interface IGeneratedCertificateNotification {
30
- file_id: string;
31
- blob_path: string;
32
- }
33
- export interface IGeneratedInvoiceNotification {
34
- user_id: string;
35
- billing_id: string;
36
- blob_path: string;
37
- invoice_number: string;
38
- language: string;
39
- }
40
- export interface IGeneratedCreditCheckReportNotification {
41
- subject_id: string;
42
- blob_path: string;
43
- hash: string;
44
- language: string;
45
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });