@vulog/aima-billing 1.2.17 → 1.2.19
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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +29 -1
- package/dist/index.mjs +28 -1
- package/package.json +3 -3
- package/src/chargeProduct.ts +5 -0
- package/src/index.ts +1 -0
- package/src/payInvoice.ts +29 -0
- package/src/types.ts +9 -0
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,14 @@ 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
|
+
requiresActionReturnUrl: string;
|
|
21
|
+
online?: boolean;
|
|
22
|
+
scope: 'RENTAL' | 'DEPOSIT';
|
|
15
23
|
};
|
|
16
24
|
type Invoice = {
|
|
17
25
|
id: string;
|
|
@@ -157,4 +165,6 @@ declare const paths: readonly ["/availableAmount", "/percentage"];
|
|
|
157
165
|
type Paths = (typeof paths)[number];
|
|
158
166
|
declare const updateWallet: (client: Client, walletId: string, actions: PatchAction<Paths>[]) => Promise<void>;
|
|
159
167
|
|
|
160
|
-
|
|
168
|
+
declare const payInvoice: (client: Client, invoiceId: string, manualPayment: ManualPayment) => Promise<Invoice>;
|
|
169
|
+
|
|
170
|
+
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,14 @@ 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
|
+
requiresActionReturnUrl: string;
|
|
21
|
+
online?: boolean;
|
|
22
|
+
scope: 'RENTAL' | 'DEPOSIT';
|
|
15
23
|
};
|
|
16
24
|
type Invoice = {
|
|
17
25
|
id: string;
|
|
@@ -157,4 +165,6 @@ declare const paths: readonly ["/availableAmount", "/percentage"];
|
|
|
157
165
|
type Paths = (typeof paths)[number];
|
|
158
166
|
declare const updateWallet: (client: Client, walletId: string, actions: PatchAction<Paths>[]) => Promise<void>;
|
|
159
167
|
|
|
160
|
-
|
|
168
|
+
declare const payInvoice: (client: Client, invoiceId: string, manualPayment: ManualPayment) => Promise<Invoice>;
|
|
169
|
+
|
|
170
|
+
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,29 @@ 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
|
+
requiresActionReturnUrl: import_zod9.default.string().default(""),
|
|
204
|
+
online: import_zod9.default.boolean().default(true),
|
|
205
|
+
scope: import_zod9.default.enum(["RENTAL", "DEPOSIT"])
|
|
206
|
+
})
|
|
207
|
+
});
|
|
208
|
+
var payInvoice = async (client, invoiceId, manualPayment) => {
|
|
209
|
+
const result = schema6.safeParse({ invoiceId, manualPayment });
|
|
210
|
+
if (!result.success) {
|
|
211
|
+
throw new TypeError("Invalid args", {
|
|
212
|
+
cause: result.error.issues
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return client.post(
|
|
216
|
+
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`,
|
|
217
|
+
result.data.manualPayment
|
|
218
|
+
).then(({ data }) => data);
|
|
219
|
+
};
|
|
193
220
|
// Annotate the CommonJS export names for ESM import in node:
|
|
194
221
|
0 && (module.exports = {
|
|
195
222
|
addCredits,
|
|
@@ -198,6 +225,7 @@ var updateWallet = async (client, walletId, actions) => {
|
|
|
198
225
|
getRefundableAmount,
|
|
199
226
|
getUserCreditsByEntityId,
|
|
200
227
|
getWalletsByEntity,
|
|
228
|
+
payInvoice,
|
|
201
229
|
refund,
|
|
202
230
|
updateWallet
|
|
203
231
|
});
|
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,29 @@ 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
|
+
requiresActionReturnUrl: z9.string().default(""),
|
|
160
|
+
online: z9.boolean().default(true),
|
|
161
|
+
scope: z9.enum(["RENTAL", "DEPOSIT"])
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
var payInvoice = async (client, invoiceId, manualPayment) => {
|
|
165
|
+
const result = schema6.safeParse({ invoiceId, manualPayment });
|
|
166
|
+
if (!result.success) {
|
|
167
|
+
throw new TypeError("Invalid args", {
|
|
168
|
+
cause: result.error.issues
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return client.post(
|
|
172
|
+
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`,
|
|
173
|
+
result.data.manualPayment
|
|
174
|
+
).then(({ data }) => data);
|
|
175
|
+
};
|
|
150
176
|
export {
|
|
151
177
|
addCredits,
|
|
152
178
|
chargeProduct,
|
|
@@ -154,6 +180,7 @@ export {
|
|
|
154
180
|
getRefundableAmount,
|
|
155
181
|
getUserCreditsByEntityId,
|
|
156
182
|
getWalletsByEntity,
|
|
183
|
+
payInvoice,
|
|
157
184
|
refund,
|
|
158
185
|
updateWallet
|
|
159
186
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-billing",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
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.19",
|
|
23
|
+
"@vulog/aima-core": "1.2.19"
|
|
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,29 @@
|
|
|
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
|
+
requiresActionReturnUrl: z.string().default(''),
|
|
10
|
+
online: z.boolean().default(true),
|
|
11
|
+
scope: z.enum(['RENTAL', 'DEPOSIT']),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const payInvoice = async (client: Client, invoiceId: string, manualPayment: ManualPayment) => {
|
|
16
|
+
const result = schema.safeParse({ invoiceId, manualPayment });
|
|
17
|
+
if (!result.success) {
|
|
18
|
+
throw new TypeError('Invalid args', {
|
|
19
|
+
cause: result.error.issues,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return client
|
|
24
|
+
.post<Invoice>(
|
|
25
|
+
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`,
|
|
26
|
+
result.data.manualPayment
|
|
27
|
+
)
|
|
28
|
+
.then(({ data }) => data);
|
|
29
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -10,6 +10,15 @@ 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
|
+
requiresActionReturnUrl: string;
|
|
20
|
+
online?: boolean;
|
|
21
|
+
scope: 'RENTAL' | 'DEPOSIT';
|
|
13
22
|
};
|
|
14
23
|
|
|
15
24
|
export type Invoice = {
|