@vulog/aima-billing 1.2.30 → 1.2.32
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 +157 -0
- package/dist/index.d.cts +179 -0
- package/dist/index.d.mts +149 -140
- package/dist/index.mjs +111 -172
- package/package.json +20 -7
- package/src/addCredits.ts +4 -2
- package/{tsup.config.ts → tsdown.config.ts} +1 -1
- package/dist/index.d.ts +0 -170
- package/dist/index.js +0 -231
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,186 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
manualPayment: z.boolean().optional()
|
|
15
|
-
}).optional()
|
|
1
|
+
import z$1, { z } from "zod";
|
|
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()
|
|
16
14
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
cause: result.error.issues
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/product`, info).then(({ data }) => data);
|
|
15
|
+
const chargeProduct = async (client, info) => {
|
|
16
|
+
const result = schema$5.safeParse(info);
|
|
17
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
18
|
+
return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/product`, info).then(({ data }) => data);
|
|
25
19
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
throw new TypeError("Invalid id", {
|
|
33
|
-
cause: result.error.issues
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/wallet/entity/${id}`).then(({ data }) => data);
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/getUserCreditsByEntityId.ts
|
|
22
|
+
const getUserCreditsByEntityId = async (client, id) => {
|
|
23
|
+
const result = z.string().trim().min(1).uuid().safeParse(id);
|
|
24
|
+
if (!result.success) throw new TypeError("Invalid id", { cause: result.error.issues });
|
|
25
|
+
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/wallet/entity/${id}`).then(({ data }) => data);
|
|
37
26
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
//#endregion
|
|
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([
|
|
38
|
+
"LOCAL",
|
|
39
|
+
"GLOBAL",
|
|
40
|
+
"PERIODIC"
|
|
41
|
+
]),
|
|
42
|
+
usage: z$1.enum([
|
|
43
|
+
"TRIP",
|
|
44
|
+
"REGISTRATION",
|
|
45
|
+
"PRODUCTS",
|
|
46
|
+
"ALL"
|
|
47
|
+
])
|
|
51
48
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
cause: result.error.issues
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return client.post(
|
|
60
|
-
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/entities/${payload.entityId}/wallets`,
|
|
61
|
-
result.data
|
|
62
|
-
).then(({ data }) => data);
|
|
49
|
+
const addCredits = async (client, payload) => {
|
|
50
|
+
const result = schema$4.safeParse(payload);
|
|
51
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
52
|
+
return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/entities/${payload.entityId}/wallets`, result.data).then(({ data }) => data);
|
|
63
53
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (!result.success) {
|
|
70
|
-
throw new Error("Invalid invoice ID");
|
|
71
|
-
}
|
|
72
|
-
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${id}`).then(({ data }) => data);
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/getInvoiceById.ts
|
|
56
|
+
const getInvoiceById = async (client, id) => {
|
|
57
|
+
if (!z.string().trim().min(1).uuid().safeParse(id).success) throw new Error("Invalid invoice ID");
|
|
58
|
+
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${id}`).then(({ data }) => data);
|
|
73
59
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
throw new TypeError("Invalid args", {
|
|
82
|
-
cause: result.error.issues
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return client.get(
|
|
86
|
-
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${invoiceId}/refundableAmount`
|
|
87
|
-
).then(({ data }) => data);
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/getRefundableAmount.ts
|
|
62
|
+
const schema$3 = z$1.string().trim().min(1);
|
|
63
|
+
const getRefundableAmount = async (client, invoiceId) => {
|
|
64
|
+
const result = schema$3.safeParse(invoiceId);
|
|
65
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
66
|
+
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${invoiceId}/refundableAmount`).then(({ data }) => data);
|
|
88
67
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
paymentIntentPspReference: z6.string().trim().min(1).optional()
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/refund.ts
|
|
70
|
+
const schema$2 = z$1.object({
|
|
71
|
+
amount: z$1.number().min(0).optional(),
|
|
72
|
+
note: z$1.string().trim().nullable().optional(),
|
|
73
|
+
paymentIntentPspReference: z$1.string().trim().min(1).optional()
|
|
96
74
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
const filteredData = Object.fromEntries(
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
|
-
Object.entries(result.data).filter(([_, value]) => value !== void 0 && value !== null)
|
|
107
|
-
);
|
|
108
|
-
return client.post(
|
|
109
|
-
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${payload.invoiceId}/refund`,
|
|
110
|
-
// filter boolean fields
|
|
111
|
-
filteredData
|
|
112
|
-
).then(({ data }) => data);
|
|
75
|
+
const refund = async (client, payload) => {
|
|
76
|
+
const result = schema$2.safeParse(payload);
|
|
77
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
78
|
+
const filteredData = Object.fromEntries(Object.entries(result.data).filter(([_, value]) => value !== void 0 && value !== null));
|
|
79
|
+
return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${payload.invoiceId}/refund`, filteredData).then(({ data }) => data);
|
|
113
80
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
throw new TypeError("Invalid entityId", {
|
|
121
|
-
cause: result.error.issues
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/wallet/entity/${entityId}`).then(({ data }) => data);
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/getWalletsByEntity.ts
|
|
83
|
+
const getWalletsByEntity = async (client, entityId) => {
|
|
84
|
+
const result = z.string().trim().min(1).uuid().safeParse(entityId);
|
|
85
|
+
if (!result.success) throw new TypeError("Invalid entityId", { cause: result.error.issues });
|
|
86
|
+
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/wallet/entity/${entityId}`).then(({ data }) => data);
|
|
125
87
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
path: z8.enum(paths),
|
|
136
|
-
value: z8.string().min(1)
|
|
137
|
-
})
|
|
138
|
-
).min(1).max(1)
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/updateWallet.ts
|
|
90
|
+
const schema$1 = z.object({
|
|
91
|
+
walletId: z.string().trim().min(1).uuid(),
|
|
92
|
+
actions: z.array(z.object({
|
|
93
|
+
op: z.enum(["replace"]),
|
|
94
|
+
path: z.enum(["/availableAmount", "/percentage"]),
|
|
95
|
+
value: z.string().min(1)
|
|
96
|
+
})).min(1).max(1)
|
|
139
97
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
await client.patch(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/wallets/${walletId}`, actions, {
|
|
148
|
-
headers: {
|
|
149
|
-
"Content-Type": "application/json-patch+json"
|
|
150
|
-
}
|
|
151
|
-
});
|
|
98
|
+
const updateWallet = async (client, walletId, actions) => {
|
|
99
|
+
const result = schema$1.safeParse({
|
|
100
|
+
walletId,
|
|
101
|
+
actions
|
|
102
|
+
});
|
|
103
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
104
|
+
await client.patch(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/wallets/${walletId}`, actions, { headers: { "Content-Type": "application/json-patch+json" } });
|
|
152
105
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
})
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/payInvoice.ts
|
|
108
|
+
const schema = z$1.object({
|
|
109
|
+
invoiceId: z$1.string().trim().min(1).uuid(),
|
|
110
|
+
manualPayment: z$1.object({
|
|
111
|
+
requiresActionReturnUrl: z$1.string().default(""),
|
|
112
|
+
online: z$1.boolean().default(true),
|
|
113
|
+
scope: z$1.enum(["RENTAL", "DEPOSIT"])
|
|
114
|
+
})
|
|
163
115
|
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
};
|
|
176
|
-
export {
|
|
177
|
-
addCredits,
|
|
178
|
-
chargeProduct,
|
|
179
|
-
getInvoiceById,
|
|
180
|
-
getRefundableAmount,
|
|
181
|
-
getUserCreditsByEntityId,
|
|
182
|
-
getWalletsByEntity,
|
|
183
|
-
payInvoice,
|
|
184
|
-
refund,
|
|
185
|
-
updateWallet
|
|
116
|
+
const payInvoice = async (client, invoiceId, manualPayment) => {
|
|
117
|
+
const result = schema.safeParse({
|
|
118
|
+
invoiceId,
|
|
119
|
+
manualPayment
|
|
120
|
+
});
|
|
121
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
122
|
+
return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`, result.data.manualPayment).then(({ data }) => data);
|
|
186
123
|
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { addCredits, chargeProduct, getInvoiceById, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
package/package.json
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-billing",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.2.32",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
5
6
|
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.
|
|
7
|
+
"types": "dist/index.d.cts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"default": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
7
20
|
"scripts": {
|
|
8
|
-
"build": "
|
|
9
|
-
"dev": "
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"dev": "tsdown --watch",
|
|
10
23
|
"test": "vitest run",
|
|
11
24
|
"test:watch": "vitest",
|
|
12
25
|
"lint": "eslint src/**/* --ext .ts"
|
|
@@ -19,8 +32,8 @@
|
|
|
19
32
|
"author": "Vulog",
|
|
20
33
|
"license": "MIT",
|
|
21
34
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.2.
|
|
23
|
-
"@vulog/aima-core": "1.2.
|
|
35
|
+
"@vulog/aima-client": "1.2.32",
|
|
36
|
+
"@vulog/aima-core": "1.2.32"
|
|
24
37
|
},
|
|
25
38
|
"peerDependencies": {
|
|
26
39
|
"zod": "^3.25.76"
|
package/src/addCredits.ts
CHANGED
|
@@ -4,8 +4,10 @@ import z from 'zod';
|
|
|
4
4
|
|
|
5
5
|
import type { Credit } from './types';
|
|
6
6
|
|
|
7
|
-
interface Payload
|
|
8
|
-
|
|
7
|
+
interface Payload extends Omit<
|
|
8
|
+
Credit,
|
|
9
|
+
'id' | 'availableAmount' | 'usedAmount' | 'originId' | 'creditAlreadyUsed' | 'updateDate'
|
|
10
|
+
> {}
|
|
9
11
|
|
|
10
12
|
const schema = z.object({
|
|
11
13
|
initialAmount: z.number().min(0),
|
package/dist/index.d.ts
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { Client } from '@vulog/aima-client';
|
|
2
|
-
import { UUID } from 'crypto';
|
|
3
|
-
import { PatchAction } from '@vulog/aima-core';
|
|
4
|
-
|
|
5
|
-
type ChargeProductInfo = {
|
|
6
|
-
productId: string;
|
|
7
|
-
serviceId?: string;
|
|
8
|
-
amount: number;
|
|
9
|
-
userId: string;
|
|
10
|
-
entityId: string;
|
|
11
|
-
subscriptionId?: string;
|
|
12
|
-
productNotes?: string;
|
|
13
|
-
originId?: string;
|
|
14
|
-
chargeProductRequestId?: string;
|
|
15
|
-
additionalInfo?: {
|
|
16
|
-
manualPayment?: boolean;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
type ManualPayment = {
|
|
20
|
-
requiresActionReturnUrl: string;
|
|
21
|
-
online?: boolean;
|
|
22
|
-
scope: 'RENTAL' | 'DEPOSIT';
|
|
23
|
-
};
|
|
24
|
-
type Invoice = {
|
|
25
|
-
id: string;
|
|
26
|
-
sequence: number;
|
|
27
|
-
refundSequence?: number;
|
|
28
|
-
userId: string;
|
|
29
|
-
pricingId?: string;
|
|
30
|
-
tripId?: string;
|
|
31
|
-
invoiceDate: string;
|
|
32
|
-
updateDate: string;
|
|
33
|
-
fleetId: string;
|
|
34
|
-
invoiceYear: number;
|
|
35
|
-
invoicesStatus: 'PENDING' | 'PAID' | 'REFUSED' | 'ERROR' | 'REFUNDED' | 'CANCELLED' | 'PENDING_EXTERNAL_PAYMENT' | 'PENDING_MANUAL_PAYMENT' | 'PENDING_AUTHENTICATION' | 'MOP_MISSING';
|
|
36
|
-
amount: number;
|
|
37
|
-
productId?: string;
|
|
38
|
-
currency: string;
|
|
39
|
-
serviceId?: string;
|
|
40
|
-
tokenId?: string;
|
|
41
|
-
entityId: string;
|
|
42
|
-
amountPayWithSystemCredit?: number;
|
|
43
|
-
attempts: number;
|
|
44
|
-
pspName?: string;
|
|
45
|
-
pspReference: string;
|
|
46
|
-
withTaxRefundAmount: number;
|
|
47
|
-
isRefunded?: boolean;
|
|
48
|
-
paymentInProgress: boolean;
|
|
49
|
-
subscriptionId?: string;
|
|
50
|
-
paymentDate?: string;
|
|
51
|
-
externalPaymentRequesterId?: string;
|
|
52
|
-
externalPaymentNotes?: string;
|
|
53
|
-
isPaidExternally?: boolean;
|
|
54
|
-
refundInProgress?: boolean;
|
|
55
|
-
originId?: string;
|
|
56
|
-
originRole?: string;
|
|
57
|
-
pspIdempotency: string;
|
|
58
|
-
paidExternally?: boolean;
|
|
59
|
-
refunded?: boolean;
|
|
60
|
-
productTaxIncluded?: boolean;
|
|
61
|
-
pspReferencePreAuth?: string;
|
|
62
|
-
amountPreAuth?: number;
|
|
63
|
-
preAuthEnabled?: boolean;
|
|
64
|
-
[key: string]: any;
|
|
65
|
-
};
|
|
66
|
-
type Credit = {
|
|
67
|
-
initialAmount: number;
|
|
68
|
-
validityStartDate: string;
|
|
69
|
-
validityEndDate: string;
|
|
70
|
-
notes: string;
|
|
71
|
-
discountCategory: 'CREDITS' | 'PERCENTAGE';
|
|
72
|
-
oneTimeUsage: boolean;
|
|
73
|
-
id: UUID;
|
|
74
|
-
availableAmount: number;
|
|
75
|
-
usedAmount: number;
|
|
76
|
-
originId: UUID;
|
|
77
|
-
entityId: UUID;
|
|
78
|
-
creditAlreadyUsed: boolean;
|
|
79
|
-
updateDate: string;
|
|
80
|
-
type: 'LOCAL' | 'GLOBAL' | 'PERIODIC';
|
|
81
|
-
usage: 'TRIP' | 'REGISTRATION' | 'PRODUCTS' | 'ALL';
|
|
82
|
-
[key: string]: any;
|
|
83
|
-
};
|
|
84
|
-
type Receipt = {
|
|
85
|
-
id: string;
|
|
86
|
-
pspName: string;
|
|
87
|
-
pspReference: string;
|
|
88
|
-
pspPublishableKey: string;
|
|
89
|
-
amount: number;
|
|
90
|
-
currency: string;
|
|
91
|
-
date: string;
|
|
92
|
-
status: string;
|
|
93
|
-
paymentMethodType: string;
|
|
94
|
-
paymentMethodPspReference: string;
|
|
95
|
-
paymentIntentPspReference: string;
|
|
96
|
-
number: number;
|
|
97
|
-
code: string;
|
|
98
|
-
declineCode: string;
|
|
99
|
-
pspClientSecret: string;
|
|
100
|
-
reason: string;
|
|
101
|
-
note: string;
|
|
102
|
-
nextAction: {
|
|
103
|
-
nextActionRedirectUrl: {
|
|
104
|
-
url: string;
|
|
105
|
-
method: string;
|
|
106
|
-
data: {
|
|
107
|
-
[key: string]: unknown;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
type: string;
|
|
111
|
-
};
|
|
112
|
-
metadatas: {
|
|
113
|
-
[key: string]: unknown;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
type RefundableAmount = {
|
|
117
|
-
invoiceId: string;
|
|
118
|
-
fleetId: string;
|
|
119
|
-
refundableAmount: number;
|
|
120
|
-
currency: string;
|
|
121
|
-
refundablePaymentReceipts: Receipt[];
|
|
122
|
-
refundedPaymentReceipts: Receipt[];
|
|
123
|
-
};
|
|
124
|
-
type Wallet = {
|
|
125
|
-
initialAmount: number;
|
|
126
|
-
validityStartDate: string;
|
|
127
|
-
validityEndDate: string;
|
|
128
|
-
notes: string;
|
|
129
|
-
discountCategory: string;
|
|
130
|
-
oneTimeUsage: boolean;
|
|
131
|
-
id: string;
|
|
132
|
-
availableAmount: number;
|
|
133
|
-
usedAmount: number;
|
|
134
|
-
originId: string;
|
|
135
|
-
entityId: string;
|
|
136
|
-
creditAlreadyUsed: boolean;
|
|
137
|
-
updateDate: string;
|
|
138
|
-
type: string;
|
|
139
|
-
usage: string;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
declare const chargeProduct: (client: Client, info: ChargeProductInfo) => Promise<Invoice>;
|
|
143
|
-
|
|
144
|
-
declare const getUserCreditsByEntityId: (client: Client, id: string) => Promise<Credit>;
|
|
145
|
-
|
|
146
|
-
interface Payload$1 extends Omit<Credit, 'id' | 'availableAmount' | 'usedAmount' | 'originId' | 'creditAlreadyUsed' | 'updateDate'> {
|
|
147
|
-
}
|
|
148
|
-
declare const addCredits: (client: Client, payload: Payload$1) => Promise<Credit>;
|
|
149
|
-
|
|
150
|
-
declare const getInvoiceById: (client: Client, id: string) => Promise<Invoice>;
|
|
151
|
-
|
|
152
|
-
declare const getRefundableAmount: (client: Client, invoiceId: string) => Promise<RefundableAmount>;
|
|
153
|
-
|
|
154
|
-
interface Payload {
|
|
155
|
-
invoiceId: string;
|
|
156
|
-
amount?: number;
|
|
157
|
-
note?: string | null;
|
|
158
|
-
paymentIntentPspReference?: string;
|
|
159
|
-
}
|
|
160
|
-
declare const refund: (client: Client, payload: Payload) => Promise<void>;
|
|
161
|
-
|
|
162
|
-
declare const getWalletsByEntity: (client: Client, entityId: string) => Promise<Wallet[]>;
|
|
163
|
-
|
|
164
|
-
declare const paths: readonly ["/availableAmount", "/percentage"];
|
|
165
|
-
type Paths = (typeof paths)[number];
|
|
166
|
-
declare const updateWallet: (client: Client, walletId: string, actions: PatchAction<Paths>[]) => Promise<void>;
|
|
167
|
-
|
|
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 };
|