pycer-sdk 0.0.0-stage → 1.0.3

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 ADDED
@@ -0,0 +1,1327 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var chunkANI325UM_cjs = require('./chunk-ANI325UM.cjs');
6
+ var crypto = require('crypto');
7
+
8
+ // src/resources/switch.ts
9
+ function validateAmount(amount) {
10
+ const decimal = String(amount);
11
+ if (!/^\d+(?:\.\d{1,2})?$/.test(decimal) || !/[1-9]/.test(decimal)) {
12
+ throw new chunkANI325UM_cjs.ValidationError("Use a positive decimal amount with at most two fractional digits", []);
13
+ }
14
+ return decimal;
15
+ }
16
+ var SwitchResource = class {
17
+ constructor(client) {
18
+ this.client = client;
19
+ }
20
+ client;
21
+ initiate(params, options) {
22
+ const amount = validateAmount(params.amount);
23
+ const phone = params.partyA?.phone?.trim();
24
+ const umid = params.partyB?.umid?.trim();
25
+ const currency = params.currency?.trim().toUpperCase();
26
+ const preferredRail = params.preferredRail?.trim().toUpperCase();
27
+ if (!phone || !/^\+[1-9]\d{6,14}$/.test(phone)) {
28
+ throw new chunkANI325UM_cjs.ValidationError("Payer phone must use strict E.164", []);
29
+ }
30
+ if (!umid || !preferredRail || !currency || !/^[A-Z]{3}$/.test(currency)) {
31
+ throw new chunkANI325UM_cjs.ValidationError("Merchant UMID, preferred rail and three-letter currency are required", []);
32
+ }
33
+ return this.client.request({
34
+ method: "POST",
35
+ path: "/payments",
36
+ body: { ...params, amount, currency, preferredRail, partyA: { ...params.partyA, phone }, partyB: { ...params.partyB, umid } },
37
+ options
38
+ });
39
+ }
40
+ charge(params, options) {
41
+ const { customerPhone, customerName, merchantUmid, accountReference, recipientAccount, ...payment } = params;
42
+ return this.initiate({
43
+ ...payment,
44
+ partyA: { phone: customerPhone, name: customerName },
45
+ partyB: { umid: merchantUmid, accountReference, recipientAccount }
46
+ }, options);
47
+ }
48
+ };
49
+
50
+ // src/resources/cards.ts
51
+ var CardsResource = class {
52
+ constructor(client) {
53
+ this.client = client;
54
+ }
55
+ client;
56
+ async charge(params, options) {
57
+ const { data } = await this.client.request({
58
+ method: "POST",
59
+ path: "/cards/charges",
60
+ body: {
61
+ payment_method_id: params.paymentMethodId,
62
+ amount: validateAmount(params.amount),
63
+ currency: params.currency.toUpperCase(),
64
+ reference: params.reference
65
+ },
66
+ options
67
+ });
68
+ return data;
69
+ }
70
+ async list(customerId, options) {
71
+ const result = await this.client.request({
72
+ method: "GET",
73
+ path: this.path(customerId),
74
+ query: { type: "card" },
75
+ options
76
+ });
77
+ return result.data;
78
+ }
79
+ async vault(customerId, params, options) {
80
+ if (!params.gatewayToken.trim()) throw new chunkANI325UM_cjs.ValidationError("Gateway token is required", []);
81
+ const result = await this.client.request({
82
+ method: "POST",
83
+ path: this.path(customerId),
84
+ body: { type: "card", gateway_token: params.gatewayToken, provider: params.provider, label: params.label, gateway_customer_id: params.gatewayCustomerId },
85
+ options
86
+ });
87
+ return result.data;
88
+ }
89
+ async setDefault(customerId, methodId, options) {
90
+ await this.client.request({ method: "PUT", path: this.path(customerId, methodId) + "/default", options });
91
+ }
92
+ async revoke(customerId, methodId, options) {
93
+ await this.client.request({ method: "DELETE", path: this.path(customerId, methodId), options });
94
+ }
95
+ path(customerId, methodId) {
96
+ for (const id of methodId === void 0 ? [customerId] : [customerId, methodId]) {
97
+ if (!Number.isSafeInteger(id) || id < 1) throw new chunkANI325UM_cjs.ValidationError("A positive numeric ID is required", []);
98
+ }
99
+ const base = `/customers/${customerId}/payment-methods`;
100
+ return methodId === void 0 ? base : `${base}/${methodId}`;
101
+ }
102
+ };
103
+
104
+ // src/resources/checkout.ts
105
+ var CheckoutResource = class {
106
+ constructor(client, baseUrl) {
107
+ this.client = client;
108
+ this.baseUrl = baseUrl;
109
+ }
110
+ client;
111
+ baseUrl;
112
+ async create(params, options) {
113
+ const { data } = await this.client.request({
114
+ method: "POST",
115
+ path: "/checkout/sessions",
116
+ body: { amount: validateAmount(params.amount), currency: params.currency.toUpperCase(), description: params.description },
117
+ options
118
+ });
119
+ return { ...data, checkoutUrl: this.url(data.token) };
120
+ }
121
+ async get(id, options) {
122
+ if (!/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(id)) {
123
+ throw new chunkANI325UM_cjs.ValidationError("A valid checkout session ID is required", []);
124
+ }
125
+ const { data } = await this.client.request({
126
+ method: "GET",
127
+ path: `/checkout/sessions/${id}`,
128
+ options
129
+ });
130
+ return data;
131
+ }
132
+ url(token, kind = "intent") {
133
+ if (!token || /\s/.test(token) || token === "." || token === "..") {
134
+ throw new chunkANI325UM_cjs.ValidationError("A valid OwnPay checkout token is required", []);
135
+ }
136
+ const prefix = kind === "intent" ? "/checkout/intent/" : "/checkout/";
137
+ return new URL(prefix + encodeURIComponent(token), this.baseUrl).href;
138
+ }
139
+ };
140
+ function generateUUID() {
141
+ return crypto.randomUUID();
142
+ }
143
+ function isValidApiKeyFormat(apiKey) {
144
+ return typeof apiKey === "string" && apiKey.startsWith("op_") && apiKey.length >= 12;
145
+ }
146
+ function isPositiveNumber(value) {
147
+ if (typeof value === "number") {
148
+ return value > 0 && Number.isFinite(value);
149
+ }
150
+ if (typeof value === "string") {
151
+ const num = Number(value);
152
+ return !isNaN(num) && num > 0 && Number.isFinite(num);
153
+ }
154
+ return false;
155
+ }
156
+ function isValidUrl(url) {
157
+ try {
158
+ const parsed = new URL(url);
159
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
160
+ } catch {
161
+ return false;
162
+ }
163
+ }
164
+ function buildQueryString(params) {
165
+ const searchParams = new URLSearchParams();
166
+ for (const [key, value] of Object.entries(params)) {
167
+ if (value !== void 0 && value !== null) {
168
+ searchParams.set(key, String(value));
169
+ }
170
+ }
171
+ const qs = searchParams.toString();
172
+ return qs ? `?${qs}` : "";
173
+ }
174
+ function sleep(ms) {
175
+ return new Promise((resolve) => setTimeout(resolve, ms));
176
+ }
177
+ function calculateBackoff(attempt, baseDelay = 1e3, maxDelay = 3e4) {
178
+ const exponentialDelay = baseDelay * Math.pow(2, attempt);
179
+ const jitter = exponentialDelay * 0.25 * (Math.random() * 2 - 1);
180
+ return Math.min(exponentialDelay + jitter, maxDelay);
181
+ }
182
+
183
+ // src/core/client.ts
184
+ var PORTAL_BASE_URLS = {
185
+ sandbox: "https://pycer.quantivogroup.com",
186
+ production: "https://pycer.quantivogroup.com"
187
+ };
188
+ var DEFAULT_CONFIG = {
189
+ TIMEOUT: 3e4,
190
+ MAX_RETRIES: 2,
191
+ API_VERSION: "v1",
192
+ USER_AGENT: "Pycer-SDK/1.0.3"
193
+ };
194
+ var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
195
+ var HttpClient = class {
196
+ apiKey;
197
+ baseUrl;
198
+ timeout;
199
+ maxRetries;
200
+ apiVersion;
201
+ defaultHeaders;
202
+ constructor(config, auth = "ownpay") {
203
+ const apiKey = config.apiKey ?? (auth === "ownpay" ? process.env.PYCER_API_KEY : void 0);
204
+ if (auth === "platform" && (!apiKey || /\s/.test(apiKey) || !config.baseUrl)) {
205
+ throw new chunkANI325UM_cjs.OwnPayError("Platform services require a base URL and a bearer token.", "INVALID_CONFIG");
206
+ }
207
+ if (!apiKey || auth === "ownpay" && !isValidApiKeyFormat(apiKey)) {
208
+ throw new chunkANI325UM_cjs.OwnPayError("Set PYCER_API_KEY or pass a valid Pycer merchant API key.", "INVALID_CONFIG");
209
+ }
210
+ this.apiKey = apiKey;
211
+ const environment = config.environment ?? (auth === "ownpay" ? process.env.PYCER_ENV : void 0) ?? (apiKey.startsWith("op_test_") ? "sandbox" : "production");
212
+ if (environment !== "sandbox" && environment !== "production") {
213
+ throw new chunkANI325UM_cjs.OwnPayError("PYCER_ENV must be sandbox or production.", "INVALID_CONFIG");
214
+ }
215
+ const configuredBaseUrl = config.baseUrl ?? process.env[`PYCER_${environment.toUpperCase()}_BASE_URL`] ?? process.env.PYCER_BASE_URL ?? process.env.OWNPAY_BASE_URL ?? PORTAL_BASE_URLS[environment];
216
+ if (!isValidUrl(configuredBaseUrl)) {
217
+ throw new chunkANI325UM_cjs.OwnPayError("Set a valid HTTP/HTTPS Pycer base URL.", "INVALID_CONFIG");
218
+ }
219
+ let normalizedBaseUrl = configuredBaseUrl;
220
+ while (normalizedBaseUrl.endsWith("/")) {
221
+ normalizedBaseUrl = normalizedBaseUrl.slice(0, -1);
222
+ }
223
+ this.baseUrl = normalizedBaseUrl;
224
+ this.timeout = config.timeout ?? DEFAULT_CONFIG.TIMEOUT;
225
+ this.maxRetries = config.maxRetries ?? DEFAULT_CONFIG.MAX_RETRIES;
226
+ this.apiVersion = config.apiVersion ?? DEFAULT_CONFIG.API_VERSION;
227
+ this.defaultHeaders = {
228
+ "User-Agent": DEFAULT_CONFIG.USER_AGENT,
229
+ "Accept": "application/json",
230
+ "Content-Type": "application/json",
231
+ ...config.headers
232
+ };
233
+ }
234
+ /**
235
+ * Makes an HTTP request to the OwnPay API.
236
+ *
237
+ * @param config - Request configuration
238
+ * @returns Parsed API response
239
+ */
240
+ async request(config) {
241
+ const { method, path, query, body, options } = config;
242
+ let lastError;
243
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
244
+ try {
245
+ return await this.executeRequest(method, path, query, body, options);
246
+ } catch (error) {
247
+ if (error instanceof chunkANI325UM_cjs.OwnPayError) {
248
+ lastError = error;
249
+ if (method !== "GET" || error instanceof chunkANI325UM_cjs.AbortError || !this.isRetryableError(error) || attempt === this.maxRetries) {
250
+ throw error;
251
+ }
252
+ const retryAfter = "retryAfter" in error ? error.retryAfter : void 0;
253
+ const delay = retryAfter !== void 0 ? retryAfter * 1e3 : calculateBackoff(attempt);
254
+ await sleep(delay);
255
+ continue;
256
+ }
257
+ throw error;
258
+ }
259
+ }
260
+ throw lastError ?? new chunkANI325UM_cjs.NetworkError("Request failed after all retries");
261
+ }
262
+ /**
263
+ * Executes a single HTTP request.
264
+ */
265
+ async executeRequest(method, path, query, body, options) {
266
+ const url = this.buildUrl(path, query);
267
+ const headers = this.buildHeaders(options);
268
+ const timeout = options?.timeout ?? this.timeout;
269
+ const controller = new AbortController();
270
+ const timeoutId = setTimeout(() => {
271
+ controller.abort();
272
+ }, timeout);
273
+ const { signal, cleanup } = options?.signal ? this.combineSignals(options.signal, controller.signal) : { signal: controller.signal, cleanup: () => {
274
+ } };
275
+ try {
276
+ const response = await fetch(url, {
277
+ method,
278
+ headers,
279
+ body: body ? JSON.stringify(body) : void 0,
280
+ signal,
281
+ redirect: "error"
282
+ });
283
+ const responseText = await response.text();
284
+ if (response.ok && responseText.trim() === "") {
285
+ return void 0;
286
+ }
287
+ let responseData;
288
+ try {
289
+ responseData = JSON.parse(responseText);
290
+ } catch {
291
+ throw new chunkANI325UM_cjs.NetworkError(
292
+ `Invalid JSON response from API (HTTP ${response.status})`
293
+ );
294
+ }
295
+ if (!response.ok) {
296
+ throw chunkANI325UM_cjs.createErrorFromResponse(
297
+ response.status,
298
+ responseData
299
+ );
300
+ }
301
+ return responseData;
302
+ } catch (error) {
303
+ if (error instanceof Error && error.name === "AbortError") {
304
+ throw new chunkANI325UM_cjs.AbortError(options?.signal?.aborted ? "Request was aborted" : "Request timed out");
305
+ }
306
+ if (error instanceof chunkANI325UM_cjs.OwnPayError) {
307
+ throw error;
308
+ }
309
+ if (error instanceof TypeError && error.message.includes("fetch")) {
310
+ throw new chunkANI325UM_cjs.NetworkError("Network request failed", error);
311
+ }
312
+ if (error instanceof Error && "cause" in error) {
313
+ throw new chunkANI325UM_cjs.NetworkError(error.message, error);
314
+ }
315
+ if (error instanceof Error) {
316
+ throw new chunkANI325UM_cjs.NetworkError(error.message, error);
317
+ }
318
+ throw new chunkANI325UM_cjs.NetworkError("Unknown network error");
319
+ } finally {
320
+ clearTimeout(timeoutId);
321
+ cleanup();
322
+ }
323
+ }
324
+ /**
325
+ * Builds the full request URL.
326
+ */
327
+ buildUrl(path, query) {
328
+ const basePath = `/api/${this.apiVersion}`;
329
+ const fullPath = path.startsWith("/") ? path : `/${path}`;
330
+ const queryString = query ? buildQueryString(query) : "";
331
+ return `${this.baseUrl}${basePath}${fullPath}${queryString}`;
332
+ }
333
+ /**
334
+ * Builds request headers including authentication.
335
+ */
336
+ buildHeaders(options) {
337
+ const headers = {
338
+ ...this.defaultHeaders,
339
+ "Authorization": `Bearer ${this.apiKey}`,
340
+ "X-Request-ID": generateUUID()
341
+ };
342
+ if (options?.idempotencyKey) {
343
+ headers["Idempotency-Key"] = options.idempotencyKey;
344
+ }
345
+ if (options?.headers) {
346
+ Object.assign(headers, options.headers);
347
+ }
348
+ return headers;
349
+ }
350
+ /**
351
+ * Combines two abort signals (external + timeout).
352
+ * Returns a combined signal and a cleanup function to remove listeners.
353
+ */
354
+ combineSignals(external, timeout) {
355
+ const controller = new AbortController();
356
+ const onAbort = () => {
357
+ controller.abort();
358
+ };
359
+ if (external.aborted || timeout.aborted) {
360
+ controller.abort();
361
+ return { signal: controller.signal, cleanup: () => {
362
+ } };
363
+ }
364
+ external.addEventListener("abort", onAbort, { once: true });
365
+ timeout.addEventListener("abort", onAbort, { once: true });
366
+ const cleanup = () => {
367
+ external.removeEventListener("abort", onAbort);
368
+ timeout.removeEventListener("abort", onAbort);
369
+ };
370
+ return { signal: controller.signal, cleanup };
371
+ }
372
+ /**
373
+ * Determines if an error is eligible for retry.
374
+ */
375
+ isRetryableError(error) {
376
+ if (error instanceof chunkANI325UM_cjs.NetworkError) return true;
377
+ if (error.status && RETRYABLE_STATUS_CODES.has(error.status)) {
378
+ return true;
379
+ }
380
+ return false;
381
+ }
382
+ };
383
+
384
+ // src/resources/payments.ts
385
+ var PaymentsResource = class {
386
+ constructor(client) {
387
+ this.client = client;
388
+ this.rail = new SwitchResource(client);
389
+ }
390
+ client;
391
+ rail;
392
+ create(params, options) {
393
+ return this.rail.initiate(params, options);
394
+ }
395
+ /**
396
+ * Retrieves a payment by its ID.
397
+ *
398
+ * @param paymentId - The payment UUID
399
+ * @param options - Optional request options
400
+ * @returns Payment details
401
+ *
402
+ * @example
403
+ * ```typescript
404
+ * const payment = await client.payments.get('pay_abc123...');
405
+ * console.log(payment.status); // 'completed'
406
+ * ```
407
+ */
408
+ async get(paymentId, options) {
409
+ if (!paymentId || typeof paymentId !== "string" || paymentId.trim() === "") {
410
+ throw new chunkANI325UM_cjs.ValidationError("Payment ID is required", [
411
+ { code: "REQUIRED", message: "Payment ID is required", field: "payment_id" }
412
+ ]);
413
+ }
414
+ const response = await this.client.request({
415
+ method: "GET",
416
+ path: `/payments/${encodeURIComponent(paymentId.trim())}`,
417
+ options
418
+ });
419
+ return response.data;
420
+ }
421
+ };
422
+
423
+ // src/resources/transactions.ts
424
+ var TransactionsResource = class {
425
+ constructor(client) {
426
+ this.client = client;
427
+ }
428
+ client;
429
+ /**
430
+ * Lists transactions with optional filtering and pagination.
431
+ *
432
+ * @param params - Optional filter and pagination parameters
433
+ * @param options - Optional request options
434
+ * @returns Paginated list of transactions
435
+ *
436
+ * @example
437
+ * ```typescript
438
+ * // Get completed transactions from last 7 days
439
+ * const result = await client.transactions.list({
440
+ * status: 'completed',
441
+ * from: '2024-01-01',
442
+ * to: '2024-01-07',
443
+ * per_page: 50,
444
+ * });
445
+ *
446
+ * for (const txn of result.items) {
447
+ * console.log(`${txn.trx_id}: ${txn.amount} ${txn.currency}`);
448
+ * }
449
+ * ```
450
+ */
451
+ async list(params, options) {
452
+ const query = {};
453
+ if (params?.page !== void 0) query.page = params.page;
454
+ if (params?.per_page !== void 0) query.per_page = params.per_page;
455
+ if (params?.status) query.status = params.status;
456
+ if (params?.gateway) query.gateway = params.gateway;
457
+ if (params?.from) query.from = params.from;
458
+ if (params?.to) query.to = params.to;
459
+ const response = await this.client.request({
460
+ method: "GET",
461
+ path: "/transactions",
462
+ query,
463
+ options
464
+ });
465
+ return {
466
+ items: response.data || [],
467
+ meta: response.meta ?? {
468
+ page: params?.page ?? 1,
469
+ per_page: params?.per_page ?? 25,
470
+ total: 0,
471
+ total_pages: 0
472
+ }
473
+ };
474
+ }
475
+ /**
476
+ * Retrieves a single transaction by ID.
477
+ *
478
+ * Accepts either an OwnPay transaction reference (e.g., 'OP-XXXX')
479
+ * or a gateway transaction ID.
480
+ *
481
+ * @param trxId - Transaction ID (OwnPay reference or gateway ID)
482
+ * @param options - Optional request options
483
+ * @returns Transaction details
484
+ *
485
+ * @example
486
+ * ```typescript
487
+ * // By OwnPay reference
488
+ * const txn = await client.transactions.get('OP-ABC123');
489
+ *
490
+ * // By gateway transaction ID
491
+ * const txn = await client.transactions.get('gw_xyz789');
492
+ * ```
493
+ */
494
+ async get(trxId, options) {
495
+ if (!trxId || typeof trxId !== "string" || trxId.trim() === "") {
496
+ throw new chunkANI325UM_cjs.ValidationError("Transaction ID is required", [
497
+ { code: "REQUIRED", message: "Transaction ID is required", field: "trx_id" }
498
+ ]);
499
+ }
500
+ const response = await this.client.request({
501
+ method: "GET",
502
+ path: `/transactions/${encodeURIComponent(trxId.trim())}`,
503
+ options
504
+ });
505
+ return response.data;
506
+ }
507
+ };
508
+
509
+ // src/resources/refunds.ts
510
+ var RefundsResource = class {
511
+ constructor(client) {
512
+ this.client = client;
513
+ }
514
+ client;
515
+ /**
516
+ * Creates a new refund for a transaction.
517
+ *
518
+ * @param params - Refund creation parameters
519
+ * @param options - Optional request options
520
+ * @returns Created refund details
521
+ *
522
+ * @example
523
+ * ```typescript
524
+ * const refund = await client.refunds.create({
525
+ * transaction_id: 'OP-ABC123',
526
+ * amount: '25.00',
527
+ * reason: 'Item returned',
528
+ * });
529
+ *
530
+ * console.log(refund.status); // 'pending' or 'completed'
531
+ * ```
532
+ */
533
+ async create(params, options) {
534
+ this.validateCreateParams(params);
535
+ const body = {};
536
+ if (params.transaction_id !== void 0) {
537
+ body.transaction_id = params.transaction_id;
538
+ } else if (params.trx_id !== void 0) {
539
+ body.trx_id = params.trx_id;
540
+ }
541
+ if (params.amount !== void 0) {
542
+ body.amount = String(params.amount);
543
+ }
544
+ if (params.reason !== void 0) {
545
+ body.reason = params.reason;
546
+ }
547
+ const response = await this.client.request({
548
+ method: "POST",
549
+ path: "/refunds",
550
+ body,
551
+ options
552
+ });
553
+ return response.data;
554
+ }
555
+ /**
556
+ * Lists refunds with optional filtering and pagination.
557
+ *
558
+ * @param params - Optional filter and pagination parameters
559
+ * @param options - Optional request options
560
+ * @returns Paginated list of refunds
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * const result = await client.refunds.list({
565
+ * status: 'completed',
566
+ * page: 1,
567
+ * per_page: 25,
568
+ * });
569
+ *
570
+ * for (const refund of result.items) {
571
+ * console.log(`${refund.uuid}: ${refund.amount}`);
572
+ * }
573
+ * ```
574
+ */
575
+ async list(params, options) {
576
+ const query = {};
577
+ if (params?.page !== void 0) query.page = params.page;
578
+ if (params?.per_page !== void 0) query.per_page = params.per_page;
579
+ if (params?.status) query.status = params.status;
580
+ if (params?.trx_id) query.trx_id = params.trx_id;
581
+ if (params?.transaction_id) query.transaction_id = params.transaction_id;
582
+ if (params?.from) query.from = params.from;
583
+ if (params?.to) query.to = params.to;
584
+ const response = await this.client.request({
585
+ method: "GET",
586
+ path: "/refunds",
587
+ query,
588
+ options
589
+ });
590
+ return {
591
+ items: response.data || [],
592
+ meta: response.meta ?? {
593
+ page: params?.page ?? 1,
594
+ per_page: params?.per_page ?? 25,
595
+ total: 0,
596
+ total_pages: 0
597
+ }
598
+ };
599
+ }
600
+ /**
601
+ * Retrieves a single refund by transaction reference.
602
+ *
603
+ * @param trxId - Transaction ID (OwnPay reference or gateway ID)
604
+ * @param options - Optional request options
605
+ * @returns Refund details
606
+ *
607
+ * @example
608
+ * ```typescript
609
+ * const refund = await client.refunds.get('OP-ABC123');
610
+ * ```
611
+ */
612
+ async get(trxId, options) {
613
+ if (!trxId || typeof trxId !== "string" || trxId.trim() === "") {
614
+ throw new chunkANI325UM_cjs.ValidationError("Transaction ID is required", [
615
+ { code: "REQUIRED", message: "Transaction ID is required", field: "trx_id" }
616
+ ]);
617
+ }
618
+ const response = await this.client.request({
619
+ method: "GET",
620
+ path: `/refunds/${encodeURIComponent(trxId.trim())}`,
621
+ options
622
+ });
623
+ return response.data;
624
+ }
625
+ /**
626
+ * Validates refund creation parameters.
627
+ */
628
+ validateCreateParams(params) {
629
+ const errors = [];
630
+ if ((params.transaction_id === void 0 || params.transaction_id === null) && (params.trx_id === void 0 || params.trx_id === null)) {
631
+ errors.push({
632
+ code: "REQUIRED",
633
+ message: "transaction_id or trx_id is required",
634
+ field: "transaction_id"
635
+ });
636
+ }
637
+ if (params.amount !== void 0 && params.amount !== null) {
638
+ if (!isPositiveNumber(params.amount)) {
639
+ errors.push({
640
+ code: "INVALID_AMOUNT",
641
+ message: "Amount must be a positive number",
642
+ field: "amount"
643
+ });
644
+ }
645
+ }
646
+ if (errors.length > 0) {
647
+ throw new chunkANI325UM_cjs.ValidationError(
648
+ errors[0]?.message ?? "Validation failed",
649
+ errors.map((e) => ({
650
+ code: e.code,
651
+ message: e.message,
652
+ field: e.field
653
+ }))
654
+ );
655
+ }
656
+ }
657
+ };
658
+
659
+ // src/resources/customers.ts
660
+ var CustomersResource = class {
661
+ constructor(client) {
662
+ this.client = client;
663
+ }
664
+ client;
665
+ /**
666
+ * Creates a new customer.
667
+ *
668
+ * @param params - Customer creation parameters
669
+ * @param options - Optional request options
670
+ * @returns Created customer with ID and UUID
671
+ *
672
+ * @example
673
+ * ```typescript
674
+ * const customer = await client.customers.create({
675
+ * name: 'Jane Smith',
676
+ * email: 'jane@example.com',
677
+ * phone: '+8801712345678',
678
+ * });
679
+ *
680
+ * console.log(customer.id); // Internal ID
681
+ * console.log(customer.uuid); // Public UUID
682
+ * ```
683
+ */
684
+ async create(params, options) {
685
+ this.validateCreateParams(params);
686
+ const body = {
687
+ name: params.name
688
+ };
689
+ if (params.email) body.email = params.email;
690
+ if (params.phone) body.phone = params.phone;
691
+ const response = await this.client.request({
692
+ method: "POST",
693
+ path: "/customers",
694
+ body,
695
+ options
696
+ });
697
+ return response.data;
698
+ }
699
+ /**
700
+ * Lists customers with pagination.
701
+ *
702
+ * @param params - Optional pagination parameters
703
+ * @param options - Optional request options
704
+ * @returns Paginated list of customers
705
+ *
706
+ * @example
707
+ * ```typescript
708
+ * const result = await client.customers.list({ page: 1, per_page: 50 });
709
+ *
710
+ * for (const customer of result.items) {
711
+ * console.log(`${customer.name}: ${customer.email}`);
712
+ * }
713
+ * ```
714
+ */
715
+ async list(params, options) {
716
+ const query = {};
717
+ if (params?.page !== void 0) query.page = params.page;
718
+ if (params?.per_page !== void 0) query.per_page = params.per_page;
719
+ const response = await this.client.request({
720
+ method: "GET",
721
+ path: "/customers",
722
+ query,
723
+ options
724
+ });
725
+ return {
726
+ items: response.data || [],
727
+ meta: response.meta ?? {
728
+ page: params?.page ?? 1,
729
+ per_page: params?.per_page ?? 25,
730
+ total: 0,
731
+ total_pages: 0
732
+ }
733
+ };
734
+ }
735
+ /**
736
+ * Retrieves a customer by email or phone number.
737
+ *
738
+ * The identifier is auto-detected:
739
+ * - Contains '@' → treated as email
740
+ * - Otherwise → treated as phone
741
+ *
742
+ * @param identifier - Customer email or phone number
743
+ * @param options - Optional request options
744
+ * @returns Customer details
745
+ *
746
+ * @example
747
+ * ```typescript
748
+ * // By email
749
+ * const customer = await client.customers.get('john@example.com');
750
+ *
751
+ * // By phone
752
+ * const customer = await client.customers.get('+8801712345678');
753
+ * ```
754
+ */
755
+ async get(identifier, options) {
756
+ if (!identifier || typeof identifier !== "string" || identifier.trim() === "") {
757
+ throw new chunkANI325UM_cjs.ValidationError("Identifier is required", [
758
+ { code: "REQUIRED", message: "Email or phone identifier is required", field: "identifier" }
759
+ ]);
760
+ }
761
+ const response = await this.client.request({
762
+ method: "GET",
763
+ path: `/customers/${encodeURIComponent(identifier.trim())}`,
764
+ options
765
+ });
766
+ return response.data;
767
+ }
768
+ /**
769
+ * Validates customer creation parameters.
770
+ */
771
+ validateCreateParams(params) {
772
+ const errors = [];
773
+ if (!params.name || typeof params.name !== "string" || params.name.trim() === "") {
774
+ errors.push({
775
+ code: "REQUIRED",
776
+ message: "Customer name is required",
777
+ field: "name"
778
+ });
779
+ }
780
+ if (params.name && params.name.length > 150) {
781
+ errors.push({
782
+ code: "INVALID_LENGTH",
783
+ message: "Customer name must be 150 characters or less",
784
+ field: "name"
785
+ });
786
+ }
787
+ if (errors.length > 0) {
788
+ throw new chunkANI325UM_cjs.ValidationError(
789
+ errors[0]?.message ?? "Validation failed",
790
+ errors.map((e) => ({
791
+ code: e.code,
792
+ message: e.message,
793
+ field: e.field
794
+ }))
795
+ );
796
+ }
797
+ }
798
+ };
799
+
800
+ // src/resources/api-keys.ts
801
+ var ApiKeysResource = class {
802
+ constructor(client) {
803
+ this.client = client;
804
+ }
805
+ client;
806
+ /**
807
+ * Lists all API keys for the authenticated merchant.
808
+ *
809
+ * Note: Requires API key with 'write' and 'admin' scopes.
810
+ *
811
+ * @param options - Optional request options (must include superAdminEmail header)
812
+ * @returns Array of API key metadata
813
+ *
814
+ * @example
815
+ * ```typescript
816
+ * const keys = await client.apiKeys.list({
817
+ * headers: { 'X-Super-Admin-Email': 'admin@example.com' },
818
+ * });
819
+ * ```
820
+ */
821
+ async list(options) {
822
+ this.ensureAdminHeaders(options);
823
+ const response = await this.client.request({
824
+ method: "GET",
825
+ path: "/api-keys",
826
+ options
827
+ });
828
+ return response.data || [];
829
+ }
830
+ /**
831
+ * Generates a new API key.
832
+ *
833
+ * Note: Requires API key with 'write' and 'admin' scopes.
834
+ * The actual key is only shown once in the response.
835
+ *
836
+ * @param params - Key generation parameters
837
+ * @param options - Optional request options (must include superAdminEmail header)
838
+ * @returns Generated API key (store securely, cannot be retrieved again)
839
+ *
840
+ * @example
841
+ * ```typescript
842
+ * const result = await client.apiKeys.generate({
843
+ * name: 'My App Key',
844
+ * scopes: ['read', 'write'],
845
+ * }, {
846
+ * headers: { 'X-Super-Admin-Email': 'admin@example.com' },
847
+ * });
848
+ *
849
+ * // IMPORTANT: Store this key securely!
850
+ * console.log(result.key); // 'op_xxxxx...'
851
+ * console.log(result.warning); // 'Store this key securely...'
852
+ * ```
853
+ */
854
+ async generate(params, options) {
855
+ this.ensureAdminHeaders(options);
856
+ const body = {};
857
+ if (params?.name) body.name = params.name;
858
+ if (params?.scopes) {
859
+ this.validateScopes(params.scopes);
860
+ body.scopes = params.scopes;
861
+ }
862
+ const response = await this.client.request({
863
+ method: "POST",
864
+ path: "/api-keys",
865
+ body,
866
+ options
867
+ });
868
+ return response.data;
869
+ }
870
+ /**
871
+ * Revokes an API key by ID.
872
+ *
873
+ * Note: Requires API key with 'write' and 'admin' scopes.
874
+ *
875
+ * @param keyId - The API key ID to revoke
876
+ * @param options - Optional request options (must include superAdminEmail header)
877
+ *
878
+ * @example
879
+ * ```typescript
880
+ * await client.apiKeys.revoke(123, {
881
+ * headers: { 'X-Super-Admin-Email': 'admin@example.com' },
882
+ * });
883
+ * ```
884
+ */
885
+ async revoke(keyId, options) {
886
+ this.ensureAdminHeaders(options);
887
+ if (!Number.isInteger(keyId) || keyId <= 0) {
888
+ throw new chunkANI325UM_cjs.ValidationError("Valid API key ID is required", [
889
+ { code: "REQUIRED", message: "Valid API key ID is required", field: "id" }
890
+ ]);
891
+ }
892
+ await this.client.request({
893
+ method: "DELETE",
894
+ path: `/api-keys/${keyId}`,
895
+ options
896
+ });
897
+ }
898
+ /**
899
+ * Ensures the X-Super-Admin-Email header is present.
900
+ */
901
+ ensureAdminHeaders(options) {
902
+ const email = options?.headers?.["X-Super-Admin-Email"];
903
+ if (!email) {
904
+ throw new chunkANI325UM_cjs.PermissionError(
905
+ 'API key operations require the X-Super-Admin-Email header. Pass it in options.headers["X-Super-Admin-Email"].'
906
+ );
907
+ }
908
+ }
909
+ /**
910
+ * Validates API key scopes.
911
+ */
912
+ validateScopes(scopes) {
913
+ const allowed = ["read", "write", "admin"];
914
+ for (const scope of scopes) {
915
+ if (!allowed.includes(scope)) {
916
+ throw new chunkANI325UM_cjs.ValidationError(
917
+ `Invalid scope: ${scope}. Allowed: ${allowed.join(", ")}`,
918
+ [{ code: "INVALID_SCOPE", message: `Invalid scope: ${scope}`, field: "scopes" }]
919
+ );
920
+ }
921
+ }
922
+ }
923
+ };
924
+
925
+ // src/resources/webhooks.ts
926
+ var WebhooksResource = class {
927
+ constructor(client) {
928
+ this.client = client;
929
+ }
930
+ client;
931
+ /**
932
+ * Sends a test webhook to the configured endpoint.
933
+ *
934
+ * @param options - Optional request options
935
+ * @returns Test result with status code and response time
936
+ *
937
+ * @example
938
+ * ```typescript
939
+ * const result = await client.webhooks.test();
940
+ *
941
+ * if (result.status_code === 200) {
942
+ * console.log('Webhook endpoint is working!');
943
+ * }
944
+ * ```
945
+ */
946
+ async test(options) {
947
+ const response = await this.client.request({
948
+ method: "POST",
949
+ path: "/webhooks/tests",
950
+ options
951
+ });
952
+ return response.data;
953
+ }
954
+ /**
955
+ * Lists recent webhook deliveries.
956
+ *
957
+ * @param options - Optional request options
958
+ * @returns Array of webhook delivery records
959
+ *
960
+ * @example
961
+ * ```typescript
962
+ * const deliveries = await client.webhooks.deliveries();
963
+ *
964
+ * for (const delivery of deliveries) {
965
+ * console.log(`${delivery.event}: ${delivery.status} (${delivery.status_code})`);
966
+ * }
967
+ * ```
968
+ */
969
+ async deliveries(options) {
970
+ const response = await this.client.request({
971
+ method: "GET",
972
+ path: "/webhooks/deliveries",
973
+ options
974
+ });
975
+ return response.data || [];
976
+ }
977
+ };
978
+
979
+ // src/resources/merchant.ts
980
+ var MerchantResource = class {
981
+ constructor(client) {
982
+ this.client = client;
983
+ }
984
+ client;
985
+ disburse(params, options) {
986
+ const phone = params.recipient.phone.trim();
987
+ if (!/^\+[1-9]\d{6,14}$/.test(phone)) throw new chunkANI325UM_cjs.ValidationError("Recipient phone must use strict E.164", []);
988
+ return this.client.request({
989
+ method: "POST",
990
+ path: "/disburse",
991
+ body: { ...params, amount: validateAmount(params.amount), recipient: { phone } },
992
+ options
993
+ });
994
+ }
995
+ async float(currency, options) {
996
+ const { data } = await this.client.request({
997
+ method: "GET",
998
+ path: "/merchants/float",
999
+ query: { currency: currency.toUpperCase() },
1000
+ options
1001
+ });
1002
+ return data;
1003
+ }
1004
+ virtualAccounts = {
1005
+ provision: async (params, options) => {
1006
+ const { data } = await this.client.request({
1007
+ method: "POST",
1008
+ path: "/virtual-accounts",
1009
+ body: { reference: params.reference, currency: params.currency.toUpperCase() },
1010
+ options
1011
+ });
1012
+ return data;
1013
+ },
1014
+ list: async (afterId, options) => {
1015
+ const { data } = await this.client.request({ method: "GET", path: "/virtual-accounts", query: { after_id: afterId }, options });
1016
+ return data;
1017
+ }
1018
+ };
1019
+ payoutMethods = {
1020
+ list: (options) => this.call("GET", "/merchants/payout-methods", options),
1021
+ create: (body, options) => this.call("POST", "/merchants/payout-methods", options, body),
1022
+ setDefault: (id, options) => this.call("PUT", `/merchants/payout-methods/${segment(id)}/default`, options)
1023
+ };
1024
+ settlement = {
1025
+ getPolicy: (options) => this.call("GET", "/merchants/settlement/policy", options),
1026
+ updatePolicy: (body, options) => this.call("PUT", "/merchants/settlement/policy", options, body),
1027
+ sweep: (body, options) => this.call("POST", "/merchants/settlement/sweep", options, body)
1028
+ };
1029
+ paymentMethods = {
1030
+ list: (customerId, options) => this.call("GET", `/customers/${segment(customerId)}/payment-methods`, options),
1031
+ create: (customerId, body, options) => this.call("POST", `/customers/${segment(customerId)}/payment-methods`, options, body),
1032
+ setDefault: (customerId, id, options) => this.call("PUT", `/customers/${segment(customerId)}/payment-methods/${segment(id)}/default`, options),
1033
+ revoke: (customerId, id, options) => this.call("DELETE", `/customers/${segment(customerId)}/payment-methods/${segment(id)}`, options)
1034
+ };
1035
+ wallets = {
1036
+ list: (customerId, options) => this.call("GET", `/customers/${segment(customerId)}/wallets`, options),
1037
+ create: (customerId, body, options) => this.call("POST", `/customers/${segment(customerId)}/wallets`, options, body),
1038
+ topUp: (customerId, currency, body, options) => this.call("POST", `/customers/${segment(customerId)}/wallets/${segment(currency.toUpperCase())}/topup`, options, body)
1039
+ };
1040
+ accountReferences = {
1041
+ list: (query, options) => this.call("GET", "/merchants/account-references", options, void 0, query),
1042
+ get: (id, options) => this.call("GET", `/merchants/account-references/${segment(id)}`, options),
1043
+ create: (body, options) => this.call("POST", "/merchants/account-references", options, body),
1044
+ update: (id, body, options) => this.call("PUT", `/merchants/account-references/${segment(id)}`, options, body),
1045
+ remove: (id, options) => this.call("DELETE", `/merchants/account-references/${segment(id)}`, options)
1046
+ };
1047
+ commerce = {
1048
+ listProducts: (query, options) => this.call("GET", "/products", options, void 0, query),
1049
+ createProduct: (body, options) => this.call("POST", "/products", options, body),
1050
+ listStorefronts: (query, options) => this.call("GET", "/storefronts", options, void 0, query),
1051
+ listOrders: (query, options) => this.call("GET", "/orders", options, void 0, query)
1052
+ };
1053
+ terminals = {
1054
+ list: (options) => this.call("GET", "/terminals", options),
1055
+ pushIntent: (body, options) => this.call("POST", "/terminals/intents", options, body),
1056
+ settle: (id, body, options) => this.call("POST", `/terminals/${segment(id)}/settle`, options, body)
1057
+ };
1058
+ call(method, path, options, body, query) {
1059
+ return this.client.request({ method, path, options, body, query });
1060
+ }
1061
+ };
1062
+ function segment(value) {
1063
+ if (!value.trim() || value === "." || value === "..") throw new chunkANI325UM_cjs.ValidationError("Invalid resource identifier", []);
1064
+ return encodeURIComponent(value);
1065
+ }
1066
+
1067
+ // src/resources/health.ts
1068
+ var HealthResource = class {
1069
+ constructor(client) {
1070
+ this.client = client;
1071
+ }
1072
+ client;
1073
+ /**
1074
+ * Performs a system health check.
1075
+ *
1076
+ * Returns detailed information about:
1077
+ * - System status (healthy/degraded)
1078
+ * - Database connectivity
1079
+ * - Mobile companion app status
1080
+ * - Active gateway count
1081
+ * - Customer count
1082
+ *
1083
+ * @param options - Optional request options
1084
+ * @returns Health status information
1085
+ *
1086
+ * @example
1087
+ * ```typescript
1088
+ * const health = await client.health.check();
1089
+ *
1090
+ * console.log(`Status: ${health.status}`);
1091
+ * console.log(`Version: ${health.version}`);
1092
+ * console.log(`Database: ${health.db}`);
1093
+ * console.log(`Active gateways: ${health.gateways}`);
1094
+ * console.log(`Total customers: ${health.customers}`);
1095
+ *
1096
+ * // Check mobile companion status
1097
+ * if (health.mobile.connected) {
1098
+ * console.log(`Mobile devices: ${health.mobile.active_devices}`);
1099
+ * }
1100
+ * ```
1101
+ */
1102
+ async check(options) {
1103
+ const response = await this.client.request({
1104
+ method: "GET",
1105
+ path: "/health",
1106
+ options
1107
+ });
1108
+ return response.data;
1109
+ }
1110
+ };
1111
+
1112
+ // src/platform.ts
1113
+ function transport(config) {
1114
+ const client = new HttpClient({ ...config, apiKey: config.token }, "platform");
1115
+ return (method, path, options, body, query) => client.request({ method, path, options, body, query });
1116
+ }
1117
+ var Notifications = class {
1118
+ call;
1119
+ constructor(config) {
1120
+ this.call = transport(config);
1121
+ }
1122
+ sendSms(body, options) {
1123
+ return this.call("POST", "/notifications/sms", options, body);
1124
+ }
1125
+ sendEmail(body, options) {
1126
+ return this.call("POST", "/notifications/email", options, body);
1127
+ }
1128
+ sendPush(body, options) {
1129
+ return this.call("POST", "/notifications/push", options, body);
1130
+ }
1131
+ sendOtp(body, options) {
1132
+ return this.call("POST", "/notifications/otp", options, body);
1133
+ }
1134
+ };
1135
+ var Billing = class {
1136
+ call;
1137
+ constructor(config) {
1138
+ this.call = transport(config);
1139
+ }
1140
+ catalog(query, options) {
1141
+ return this.call("GET", "/utilities/catalog", options, void 0, query);
1142
+ }
1143
+ lookupAccount(body, options) {
1144
+ return this.call("POST", "/utilities/account-lookup", options, body);
1145
+ }
1146
+ quote(body, options) {
1147
+ return this.call("POST", "/utilities/quotes", options, body);
1148
+ }
1149
+ vend(body, options) {
1150
+ return this.call("POST", "/utilities/vend", options, body);
1151
+ }
1152
+ quoteAirtime(body, options) {
1153
+ return this.call("POST", "/airtime/query", options, body);
1154
+ }
1155
+ };
1156
+ var DeveloperTools = class {
1157
+ call;
1158
+ constructor(config) {
1159
+ this.call = transport(config);
1160
+ }
1161
+ usage(query, options) {
1162
+ return this.call("GET", "/developer/usage", options, void 0, query);
1163
+ }
1164
+ executeSandbox(body, options) {
1165
+ return this.call("POST", "/developer/sandbox/execute", options, body);
1166
+ }
1167
+ simulateWebhook(body, options) {
1168
+ return this.call("POST", "/developer/webhooks/simulate", options, body);
1169
+ }
1170
+ };
1171
+ var ForeignExchange = class {
1172
+ call;
1173
+ constructor(config) {
1174
+ this.call = transport(config);
1175
+ }
1176
+ quote(body, options) {
1177
+ return this.call("POST", "/fx/quotes", options, body);
1178
+ }
1179
+ currencies(options) {
1180
+ return this.call("GET", "/fx/currencies", options);
1181
+ }
1182
+ };
1183
+ var Banking = class {
1184
+ call;
1185
+ constructor(config) {
1186
+ this.call = transport(config);
1187
+ }
1188
+ walletBalance(currency, options) {
1189
+ return this.call("GET", "/wallets/balance", options, void 0, { currency });
1190
+ }
1191
+ };
1192
+
1193
+ // src/index.ts
1194
+ var OwnPay = class {
1195
+ /** HTTP client instance */
1196
+ client;
1197
+ /** Payment operations */
1198
+ payments;
1199
+ /** Direct switch & multi-rail operations (M-Pesa STK push, Airtel Money) */
1200
+ switch;
1201
+ /** Transaction queries */
1202
+ transactions;
1203
+ /** Refund operations */
1204
+ refunds;
1205
+ /** Customer management */
1206
+ customers;
1207
+ /** API key management */
1208
+ apiKeys;
1209
+ /** Webhook operations */
1210
+ webhooks;
1211
+ /** Health checks */
1212
+ health;
1213
+ merchant;
1214
+ cards;
1215
+ checkout;
1216
+ /**
1217
+ * Creates a new OwnPay client instance.
1218
+ *
1219
+ * @param apiKeyOrConfig - API key string or configuration object
1220
+ *
1221
+ * @example
1222
+ * ```typescript
1223
+ * // With configuration
1224
+ * const client = new OwnPay({
1225
+ * apiKey: 'op_xxx...',
1226
+ * baseUrl: 'https://custom.domain.com',
1227
+ * timeout: 30000,
1228
+ * maxRetries: 3,
1229
+ * });
1230
+ * ```
1231
+ */
1232
+ constructor(apiKeyOrConfig = {}) {
1233
+ const config = typeof apiKeyOrConfig === "string" ? { apiKey: apiKeyOrConfig } : apiKeyOrConfig;
1234
+ this.client = new HttpClient(config);
1235
+ this.payments = new PaymentsResource(this.client);
1236
+ this.switch = new SwitchResource(this.client);
1237
+ this.transactions = new TransactionsResource(this.client);
1238
+ this.refunds = new RefundsResource(this.client);
1239
+ this.customers = new CustomersResource(this.client);
1240
+ this.apiKeys = new ApiKeysResource(this.client);
1241
+ this.webhooks = new WebhooksResource(this.client);
1242
+ this.health = new HealthResource(this.client);
1243
+ this.merchant = new MerchantResource(this.client);
1244
+ this.cards = new CardsResource(this.client);
1245
+ this.checkout = new CheckoutResource(this.client, config.checkoutBaseUrl ?? this.client.baseUrl);
1246
+ }
1247
+ };
1248
+ var src_default = OwnPay;
1249
+
1250
+ Object.defineProperty(exports, "AbortError", {
1251
+ enumerable: true,
1252
+ get: function () { return chunkANI325UM_cjs.AbortError; }
1253
+ });
1254
+ Object.defineProperty(exports, "ApiError", {
1255
+ enumerable: true,
1256
+ get: function () { return chunkANI325UM_cjs.ApiError; }
1257
+ });
1258
+ Object.defineProperty(exports, "AuthenticationError", {
1259
+ enumerable: true,
1260
+ get: function () { return chunkANI325UM_cjs.AuthenticationError; }
1261
+ });
1262
+ Object.defineProperty(exports, "IdempotencyError", {
1263
+ enumerable: true,
1264
+ get: function () { return chunkANI325UM_cjs.IdempotencyError; }
1265
+ });
1266
+ Object.defineProperty(exports, "NetworkError", {
1267
+ enumerable: true,
1268
+ get: function () { return chunkANI325UM_cjs.NetworkError; }
1269
+ });
1270
+ Object.defineProperty(exports, "NotFoundError", {
1271
+ enumerable: true,
1272
+ get: function () { return chunkANI325UM_cjs.NotFoundError; }
1273
+ });
1274
+ Object.defineProperty(exports, "OwnPayError", {
1275
+ enumerable: true,
1276
+ get: function () { return chunkANI325UM_cjs.OwnPayError; }
1277
+ });
1278
+ Object.defineProperty(exports, "PermissionError", {
1279
+ enumerable: true,
1280
+ get: function () { return chunkANI325UM_cjs.PermissionError; }
1281
+ });
1282
+ Object.defineProperty(exports, "RateLimitError", {
1283
+ enumerable: true,
1284
+ get: function () { return chunkANI325UM_cjs.RateLimitError; }
1285
+ });
1286
+ Object.defineProperty(exports, "ValidationError", {
1287
+ enumerable: true,
1288
+ get: function () { return chunkANI325UM_cjs.ValidationError; }
1289
+ });
1290
+ Object.defineProperty(exports, "WebhookVerificationError", {
1291
+ enumerable: true,
1292
+ get: function () { return chunkANI325UM_cjs.WebhookVerificationError; }
1293
+ });
1294
+ Object.defineProperty(exports, "generateSignature", {
1295
+ enumerable: true,
1296
+ get: function () { return chunkANI325UM_cjs.generateSignature; }
1297
+ });
1298
+ Object.defineProperty(exports, "parseWebhookPayload", {
1299
+ enumerable: true,
1300
+ get: function () { return chunkANI325UM_cjs.parseWebhookPayload; }
1301
+ });
1302
+ Object.defineProperty(exports, "verifyWebhookSignature", {
1303
+ enumerable: true,
1304
+ get: function () { return chunkANI325UM_cjs.verifyWebhookSignature; }
1305
+ });
1306
+ exports.ApiKeysResource = ApiKeysResource;
1307
+ exports.Banking = Banking;
1308
+ exports.Billing = Billing;
1309
+ exports.CardsResource = CardsResource;
1310
+ exports.CheckoutResource = CheckoutResource;
1311
+ exports.Client = OwnPay;
1312
+ exports.CustomersResource = CustomersResource;
1313
+ exports.DeveloperTools = DeveloperTools;
1314
+ exports.ForeignExchange = ForeignExchange;
1315
+ exports.HealthResource = HealthResource;
1316
+ exports.MerchantResource = MerchantResource;
1317
+ exports.Notifications = Notifications;
1318
+ exports.OwnPay = OwnPay;
1319
+ exports.PaymentsResource = PaymentsResource;
1320
+ exports.Pycer = OwnPay;
1321
+ exports.RefundsResource = RefundsResource;
1322
+ exports.SwitchResource = SwitchResource;
1323
+ exports.TransactionsResource = TransactionsResource;
1324
+ exports.WebhooksResource = WebhooksResource;
1325
+ exports.default = src_default;
1326
+ //# sourceMappingURL=index.cjs.map
1327
+ //# sourceMappingURL=index.cjs.map