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