@vulog/aima-billing 1.2.14 → 1.2.16
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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +28 -1
- package/dist/index.mjs +27 -1
- package/package.json +3 -3
- package/src/chargeProduct.ts +5 -0
- package/src/index.ts +1 -0
- package/src/payInvoice.ts +28 -0
- package/src/types.ts +8 -0
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,13 @@ type ChargeProductInfo = {
|
|
|
12
12
|
productNotes?: string;
|
|
13
13
|
originId?: string;
|
|
14
14
|
chargeProductRequestId?: string;
|
|
15
|
+
additionalInfo?: {
|
|
16
|
+
manualPayment?: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type ManualPayment = {
|
|
20
|
+
online?: boolean;
|
|
21
|
+
scope: 'RENTAL' | 'DEPOSIT';
|
|
15
22
|
};
|
|
16
23
|
type Invoice = {
|
|
17
24
|
id: string;
|
|
@@ -157,4 +164,6 @@ declare const paths: readonly ["/availableAmount", "/percentage"];
|
|
|
157
164
|
type Paths = (typeof paths)[number];
|
|
158
165
|
declare const updateWallet: (client: Client, walletId: string, actions: PatchAction<Paths>[]) => Promise<void>;
|
|
159
166
|
|
|
160
|
-
|
|
167
|
+
declare const payInvoice: (client: Client, invoiceId: string, manualPayment: ManualPayment) => Promise<Invoice>;
|
|
168
|
+
|
|
169
|
+
export { type ChargeProductInfo, type Credit, type Invoice, type ManualPayment, type Paths, type Receipt, type RefundableAmount, type Wallet, addCredits, chargeProduct, getInvoiceById, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ type ChargeProductInfo = {
|
|
|
12
12
|
productNotes?: string;
|
|
13
13
|
originId?: string;
|
|
14
14
|
chargeProductRequestId?: string;
|
|
15
|
+
additionalInfo?: {
|
|
16
|
+
manualPayment?: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type ManualPayment = {
|
|
20
|
+
online?: boolean;
|
|
21
|
+
scope: 'RENTAL' | 'DEPOSIT';
|
|
15
22
|
};
|
|
16
23
|
type Invoice = {
|
|
17
24
|
id: string;
|
|
@@ -157,4 +164,6 @@ declare const paths: readonly ["/availableAmount", "/percentage"];
|
|
|
157
164
|
type Paths = (typeof paths)[number];
|
|
158
165
|
declare const updateWallet: (client: Client, walletId: string, actions: PatchAction<Paths>[]) => Promise<void>;
|
|
159
166
|
|
|
160
|
-
|
|
167
|
+
declare const payInvoice: (client: Client, invoiceId: string, manualPayment: ManualPayment) => Promise<Invoice>;
|
|
168
|
+
|
|
169
|
+
export { type ChargeProductInfo, type Credit, type Invoice, type ManualPayment, type Paths, type Receipt, type RefundableAmount, type Wallet, addCredits, chargeProduct, getInvoiceById, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
getRefundableAmount: () => getRefundableAmount,
|
|
37
37
|
getUserCreditsByEntityId: () => getUserCreditsByEntityId,
|
|
38
38
|
getWalletsByEntity: () => getWalletsByEntity,
|
|
39
|
+
payInvoice: () => payInvoice,
|
|
39
40
|
refund: () => refund,
|
|
40
41
|
updateWallet: () => updateWallet
|
|
41
42
|
});
|
|
@@ -52,7 +53,10 @@ var schema = import_zod.default.object({
|
|
|
52
53
|
subscriptionId: import_zod.default.string().trim().min(1).uuid().nullable().optional(),
|
|
53
54
|
productNotes: import_zod.default.string().trim().nullable().optional(),
|
|
54
55
|
originId: import_zod.default.string().trim().nullable().optional(),
|
|
55
|
-
chargeProductRequestId: import_zod.default.string().trim().min(1).uuid().nullable().optional()
|
|
56
|
+
chargeProductRequestId: import_zod.default.string().trim().min(1).uuid().nullable().optional(),
|
|
57
|
+
additionalInfo: import_zod.default.object({
|
|
58
|
+
manualPayment: import_zod.default.boolean().optional()
|
|
59
|
+
}).optional()
|
|
56
60
|
});
|
|
57
61
|
var chargeProduct = async (client, info) => {
|
|
58
62
|
const result = schema.safeParse(info);
|
|
@@ -190,6 +194,28 @@ var updateWallet = async (client, walletId, actions) => {
|
|
|
190
194
|
}
|
|
191
195
|
});
|
|
192
196
|
};
|
|
197
|
+
|
|
198
|
+
// src/payInvoice.ts
|
|
199
|
+
var import_zod9 = __toESM(require("zod"));
|
|
200
|
+
var schema6 = import_zod9.default.object({
|
|
201
|
+
invoiceId: import_zod9.default.string().trim().min(1).uuid(),
|
|
202
|
+
manualPayment: import_zod9.default.object({
|
|
203
|
+
online: import_zod9.default.boolean().default(true),
|
|
204
|
+
scope: import_zod9.default.enum(["RENTAL", "DEPOSIT"])
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
var payInvoice = async (client, invoiceId, manualPayment) => {
|
|
208
|
+
const result = schema6.safeParse({ invoiceId, manualPayment });
|
|
209
|
+
if (!result.success) {
|
|
210
|
+
throw new TypeError("Invalid args", {
|
|
211
|
+
cause: result.error.issues
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return client.post(
|
|
215
|
+
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`,
|
|
216
|
+
result.data.manualPayment
|
|
217
|
+
).then(({ data }) => data);
|
|
218
|
+
};
|
|
193
219
|
// Annotate the CommonJS export names for ESM import in node:
|
|
194
220
|
0 && (module.exports = {
|
|
195
221
|
addCredits,
|
|
@@ -198,6 +224,7 @@ var updateWallet = async (client, walletId, actions) => {
|
|
|
198
224
|
getRefundableAmount,
|
|
199
225
|
getUserCreditsByEntityId,
|
|
200
226
|
getWalletsByEntity,
|
|
227
|
+
payInvoice,
|
|
201
228
|
refund,
|
|
202
229
|
updateWallet
|
|
203
230
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,10 @@ var schema = z.object({
|
|
|
9
9
|
subscriptionId: z.string().trim().min(1).uuid().nullable().optional(),
|
|
10
10
|
productNotes: z.string().trim().nullable().optional(),
|
|
11
11
|
originId: z.string().trim().nullable().optional(),
|
|
12
|
-
chargeProductRequestId: z.string().trim().min(1).uuid().nullable().optional()
|
|
12
|
+
chargeProductRequestId: z.string().trim().min(1).uuid().nullable().optional(),
|
|
13
|
+
additionalInfo: z.object({
|
|
14
|
+
manualPayment: z.boolean().optional()
|
|
15
|
+
}).optional()
|
|
13
16
|
});
|
|
14
17
|
var chargeProduct = async (client, info) => {
|
|
15
18
|
const result = schema.safeParse(info);
|
|
@@ -147,6 +150,28 @@ var updateWallet = async (client, walletId, actions) => {
|
|
|
147
150
|
}
|
|
148
151
|
});
|
|
149
152
|
};
|
|
153
|
+
|
|
154
|
+
// src/payInvoice.ts
|
|
155
|
+
import z9 from "zod";
|
|
156
|
+
var schema6 = z9.object({
|
|
157
|
+
invoiceId: z9.string().trim().min(1).uuid(),
|
|
158
|
+
manualPayment: z9.object({
|
|
159
|
+
online: z9.boolean().default(true),
|
|
160
|
+
scope: z9.enum(["RENTAL", "DEPOSIT"])
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
var payInvoice = async (client, invoiceId, manualPayment) => {
|
|
164
|
+
const result = schema6.safeParse({ invoiceId, manualPayment });
|
|
165
|
+
if (!result.success) {
|
|
166
|
+
throw new TypeError("Invalid args", {
|
|
167
|
+
cause: result.error.issues
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return client.post(
|
|
171
|
+
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`,
|
|
172
|
+
result.data.manualPayment
|
|
173
|
+
).then(({ data }) => data);
|
|
174
|
+
};
|
|
150
175
|
export {
|
|
151
176
|
addCredits,
|
|
152
177
|
chargeProduct,
|
|
@@ -154,6 +179,7 @@ export {
|
|
|
154
179
|
getRefundableAmount,
|
|
155
180
|
getUserCreditsByEntityId,
|
|
156
181
|
getWalletsByEntity,
|
|
182
|
+
payInvoice,
|
|
157
183
|
refund,
|
|
158
184
|
updateWallet
|
|
159
185
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-billing",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.16",
|
|
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.2.
|
|
23
|
-
"@vulog/aima-core": "1.2.
|
|
22
|
+
"@vulog/aima-client": "1.2.16",
|
|
23
|
+
"@vulog/aima-core": "1.2.16"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"zod": "^3.25.76"
|
package/src/chargeProduct.ts
CHANGED
|
@@ -13,6 +13,11 @@ const schema = z.object({
|
|
|
13
13
|
productNotes: z.string().trim().nullable().optional(),
|
|
14
14
|
originId: z.string().trim().nullable().optional(),
|
|
15
15
|
chargeProductRequestId: z.string().trim().min(1).uuid().nullable().optional(),
|
|
16
|
+
additionalInfo: z
|
|
17
|
+
.object({
|
|
18
|
+
manualPayment: z.boolean().optional(),
|
|
19
|
+
})
|
|
20
|
+
.optional(),
|
|
16
21
|
});
|
|
17
22
|
|
|
18
23
|
export const chargeProduct = async (client: Client, info: ChargeProductInfo) => {
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
|
|
4
|
+
import { Invoice, ManualPayment } from './types';
|
|
5
|
+
|
|
6
|
+
const schema = z.object({
|
|
7
|
+
invoiceId: z.string().trim().min(1).uuid(),
|
|
8
|
+
manualPayment: z.object({
|
|
9
|
+
online: z.boolean().default(true),
|
|
10
|
+
scope: z.enum(['RENTAL', 'DEPOSIT']),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const payInvoice = async (client: Client, invoiceId: string, manualPayment: ManualPayment) => {
|
|
15
|
+
const result = schema.safeParse({ invoiceId, manualPayment });
|
|
16
|
+
if (!result.success) {
|
|
17
|
+
throw new TypeError('Invalid args', {
|
|
18
|
+
cause: result.error.issues,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return client
|
|
23
|
+
.post<Invoice>(
|
|
24
|
+
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`,
|
|
25
|
+
result.data.manualPayment
|
|
26
|
+
)
|
|
27
|
+
.then(({ data }) => data);
|
|
28
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -10,6 +10,14 @@ export type ChargeProductInfo = {
|
|
|
10
10
|
productNotes?: string;
|
|
11
11
|
originId?: string;
|
|
12
12
|
chargeProductRequestId?: string;
|
|
13
|
+
additionalInfo?: {
|
|
14
|
+
manualPayment?: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ManualPayment = {
|
|
19
|
+
online?: boolean;
|
|
20
|
+
scope: 'RENTAL' | 'DEPOSIT';
|
|
13
21
|
};
|
|
14
22
|
|
|
15
23
|
export type Invoice = {
|