@lavapayments/nodejs 2.5.1 → 3.0.0
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 +101 -90
- package/dist/index.d.ts +101 -90
- package/dist/index.js +37 -9
- package/dist/index.mjs +37 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ApiVersion = "2025-
|
|
1
|
+
type ApiVersion = "2025-04-21.v1";
|
|
2
2
|
interface Config {
|
|
3
3
|
apiVersion: ApiVersion;
|
|
4
4
|
/**
|
|
@@ -21,9 +21,9 @@ declare class Lava {
|
|
|
21
21
|
private readonly baseUrl;
|
|
22
22
|
private readonly apiVersion;
|
|
23
23
|
/**
|
|
24
|
-
* The checkout resource
|
|
24
|
+
* The checkout sessions resource
|
|
25
25
|
*/
|
|
26
|
-
readonly
|
|
26
|
+
readonly checkoutSessions: Resources.CheckoutSessionsResource;
|
|
27
27
|
/**
|
|
28
28
|
* The connections resource
|
|
29
29
|
*/
|
|
@@ -89,76 +89,72 @@ declare class Lava {
|
|
|
89
89
|
generateForwardToken(options: ForwardTokenOptions): string;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
type CheckoutMode = "onboarding" | "topup";
|
|
93
92
|
interface CreateCheckoutSessionParams {
|
|
94
|
-
checkout_mode:
|
|
93
|
+
checkout_mode: "onboarding" | "topup";
|
|
95
94
|
origin_url: string;
|
|
96
95
|
reference_id?: string;
|
|
97
96
|
connection_id?: string;
|
|
98
97
|
}
|
|
99
|
-
interface
|
|
98
|
+
interface CheckoutSessionsListParams {
|
|
99
|
+
cursor?: string;
|
|
100
|
+
limit?: number;
|
|
101
|
+
reference_id?: string;
|
|
102
|
+
}
|
|
103
|
+
interface ConnectionsListParams {
|
|
104
|
+
cursor?: string;
|
|
105
|
+
limit?: number;
|
|
106
|
+
reference_id?: string;
|
|
107
|
+
}
|
|
108
|
+
interface RequestsListParams {
|
|
109
|
+
cursor?: string;
|
|
110
|
+
limit?: number;
|
|
111
|
+
connection_id?: string;
|
|
112
|
+
product_id?: string;
|
|
113
|
+
metadata_filters?: Record<string, string>;
|
|
114
|
+
}
|
|
115
|
+
interface RequestsListResponse {
|
|
116
|
+
data: Request[];
|
|
117
|
+
has_more: boolean;
|
|
118
|
+
next_cursor?: string;
|
|
119
|
+
}
|
|
120
|
+
interface UsageParams {
|
|
121
|
+
start: string;
|
|
122
|
+
end?: string;
|
|
123
|
+
connection_id?: string;
|
|
124
|
+
product_id?: string;
|
|
125
|
+
metadata_filters?: Record<string, string>;
|
|
126
|
+
}
|
|
127
|
+
interface ListResponse<T> {
|
|
128
|
+
data: T[];
|
|
129
|
+
has_more: boolean;
|
|
130
|
+
next_cursor?: string;
|
|
131
|
+
}
|
|
132
|
+
type RestCheckoutSession = {
|
|
100
133
|
checkout_session_id: string;
|
|
101
134
|
checkout_session_token: string;
|
|
102
|
-
checkout_mode:
|
|
135
|
+
checkout_mode: "onboarding" | "topup";
|
|
103
136
|
origin_url: string;
|
|
104
137
|
connection_id?: string;
|
|
105
138
|
reference_id?: string;
|
|
106
139
|
created_at: string;
|
|
107
140
|
completed_at?: string;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
balance: string;
|
|
111
|
-
phone: string;
|
|
112
|
-
email: string;
|
|
113
|
-
first_name: string;
|
|
114
|
-
last_name: string;
|
|
115
|
-
}
|
|
116
|
-
interface Connection {
|
|
141
|
+
};
|
|
142
|
+
type RestConnection = {
|
|
117
143
|
connection_id: string;
|
|
118
144
|
connection_secret: string;
|
|
119
145
|
reference_id?: string;
|
|
120
|
-
wallet:
|
|
146
|
+
wallet: {
|
|
147
|
+
balance: string;
|
|
148
|
+
phone: string;
|
|
149
|
+
email: string;
|
|
150
|
+
first_name: string;
|
|
151
|
+
last_name: string;
|
|
152
|
+
};
|
|
121
153
|
next_usage_reset: string;
|
|
122
154
|
previous_usage_reset: string;
|
|
123
155
|
created_at: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
cursor?: string;
|
|
127
|
-
limit?: number;
|
|
128
|
-
reference_id?: string;
|
|
129
|
-
}
|
|
130
|
-
interface ConnectionsListResponse {
|
|
131
|
-
data: Connection[];
|
|
132
|
-
has_more: boolean;
|
|
133
|
-
next_cursor?: string;
|
|
134
|
-
}
|
|
135
|
-
interface ModelUsage {
|
|
136
|
-
input_tokens: number;
|
|
137
|
-
output_tokens: number;
|
|
138
|
-
total_tokens: number;
|
|
139
|
-
input_cost: string;
|
|
140
|
-
output_cost: string;
|
|
141
|
-
total_cost: string;
|
|
142
|
-
}
|
|
143
|
-
interface FeeTierBreakdown {
|
|
144
|
-
tier: {
|
|
145
|
-
start: number;
|
|
146
|
-
rate: string;
|
|
147
|
-
};
|
|
148
|
-
tokens: number;
|
|
149
|
-
cost: string;
|
|
150
|
-
}
|
|
151
|
-
interface Fee {
|
|
152
|
-
amount: string;
|
|
153
|
-
rate_type: "fixed" | "percentage";
|
|
154
|
-
token_basis: "input+output" | "output";
|
|
155
|
-
breakdown: FeeTierBreakdown[];
|
|
156
|
-
}
|
|
157
|
-
interface ServiceCharge {
|
|
158
|
-
amount: string;
|
|
159
|
-
payer: "wallet" | "merchant";
|
|
160
|
-
}
|
|
161
|
-
interface Request {
|
|
156
|
+
};
|
|
157
|
+
type RestRequest = {
|
|
162
158
|
request_id: string;
|
|
163
159
|
connection_id?: string;
|
|
164
160
|
product_id?: string;
|
|
@@ -167,27 +163,40 @@ interface Request {
|
|
|
167
163
|
model: string;
|
|
168
164
|
endpoint: string;
|
|
169
165
|
response_id?: string;
|
|
170
|
-
model_usage:
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
model_usage: {
|
|
167
|
+
input_tokens: number;
|
|
168
|
+
output_tokens: number;
|
|
169
|
+
total_tokens: number;
|
|
170
|
+
input_cost: string;
|
|
171
|
+
output_cost: string;
|
|
172
|
+
total_cost: string;
|
|
173
|
+
payer: "wallet" | "merchant";
|
|
174
|
+
};
|
|
175
|
+
fee: {
|
|
176
|
+
amount: string;
|
|
177
|
+
rate_type: "fixed" | "percentage";
|
|
178
|
+
token_basis: "input+output" | "output";
|
|
179
|
+
breakdown: {
|
|
180
|
+
tier: {
|
|
181
|
+
start: number;
|
|
182
|
+
rate: string;
|
|
183
|
+
};
|
|
184
|
+
tokens: number;
|
|
185
|
+
cost: string;
|
|
186
|
+
}[];
|
|
187
|
+
};
|
|
188
|
+
service_charge: {
|
|
189
|
+
amount: string;
|
|
190
|
+
payer: "wallet" | "merchant";
|
|
191
|
+
};
|
|
173
192
|
total_request_cost: string;
|
|
193
|
+
total_wallet_cost: string;
|
|
194
|
+
total_merchant_cost: string;
|
|
174
195
|
metadata: Record<string, string>;
|
|
175
196
|
timestamp: string;
|
|
176
197
|
created_at: string;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
cursor?: string;
|
|
180
|
-
limit?: number;
|
|
181
|
-
connection_id?: string;
|
|
182
|
-
product_id?: string;
|
|
183
|
-
metadata_filters?: Record<string, string>;
|
|
184
|
-
}
|
|
185
|
-
interface RequestsListResponse {
|
|
186
|
-
data: Request[];
|
|
187
|
-
has_more: boolean;
|
|
188
|
-
next_cursor?: string;
|
|
189
|
-
}
|
|
190
|
-
interface UsageData {
|
|
198
|
+
};
|
|
199
|
+
type RestUsage = {
|
|
191
200
|
items: {
|
|
192
201
|
date: string;
|
|
193
202
|
total_requests: number;
|
|
@@ -196,6 +205,8 @@ interface UsageData {
|
|
|
196
205
|
total_fee_amount: string;
|
|
197
206
|
total_service_charge_amount: string;
|
|
198
207
|
total_request_cost: string;
|
|
208
|
+
total_wallet_cost: string;
|
|
209
|
+
total_merchant_cost: string;
|
|
199
210
|
}[];
|
|
200
211
|
totals: {
|
|
201
212
|
total_requests: number;
|
|
@@ -204,16 +215,10 @@ interface UsageData {
|
|
|
204
215
|
total_fee_amount: string;
|
|
205
216
|
total_service_charge_amount: string;
|
|
206
217
|
total_request_cost: string;
|
|
218
|
+
total_wallet_cost: string;
|
|
219
|
+
total_merchant_cost: string;
|
|
207
220
|
};
|
|
208
|
-
}
|
|
209
|
-
interface UsageParams {
|
|
210
|
-
start: string;
|
|
211
|
-
end?: string;
|
|
212
|
-
connection_id?: string;
|
|
213
|
-
product_id?: string;
|
|
214
|
-
metadata_filters?: Record<string, string>;
|
|
215
|
-
}
|
|
216
|
-
type Usage = UsageData[];
|
|
221
|
+
};
|
|
217
222
|
|
|
218
223
|
declare namespace Resources {
|
|
219
224
|
abstract class BaseResource {
|
|
@@ -223,19 +228,25 @@ declare namespace Resources {
|
|
|
223
228
|
/**
|
|
224
229
|
* Checkout session related endpoints
|
|
225
230
|
*/
|
|
226
|
-
export class
|
|
231
|
+
export class CheckoutSessionsResource extends BaseResource {
|
|
227
232
|
/**
|
|
228
233
|
* Create a checkout session
|
|
229
234
|
* @param params Checkout session parameters
|
|
230
235
|
* @returns Created checkout session
|
|
231
236
|
*/
|
|
232
|
-
create(params: CreateCheckoutSessionParams): Promise<
|
|
237
|
+
create(params: CreateCheckoutSessionParams): Promise<RestCheckoutSession>;
|
|
238
|
+
/**
|
|
239
|
+
* List checkout sessions
|
|
240
|
+
* @param params List parameters
|
|
241
|
+
* @returns Paginated list of checkout sessions
|
|
242
|
+
*/
|
|
243
|
+
list(params?: CheckoutSessionsListParams): Promise<ListResponse<RestCheckoutSession>>;
|
|
233
244
|
/**
|
|
234
245
|
* Retrieve a checkout session
|
|
235
246
|
* @param checkoutSessionId Checkout session ID
|
|
236
247
|
* @returns Checkout session details
|
|
237
248
|
*/
|
|
238
|
-
retrieve(checkoutSessionId: string): Promise<
|
|
249
|
+
retrieve(checkoutSessionId: string): Promise<RestCheckoutSession>;
|
|
239
250
|
}
|
|
240
251
|
/**
|
|
241
252
|
* Connection related endpoints
|
|
@@ -246,13 +257,13 @@ declare namespace Resources {
|
|
|
246
257
|
* @param params List parameters
|
|
247
258
|
* @returns Paginated list of connections
|
|
248
259
|
*/
|
|
249
|
-
list(params?: ConnectionsListParams): Promise<
|
|
260
|
+
list(params?: ConnectionsListParams): Promise<ListResponse<RestConnection>>;
|
|
250
261
|
/**
|
|
251
262
|
* Retrieve a connection
|
|
252
263
|
* @param connectionId Connection ID
|
|
253
264
|
* @returns Connection details
|
|
254
265
|
*/
|
|
255
|
-
retrieve(connectionId: string): Promise<
|
|
266
|
+
retrieve(connectionId: string): Promise<RestConnection>;
|
|
256
267
|
/**
|
|
257
268
|
* Delete a connection
|
|
258
269
|
* @param connectionId Connection ID
|
|
@@ -271,13 +282,13 @@ declare namespace Resources {
|
|
|
271
282
|
* @param params List parameters
|
|
272
283
|
* @returns Paginated list of requests
|
|
273
284
|
*/
|
|
274
|
-
list(params?: RequestsListParams): Promise<
|
|
285
|
+
list(params?: RequestsListParams): Promise<ListResponse<RestRequest>>;
|
|
275
286
|
/**
|
|
276
287
|
* Retrieve a request
|
|
277
288
|
* @param requestId Request ID
|
|
278
289
|
* @returns Request details
|
|
279
290
|
*/
|
|
280
|
-
retrieve(requestId: string): Promise<
|
|
291
|
+
retrieve(requestId: string): Promise<RestRequest>;
|
|
281
292
|
}
|
|
282
293
|
/**
|
|
283
294
|
* Usage related endpoints
|
|
@@ -288,9 +299,9 @@ declare namespace Resources {
|
|
|
288
299
|
* @param params Usage parameters
|
|
289
300
|
* @returns Usage data
|
|
290
301
|
*/
|
|
291
|
-
retrieve(params: UsageParams): Promise<
|
|
302
|
+
retrieve(params: UsageParams): Promise<RestUsage>;
|
|
292
303
|
}
|
|
293
304
|
export { };
|
|
294
305
|
}
|
|
295
306
|
|
|
296
|
-
export { type ApiVersion, type
|
|
307
|
+
export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestCheckoutSession, type RestConnection, type RestRequest, type RestUsage, type UsageParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ApiVersion = "2025-
|
|
1
|
+
type ApiVersion = "2025-04-21.v1";
|
|
2
2
|
interface Config {
|
|
3
3
|
apiVersion: ApiVersion;
|
|
4
4
|
/**
|
|
@@ -21,9 +21,9 @@ declare class Lava {
|
|
|
21
21
|
private readonly baseUrl;
|
|
22
22
|
private readonly apiVersion;
|
|
23
23
|
/**
|
|
24
|
-
* The checkout resource
|
|
24
|
+
* The checkout sessions resource
|
|
25
25
|
*/
|
|
26
|
-
readonly
|
|
26
|
+
readonly checkoutSessions: Resources.CheckoutSessionsResource;
|
|
27
27
|
/**
|
|
28
28
|
* The connections resource
|
|
29
29
|
*/
|
|
@@ -89,76 +89,72 @@ declare class Lava {
|
|
|
89
89
|
generateForwardToken(options: ForwardTokenOptions): string;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
type CheckoutMode = "onboarding" | "topup";
|
|
93
92
|
interface CreateCheckoutSessionParams {
|
|
94
|
-
checkout_mode:
|
|
93
|
+
checkout_mode: "onboarding" | "topup";
|
|
95
94
|
origin_url: string;
|
|
96
95
|
reference_id?: string;
|
|
97
96
|
connection_id?: string;
|
|
98
97
|
}
|
|
99
|
-
interface
|
|
98
|
+
interface CheckoutSessionsListParams {
|
|
99
|
+
cursor?: string;
|
|
100
|
+
limit?: number;
|
|
101
|
+
reference_id?: string;
|
|
102
|
+
}
|
|
103
|
+
interface ConnectionsListParams {
|
|
104
|
+
cursor?: string;
|
|
105
|
+
limit?: number;
|
|
106
|
+
reference_id?: string;
|
|
107
|
+
}
|
|
108
|
+
interface RequestsListParams {
|
|
109
|
+
cursor?: string;
|
|
110
|
+
limit?: number;
|
|
111
|
+
connection_id?: string;
|
|
112
|
+
product_id?: string;
|
|
113
|
+
metadata_filters?: Record<string, string>;
|
|
114
|
+
}
|
|
115
|
+
interface RequestsListResponse {
|
|
116
|
+
data: Request[];
|
|
117
|
+
has_more: boolean;
|
|
118
|
+
next_cursor?: string;
|
|
119
|
+
}
|
|
120
|
+
interface UsageParams {
|
|
121
|
+
start: string;
|
|
122
|
+
end?: string;
|
|
123
|
+
connection_id?: string;
|
|
124
|
+
product_id?: string;
|
|
125
|
+
metadata_filters?: Record<string, string>;
|
|
126
|
+
}
|
|
127
|
+
interface ListResponse<T> {
|
|
128
|
+
data: T[];
|
|
129
|
+
has_more: boolean;
|
|
130
|
+
next_cursor?: string;
|
|
131
|
+
}
|
|
132
|
+
type RestCheckoutSession = {
|
|
100
133
|
checkout_session_id: string;
|
|
101
134
|
checkout_session_token: string;
|
|
102
|
-
checkout_mode:
|
|
135
|
+
checkout_mode: "onboarding" | "topup";
|
|
103
136
|
origin_url: string;
|
|
104
137
|
connection_id?: string;
|
|
105
138
|
reference_id?: string;
|
|
106
139
|
created_at: string;
|
|
107
140
|
completed_at?: string;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
balance: string;
|
|
111
|
-
phone: string;
|
|
112
|
-
email: string;
|
|
113
|
-
first_name: string;
|
|
114
|
-
last_name: string;
|
|
115
|
-
}
|
|
116
|
-
interface Connection {
|
|
141
|
+
};
|
|
142
|
+
type RestConnection = {
|
|
117
143
|
connection_id: string;
|
|
118
144
|
connection_secret: string;
|
|
119
145
|
reference_id?: string;
|
|
120
|
-
wallet:
|
|
146
|
+
wallet: {
|
|
147
|
+
balance: string;
|
|
148
|
+
phone: string;
|
|
149
|
+
email: string;
|
|
150
|
+
first_name: string;
|
|
151
|
+
last_name: string;
|
|
152
|
+
};
|
|
121
153
|
next_usage_reset: string;
|
|
122
154
|
previous_usage_reset: string;
|
|
123
155
|
created_at: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
cursor?: string;
|
|
127
|
-
limit?: number;
|
|
128
|
-
reference_id?: string;
|
|
129
|
-
}
|
|
130
|
-
interface ConnectionsListResponse {
|
|
131
|
-
data: Connection[];
|
|
132
|
-
has_more: boolean;
|
|
133
|
-
next_cursor?: string;
|
|
134
|
-
}
|
|
135
|
-
interface ModelUsage {
|
|
136
|
-
input_tokens: number;
|
|
137
|
-
output_tokens: number;
|
|
138
|
-
total_tokens: number;
|
|
139
|
-
input_cost: string;
|
|
140
|
-
output_cost: string;
|
|
141
|
-
total_cost: string;
|
|
142
|
-
}
|
|
143
|
-
interface FeeTierBreakdown {
|
|
144
|
-
tier: {
|
|
145
|
-
start: number;
|
|
146
|
-
rate: string;
|
|
147
|
-
};
|
|
148
|
-
tokens: number;
|
|
149
|
-
cost: string;
|
|
150
|
-
}
|
|
151
|
-
interface Fee {
|
|
152
|
-
amount: string;
|
|
153
|
-
rate_type: "fixed" | "percentage";
|
|
154
|
-
token_basis: "input+output" | "output";
|
|
155
|
-
breakdown: FeeTierBreakdown[];
|
|
156
|
-
}
|
|
157
|
-
interface ServiceCharge {
|
|
158
|
-
amount: string;
|
|
159
|
-
payer: "wallet" | "merchant";
|
|
160
|
-
}
|
|
161
|
-
interface Request {
|
|
156
|
+
};
|
|
157
|
+
type RestRequest = {
|
|
162
158
|
request_id: string;
|
|
163
159
|
connection_id?: string;
|
|
164
160
|
product_id?: string;
|
|
@@ -167,27 +163,40 @@ interface Request {
|
|
|
167
163
|
model: string;
|
|
168
164
|
endpoint: string;
|
|
169
165
|
response_id?: string;
|
|
170
|
-
model_usage:
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
model_usage: {
|
|
167
|
+
input_tokens: number;
|
|
168
|
+
output_tokens: number;
|
|
169
|
+
total_tokens: number;
|
|
170
|
+
input_cost: string;
|
|
171
|
+
output_cost: string;
|
|
172
|
+
total_cost: string;
|
|
173
|
+
payer: "wallet" | "merchant";
|
|
174
|
+
};
|
|
175
|
+
fee: {
|
|
176
|
+
amount: string;
|
|
177
|
+
rate_type: "fixed" | "percentage";
|
|
178
|
+
token_basis: "input+output" | "output";
|
|
179
|
+
breakdown: {
|
|
180
|
+
tier: {
|
|
181
|
+
start: number;
|
|
182
|
+
rate: string;
|
|
183
|
+
};
|
|
184
|
+
tokens: number;
|
|
185
|
+
cost: string;
|
|
186
|
+
}[];
|
|
187
|
+
};
|
|
188
|
+
service_charge: {
|
|
189
|
+
amount: string;
|
|
190
|
+
payer: "wallet" | "merchant";
|
|
191
|
+
};
|
|
173
192
|
total_request_cost: string;
|
|
193
|
+
total_wallet_cost: string;
|
|
194
|
+
total_merchant_cost: string;
|
|
174
195
|
metadata: Record<string, string>;
|
|
175
196
|
timestamp: string;
|
|
176
197
|
created_at: string;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
cursor?: string;
|
|
180
|
-
limit?: number;
|
|
181
|
-
connection_id?: string;
|
|
182
|
-
product_id?: string;
|
|
183
|
-
metadata_filters?: Record<string, string>;
|
|
184
|
-
}
|
|
185
|
-
interface RequestsListResponse {
|
|
186
|
-
data: Request[];
|
|
187
|
-
has_more: boolean;
|
|
188
|
-
next_cursor?: string;
|
|
189
|
-
}
|
|
190
|
-
interface UsageData {
|
|
198
|
+
};
|
|
199
|
+
type RestUsage = {
|
|
191
200
|
items: {
|
|
192
201
|
date: string;
|
|
193
202
|
total_requests: number;
|
|
@@ -196,6 +205,8 @@ interface UsageData {
|
|
|
196
205
|
total_fee_amount: string;
|
|
197
206
|
total_service_charge_amount: string;
|
|
198
207
|
total_request_cost: string;
|
|
208
|
+
total_wallet_cost: string;
|
|
209
|
+
total_merchant_cost: string;
|
|
199
210
|
}[];
|
|
200
211
|
totals: {
|
|
201
212
|
total_requests: number;
|
|
@@ -204,16 +215,10 @@ interface UsageData {
|
|
|
204
215
|
total_fee_amount: string;
|
|
205
216
|
total_service_charge_amount: string;
|
|
206
217
|
total_request_cost: string;
|
|
218
|
+
total_wallet_cost: string;
|
|
219
|
+
total_merchant_cost: string;
|
|
207
220
|
};
|
|
208
|
-
}
|
|
209
|
-
interface UsageParams {
|
|
210
|
-
start: string;
|
|
211
|
-
end?: string;
|
|
212
|
-
connection_id?: string;
|
|
213
|
-
product_id?: string;
|
|
214
|
-
metadata_filters?: Record<string, string>;
|
|
215
|
-
}
|
|
216
|
-
type Usage = UsageData[];
|
|
221
|
+
};
|
|
217
222
|
|
|
218
223
|
declare namespace Resources {
|
|
219
224
|
abstract class BaseResource {
|
|
@@ -223,19 +228,25 @@ declare namespace Resources {
|
|
|
223
228
|
/**
|
|
224
229
|
* Checkout session related endpoints
|
|
225
230
|
*/
|
|
226
|
-
export class
|
|
231
|
+
export class CheckoutSessionsResource extends BaseResource {
|
|
227
232
|
/**
|
|
228
233
|
* Create a checkout session
|
|
229
234
|
* @param params Checkout session parameters
|
|
230
235
|
* @returns Created checkout session
|
|
231
236
|
*/
|
|
232
|
-
create(params: CreateCheckoutSessionParams): Promise<
|
|
237
|
+
create(params: CreateCheckoutSessionParams): Promise<RestCheckoutSession>;
|
|
238
|
+
/**
|
|
239
|
+
* List checkout sessions
|
|
240
|
+
* @param params List parameters
|
|
241
|
+
* @returns Paginated list of checkout sessions
|
|
242
|
+
*/
|
|
243
|
+
list(params?: CheckoutSessionsListParams): Promise<ListResponse<RestCheckoutSession>>;
|
|
233
244
|
/**
|
|
234
245
|
* Retrieve a checkout session
|
|
235
246
|
* @param checkoutSessionId Checkout session ID
|
|
236
247
|
* @returns Checkout session details
|
|
237
248
|
*/
|
|
238
|
-
retrieve(checkoutSessionId: string): Promise<
|
|
249
|
+
retrieve(checkoutSessionId: string): Promise<RestCheckoutSession>;
|
|
239
250
|
}
|
|
240
251
|
/**
|
|
241
252
|
* Connection related endpoints
|
|
@@ -246,13 +257,13 @@ declare namespace Resources {
|
|
|
246
257
|
* @param params List parameters
|
|
247
258
|
* @returns Paginated list of connections
|
|
248
259
|
*/
|
|
249
|
-
list(params?: ConnectionsListParams): Promise<
|
|
260
|
+
list(params?: ConnectionsListParams): Promise<ListResponse<RestConnection>>;
|
|
250
261
|
/**
|
|
251
262
|
* Retrieve a connection
|
|
252
263
|
* @param connectionId Connection ID
|
|
253
264
|
* @returns Connection details
|
|
254
265
|
*/
|
|
255
|
-
retrieve(connectionId: string): Promise<
|
|
266
|
+
retrieve(connectionId: string): Promise<RestConnection>;
|
|
256
267
|
/**
|
|
257
268
|
* Delete a connection
|
|
258
269
|
* @param connectionId Connection ID
|
|
@@ -271,13 +282,13 @@ declare namespace Resources {
|
|
|
271
282
|
* @param params List parameters
|
|
272
283
|
* @returns Paginated list of requests
|
|
273
284
|
*/
|
|
274
|
-
list(params?: RequestsListParams): Promise<
|
|
285
|
+
list(params?: RequestsListParams): Promise<ListResponse<RestRequest>>;
|
|
275
286
|
/**
|
|
276
287
|
* Retrieve a request
|
|
277
288
|
* @param requestId Request ID
|
|
278
289
|
* @returns Request details
|
|
279
290
|
*/
|
|
280
|
-
retrieve(requestId: string): Promise<
|
|
291
|
+
retrieve(requestId: string): Promise<RestRequest>;
|
|
281
292
|
}
|
|
282
293
|
/**
|
|
283
294
|
* Usage related endpoints
|
|
@@ -288,9 +299,9 @@ declare namespace Resources {
|
|
|
288
299
|
* @param params Usage parameters
|
|
289
300
|
* @returns Usage data
|
|
290
301
|
*/
|
|
291
|
-
retrieve(params: UsageParams): Promise<
|
|
302
|
+
retrieve(params: UsageParams): Promise<RestUsage>;
|
|
292
303
|
}
|
|
293
304
|
export { };
|
|
294
305
|
}
|
|
295
306
|
|
|
296
|
-
export { type ApiVersion, type
|
|
307
|
+
export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestCheckoutSession, type RestConnection, type RestRequest, type RestUsage, type UsageParams };
|
package/dist/index.js
CHANGED
|
@@ -33,16 +33,40 @@ var Resources;
|
|
|
33
33
|
this.lava = lava;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
class
|
|
36
|
+
class CheckoutSessionsResource extends BaseResource {
|
|
37
37
|
/**
|
|
38
38
|
* Create a checkout session
|
|
39
39
|
* @param params Checkout session parameters
|
|
40
40
|
* @returns Created checkout session
|
|
41
41
|
*/
|
|
42
42
|
async create(params) {
|
|
43
|
-
return this.lava.request(
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
return this.lava.request(
|
|
44
|
+
"POST",
|
|
45
|
+
"checkout_sessions",
|
|
46
|
+
{
|
|
47
|
+
data: params
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* List checkout sessions
|
|
53
|
+
* @param params List parameters
|
|
54
|
+
* @returns Paginated list of checkout sessions
|
|
55
|
+
*/
|
|
56
|
+
async list(params) {
|
|
57
|
+
const queryParams = {};
|
|
58
|
+
if (params) {
|
|
59
|
+
if (params.cursor) queryParams.cursor = params.cursor;
|
|
60
|
+
if (params.limit) queryParams.limit = params.limit.toString();
|
|
61
|
+
if (params.reference_id) queryParams.reference_id = params.reference_id;
|
|
62
|
+
}
|
|
63
|
+
return this.lava.request(
|
|
64
|
+
"GET",
|
|
65
|
+
"checkout_sessions",
|
|
66
|
+
{
|
|
67
|
+
query: queryParams
|
|
68
|
+
}
|
|
69
|
+
);
|
|
46
70
|
}
|
|
47
71
|
/**
|
|
48
72
|
* Retrieve a checkout session
|
|
@@ -56,7 +80,7 @@ var Resources;
|
|
|
56
80
|
);
|
|
57
81
|
}
|
|
58
82
|
}
|
|
59
|
-
Resources2.
|
|
83
|
+
Resources2.CheckoutSessionsResource = CheckoutSessionsResource;
|
|
60
84
|
class ConnectionsResource extends BaseResource {
|
|
61
85
|
/**
|
|
62
86
|
* List connections
|
|
@@ -70,9 +94,13 @@ var Resources;
|
|
|
70
94
|
if (params.limit) queryParams.limit = params.limit.toString();
|
|
71
95
|
if (params.reference_id) queryParams.reference_id = params.reference_id;
|
|
72
96
|
}
|
|
73
|
-
return this.lava.request(
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
return this.lava.request(
|
|
98
|
+
"GET",
|
|
99
|
+
"connections",
|
|
100
|
+
{
|
|
101
|
+
query: queryParams
|
|
102
|
+
}
|
|
103
|
+
);
|
|
76
104
|
}
|
|
77
105
|
/**
|
|
78
106
|
* Retrieve a connection
|
|
@@ -169,7 +197,7 @@ var Lava = class {
|
|
|
169
197
|
this.apiVersion = config.apiVersion;
|
|
170
198
|
const isTestMode = secretKey.startsWith("aks_test_");
|
|
171
199
|
this.baseUrl = config.baseUrl || (isTestMode ? "https://sandbox-api.lavapayments.com/v1/" : "https://api.lavapayments.com/v1/");
|
|
172
|
-
this.
|
|
200
|
+
this.checkoutSessions = new Resources.CheckoutSessionsResource(this);
|
|
173
201
|
this.connections = new Resources.ConnectionsResource(this);
|
|
174
202
|
this.requests = new Resources.RequestsResource(this);
|
|
175
203
|
this.usage = new Resources.UsageResource(this);
|
package/dist/index.mjs
CHANGED
|
@@ -6,16 +6,40 @@ var Resources;
|
|
|
6
6
|
this.lava = lava;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
class
|
|
9
|
+
class CheckoutSessionsResource extends BaseResource {
|
|
10
10
|
/**
|
|
11
11
|
* Create a checkout session
|
|
12
12
|
* @param params Checkout session parameters
|
|
13
13
|
* @returns Created checkout session
|
|
14
14
|
*/
|
|
15
15
|
async create(params) {
|
|
16
|
-
return this.lava.request(
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return this.lava.request(
|
|
17
|
+
"POST",
|
|
18
|
+
"checkout_sessions",
|
|
19
|
+
{
|
|
20
|
+
data: params
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* List checkout sessions
|
|
26
|
+
* @param params List parameters
|
|
27
|
+
* @returns Paginated list of checkout sessions
|
|
28
|
+
*/
|
|
29
|
+
async list(params) {
|
|
30
|
+
const queryParams = {};
|
|
31
|
+
if (params) {
|
|
32
|
+
if (params.cursor) queryParams.cursor = params.cursor;
|
|
33
|
+
if (params.limit) queryParams.limit = params.limit.toString();
|
|
34
|
+
if (params.reference_id) queryParams.reference_id = params.reference_id;
|
|
35
|
+
}
|
|
36
|
+
return this.lava.request(
|
|
37
|
+
"GET",
|
|
38
|
+
"checkout_sessions",
|
|
39
|
+
{
|
|
40
|
+
query: queryParams
|
|
41
|
+
}
|
|
42
|
+
);
|
|
19
43
|
}
|
|
20
44
|
/**
|
|
21
45
|
* Retrieve a checkout session
|
|
@@ -29,7 +53,7 @@ var Resources;
|
|
|
29
53
|
);
|
|
30
54
|
}
|
|
31
55
|
}
|
|
32
|
-
Resources2.
|
|
56
|
+
Resources2.CheckoutSessionsResource = CheckoutSessionsResource;
|
|
33
57
|
class ConnectionsResource extends BaseResource {
|
|
34
58
|
/**
|
|
35
59
|
* List connections
|
|
@@ -43,9 +67,13 @@ var Resources;
|
|
|
43
67
|
if (params.limit) queryParams.limit = params.limit.toString();
|
|
44
68
|
if (params.reference_id) queryParams.reference_id = params.reference_id;
|
|
45
69
|
}
|
|
46
|
-
return this.lava.request(
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
return this.lava.request(
|
|
71
|
+
"GET",
|
|
72
|
+
"connections",
|
|
73
|
+
{
|
|
74
|
+
query: queryParams
|
|
75
|
+
}
|
|
76
|
+
);
|
|
49
77
|
}
|
|
50
78
|
/**
|
|
51
79
|
* Retrieve a connection
|
|
@@ -142,7 +170,7 @@ var Lava = class {
|
|
|
142
170
|
this.apiVersion = config.apiVersion;
|
|
143
171
|
const isTestMode = secretKey.startsWith("aks_test_");
|
|
144
172
|
this.baseUrl = config.baseUrl || (isTestMode ? "https://sandbox-api.lavapayments.com/v1/" : "https://api.lavapayments.com/v1/");
|
|
145
|
-
this.
|
|
173
|
+
this.checkoutSessions = new Resources.CheckoutSessionsResource(this);
|
|
146
174
|
this.connections = new Resources.ConnectionsResource(this);
|
|
147
175
|
this.requests = new Resources.RequestsResource(this);
|
|
148
176
|
this.usage = new Resources.UsageResource(this);
|