@abyss-project/main 11.8.0 → 12.0.0

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.
Files changed (88) hide show
  1. package/dist/api/billing-account.admin.api.d.ts +7 -2
  2. package/dist/api/billing-account.admin.api.js +21 -1
  3. package/dist/api/billing-account.admin.api.js.map +1 -1
  4. package/dist/api/organization-billing.api.d.ts +4 -2
  5. package/dist/api/organization-billing.api.js +9 -1
  6. package/dist/api/organization-billing.api.js.map +1 -1
  7. package/dist/api/user-billing.api.d.ts +4 -1
  8. package/dist/api/user-billing.api.js +11 -1
  9. package/dist/api/user-billing.api.js.map +1 -1
  10. package/dist/billing-metric-label/billing-metric-label.labels.d.ts +115 -0
  11. package/dist/billing-metric-label/billing-metric-label.labels.js +119 -0
  12. package/dist/billing-metric-label/billing-metric-label.labels.js.map +1 -0
  13. package/dist/billing-metric-label/index.d.ts +1 -0
  14. package/dist/billing-metric-label/index.js +18 -0
  15. package/dist/billing-metric-label/index.js.map +1 -0
  16. package/dist/constants/commercial-gesture.constants.d.ts +2 -0
  17. package/dist/constants/commercial-gesture.constants.js +6 -0
  18. package/dist/constants/commercial-gesture.constants.js.map +1 -0
  19. package/dist/constants/index.d.ts +1 -0
  20. package/dist/constants/index.js +1 -0
  21. package/dist/constants/index.js.map +1 -1
  22. package/dist/index.d.ts +10 -0
  23. package/dist/index.js +10 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/translate/en.translate.d.ts +12 -0
  26. package/dist/translate/en.translate.js +12 -0
  27. package/dist/translate/en.translate.js.map +1 -1
  28. package/dist/translate/fr.translate.d.ts +12 -0
  29. package/dist/translate/fr.translate.js +12 -0
  30. package/dist/translate/fr.translate.js.map +1 -1
  31. package/dist/types/enum/abyss-application-event.enum.d.ts +3 -1
  32. package/dist/types/enum/abyss-application-event.enum.js +3 -1
  33. package/dist/types/enum/abyss-application-event.enum.js.map +1 -1
  34. package/dist/types/enum/api-error.enum.d.ts +7 -0
  35. package/dist/types/enum/api-error.enum.js +7 -0
  36. package/dist/types/enum/api-error.enum.js.map +1 -1
  37. package/dist/types/enum/email-type.enum.d.ts +3 -0
  38. package/dist/types/enum/email-type.enum.js +3 -0
  39. package/dist/types/enum/email-type.enum.js.map +1 -1
  40. package/dist/types/enum/organization-billing.enum.d.ts +48 -2
  41. package/dist/types/enum/organization-billing.enum.js +64 -3
  42. package/dist/types/enum/organization-billing.enum.js.map +1 -1
  43. package/dist/types/enum/support-ticket.enum.d.ts +1 -0
  44. package/dist/types/enum/support-ticket.enum.js +2 -0
  45. package/dist/types/enum/support-ticket.enum.js.map +1 -1
  46. package/dist/types/enum/user-notification-category.enum.js +3 -0
  47. package/dist/types/enum/user-notification-category.enum.js.map +1 -1
  48. package/dist/types/enum/user-notification-content-type.enum.d.ts +31 -0
  49. package/dist/types/enum/user-notification-content-type.enum.js +4 -1
  50. package/dist/types/enum/user-notification-content-type.enum.js.map +1 -1
  51. package/dist/types/interface/api/requests/billing-account.admin.request.d.ts +39 -1
  52. package/dist/types/interface/api/requests/organization-billing.request.d.ts +8 -0
  53. package/dist/types/interface/api/requests/user-billing.request.d.ts +6 -0
  54. package/dist/types/interface/api/responses/billing-account.admin.response.d.ts +47 -1
  55. package/dist/types/interface/api/responses/billing-estimate.response.d.ts +13 -1
  56. package/dist/types/interface/api/responses/organization-billing.response.d.ts +19 -2
  57. package/dist/types/interface/api/responses/user-billing.response.d.ts +2 -2
  58. package/dist/types/interface/index.d.ts +3 -0
  59. package/dist/types/interface/index.js +3 -0
  60. package/dist/types/interface/index.js.map +1 -1
  61. package/dist/types/interface/models/commercial-gesture.model.d.ts +39 -0
  62. package/dist/types/interface/models/commercial-gesture.model.js +3 -0
  63. package/dist/types/interface/models/commercial-gesture.model.js.map +1 -0
  64. package/dist/types/interface/models/credit-note.model.d.ts +17 -0
  65. package/dist/types/interface/models/credit-note.model.js +3 -0
  66. package/dist/types/interface/models/credit-note.model.js.map +1 -0
  67. package/dist/types/interface/models/index.d.ts +3 -0
  68. package/dist/types/interface/models/index.js +3 -0
  69. package/dist/types/interface/models/index.js.map +1 -1
  70. package/dist/types/interface/models/invoice-line.model.d.ts +25 -0
  71. package/dist/types/interface/models/invoice-line.model.js +3 -0
  72. package/dist/types/interface/models/invoice-line.model.js.map +1 -0
  73. package/dist/types/interface/models/invoice.model.d.ts +16 -1
  74. package/dist/utils/index.d.ts +1 -0
  75. package/dist/utils/index.js +1 -0
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/utils/invoice-amounts.utils.d.ts +9 -8
  78. package/dist/utils/invoice-amounts.utils.js +30 -12
  79. package/dist/utils/invoice-amounts.utils.js.map +1 -1
  80. package/dist/utils/invoice-line-label.utils.d.ts +26 -0
  81. package/dist/utils/invoice-line-label.utils.js +125 -0
  82. package/dist/utils/invoice-line-label.utils.js.map +1 -0
  83. package/dist/utils/tests/invoice-amounts.utils.spec.js +173 -92
  84. package/dist/utils/tests/invoice-amounts.utils.spec.js.map +1 -1
  85. package/dist/utils/tests/invoice-line-label.utils.spec.d.ts +1 -0
  86. package/dist/utils/tests/invoice-line-label.utils.spec.js +108 -0
  87. package/dist/utils/tests/invoice-line-label.utils.spec.js.map +1 -0
  88. package/package.json +8 -1
@@ -0,0 +1,39 @@
1
+ import { CommercialGestureDestination, CommercialGestureMode, CommercialGestureReason, CommercialGestureStatus } from '../../enum';
2
+ import type { IBillingAccount } from './billing-account.model';
3
+ import type { ICreditNote } from './credit-note.model';
4
+ import type { IInvoice } from './invoice.model';
5
+ import type { IInvoiceLine } from './invoice-line.model';
6
+ export interface ICommercialGesture {
7
+ id?: string;
8
+ billingAccountId: string;
9
+ invoiceId: string;
10
+ mode: CommercialGestureMode;
11
+ amountEurCents: number;
12
+ requestedPercent?: number | null;
13
+ reason: CommercialGestureReason;
14
+ internalComment: string | null;
15
+ customerMessage: string | null;
16
+ destination: CommercialGestureDestination;
17
+ status: CommercialGestureStatus;
18
+ failureReason: string | null;
19
+ grantedByAdminId: string;
20
+ supportTicketId: string | null;
21
+ idempotencyKey: string;
22
+ creditNoteId: string | null;
23
+ updatedAt?: Date;
24
+ createdAt?: Date;
25
+ billingAccount?: IBillingAccount;
26
+ invoice?: IInvoice;
27
+ lines?: ICommercialGestureLine[];
28
+ creditNote?: ICreditNote | null;
29
+ }
30
+ export interface ICommercialGestureLine {
31
+ id?: string;
32
+ gestureId: string;
33
+ invoiceLineId: string;
34
+ amountEurCents: number;
35
+ updatedAt?: Date;
36
+ createdAt?: Date;
37
+ gesture?: ICommercialGesture;
38
+ invoiceLine?: IInvoiceLine;
39
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=commercial-gesture.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commercial-gesture.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/commercial-gesture.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { CommercialGestureDestination } from '../../enum';
2
+ import type { IBillingAccount } from './billing-account.model';
3
+ import type { IInvoice } from './invoice.model';
4
+ export interface ICreditNote {
5
+ id?: string;
6
+ number: string;
7
+ invoiceId: string;
8
+ billingAccountId: string;
9
+ amountEurCents: number;
10
+ destination: CommercialGestureDestination;
11
+ stripeCreditNoteId: string;
12
+ issuedAt: Date;
13
+ updatedAt?: Date;
14
+ createdAt?: Date;
15
+ invoice?: IInvoice;
16
+ billingAccount?: IBillingAccount;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=credit-note.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credit-note.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/credit-note.model.ts"],"names":[],"mappings":""}
@@ -23,6 +23,9 @@ export * from './organization-service-quota.model';
23
23
  export * from './organization-project-quota.model';
24
24
  export * from './usage-record.model';
25
25
  export * from './invoice.model';
26
+ export * from './invoice-line.model';
27
+ export * from './commercial-gesture.model';
28
+ export * from './credit-note.model';
26
29
  export * from './credit-transaction.model';
27
30
  export * from './eur-transaction.model';
28
31
  export * from './organization-quota-alert.model';
@@ -39,6 +39,9 @@ __exportStar(require("./organization-service-quota.model"), exports);
39
39
  __exportStar(require("./organization-project-quota.model"), exports);
40
40
  __exportStar(require("./usage-record.model"), exports);
41
41
  __exportStar(require("./invoice.model"), exports);
42
+ __exportStar(require("./invoice-line.model"), exports);
43
+ __exportStar(require("./commercial-gesture.model"), exports);
44
+ __exportStar(require("./credit-note.model"), exports);
42
45
  __exportStar(require("./credit-transaction.model"), exports);
43
46
  __exportStar(require("./eur-transaction.model"), exports);
44
47
  __exportStar(require("./organization-quota-alert.model"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,qEAAmD;AACnD,sDAAoC;AACpC,4DAA0C;AAC1C,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,4DAA0C;AAC1C,6DAA2C;AAG3C,oDAAkC;AAClC,+DAA6C;AAG7C,gDAA8B;AAG9B,iDAA+B;AAG/B,uDAAqC;AACrC,mEAAiD;AACjD,8DAA4C;AAG5C,wDAAsC;AACtC,0DAAwC;AACxC,gEAA8C;AAC9C,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,8DAA4C;AAC5C,+CAA6B;AAC7B,sDAAoC;AACpC,8DAA4C;AAC5C,0EAAwD;AACxD,0DAAwC;AACxC,6EAA2D;AAG3D,2DAAyC;AAGzC,4DAA0C;AAG1C,wDAAsC;AAGtC,yDAAuC;AACvC,iEAA+C;AAC/C,oEAAkD;AAClD,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAGhD,qDAAmC;AAGnC,qDAAmC;AAGnC,8DAA4C;AAG5C,8DAA4C;AAG5C,2DAAyC;AAGzC,0DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,qEAAmD;AACnD,sDAAoC;AACpC,4DAA0C;AAC1C,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,4DAA0C;AAC1C,6DAA2C;AAG3C,oDAAkC;AAClC,+DAA6C;AAG7C,gDAA8B;AAG9B,iDAA+B;AAG/B,uDAAqC;AACrC,mEAAiD;AACjD,8DAA4C;AAG5C,wDAAsC;AACtC,0DAAwC;AACxC,gEAA8C;AAC9C,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,uDAAqC;AACrC,6DAA2C;AAC3C,sDAAoC;AACpC,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,8DAA4C;AAC5C,+CAA6B;AAC7B,sDAAoC;AACpC,8DAA4C;AAC5C,0EAAwD;AACxD,0DAAwC;AACxC,6EAA2D;AAG3D,2DAAyC;AAGzC,4DAA0C;AAG1C,wDAAsC;AAGtC,yDAAuC;AACvC,iEAA+C;AAC/C,oEAAkD;AAClD,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAGhD,qDAAmC;AAGnC,qDAAmC;AAGnC,8DAA4C;AAG5C,8DAA4C;AAG5C,2DAAyC;AAGzC,0DAAwC"}
@@ -0,0 +1,25 @@
1
+ import { BillingMetric, BillingService, InvoiceLineType } from '../../enum';
2
+ import { BillingModuleId } from '../../../constants/module-catalog.constants';
3
+ import type { PlanNameKey } from '../../../plan-name/plan-name.utils';
4
+ import type { IInvoice } from './invoice.model';
5
+ export interface IInvoiceLine {
6
+ id?: string;
7
+ invoiceId: string;
8
+ position: number;
9
+ type: InvoiceLineType;
10
+ label: string;
11
+ amountEurCents: number;
12
+ quantity: number | null;
13
+ unitPriceEur: number | null;
14
+ service: BillingService | null;
15
+ metric: BillingMetric | null;
16
+ moduleId: BillingModuleId | null;
17
+ planNameKey: PlanNameKey | null;
18
+ periodStart: Date | null;
19
+ periodEnd: Date | null;
20
+ proration: boolean;
21
+ stripeInvoiceLineItemId: string | null;
22
+ updatedAt?: Date;
23
+ createdAt?: Date;
24
+ invoice?: IInvoice;
25
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=invoice-line.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-line.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/invoice-line.model.ts"],"names":[],"mappings":""}
@@ -1,8 +1,16 @@
1
- import { InvoiceStatus, InvoiceType, OrganizationLegalForm } from '../../enum';
1
+ import { CommercialGestureRequestBasis, InvoiceStatus, InvoiceType, OrganizationLegalForm } from '../../enum';
2
2
  import { IBillingAccount, IBillingAddress } from './billing-account.model';
3
3
  import { IUsageRecord } from './usage-record.model';
4
4
  import type { ICreditTransaction } from './credit-transaction.model';
5
5
  import type { IEurTransaction } from './eur-transaction.model';
6
+ import type { IInvoiceLine } from './invoice-line.model';
7
+ import type { ICommercialGesture } from './commercial-gesture.model';
8
+ import type { ICreditNote } from './credit-note.model';
9
+ export interface IInvoiceCommercialGestureRequest {
10
+ eligible: boolean;
11
+ basis: CommercialGestureRequestBasis | null;
12
+ ticketId: string | null;
13
+ }
6
14
  export interface IInvoice {
7
15
  id?: string;
8
16
  billingAccountId: string;
@@ -15,10 +23,13 @@ export interface IInvoice {
15
23
  overageTotalEur: number;
16
24
  totalEur: number;
17
25
  stripeInvoiceId: string | null;
26
+ stripeInvoiceNumber: string | null;
18
27
  stripeInvoiceUrl: string | null;
19
28
  stripePaymentIntentId: string | null;
20
29
  dueDate: Date | null;
21
30
  paidAt: Date | null;
31
+ nextCollectAttemptAt: Date | null;
32
+ collectAttemptCount: number;
22
33
  metadata: Record<string, unknown>;
23
34
  billingName: string | null;
24
35
  billingEmail: string | null;
@@ -32,4 +43,8 @@ export interface IInvoice {
32
43
  usageRecords?: IUsageRecord[];
33
44
  creditTransactions?: ICreditTransaction[];
34
45
  eurTransactions?: IEurTransaction[];
46
+ lines?: IInvoiceLine[];
47
+ commercialGestures?: ICommercialGesture[];
48
+ creditNotes?: ICreditNote[];
49
+ commercialGestureRequest?: IInvoiceCommercialGestureRequest;
35
50
  }
@@ -22,6 +22,7 @@ export * from './pricing-calculator.utils';
22
22
  export * from './content-share-scope.utils';
23
23
  export * from './invitation.utils';
24
24
  export * from './invoice-amounts.utils';
25
+ export * from './invoice-line-label.utils';
25
26
  export * from './resolve-user.utils';
26
27
  export * from './pricing.utils';
27
28
  export * from './plan-capacity.utils';
@@ -38,6 +38,7 @@ __exportStar(require("./pricing-calculator.utils"), exports);
38
38
  __exportStar(require("./content-share-scope.utils"), exports);
39
39
  __exportStar(require("./invitation.utils"), exports);
40
40
  __exportStar(require("./invoice-amounts.utils"), exports);
41
+ __exportStar(require("./invoice-line-label.utils"), exports);
41
42
  __exportStar(require("./resolve-user.utils"), exports);
42
43
  __exportStar(require("./pricing.utils"), exports);
43
44
  __exportStar(require("./plan-capacity.utils"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,uDAAqC;AAIrC,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,6DAA2C;AAC3C,uDAAqC;AAIrC,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C"}
@@ -1,9 +1,10 @@
1
1
  import type { IInvoice } from '../types/interface';
2
- export type InvoiceAmounts = {
3
- grossEur: number;
4
- overageEur: number;
5
- creditUsed: number;
6
- eurWalletUsed: number;
7
- netTotalEur: number;
8
- };
9
- export declare const computeInvoiceAmounts: (invoice: IInvoice) => InvoiceAmounts;
2
+ export interface IInvoiceAmounts {
3
+ grossEurCents: number;
4
+ deductionsEurCents: number;
5
+ gesturesEurCents: number;
6
+ netEurCents: number;
7
+ paidEurCents: number;
8
+ remainingEurCents: number;
9
+ }
10
+ export declare const computeInvoiceAmounts: (invoice: IInvoice) => IInvoiceAmounts;
@@ -2,20 +2,38 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.computeInvoiceAmounts = void 0;
4
4
  const enum_1 = require("../types/enum");
5
+ const OWED_STATUSES = new Set([
6
+ enum_1.InvoiceStatus.OPEN,
7
+ enum_1.InvoiceStatus.UNCOLLECTIBLE,
8
+ ]);
5
9
  const computeInvoiceAmounts = (invoice) => {
6
- const creditUsed = (invoice.creditTransactions ?? [])
7
- .filter((t) => t.amount < 0)
8
- .reduce((sum, t) => sum + Math.abs(t.amount), 0);
9
- const eurWalletUsed = (invoice.eurTransactions ?? [])
10
- .filter((t) => t.amount < 0 && t.type === enum_1.EurTransactionType.INVOICE_DEDUCTION)
11
- .reduce((sum, t) => sum + Math.abs(t.amount), 0);
12
- const netSubtotal = invoice.subtotalEur ?? invoice.totalEur;
10
+ let grossEurCents = 0;
11
+ let deductionsEurCents = 0;
12
+ for (const line of invoice.lines ?? []) {
13
+ if (enum_1.INVOICE_DEDUCTION_LINE_TYPES.includes(line.type)) {
14
+ deductionsEurCents -= line.amountEurCents;
15
+ }
16
+ else {
17
+ grossEurCents += line.amountEurCents;
18
+ }
19
+ }
20
+ const applied = (invoice.commercialGestures ?? []).filter((gesture) => gesture.status === enum_1.CommercialGestureStatus.APPLIED);
21
+ const gesturesEurCents = applied.reduce((sum, gesture) => sum + gesture.amountEurCents, 0);
22
+ const reducedBeforePaymentEurCents = applied
23
+ .filter((gesture) => gesture.destination === enum_1.CommercialGestureDestination.REDUCE_AMOUNT_DUE)
24
+ .reduce((sum, gesture) => sum + gesture.amountEurCents, 0);
25
+ const netEurCents = grossEurCents - deductionsEurCents - gesturesEurCents;
26
+ const paidEurCents = invoice.status === enum_1.InvoiceStatus.PAID
27
+ ? grossEurCents - deductionsEurCents - reducedBeforePaymentEurCents
28
+ : 0;
29
+ const remainingEurCents = OWED_STATUSES.has(invoice.status) ? Math.max(0, netEurCents) : 0;
13
30
  return {
14
- grossEur: netSubtotal + creditUsed + eurWalletUsed,
15
- overageEur: invoice.overageTotalEur ?? 0,
16
- creditUsed,
17
- eurWalletUsed,
18
- netTotalEur: invoice.totalEur,
31
+ grossEurCents,
32
+ deductionsEurCents,
33
+ gesturesEurCents,
34
+ netEurCents,
35
+ paidEurCents,
36
+ remainingEurCents,
19
37
  };
20
38
  };
21
39
  exports.computeInvoiceAmounts = computeInvoiceAmounts;
@@ -1 +1 @@
1
- {"version":3,"file":"invoice-amounts.utils.js","sourceRoot":"","sources":["../../src/utils/invoice-amounts.utils.ts"],"names":[],"mappings":";;;AAAA,wCAAmD;AAiC5C,MAAM,qBAAqB,GAAG,CAAC,OAAiB,EAAkB,EAAE;IACzE,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,kBAAkB,IAAI,EAAE,CAAC;SAClD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SAC3B,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnD,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;SAClD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,yBAAkB,CAAC,iBAAiB,CAAC;SAC9E,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;IAE5D,OAAO;QACL,QAAQ,EAAE,WAAW,GAAG,UAAU,GAAG,aAAa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AA4B,CAAC,iBAAiB,CAAC;SAC3F,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IAE7D,MAAM,WAAW,GAAG,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;IAC1E,MAAM,YAAY,GAChB,OAAO,CAAC,MAAM,KAAK,oBAAa,CAAC,IAAI;QACnC,CAAC,CAAC,aAAa,GAAG,kBAAkB,GAAG,4BAA4B;QACnE,CAAC,CAAC,CAAC,CAAC;IACR,MAAM,iBAAiB,GAAG,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3F,OAAO;QACL,aAAa;QACb,kBAAkB;QAClB,gBAAgB;QAChB,WAAW;QACX,YAAY;QACZ,iBAAiB;KAClB,CAAC;AACJ,CAAC,CAAC;AAlCW,QAAA,qBAAqB,yBAkChC"}
@@ -0,0 +1,26 @@
1
+ import { BillingModuleId } from '../constants/module-catalog.constants';
2
+ import type { PlanNameKey } from '../plan-name/plan-name.utils';
3
+ import { BillingMetric, BillingService, InvoiceLineType } from '../types/enum/organization-billing.enum';
4
+ import { UserLanguage } from '../types/enum/user-language.enum';
5
+ export declare const formatOverageLineLabel: (line: {
6
+ metric: BillingMetric | null;
7
+ quantity: number | null;
8
+ }, language: UserLanguage) => string;
9
+ export declare const formatInvoiceUnitPrice: (unitPriceEur: number, locale: string) => string;
10
+ export declare const BILLING_SERVICE_NAMES: Record<BillingService, string>;
11
+ export declare const formatOverageLineName: (line: {
12
+ metric: BillingMetric | null;
13
+ service: BillingService | null;
14
+ }, language: UserLanguage) => string | null;
15
+ export type PlanLineType = InvoiceLineType.SUBSCRIPTION | InvoiceLineType.PLAN_UPGRADE | InvoiceLineType.MODULE;
16
+ export declare const isPlanLineType: (type: InvoiceLineType) => type is PlanLineType;
17
+ export type PlanLineLabelFields = {
18
+ type: PlanLineType;
19
+ amountEurCents: number;
20
+ planNameKey: PlanNameKey | null;
21
+ moduleId: BillingModuleId | null;
22
+ proration: boolean;
23
+ periodStart: Date | null;
24
+ periodEnd: Date | null;
25
+ };
26
+ export declare const formatPlanLineLabel: (line: PlanLineLabelFields, language: UserLanguage) => string;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatPlanLineLabel = exports.isPlanLineType = exports.formatOverageLineName = exports.BILLING_SERVICE_NAMES = exports.formatInvoiceUnitPrice = exports.formatOverageLineLabel = void 0;
4
+ const billing_metric_label_labels_1 = require("../billing-metric-label/billing-metric-label.labels");
5
+ const module_catalog_constants_1 = require("../constants/module-catalog.constants");
6
+ const plan_name_labels_1 = require("../plan-name/plan-name.labels");
7
+ const organization_billing_enum_1 = require("../types/enum/organization-billing.enum");
8
+ const user_language_enum_1 = require("../types/enum/user-language.enum");
9
+ const user_language_utils_1 = require("./user-language.utils");
10
+ const OVERAGE_WORD = {
11
+ [user_language_enum_1.UserLanguage.FRENCH]: 'Dépassement',
12
+ [user_language_enum_1.UserLanguage.ENGLISH]: 'Overage',
13
+ };
14
+ const formatOverageLineLabel = (line, language) => {
15
+ if (!line.metric) {
16
+ return OVERAGE_WORD[language];
17
+ }
18
+ const label = `${OVERAGE_WORD[language]} — ${(0, billing_metric_label_labels_1.billingMetricLabel)(line.metric, language)}`;
19
+ if (line.quantity === null) {
20
+ return label;
21
+ }
22
+ const quantity = new Intl.NumberFormat((0, user_language_utils_1.userLanguageToLocale)(language), {
23
+ maximumFractionDigits: 2,
24
+ }).format(line.quantity);
25
+ return `${label} × ${quantity}`;
26
+ };
27
+ exports.formatOverageLineLabel = formatOverageLineLabel;
28
+ const UNIT_PRICE_SIGNIFICANT_DIGITS = 6;
29
+ const formatInvoiceUnitPrice = (unitPriceEur, locale) => {
30
+ const magnitude = unitPriceEur === 0 ? 0 : Math.floor(Math.log10(Math.abs(unitPriceEur)));
31
+ const fractionDigits = Math.min(20, Math.max(2, UNIT_PRICE_SIGNIFICANT_DIGITS - 1 - magnitude));
32
+ return new Intl.NumberFormat(locale, {
33
+ style: 'currency',
34
+ currency: 'EUR',
35
+ minimumFractionDigits: 2,
36
+ maximumFractionDigits: fractionDigits,
37
+ }).format(unitPriceEur);
38
+ };
39
+ exports.formatInvoiceUnitPrice = formatInvoiceUnitPrice;
40
+ exports.BILLING_SERVICE_NAMES = {
41
+ [organization_billing_enum_1.BillingService.ABYSS_PLATFORM]: 'AbyssProject',
42
+ [organization_billing_enum_1.BillingService.ABYSS_STORAGE]: 'AbyssStorage',
43
+ [organization_billing_enum_1.BillingService.ABYSS_MONITOR]: 'AbyssMonitor',
44
+ [organization_billing_enum_1.BillingService.ABYSS_CLOUD]: 'AbyssCloud',
45
+ [organization_billing_enum_1.BillingService.ABYSS_CRYPT]: 'AbyssCrypt',
46
+ [organization_billing_enum_1.BillingService.ABYSS_FORM]: 'AbyssForm',
47
+ [organization_billing_enum_1.BillingService.ABYSS_TOOLS]: 'AbyssTools',
48
+ [organization_billing_enum_1.BillingService.ABYSS_SPOTLIGHT]: 'AbyssSpotlight',
49
+ [organization_billing_enum_1.BillingService.ABYSS_TRAINING]: 'AbyssTraining',
50
+ [organization_billing_enum_1.BillingService.ABYSS_MEMORIES]: 'AbyssMemories',
51
+ [organization_billing_enum_1.BillingService.ABYSS_BANKING]: 'AbyssBanking',
52
+ };
53
+ const formatOverageLineName = (line, language) => {
54
+ if (!line.metric) {
55
+ return null;
56
+ }
57
+ const metric = (0, billing_metric_label_labels_1.billingMetricLabel)(line.metric, language) ?? line.metric;
58
+ if (!line.service) {
59
+ return metric;
60
+ }
61
+ return `${metric} · ${exports.BILLING_SERVICE_NAMES[line.service] ?? line.service}`;
62
+ };
63
+ exports.formatOverageLineName = formatOverageLineName;
64
+ const PLAN_LINE_TYPES = new Set([
65
+ organization_billing_enum_1.InvoiceLineType.SUBSCRIPTION,
66
+ organization_billing_enum_1.InvoiceLineType.PLAN_UPGRADE,
67
+ organization_billing_enum_1.InvoiceLineType.MODULE,
68
+ ]);
69
+ const isPlanLineType = (type) => PLAN_LINE_TYPES.has(type);
70
+ exports.isPlanLineType = isPlanLineType;
71
+ const PLAN_LINE_WORDS = {
72
+ [user_language_enum_1.UserLanguage.FRENCH]: {
73
+ subscription: (plan) => (plan ? `Abonnement ${plan}` : 'Abonnement'),
74
+ planChange: (plan) => (plan ? `Passage à l’abonnement ${plan}` : 'Changement de plan'),
75
+ module: (module) => (module ? `Module ${module}` : 'Module'),
76
+ remainingTime: (subject) => `Temps restant sur ${subject}`,
77
+ unusedTime: (subject) => `Temps non utilisé sur ${subject}`,
78
+ planSubject: (plan) => (plan ? `l’abonnement ${plan}` : 'l’abonnement'),
79
+ moduleSubject: (module) => (module ? `le module ${module}` : 'le module'),
80
+ period: (start, end) => `du ${start} au ${end}`,
81
+ },
82
+ [user_language_enum_1.UserLanguage.ENGLISH]: {
83
+ subscription: (plan) => (plan ? `${plan} subscription` : 'Subscription'),
84
+ planChange: (plan) => (plan ? `Upgrade to the ${plan} subscription` : 'Plan change'),
85
+ module: (module) => (module ? `${module} module` : 'Module'),
86
+ remainingTime: (subject) => `Remaining time on ${subject}`,
87
+ unusedTime: (subject) => `Unused time on ${subject}`,
88
+ planSubject: (plan) => (plan ? `the ${plan} subscription` : 'the subscription'),
89
+ moduleSubject: (module) => (module ? `the ${module} module` : 'the module'),
90
+ period: (start, end) => `from ${start} to ${end}`,
91
+ },
92
+ };
93
+ const formatPlanLineLabel = (line, language) => {
94
+ const words = PLAN_LINE_WORDS[language];
95
+ const plan = line.planNameKey ? plan_name_labels_1.PLAN_NAME_LABELS[language][line.planNameKey] ?? null : null;
96
+ const module = line.moduleId ? (0, module_catalog_constants_1.moduleById)(line.moduleId)?.label ?? null : null;
97
+ const isModule = line.type === organization_billing_enum_1.InvoiceLineType.MODULE;
98
+ let label;
99
+ if (line.proration) {
100
+ const subject = isModule ? words.moduleSubject(module) : words.planSubject(plan);
101
+ label = line.amountEurCents < 0 ? words.unusedTime(subject) : words.remainingTime(subject);
102
+ }
103
+ else if (isModule) {
104
+ label = words.module(module);
105
+ }
106
+ else if (line.type === organization_billing_enum_1.InvoiceLineType.PLAN_UPGRADE) {
107
+ label = words.planChange(plan);
108
+ }
109
+ else {
110
+ label = words.subscription(plan);
111
+ }
112
+ if (!line.periodStart || !line.periodEnd) {
113
+ return label;
114
+ }
115
+ const date = new Intl.DateTimeFormat((0, user_language_utils_1.userLanguageToLocale)(language), {
116
+ day: 'numeric',
117
+ month: 'short',
118
+ year: 'numeric',
119
+ timeZone: 'UTC',
120
+ });
121
+ const period = words.period(date.format(new Date(line.periodStart)), date.format(new Date(line.periodEnd)));
122
+ return `${label} (${period})`;
123
+ };
124
+ exports.formatPlanLineLabel = formatPlanLineLabel;
125
+ //# sourceMappingURL=invoice-line-label.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-line-label.utils.js","sourceRoot":"","sources":["../../src/utils/invoice-line-label.utils.ts"],"names":[],"mappings":";;;AAAA,qGAAyF;AACzF,oFAAoF;AACpF,oEAAiE;AAEjE,uFAIiD;AACjD,yEAAgE;AAChE,+DAA6D;AAE7D,MAAM,YAAY,GAAiC;IACjD,CAAC,iCAAY,CAAC,MAAM,CAAC,EAAE,aAAa;IACpC,CAAC,iCAAY,CAAC,OAAO,CAAC,EAAE,SAAS;CAClC,CAAC;AASK,MAAM,sBAAsB,GAAG,CACpC,IAA+D,EAC/D,QAAsB,EACd,EAAE;IACV,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,MAAM,IAAA,gDAAkB,EAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAA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