@vulog/aima-billing 1.1.76 → 1.1.77

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.
package/dist/index.d.mts CHANGED
@@ -13,6 +13,45 @@ type ChargeProductInfo = {
13
13
  chargeProductRequestId?: string;
14
14
  };
15
15
  type Invoice = {
16
+ id: string;
17
+ sequence: number;
18
+ refundSequence?: number;
19
+ userId: string;
20
+ pricingId?: string;
21
+ tripId?: string;
22
+ invoiceDate: string;
23
+ updateDate: string;
24
+ fleetId: string;
25
+ invoiceYear: number;
26
+ invoicesStatus: 'PENDING' | 'PAID' | 'REFUSED' | 'ERROR' | 'REFUNDED' | 'CANCELLED' | 'PENDING_EXTERNAL_PAYMENT' | 'PENDING_MANUAL_PAYMENT' | 'PENDING_AUTHENTICATION' | 'MOP_MISSING';
27
+ amount: number;
28
+ productId?: string;
29
+ currency: string;
30
+ serviceId?: string;
31
+ tokenId?: string;
32
+ entityId: string;
33
+ amountPayWithSystemCredit?: number;
34
+ attempts: number;
35
+ pspName?: string;
36
+ pspReference: string;
37
+ withTaxRefundAmount: number;
38
+ isRefunded?: boolean;
39
+ paymentInProgress: boolean;
40
+ subscriptionId?: string;
41
+ paymentDate?: string;
42
+ externalPaymentRequesterId?: string;
43
+ externalPaymentNotes?: string;
44
+ isPaidExternally?: boolean;
45
+ refundInProgress?: boolean;
46
+ originId?: string;
47
+ originRole?: string;
48
+ pspIdempotency: string;
49
+ paidExternally?: boolean;
50
+ refunded?: boolean;
51
+ productTaxIncluded?: boolean;
52
+ pspReferencePreAuth?: string;
53
+ amountPreAuth?: number;
54
+ preAuthEnabled?: boolean;
16
55
  [key: string]: any;
17
56
  };
18
57
  type Credit = {
@@ -42,4 +81,6 @@ interface Payload extends Omit<Credit, 'id' | 'availableAmount' | 'usedAmount' |
42
81
  }
43
82
  declare const addCredits: (client: Client, payload: Payload) => Promise<Credit>;
44
83
 
45
- export { type ChargeProductInfo, type Credit, type Invoice, addCredits, chargeProduct, getUserCreditsByEntityId };
84
+ declare const getInvoiceById: (client: Client, id: string) => Promise<Invoice>;
85
+
86
+ export { type ChargeProductInfo, type Credit, type Invoice, addCredits, chargeProduct, getInvoiceById, getUserCreditsByEntityId };
package/dist/index.d.ts CHANGED
@@ -13,6 +13,45 @@ type ChargeProductInfo = {
13
13
  chargeProductRequestId?: string;
14
14
  };
15
15
  type Invoice = {
16
+ id: string;
17
+ sequence: number;
18
+ refundSequence?: number;
19
+ userId: string;
20
+ pricingId?: string;
21
+ tripId?: string;
22
+ invoiceDate: string;
23
+ updateDate: string;
24
+ fleetId: string;
25
+ invoiceYear: number;
26
+ invoicesStatus: 'PENDING' | 'PAID' | 'REFUSED' | 'ERROR' | 'REFUNDED' | 'CANCELLED' | 'PENDING_EXTERNAL_PAYMENT' | 'PENDING_MANUAL_PAYMENT' | 'PENDING_AUTHENTICATION' | 'MOP_MISSING';
27
+ amount: number;
28
+ productId?: string;
29
+ currency: string;
30
+ serviceId?: string;
31
+ tokenId?: string;
32
+ entityId: string;
33
+ amountPayWithSystemCredit?: number;
34
+ attempts: number;
35
+ pspName?: string;
36
+ pspReference: string;
37
+ withTaxRefundAmount: number;
38
+ isRefunded?: boolean;
39
+ paymentInProgress: boolean;
40
+ subscriptionId?: string;
41
+ paymentDate?: string;
42
+ externalPaymentRequesterId?: string;
43
+ externalPaymentNotes?: string;
44
+ isPaidExternally?: boolean;
45
+ refundInProgress?: boolean;
46
+ originId?: string;
47
+ originRole?: string;
48
+ pspIdempotency: string;
49
+ paidExternally?: boolean;
50
+ refunded?: boolean;
51
+ productTaxIncluded?: boolean;
52
+ pspReferencePreAuth?: string;
53
+ amountPreAuth?: number;
54
+ preAuthEnabled?: boolean;
16
55
  [key: string]: any;
17
56
  };
18
57
  type Credit = {
@@ -42,4 +81,6 @@ interface Payload extends Omit<Credit, 'id' | 'availableAmount' | 'usedAmount' |
42
81
  }
43
82
  declare const addCredits: (client: Client, payload: Payload) => Promise<Credit>;
44
83
 
45
- export { type ChargeProductInfo, type Credit, type Invoice, addCredits, chargeProduct, getUserCreditsByEntityId };
84
+ declare const getInvoiceById: (client: Client, id: string) => Promise<Invoice>;
85
+
86
+ export { type ChargeProductInfo, type Credit, type Invoice, addCredits, chargeProduct, getInvoiceById, getUserCreditsByEntityId };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  addCredits: () => addCredits,
34
34
  chargeProduct: () => chargeProduct,
35
+ getInvoiceById: () => getInvoiceById,
35
36
  getUserCreditsByEntityId: () => getUserCreditsByEntityId
36
37
  });
37
38
  module.exports = __toCommonJS(index_exports);
@@ -96,9 +97,20 @@ var addCredits = async (client, payload) => {
96
97
  result.data
97
98
  ).then(({ data }) => data);
98
99
  };
100
+
101
+ // src/getInvoiceById.ts
102
+ var import_zod4 = require("zod");
103
+ var getInvoiceById = async (client, id) => {
104
+ const result = import_zod4.z.string().trim().min(1).uuid().safeParse(id);
105
+ if (!result.success) {
106
+ throw new Error("Invalid invoice ID");
107
+ }
108
+ return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${id}`).then(({ data }) => data);
109
+ };
99
110
  // Annotate the CommonJS export names for ESM import in node:
100
111
  0 && (module.exports = {
101
112
  addCredits,
102
113
  chargeProduct,
114
+ getInvoiceById,
103
115
  getUserCreditsByEntityId
104
116
  });
package/dist/index.mjs CHANGED
@@ -58,8 +58,19 @@ var addCredits = async (client, payload) => {
58
58
  result.data
59
59
  ).then(({ data }) => data);
60
60
  };
61
+
62
+ // src/getInvoiceById.ts
63
+ import { z as z4 } from "zod";
64
+ var getInvoiceById = async (client, id) => {
65
+ const result = z4.string().trim().min(1).uuid().safeParse(id);
66
+ if (!result.success) {
67
+ throw new Error("Invalid invoice ID");
68
+ }
69
+ return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${id}`).then(({ data }) => data);
70
+ };
61
71
  export {
62
72
  addCredits,
63
73
  chargeProduct,
74
+ getInvoiceById,
64
75
  getUserCreditsByEntityId
65
76
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-billing",
3
- "version": "1.1.76",
3
+ "version": "1.1.77",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "author": "Vulog",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@vulog/aima-client": "1.1.76",
23
- "@vulog/aima-core": "1.1.76"
22
+ "@vulog/aima-client": "1.1.77",
23
+ "@vulog/aima-core": "1.1.77"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.24.2"
@@ -0,0 +1,15 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { z } from 'zod';
3
+
4
+ import { Invoice } from './types';
5
+
6
+ export const getInvoiceById = async (client: Client, id: string): Promise<Invoice> => {
7
+ const result = z.string().trim().min(1).uuid().safeParse(id);
8
+ if (!result.success) {
9
+ throw new Error('Invalid invoice ID');
10
+ }
11
+
12
+ return client
13
+ .get<Invoice>(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${id}`)
14
+ .then(({ data }) => data);
15
+ };
package/src/index.ts CHANGED
@@ -2,3 +2,4 @@ export * from './chargeProduct';
2
2
  export * from './types';
3
3
  export * from './getUserCreditsByEntityId';
4
4
  export * from './addCredits';
5
+ export * from './getInvoiceById';
package/src/types.ts CHANGED
@@ -13,6 +13,55 @@ export type ChargeProductInfo = {
13
13
  };
14
14
 
15
15
  export type Invoice = {
16
+ id: string;
17
+ sequence: number;
18
+ refundSequence?: number;
19
+ userId: string;
20
+ pricingId?: string;
21
+ tripId?: string;
22
+ invoiceDate: string;
23
+ updateDate: string;
24
+ fleetId: string;
25
+ invoiceYear: number;
26
+ invoicesStatus:
27
+ | 'PENDING'
28
+ | 'PAID'
29
+ | 'REFUSED'
30
+ | 'ERROR'
31
+ | 'REFUNDED'
32
+ | 'CANCELLED'
33
+ | 'PENDING_EXTERNAL_PAYMENT'
34
+ | 'PENDING_MANUAL_PAYMENT'
35
+ | 'PENDING_AUTHENTICATION'
36
+ | 'MOP_MISSING';
37
+ amount: number;
38
+ productId?: string;
39
+ currency: string;
40
+ serviceId?: string;
41
+ tokenId?: string;
42
+ entityId: string;
43
+ amountPayWithSystemCredit?: number;
44
+ attempts: number;
45
+ pspName?: string;
46
+ pspReference: string;
47
+ withTaxRefundAmount: number;
48
+ isRefunded?: boolean;
49
+ paymentInProgress: boolean;
50
+ subscriptionId?: string;
51
+ paymentDate?: string;
52
+ externalPaymentRequesterId?: string;
53
+ externalPaymentNotes?: string;
54
+ isPaidExternally?: boolean;
55
+ refundInProgress?: boolean;
56
+ originId?: string;
57
+ originRole?: string;
58
+ pspIdempotency: string;
59
+ paidExternally?: boolean;
60
+ refunded?: boolean;
61
+ productTaxIncluded?: boolean;
62
+ pspReferencePreAuth?: string;
63
+ amountPreAuth?: number;
64
+ preAuthEnabled?: boolean;
16
65
  [key: string]: any;
17
66
  };
18
67