@vulog/aima-billing 1.2.38 → 1.2.39
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.cjs +32 -55
- package/dist/index.mjs +33 -33
- package/package.json +5 -5
- package/src/addCredits.ts +1 -1
- package/src/chargeProduct.ts +1 -1
- package/src/getRefundableAmount.ts +1 -1
- package/src/getUserCreditsByEntityId.test.ts +2 -2
- package/src/payInvoice.ts +1 -1
- package/src/refund.ts +1 -1
- package/tsconfig.json +1 -8
- package/vitest.config.ts +1 -8
package/dist/index.cjs
CHANGED
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
2
|
let zod = require("zod");
|
|
25
|
-
zod = __toESM(zod);
|
|
26
3
|
//#region src/chargeProduct.ts
|
|
27
|
-
const schema$5 = zod.
|
|
28
|
-
productId: zod.
|
|
29
|
-
serviceId: zod.
|
|
30
|
-
amount: zod.
|
|
31
|
-
userId: zod.
|
|
32
|
-
entityId: zod.
|
|
33
|
-
subscriptionId: zod.
|
|
34
|
-
productNotes: zod.
|
|
35
|
-
originId: zod.
|
|
36
|
-
chargeProductRequestId: zod.
|
|
37
|
-
additionalInfo: zod.
|
|
4
|
+
const schema$5 = zod.z.object({
|
|
5
|
+
productId: zod.z.string().trim().min(1).uuid(),
|
|
6
|
+
serviceId: zod.z.string().trim().min(1).uuid().nullable().optional(),
|
|
7
|
+
amount: zod.z.number().min(0),
|
|
8
|
+
userId: zod.z.string().trim().min(1).uuid(),
|
|
9
|
+
entityId: zod.z.string().trim().min(1).uuid(),
|
|
10
|
+
subscriptionId: zod.z.string().trim().min(1).uuid().nullable().optional(),
|
|
11
|
+
productNotes: zod.z.string().trim().nullable().optional(),
|
|
12
|
+
originId: zod.z.string().trim().nullable().optional(),
|
|
13
|
+
chargeProductRequestId: zod.z.string().trim().min(1).uuid().nullable().optional(),
|
|
14
|
+
additionalInfo: zod.z.object({ manualPayment: zod.z.boolean().optional() }).optional()
|
|
38
15
|
});
|
|
39
16
|
const chargeProduct = async (client, info) => {
|
|
40
17
|
const result = schema$5.safeParse(info);
|
|
@@ -50,20 +27,20 @@ const getUserCreditsByEntityId = async (client, id) => {
|
|
|
50
27
|
};
|
|
51
28
|
//#endregion
|
|
52
29
|
//#region src/addCredits.ts
|
|
53
|
-
const schema$4 = zod.
|
|
54
|
-
initialAmount: zod.
|
|
55
|
-
validityStartDate: zod.
|
|
56
|
-
validityEndDate: zod.
|
|
57
|
-
notes: zod.
|
|
58
|
-
discountCategory: zod.
|
|
59
|
-
oneTimeUsage: zod.
|
|
60
|
-
entityId: zod.
|
|
61
|
-
type: zod.
|
|
30
|
+
const schema$4 = zod.z.object({
|
|
31
|
+
initialAmount: zod.z.number().min(0),
|
|
32
|
+
validityStartDate: zod.z.string().datetime(),
|
|
33
|
+
validityEndDate: zod.z.string().datetime(),
|
|
34
|
+
notes: zod.z.string().trim().nullable().optional(),
|
|
35
|
+
discountCategory: zod.z.enum(["CREDITS", "PERCENTAGE"]),
|
|
36
|
+
oneTimeUsage: zod.z.boolean().optional(),
|
|
37
|
+
entityId: zod.z.string().trim().min(1).uuid(),
|
|
38
|
+
type: zod.z.enum([
|
|
62
39
|
"LOCAL",
|
|
63
40
|
"GLOBAL",
|
|
64
41
|
"PERIODIC"
|
|
65
42
|
]),
|
|
66
|
-
usage: zod.
|
|
43
|
+
usage: zod.z.enum([
|
|
67
44
|
"TRIP",
|
|
68
45
|
"REGISTRATION",
|
|
69
46
|
"PRODUCTS",
|
|
@@ -98,7 +75,7 @@ const getInvoicesByTripId = async (client, tripId) => {
|
|
|
98
75
|
};
|
|
99
76
|
//#endregion
|
|
100
77
|
//#region src/getRefundableAmount.ts
|
|
101
|
-
const schema$3 = zod.
|
|
78
|
+
const schema$3 = zod.z.string().trim().min(1);
|
|
102
79
|
const getRefundableAmount = async (client, invoiceId) => {
|
|
103
80
|
const result = schema$3.safeParse(invoiceId);
|
|
104
81
|
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
@@ -106,10 +83,10 @@ const getRefundableAmount = async (client, invoiceId) => {
|
|
|
106
83
|
};
|
|
107
84
|
//#endregion
|
|
108
85
|
//#region src/refund.ts
|
|
109
|
-
const schema$2 = zod.
|
|
110
|
-
amount: zod.
|
|
111
|
-
note: zod.
|
|
112
|
-
paymentIntentPspReference: zod.
|
|
86
|
+
const schema$2 = zod.z.object({
|
|
87
|
+
amount: zod.z.number().min(0).optional(),
|
|
88
|
+
note: zod.z.string().trim().nullable().optional(),
|
|
89
|
+
paymentIntentPspReference: zod.z.string().trim().min(1).optional()
|
|
113
90
|
});
|
|
114
91
|
const refund = async (client, payload) => {
|
|
115
92
|
const result = schema$2.safeParse(payload);
|
|
@@ -144,12 +121,12 @@ const updateWallet = async (client, walletId, actions) => {
|
|
|
144
121
|
};
|
|
145
122
|
//#endregion
|
|
146
123
|
//#region src/payInvoice.ts
|
|
147
|
-
const schema = zod.
|
|
148
|
-
invoiceId: zod.
|
|
149
|
-
manualPayment: zod.
|
|
150
|
-
requiresActionReturnUrl: zod.
|
|
151
|
-
online: zod.
|
|
152
|
-
scope: zod.
|
|
124
|
+
const schema = zod.z.object({
|
|
125
|
+
invoiceId: zod.z.string().trim().min(1).uuid(),
|
|
126
|
+
manualPayment: zod.z.object({
|
|
127
|
+
requiresActionReturnUrl: zod.z.string().default(""),
|
|
128
|
+
online: zod.z.boolean().default(true),
|
|
129
|
+
scope: zod.z.enum(["RENTAL", "DEPOSIT"])
|
|
153
130
|
})
|
|
154
131
|
});
|
|
155
132
|
const payInvoice = async (client, invoiceId, manualPayment) => {
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
//#region src/chargeProduct.ts
|
|
3
|
-
const schema$5 = z
|
|
4
|
-
productId: z
|
|
5
|
-
serviceId: z
|
|
6
|
-
amount: z
|
|
7
|
-
userId: z
|
|
8
|
-
entityId: z
|
|
9
|
-
subscriptionId: z
|
|
10
|
-
productNotes: z
|
|
11
|
-
originId: z
|
|
12
|
-
chargeProductRequestId: z
|
|
13
|
-
additionalInfo: z
|
|
3
|
+
const schema$5 = z.object({
|
|
4
|
+
productId: z.string().trim().min(1).uuid(),
|
|
5
|
+
serviceId: z.string().trim().min(1).uuid().nullable().optional(),
|
|
6
|
+
amount: z.number().min(0),
|
|
7
|
+
userId: z.string().trim().min(1).uuid(),
|
|
8
|
+
entityId: z.string().trim().min(1).uuid(),
|
|
9
|
+
subscriptionId: z.string().trim().min(1).uuid().nullable().optional(),
|
|
10
|
+
productNotes: z.string().trim().nullable().optional(),
|
|
11
|
+
originId: z.string().trim().nullable().optional(),
|
|
12
|
+
chargeProductRequestId: z.string().trim().min(1).uuid().nullable().optional(),
|
|
13
|
+
additionalInfo: z.object({ manualPayment: z.boolean().optional() }).optional()
|
|
14
14
|
});
|
|
15
15
|
const chargeProduct = async (client, info) => {
|
|
16
16
|
const result = schema$5.safeParse(info);
|
|
@@ -26,20 +26,20 @@ const getUserCreditsByEntityId = async (client, id) => {
|
|
|
26
26
|
};
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/addCredits.ts
|
|
29
|
-
const schema$4 = z
|
|
30
|
-
initialAmount: z
|
|
31
|
-
validityStartDate: z
|
|
32
|
-
validityEndDate: z
|
|
33
|
-
notes: z
|
|
34
|
-
discountCategory: z
|
|
35
|
-
oneTimeUsage: z
|
|
36
|
-
entityId: z
|
|
37
|
-
type: z
|
|
29
|
+
const schema$4 = z.object({
|
|
30
|
+
initialAmount: z.number().min(0),
|
|
31
|
+
validityStartDate: z.string().datetime(),
|
|
32
|
+
validityEndDate: z.string().datetime(),
|
|
33
|
+
notes: z.string().trim().nullable().optional(),
|
|
34
|
+
discountCategory: z.enum(["CREDITS", "PERCENTAGE"]),
|
|
35
|
+
oneTimeUsage: z.boolean().optional(),
|
|
36
|
+
entityId: z.string().trim().min(1).uuid(),
|
|
37
|
+
type: z.enum([
|
|
38
38
|
"LOCAL",
|
|
39
39
|
"GLOBAL",
|
|
40
40
|
"PERIODIC"
|
|
41
41
|
]),
|
|
42
|
-
usage: z
|
|
42
|
+
usage: z.enum([
|
|
43
43
|
"TRIP",
|
|
44
44
|
"REGISTRATION",
|
|
45
45
|
"PRODUCTS",
|
|
@@ -74,7 +74,7 @@ const getInvoicesByTripId = async (client, tripId) => {
|
|
|
74
74
|
};
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/getRefundableAmount.ts
|
|
77
|
-
const schema$3 = z
|
|
77
|
+
const schema$3 = z.string().trim().min(1);
|
|
78
78
|
const getRefundableAmount = async (client, invoiceId) => {
|
|
79
79
|
const result = schema$3.safeParse(invoiceId);
|
|
80
80
|
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
@@ -82,10 +82,10 @@ const getRefundableAmount = async (client, invoiceId) => {
|
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/refund.ts
|
|
85
|
-
const schema$2 = z
|
|
86
|
-
amount: z
|
|
87
|
-
note: z
|
|
88
|
-
paymentIntentPspReference: z
|
|
85
|
+
const schema$2 = z.object({
|
|
86
|
+
amount: z.number().min(0).optional(),
|
|
87
|
+
note: z.string().trim().nullable().optional(),
|
|
88
|
+
paymentIntentPspReference: z.string().trim().min(1).optional()
|
|
89
89
|
});
|
|
90
90
|
const refund = async (client, payload) => {
|
|
91
91
|
const result = schema$2.safeParse(payload);
|
|
@@ -120,12 +120,12 @@ const updateWallet = async (client, walletId, actions) => {
|
|
|
120
120
|
};
|
|
121
121
|
//#endregion
|
|
122
122
|
//#region src/payInvoice.ts
|
|
123
|
-
const schema = z
|
|
124
|
-
invoiceId: z
|
|
125
|
-
manualPayment: z
|
|
126
|
-
requiresActionReturnUrl: z
|
|
127
|
-
online: z
|
|
128
|
-
scope: z
|
|
123
|
+
const schema = z.object({
|
|
124
|
+
invoiceId: z.string().trim().min(1).uuid(),
|
|
125
|
+
manualPayment: z.object({
|
|
126
|
+
requiresActionReturnUrl: z.string().default(""),
|
|
127
|
+
online: z.boolean().default(true),
|
|
128
|
+
scope: z.enum(["RENTAL", "DEPOSIT"])
|
|
129
129
|
})
|
|
130
130
|
});
|
|
131
131
|
const payInvoice = async (client, invoiceId, manualPayment) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-billing",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.39",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.cts",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"author": "Vulog",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vulog/aima-client": "1.2.
|
|
36
|
-
"@vulog/aima-core": "1.2.
|
|
35
|
+
"@vulog/aima-client": "1.2.39",
|
|
36
|
+
"@vulog/aima-core": "1.2.39"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"zod": "^3.
|
|
39
|
+
"zod": "^4.3.6"
|
|
40
40
|
},
|
|
41
41
|
"description": ""
|
|
42
|
-
}
|
|
42
|
+
}
|
package/src/addCredits.ts
CHANGED
package/src/chargeProduct.ts
CHANGED
|
@@ -55,9 +55,9 @@ describe('getUserCreditsByEntityId', () => {
|
|
|
55
55
|
expect(error).toHaveProperty('cause');
|
|
56
56
|
expect(error.cause).toHaveLength(1);
|
|
57
57
|
expect(error.cause[0]).toHaveProperty('code');
|
|
58
|
-
expect(error.cause[0].code).toBe('
|
|
58
|
+
expect(error.cause[0].code).toBe('invalid_format');
|
|
59
59
|
expect(error.cause[0]).toHaveProperty('message');
|
|
60
|
-
expect(error.cause[0].message).toBe('Invalid
|
|
60
|
+
expect(error.cause[0].message).toBe('Invalid UUID');
|
|
61
61
|
return true;
|
|
62
62
|
});
|
|
63
63
|
});
|
package/src/payInvoice.ts
CHANGED
package/src/refund.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
2
3
|
"include": ["src"],
|
|
3
4
|
"exclude": ["**/*.test.ts"],
|
|
4
5
|
"compilerOptions": {
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"target": "esnext",
|
|
7
|
-
"lib": ["esnext"],
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
6
|
"outDir": "dist",
|
|
14
7
|
"rootDir": "src"
|
|
15
8
|
}
|