pycer-sdk 0.0.0-stage → 1.0.2

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.
@@ -0,0 +1,831 @@
1
+ import { O as OwnPayConfig, R as RequestConfig, a as RequestOptions, L as ListTransactionsParams, P as PaginatedList, T as Transaction, C as CreateRefundParams, b as Refund, c as ListRefundsParams, d as CreateCustomerParams, e as Customer, f as ListCustomersParams, A as ApiKey, G as GenerateApiKeyParams, g as GeneratedApiKey, W as WebhookTestResult, h as WebhookDelivery, i as ApiResponse, H as HealthStatus } from './index-XbnGOTNP.cjs';
2
+ export { j as AbortError, k as ApiError, l as ApiErrorDetail, m as ApiErrorResponse, n as ApiKeyScope, o as AuthenticationError, p as CreatePaymentParams, q as CustomerSummary, I as IdempotencyError, N as NetworkError, r as NotFoundError, s as OwnPayError, t as PaginationMeta, u as Payment, v as PaymentIntent, w as PaymentStatus, x as PermissionError, y as RateLimitError, V as ValidationError, z as WebhookPayload, B as WebhookVerificationError, D as WebhookVerificationParams, E as generateSignature, F as parseWebhookPayload, J as verifyWebhookSignature } from './index-XbnGOTNP.cjs';
3
+
4
+ /**
5
+ * OwnPay Node.js SDK - HTTP Client
6
+ *
7
+ * Core HTTP client that handles all API communication.
8
+ * Uses native fetch API with retry logic, timeout handling, and error classification.
9
+ */
10
+
11
+ /**
12
+ * Core HTTP client for the OwnPay API.
13
+ *
14
+ * Handles authentication, request signing, retry logic, and error handling.
15
+ * All API resource classes use this client internally.
16
+ *
17
+ * @internal
18
+ */
19
+ declare class HttpClient {
20
+ private readonly apiKey;
21
+ private readonly baseUrl;
22
+ private readonly timeout;
23
+ private readonly maxRetries;
24
+ private readonly apiVersion;
25
+ private readonly defaultHeaders;
26
+ constructor(config: OwnPayConfig, auth?: 'ownpay' | 'platform');
27
+ /**
28
+ * Makes an HTTP request to the OwnPay API.
29
+ *
30
+ * @param config - Request configuration
31
+ * @returns Parsed API response
32
+ */
33
+ request<T>(config: RequestConfig): Promise<T>;
34
+ /**
35
+ * Executes a single HTTP request.
36
+ */
37
+ private executeRequest;
38
+ /**
39
+ * Builds the full request URL.
40
+ */
41
+ private buildUrl;
42
+ /**
43
+ * Builds request headers including authentication.
44
+ */
45
+ private buildHeaders;
46
+ /**
47
+ * Combines two abort signals (external + timeout).
48
+ * Returns a combined signal and a cleanup function to remove listeners.
49
+ */
50
+ private combineSignals;
51
+ /**
52
+ * Determines if an error is eligible for retry.
53
+ */
54
+ private isRetryableError;
55
+ }
56
+
57
+ interface VaultCardParams {
58
+ gatewayToken: string;
59
+ provider?: string;
60
+ label?: string;
61
+ gatewayCustomerId?: string;
62
+ }
63
+ interface VaultedCard {
64
+ id: number;
65
+ uuid: string;
66
+ customer_id: number;
67
+ type: 'card';
68
+ provider: string;
69
+ label: string;
70
+ identifier_last4: string | null;
71
+ identifier_masked: string;
72
+ is_default: boolean;
73
+ status: string;
74
+ }
75
+ declare class CardsResource {
76
+ private readonly client;
77
+ constructor(client: HttpClient);
78
+ charge(params: {
79
+ paymentMethodId: number;
80
+ amount: string | number;
81
+ currency: string;
82
+ reference: string;
83
+ }, options?: RequestOptions): Promise<{
84
+ transactionId: string;
85
+ stripePaymentIntentId: string;
86
+ status: string;
87
+ }>;
88
+ list(customerId: number, options?: RequestOptions): Promise<VaultedCard[]>;
89
+ vault(customerId: number, params: VaultCardParams, options?: RequestOptions): Promise<VaultedCard>;
90
+ setDefault(customerId: number, methodId: number, options?: RequestOptions): Promise<void>;
91
+ revoke(customerId: number, methodId: number, options?: RequestOptions): Promise<void>;
92
+ private path;
93
+ }
94
+
95
+ interface CheckoutSession {
96
+ id: string;
97
+ token: string;
98
+ status: string;
99
+ expires_at: string;
100
+ checkoutUrl: string;
101
+ }
102
+ interface CheckoutStatus {
103
+ id: string;
104
+ status: string;
105
+ amount: string | number;
106
+ currency: string;
107
+ expires_at: string;
108
+ }
109
+ interface CreateCheckoutParams {
110
+ amount: string | number;
111
+ currency: string;
112
+ description?: string;
113
+ }
114
+ declare class CheckoutResource {
115
+ private readonly client;
116
+ private readonly baseUrl;
117
+ constructor(client: HttpClient, baseUrl: string);
118
+ create(params: CreateCheckoutParams, options?: RequestOptions): Promise<CheckoutSession>;
119
+ get(id: string, options?: RequestOptions): Promise<CheckoutStatus>;
120
+ url(token: string, kind?: 'intent' | 'legacy'): string;
121
+ }
122
+
123
+ interface RailPaymentParams {
124
+ amount: string | number;
125
+ currency: string;
126
+ preferredRail: string;
127
+ reference?: string;
128
+ description?: string;
129
+ partyA: {
130
+ phone: string;
131
+ name?: string;
132
+ };
133
+ partyB: {
134
+ umid: string;
135
+ accountReference?: string;
136
+ recipientAccount?: string;
137
+ };
138
+ metadata?: Record<string, unknown>;
139
+ }
140
+ interface SwitchChargeParams extends Omit<RailPaymentParams, 'partyA' | 'partyB'> {
141
+ customerPhone: string;
142
+ customerName?: string;
143
+ merchantUmid: string;
144
+ accountReference?: string;
145
+ recipientAccount?: string;
146
+ }
147
+ interface SwitchChargeResult {
148
+ success: boolean;
149
+ transactionId: string;
150
+ reference: string;
151
+ status: string;
152
+ routedProvider: string;
153
+ amount: number;
154
+ currency: string;
155
+ providerReference: string | null;
156
+ }
157
+ declare class SwitchResource {
158
+ private readonly client;
159
+ constructor(client: HttpClient);
160
+ initiate(params: RailPaymentParams, options?: RequestOptions): Promise<SwitchChargeResult>;
161
+ charge(params: SwitchChargeParams, options?: RequestOptions): Promise<SwitchChargeResult>;
162
+ }
163
+
164
+ interface PaymentDetails {
165
+ transactionId: string;
166
+ providerReference: string | null;
167
+ amount: string | number;
168
+ currency: string;
169
+ status: string;
170
+ rail: string | null;
171
+ reference: string | null;
172
+ }
173
+ declare class PaymentsResource {
174
+ private readonly client;
175
+ private readonly rail;
176
+ constructor(client: HttpClient);
177
+ create(params: RailPaymentParams, options?: RequestOptions): Promise<SwitchChargeResult>;
178
+ /**
179
+ * Retrieves a payment by its ID.
180
+ *
181
+ * @param paymentId - The payment UUID
182
+ * @param options - Optional request options
183
+ * @returns Payment details
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * const payment = await client.payments.get('pay_abc123...');
188
+ * console.log(payment.status); // 'completed'
189
+ * ```
190
+ */
191
+ get(paymentId: string, options?: RequestOptions): Promise<PaymentDetails>;
192
+ }
193
+
194
+ /**
195
+ * OwnPay Node.js SDK - Transactions Resource
196
+ *
197
+ * Handles transaction listing and retrieval.
198
+ */
199
+
200
+ /**
201
+ * Resource for querying transactions.
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * // List transactions with filters
206
+ * const result = await client.transactions.list({
207
+ * page: 1,
208
+ * per_page: 25,
209
+ * status: 'completed',
210
+ * });
211
+ *
212
+ * console.log(result.items); // Transaction[]
213
+ * console.log(result.meta.total); // Total count
214
+ * ```
215
+ */
216
+ declare class TransactionsResource {
217
+ private readonly client;
218
+ constructor(client: HttpClient);
219
+ /**
220
+ * Lists transactions with optional filtering and pagination.
221
+ *
222
+ * @param params - Optional filter and pagination parameters
223
+ * @param options - Optional request options
224
+ * @returns Paginated list of transactions
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * // Get completed transactions from last 7 days
229
+ * const result = await client.transactions.list({
230
+ * status: 'completed',
231
+ * from: '2024-01-01',
232
+ * to: '2024-01-07',
233
+ * per_page: 50,
234
+ * });
235
+ *
236
+ * for (const txn of result.items) {
237
+ * console.log(`${txn.trx_id}: ${txn.amount} ${txn.currency}`);
238
+ * }
239
+ * ```
240
+ */
241
+ list(params?: ListTransactionsParams, options?: RequestOptions): Promise<PaginatedList<Transaction>>;
242
+ /**
243
+ * Retrieves a single transaction by ID.
244
+ *
245
+ * Accepts either an OwnPay transaction reference (e.g., 'OP-XXXX')
246
+ * or a gateway transaction ID.
247
+ *
248
+ * @param trxId - Transaction ID (OwnPay reference or gateway ID)
249
+ * @param options - Optional request options
250
+ * @returns Transaction details
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * // By OwnPay reference
255
+ * const txn = await client.transactions.get('OP-ABC123');
256
+ *
257
+ * // By gateway transaction ID
258
+ * const txn = await client.transactions.get('gw_xyz789');
259
+ * ```
260
+ */
261
+ get(trxId: string, options?: RequestOptions): Promise<Transaction>;
262
+ }
263
+
264
+ /**
265
+ * OwnPay Node.js SDK - Refunds Resource
266
+ *
267
+ * Handles refund creation and retrieval.
268
+ */
269
+
270
+ /**
271
+ * Resource for managing refunds.
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * // Create a full refund
276
+ * const refund = await client.refunds.create({
277
+ * transaction_id: 'OP-ABC123',
278
+ * reason: 'Customer request',
279
+ * });
280
+ *
281
+ * // Create a partial refund
282
+ * const refund = await client.refunds.create({
283
+ * transaction_id: 'OP-ABC123',
284
+ * amount: '50.00',
285
+ * reason: 'Partial refund',
286
+ * });
287
+ * ```
288
+ */
289
+ declare class RefundsResource {
290
+ private readonly client;
291
+ constructor(client: HttpClient);
292
+ /**
293
+ * Creates a new refund for a transaction.
294
+ *
295
+ * @param params - Refund creation parameters
296
+ * @param options - Optional request options
297
+ * @returns Created refund details
298
+ *
299
+ * @example
300
+ * ```typescript
301
+ * const refund = await client.refunds.create({
302
+ * transaction_id: 'OP-ABC123',
303
+ * amount: '25.00',
304
+ * reason: 'Item returned',
305
+ * });
306
+ *
307
+ * console.log(refund.status); // 'pending' or 'completed'
308
+ * ```
309
+ */
310
+ create(params: CreateRefundParams, options?: RequestOptions): Promise<Refund>;
311
+ /**
312
+ * Lists refunds with optional filtering and pagination.
313
+ *
314
+ * @param params - Optional filter and pagination parameters
315
+ * @param options - Optional request options
316
+ * @returns Paginated list of refunds
317
+ *
318
+ * @example
319
+ * ```typescript
320
+ * const result = await client.refunds.list({
321
+ * status: 'completed',
322
+ * page: 1,
323
+ * per_page: 25,
324
+ * });
325
+ *
326
+ * for (const refund of result.items) {
327
+ * console.log(`${refund.uuid}: ${refund.amount}`);
328
+ * }
329
+ * ```
330
+ */
331
+ list(params?: ListRefundsParams, options?: RequestOptions): Promise<PaginatedList<Refund>>;
332
+ /**
333
+ * Retrieves a single refund by transaction reference.
334
+ *
335
+ * @param trxId - Transaction ID (OwnPay reference or gateway ID)
336
+ * @param options - Optional request options
337
+ * @returns Refund details
338
+ *
339
+ * @example
340
+ * ```typescript
341
+ * const refund = await client.refunds.get('OP-ABC123');
342
+ * ```
343
+ */
344
+ get(trxId: string, options?: RequestOptions): Promise<Refund>;
345
+ /**
346
+ * Validates refund creation parameters.
347
+ */
348
+ private validateCreateParams;
349
+ }
350
+
351
+ /**
352
+ * OwnPay Node.js SDK - Customers Resource
353
+ *
354
+ * Handles customer creation and retrieval.
355
+ */
356
+
357
+ /**
358
+ * Resource for managing customers.
359
+ *
360
+ * @example
361
+ * ```typescript
362
+ * // Create a customer
363
+ * const customer = await client.customers.create({
364
+ * name: 'John Doe',
365
+ * email: 'john@example.com',
366
+ * phone: '+8801712345678',
367
+ * });
368
+ *
369
+ * // Find customer by email
370
+ * const customer = await client.customers.get('john@example.com');
371
+ * ```
372
+ */
373
+ declare class CustomersResource {
374
+ private readonly client;
375
+ constructor(client: HttpClient);
376
+ /**
377
+ * Creates a new customer.
378
+ *
379
+ * @param params - Customer creation parameters
380
+ * @param options - Optional request options
381
+ * @returns Created customer with ID and UUID
382
+ *
383
+ * @example
384
+ * ```typescript
385
+ * const customer = await client.customers.create({
386
+ * name: 'Jane Smith',
387
+ * email: 'jane@example.com',
388
+ * phone: '+8801712345678',
389
+ * });
390
+ *
391
+ * console.log(customer.id); // Internal ID
392
+ * console.log(customer.uuid); // Public UUID
393
+ * ```
394
+ */
395
+ create(params: CreateCustomerParams, options?: RequestOptions): Promise<Pick<Customer, 'id' | 'uuid'>>;
396
+ /**
397
+ * Lists customers with pagination.
398
+ *
399
+ * @param params - Optional pagination parameters
400
+ * @param options - Optional request options
401
+ * @returns Paginated list of customers
402
+ *
403
+ * @example
404
+ * ```typescript
405
+ * const result = await client.customers.list({ page: 1, per_page: 50 });
406
+ *
407
+ * for (const customer of result.items) {
408
+ * console.log(`${customer.name}: ${customer.email}`);
409
+ * }
410
+ * ```
411
+ */
412
+ list(params?: ListCustomersParams, options?: RequestOptions): Promise<PaginatedList<Customer>>;
413
+ /**
414
+ * Retrieves a customer by email or phone number.
415
+ *
416
+ * The identifier is auto-detected:
417
+ * - Contains '@' → treated as email
418
+ * - Otherwise → treated as phone
419
+ *
420
+ * @param identifier - Customer email or phone number
421
+ * @param options - Optional request options
422
+ * @returns Customer details
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * // By email
427
+ * const customer = await client.customers.get('john@example.com');
428
+ *
429
+ * // By phone
430
+ * const customer = await client.customers.get('+8801712345678');
431
+ * ```
432
+ */
433
+ get(identifier: string, options?: RequestOptions): Promise<Customer>;
434
+ /**
435
+ * Validates customer creation parameters.
436
+ */
437
+ private validateCreateParams;
438
+ }
439
+
440
+ /**
441
+ * OwnPay Node.js SDK - API Keys Resource
442
+ *
443
+ * Handles API key generation, listing, and revocation.
444
+ *
445
+ * Note: API key operations require both 'write' and 'admin' scopes,
446
+ * and must include the X-Super-Admin-Email header.
447
+ */
448
+
449
+ /**
450
+ * Resource for managing API keys.
451
+ *
452
+ * @example
453
+ * ```typescript
454
+ * // List API keys
455
+ * const keys = await client.apiKeys.list();
456
+ *
457
+ * // Generate a new key
458
+ * const newKey = await client.apiKeys.generate({
459
+ * name: 'Production Key',
460
+ * scopes: ['read', 'write'],
461
+ * });
462
+ *
463
+ * // Revoke a key
464
+ * await client.apiKeys.revoke(keyId);
465
+ * ```
466
+ */
467
+ declare class ApiKeysResource {
468
+ private readonly client;
469
+ constructor(client: HttpClient);
470
+ /**
471
+ * Lists all API keys for the authenticated merchant.
472
+ *
473
+ * Note: Requires API key with 'write' and 'admin' scopes.
474
+ *
475
+ * @param options - Optional request options (must include superAdminEmail header)
476
+ * @returns Array of API key metadata
477
+ *
478
+ * @example
479
+ * ```typescript
480
+ * const keys = await client.apiKeys.list({
481
+ * headers: { 'X-Super-Admin-Email': 'admin@example.com' },
482
+ * });
483
+ * ```
484
+ */
485
+ list(options?: RequestOptions): Promise<ApiKey[]>;
486
+ /**
487
+ * Generates a new API key.
488
+ *
489
+ * Note: Requires API key with 'write' and 'admin' scopes.
490
+ * The actual key is only shown once in the response.
491
+ *
492
+ * @param params - Key generation parameters
493
+ * @param options - Optional request options (must include superAdminEmail header)
494
+ * @returns Generated API key (store securely, cannot be retrieved again)
495
+ *
496
+ * @example
497
+ * ```typescript
498
+ * const result = await client.apiKeys.generate({
499
+ * name: 'My App Key',
500
+ * scopes: ['read', 'write'],
501
+ * }, {
502
+ * headers: { 'X-Super-Admin-Email': 'admin@example.com' },
503
+ * });
504
+ *
505
+ * // IMPORTANT: Store this key securely!
506
+ * console.log(result.key); // 'op_xxxxx...'
507
+ * console.log(result.warning); // 'Store this key securely...'
508
+ * ```
509
+ */
510
+ generate(params?: GenerateApiKeyParams, options?: RequestOptions): Promise<GeneratedApiKey>;
511
+ /**
512
+ * Revokes an API key by ID.
513
+ *
514
+ * Note: Requires API key with 'write' and 'admin' scopes.
515
+ *
516
+ * @param keyId - The API key ID to revoke
517
+ * @param options - Optional request options (must include superAdminEmail header)
518
+ *
519
+ * @example
520
+ * ```typescript
521
+ * await client.apiKeys.revoke(123, {
522
+ * headers: { 'X-Super-Admin-Email': 'admin@example.com' },
523
+ * });
524
+ * ```
525
+ */
526
+ revoke(keyId: number, options?: RequestOptions): Promise<void>;
527
+ /**
528
+ * Ensures the X-Super-Admin-Email header is present.
529
+ */
530
+ private ensureAdminHeaders;
531
+ /**
532
+ * Validates API key scopes.
533
+ */
534
+ private validateScopes;
535
+ }
536
+
537
+ /**
538
+ * OwnPay Node.js SDK - Webhooks Resource
539
+ *
540
+ * Handles webhook testing and delivery history.
541
+ */
542
+
543
+ /**
544
+ * Resource for managing webhooks.
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * // Test webhook endpoint
549
+ * const result = await client.webhooks.test();
550
+ * console.log(result.status_code); // 200
551
+ *
552
+ * // List recent deliveries
553
+ * const deliveries = await client.webhooks.deliveries();
554
+ * ```
555
+ */
556
+ declare class WebhooksResource {
557
+ private readonly client;
558
+ constructor(client: HttpClient);
559
+ /**
560
+ * Sends a test webhook to the configured endpoint.
561
+ *
562
+ * @param options - Optional request options
563
+ * @returns Test result with status code and response time
564
+ *
565
+ * @example
566
+ * ```typescript
567
+ * const result = await client.webhooks.test();
568
+ *
569
+ * if (result.status_code === 200) {
570
+ * console.log('Webhook endpoint is working!');
571
+ * }
572
+ * ```
573
+ */
574
+ test(options?: RequestOptions): Promise<WebhookTestResult>;
575
+ /**
576
+ * Lists recent webhook deliveries.
577
+ *
578
+ * @param options - Optional request options
579
+ * @returns Array of webhook delivery records
580
+ *
581
+ * @example
582
+ * ```typescript
583
+ * const deliveries = await client.webhooks.deliveries();
584
+ *
585
+ * for (const delivery of deliveries) {
586
+ * console.log(`${delivery.event}: ${delivery.status} (${delivery.status_code})`);
587
+ * }
588
+ * ```
589
+ */
590
+ deliveries(options?: RequestOptions): Promise<WebhookDelivery[]>;
591
+ }
592
+
593
+ type Fields$1 = Record<string, unknown>;
594
+ type Query$1 = Record<string, string | number | boolean | undefined>;
595
+ interface VirtualAccount {
596
+ id: string | number;
597
+ dva_code: string;
598
+ account_number: string;
599
+ account_name: string;
600
+ bank_code: string | null;
601
+ bank_name: string | null;
602
+ channel: string;
603
+ currency: string;
604
+ status: string;
605
+ }
606
+ interface DisbursementParams {
607
+ amount: string | number;
608
+ currency: string;
609
+ recipient: {
610
+ phone: string;
611
+ };
612
+ preferredRail?: string;
613
+ reference?: string;
614
+ description?: string;
615
+ sourceAccount?: string;
616
+ }
617
+ declare class MerchantResource {
618
+ private readonly client;
619
+ constructor(client: HttpClient);
620
+ disburse(params: DisbursementParams, options?: RequestOptions): Promise<unknown>;
621
+ float(currency: string, options?: RequestOptions): Promise<{
622
+ currency: string;
623
+ balance: string;
624
+ }>;
625
+ readonly virtualAccounts: {
626
+ provision: (params: {
627
+ reference: string;
628
+ currency: string;
629
+ }, options?: RequestOptions) => Promise<VirtualAccount>;
630
+ list: (afterId?: string, options?: RequestOptions) => Promise<{
631
+ items: VirtualAccount[];
632
+ next_after_id: string | null;
633
+ }>;
634
+ };
635
+ readonly payoutMethods: {
636
+ list: (options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
637
+ create: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
638
+ setDefault: (id: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
639
+ };
640
+ readonly settlement: {
641
+ getPolicy: (options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
642
+ updatePolicy: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
643
+ sweep: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
644
+ };
645
+ readonly paymentMethods: {
646
+ list: (customerId: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
647
+ create: (customerId: string, body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
648
+ setDefault: (customerId: string, id: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
649
+ revoke: (customerId: string, id: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
650
+ };
651
+ readonly wallets: {
652
+ list: (customerId: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
653
+ create: (customerId: string, body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
654
+ topUp: (customerId: string, currency: string, body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
655
+ };
656
+ readonly accountReferences: {
657
+ list: (query?: Query$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
658
+ get: (id: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
659
+ create: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
660
+ update: (id: string, body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
661
+ remove: (id: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
662
+ };
663
+ readonly commerce: {
664
+ listProducts: (query?: Query$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
665
+ createProduct: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
666
+ listStorefronts: (query?: Query$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
667
+ listOrders: (query?: Query$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
668
+ };
669
+ readonly terminals: {
670
+ list: (options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
671
+ pushIntent: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
672
+ settle: (id: string, body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
673
+ };
674
+ private call;
675
+ }
676
+
677
+ /**
678
+ * OwnPay Node.js SDK - Health Resource
679
+ *
680
+ * Handles system health check operations.
681
+ */
682
+
683
+ /**
684
+ * Resource for system health checks.
685
+ *
686
+ * @example
687
+ * ```typescript
688
+ * const health = await client.health.check();
689
+ *
690
+ * if (health.status === 'healthy') {
691
+ * console.log('System is operational');
692
+ * }
693
+ * ```
694
+ */
695
+ declare class HealthResource {
696
+ private readonly client;
697
+ constructor(client: HttpClient);
698
+ /**
699
+ * Performs a system health check.
700
+ *
701
+ * Returns detailed information about:
702
+ * - System status (healthy/degraded)
703
+ * - Database connectivity
704
+ * - Mobile companion app status
705
+ * - Active gateway count
706
+ * - Customer count
707
+ *
708
+ * @param options - Optional request options
709
+ * @returns Health status information
710
+ *
711
+ * @example
712
+ * ```typescript
713
+ * const health = await client.health.check();
714
+ *
715
+ * console.log(`Status: ${health.status}`);
716
+ * console.log(`Version: ${health.version}`);
717
+ * console.log(`Database: ${health.db}`);
718
+ * console.log(`Active gateways: ${health.gateways}`);
719
+ * console.log(`Total customers: ${health.customers}`);
720
+ *
721
+ * // Check mobile companion status
722
+ * if (health.mobile.connected) {
723
+ * console.log(`Mobile devices: ${health.mobile.active_devices}`);
724
+ * }
725
+ * ```
726
+ */
727
+ check(options?: RequestOptions): Promise<HealthStatus>;
728
+ }
729
+
730
+ interface PlatformServiceConfig {
731
+ baseUrl: string;
732
+ token: string;
733
+ timeout?: number;
734
+ maxRetries?: number;
735
+ }
736
+ type Fields = Record<string, unknown>;
737
+ type Query = Record<string, string | number | boolean | undefined>;
738
+ declare class Notifications {
739
+ private readonly call;
740
+ constructor(config: PlatformServiceConfig);
741
+ sendSms(body: Fields, options?: RequestOptions): Promise<unknown>;
742
+ sendEmail(body: Fields, options?: RequestOptions): Promise<unknown>;
743
+ sendPush(body: Fields, options?: RequestOptions): Promise<unknown>;
744
+ sendOtp(body: Fields, options?: RequestOptions): Promise<unknown>;
745
+ }
746
+ declare class Billing {
747
+ private readonly call;
748
+ constructor(config: PlatformServiceConfig);
749
+ catalog(query?: Query, options?: RequestOptions): Promise<unknown>;
750
+ lookupAccount(body: Fields, options?: RequestOptions): Promise<unknown>;
751
+ quote(body: Fields, options?: RequestOptions): Promise<unknown>;
752
+ vend(body: Fields, options?: RequestOptions): Promise<unknown>;
753
+ quoteAirtime(body: Fields, options?: RequestOptions): Promise<unknown>;
754
+ }
755
+ declare class DeveloperTools {
756
+ private readonly call;
757
+ constructor(config: PlatformServiceConfig);
758
+ usage(query?: Query, options?: RequestOptions): Promise<unknown>;
759
+ executeSandbox(body: Fields, options?: RequestOptions): Promise<unknown>;
760
+ simulateWebhook(body: Fields, options?: RequestOptions): Promise<unknown>;
761
+ }
762
+ declare class ForeignExchange {
763
+ private readonly call;
764
+ constructor(config: PlatformServiceConfig);
765
+ quote(body: Fields, options?: RequestOptions): Promise<unknown>;
766
+ currencies(options?: RequestOptions): Promise<unknown>;
767
+ }
768
+ declare class Banking {
769
+ private readonly call;
770
+ constructor(config: PlatformServiceConfig);
771
+ walletBalance(currency?: string, options?: RequestOptions): Promise<unknown>;
772
+ }
773
+
774
+ /**
775
+ * Main OwnPay client class.
776
+ *
777
+ * Provides access to all API resources through a single client instance.
778
+ *
779
+ * @example
780
+ * ```typescript
781
+ * // Initialize with options
782
+ * const client = new OwnPay({
783
+ * apiKey: 'op_xxx...',
784
+ * baseUrl: 'https://your-ownpay-domain.com',
785
+ * timeout: 30000,
786
+ * maxRetries: 3,
787
+ * });
788
+ * ```
789
+ */
790
+ declare class OwnPay {
791
+ /** HTTP client instance */
792
+ private readonly client;
793
+ /** Payment operations */
794
+ readonly payments: PaymentsResource;
795
+ /** Direct switch & multi-rail operations (M-Pesa STK push, Airtel Money) */
796
+ readonly switch: SwitchResource;
797
+ /** Transaction queries */
798
+ readonly transactions: TransactionsResource;
799
+ /** Refund operations */
800
+ readonly refunds: RefundsResource;
801
+ /** Customer management */
802
+ readonly customers: CustomersResource;
803
+ /** API key management */
804
+ readonly apiKeys: ApiKeysResource;
805
+ /** Webhook operations */
806
+ readonly webhooks: WebhooksResource;
807
+ /** Health checks */
808
+ readonly health: HealthResource;
809
+ readonly merchant: MerchantResource;
810
+ readonly cards: CardsResource;
811
+ readonly checkout: CheckoutResource;
812
+ /**
813
+ * Creates a new OwnPay client instance.
814
+ *
815
+ * @param apiKeyOrConfig - API key string or configuration object
816
+ *
817
+ * @example
818
+ * ```typescript
819
+ * // With configuration
820
+ * const client = new OwnPay({
821
+ * apiKey: 'op_xxx...',
822
+ * baseUrl: 'https://custom.domain.com',
823
+ * timeout: 30000,
824
+ * maxRetries: 3,
825
+ * });
826
+ * ```
827
+ */
828
+ constructor(apiKeyOrConfig: string | OwnPayConfig);
829
+ }
830
+
831
+ export { ApiKey, ApiKeysResource, ApiResponse, Banking, Billing, CardsResource, CheckoutResource, type CheckoutSession, type CheckoutStatus, OwnPay as Client, type CreateCheckoutParams, CreateCustomerParams, CreateRefundParams, Customer, CustomersResource, DeveloperTools, type DisbursementParams, ForeignExchange, GenerateApiKeyParams, GeneratedApiKey, HealthResource, HealthStatus, ListCustomersParams, ListRefundsParams, ListTransactionsParams, MerchantResource, Notifications, OwnPay, OwnPayConfig, PaginatedList, type PaymentDetails, PaymentsResource, type PlatformServiceConfig, type RailPaymentParams, Refund, RefundsResource, RequestOptions, type SwitchChargeParams, type SwitchChargeResult, SwitchResource, Transaction, TransactionsResource, type VaultCardParams, type VaultedCard, WebhookDelivery, WebhookTestResult, WebhooksResource, OwnPay as default };