@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 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.default.object({
28
- productId: zod.default.string().trim().min(1).uuid(),
29
- serviceId: zod.default.string().trim().min(1).uuid().nullable().optional(),
30
- amount: zod.default.number().min(0),
31
- userId: zod.default.string().trim().min(1).uuid(),
32
- entityId: zod.default.string().trim().min(1).uuid(),
33
- subscriptionId: zod.default.string().trim().min(1).uuid().nullable().optional(),
34
- productNotes: zod.default.string().trim().nullable().optional(),
35
- originId: zod.default.string().trim().nullable().optional(),
36
- chargeProductRequestId: zod.default.string().trim().min(1).uuid().nullable().optional(),
37
- additionalInfo: zod.default.object({ manualPayment: zod.default.boolean().optional() }).optional()
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.default.object({
54
- initialAmount: zod.default.number().min(0),
55
- validityStartDate: zod.default.string().datetime(),
56
- validityEndDate: zod.default.string().datetime(),
57
- notes: zod.default.string().trim().nullable().optional(),
58
- discountCategory: zod.default.enum(["CREDITS", "PERCENTAGE"]),
59
- oneTimeUsage: zod.default.boolean().optional(),
60
- entityId: zod.default.string().trim().min(1).uuid(),
61
- type: zod.default.enum([
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.default.enum([
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.default.string().trim().min(1);
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.default.object({
110
- amount: zod.default.number().min(0).optional(),
111
- note: zod.default.string().trim().nullable().optional(),
112
- paymentIntentPspReference: zod.default.string().trim().min(1).optional()
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.default.object({
148
- invoiceId: zod.default.string().trim().min(1).uuid(),
149
- manualPayment: zod.default.object({
150
- requiresActionReturnUrl: zod.default.string().default(""),
151
- online: zod.default.boolean().default(true),
152
- scope: zod.default.enum(["RENTAL", "DEPOSIT"])
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 z$1, { z } from "zod";
1
+ import { z } from "zod";
2
2
  //#region src/chargeProduct.ts
3
- const schema$5 = z$1.object({
4
- productId: z$1.string().trim().min(1).uuid(),
5
- serviceId: z$1.string().trim().min(1).uuid().nullable().optional(),
6
- amount: z$1.number().min(0),
7
- userId: z$1.string().trim().min(1).uuid(),
8
- entityId: z$1.string().trim().min(1).uuid(),
9
- subscriptionId: z$1.string().trim().min(1).uuid().nullable().optional(),
10
- productNotes: z$1.string().trim().nullable().optional(),
11
- originId: z$1.string().trim().nullable().optional(),
12
- chargeProductRequestId: z$1.string().trim().min(1).uuid().nullable().optional(),
13
- additionalInfo: z$1.object({ manualPayment: z$1.boolean().optional() }).optional()
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$1.object({
30
- initialAmount: z$1.number().min(0),
31
- validityStartDate: z$1.string().datetime(),
32
- validityEndDate: z$1.string().datetime(),
33
- notes: z$1.string().trim().nullable().optional(),
34
- discountCategory: z$1.enum(["CREDITS", "PERCENTAGE"]),
35
- oneTimeUsage: z$1.boolean().optional(),
36
- entityId: z$1.string().trim().min(1).uuid(),
37
- type: z$1.enum([
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$1.enum([
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$1.string().trim().min(1);
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$1.object({
86
- amount: z$1.number().min(0).optional(),
87
- note: z$1.string().trim().nullable().optional(),
88
- paymentIntentPspReference: z$1.string().trim().min(1).optional()
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$1.object({
124
- invoiceId: z$1.string().trim().min(1).uuid(),
125
- manualPayment: z$1.object({
126
- requiresActionReturnUrl: z$1.string().default(""),
127
- online: z$1.boolean().default(true),
128
- scope: z$1.enum(["RENTAL", "DEPOSIT"])
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.38",
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.38",
36
- "@vulog/aima-core": "1.2.38"
35
+ "@vulog/aima-client": "1.2.39",
36
+ "@vulog/aima-core": "1.2.39"
37
37
  },
38
38
  "peerDependencies": {
39
- "zod": "^3.25.76"
39
+ "zod": "^4.3.6"
40
40
  },
41
41
  "description": ""
42
- }
42
+ }
package/src/addCredits.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@vulog/aima-client';
2
2
 
3
- import z from 'zod';
3
+ import { z } from 'zod';
4
4
 
5
5
  import type { Credit } from './types';
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@vulog/aima-client';
2
- import z from 'zod';
2
+ import { z } from 'zod';
3
3
 
4
4
  import { ChargeProductInfo, Invoice } from './types';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@vulog/aima-client';
2
2
 
3
- import z from 'zod';
3
+ import { z } from 'zod';
4
4
 
5
5
  import { RefundableAmount } from './types';
6
6
 
@@ -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('invalid_string');
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 uuid');
60
+ expect(error.cause[0].message).toBe('Invalid UUID');
61
61
  return true;
62
62
  });
63
63
  });
package/src/payInvoice.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@vulog/aima-client';
2
- import z from 'zod';
2
+ import { z } from 'zod';
3
3
 
4
4
  import { Invoice, ManualPayment } from './types';
5
5
 
package/src/refund.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@vulog/aima-client';
2
2
 
3
- import z from 'zod';
3
+ import { z } from 'zod';
4
4
 
5
5
  interface Payload {
6
6
  invoiceId: string;
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
  }
package/vitest.config.ts CHANGED
@@ -1,8 +1 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- environment: 'node',
7
- },
8
- });
1
+ export { default } from '../../vitest.config.base.ts';