@tapsilat/tapsilat-js 1.0.2 → 1.0.4

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.ts CHANGED
@@ -1,3 +1,13 @@
1
+ /**
2
+ * @module Types
3
+ * @description Tapsilat SDK type definitions, interfaces, and API data structures
4
+ */
5
+ /**
6
+ * @category Configuration
7
+ * @summary Core configuration options for the Tapsilat SDK
8
+ * @description Defines the settings used to initialize and configure SDK behavior including API connection parameters and retry logic
9
+ * @interface TapsilatConfig
10
+ */
1
11
  interface TapsilatConfig {
2
12
  bearerToken: string;
3
13
  baseURL?: string;
@@ -7,118 +17,226 @@ interface TapsilatConfig {
7
17
  version?: string;
8
18
  debug?: boolean;
9
19
  }
10
- interface APIResponse<T> {
11
- success: boolean;
12
- data?: T;
13
- error?: {
14
- message: string;
15
- code: string;
16
- details?: any;
17
- };
18
- status?: number;
19
- headers?: Record<string, string>;
20
- }
21
- interface APIError {
22
- message: string;
23
- code: string;
24
- details?: Record<string, any>;
25
- }
20
+ /**
21
+ * @category Payment Processing
22
+ * @summary Supported payment method types in the Tapsilat system
23
+ * @description Defines all available payment options that customers can use during checkout
24
+ * @typedef {string} PaymentMethod
25
+ */
26
+ type PaymentMethod = "credit_card" | "debit_card" | "bank_transfer" | "digital_wallet" | "crypto";
27
+ /**
28
+ * @category Payment Processing
29
+ * @summary Possible states of a payment throughout its lifecycle
30
+ * @description Defines all states a payment can be in from creation to completion or failure
31
+ * @typedef {string} PaymentStatus
32
+ */
33
+ type PaymentStatus = "pending" | "processing" | "completed" | "failed" | "cancelled" | "refunded";
34
+ /**
35
+ * @category Payment Processing
36
+ * @summary Supported currency codes for transactions
37
+ * @description ISO currency codes supported by the payment processing system
38
+ * @typedef {string} Currency
39
+ */
26
40
  type Currency = "TRY" | "USD" | "EUR" | "GBP";
27
- type PaymentMethod = "credit_card" | "debit_card" | "bank_transfer" | "digital_wallet";
28
- type PaymentStatus = "pending" | "completed" | "failed" | "cancelled" | "refunded";
41
+ /**
42
+ * @category Payment Processing
43
+ * @summary Data required to initiate a payment transaction
44
+ * @description Contains required and optional fields for creating a new payment request including amount, currency, and payment method
45
+ * @interface PaymentRequest
46
+ */
29
47
  interface PaymentRequest {
30
48
  amount: number;
31
49
  currency: Currency;
32
50
  paymentMethod: PaymentMethod;
33
51
  description?: string;
52
+ metadata?: Record<string, any>;
34
53
  returnUrl?: string;
35
- cancelUrl?: string;
36
54
  webhookUrl?: string;
37
- metadata?: Record<string, any>;
38
55
  customerId?: string;
39
56
  }
57
+ /**
58
+ * @category Payment Processing
59
+ * @summary Data returned after processing a payment request
60
+ * @description Contains payment details, status, transaction identifiers, timestamps, and payment URLs
61
+ * @interface PaymentResponse
62
+ */
40
63
  interface PaymentResponse {
41
64
  id: string;
65
+ status: PaymentStatus;
42
66
  amount: number;
43
67
  currency: Currency;
44
68
  paymentMethod: PaymentMethod;
45
- status: PaymentStatus;
46
69
  description?: string;
47
- returnUrl?: string;
48
- cancelUrl?: string;
49
- webhookUrl?: string;
50
70
  metadata?: Record<string, any>;
51
- customerId?: string;
52
- paymentUrl?: string;
53
71
  createdAt: string;
54
72
  updatedAt: string;
73
+ paymentUrl?: string;
74
+ transactionId?: string;
75
+ errorMessage?: string;
55
76
  }
77
+ /**
78
+ * @category Customer Data
79
+ * @summary Customer identification and contact details
80
+ * @description Essential information about a customer for payment processing, KYC, and communications
81
+ * @interface Customer
82
+ */
83
+ interface Customer {
84
+ id?: string;
85
+ email: string;
86
+ name: string;
87
+ phone?: string;
88
+ address?: Address;
89
+ }
90
+ /**
91
+ * @category Customer Data
92
+ * @summary Physical address structure for shipping and billing
93
+ * @description Standardized address format for customer locations with required and optional fields
94
+ * @interface Address
95
+ */
96
+ interface Address {
97
+ street: string;
98
+ city: string;
99
+ state?: string;
100
+ postalCode: string;
101
+ country: string;
102
+ }
103
+ /**
104
+ * @category Refunds
105
+ * @summary Information needed to process a refund
106
+ * @description Data required to initiate full or partial refunds for completed payments
107
+ * @interface RefundRequest
108
+ */
56
109
  interface RefundRequest {
57
110
  paymentId: string;
58
111
  amount?: number;
59
112
  reason?: string;
60
- metadata?: Record<string, any>;
61
113
  }
114
+ /**
115
+ * @category Refunds
116
+ * @summary Data returned after processing a refund request
117
+ * @description Contains refund details, status, amount, and related transaction identifiers
118
+ * @interface RefundResponse
119
+ */
62
120
  interface RefundResponse {
63
121
  id: string;
64
122
  paymentId: string;
65
123
  amount: number;
66
- currency: Currency;
67
124
  status: "pending" | "completed" | "failed";
68
125
  reason?: string;
69
- metadata?: Record<string, any>;
70
126
  createdAt: string;
71
- updatedAt: string;
72
127
  }
73
- interface Customer {
74
- id?: string;
75
- email: string;
76
- name: string;
77
- phone?: string;
78
- address?: Address;
79
- metadata?: Record<string, any>;
80
- createdAt?: string;
81
- updatedAt?: string;
128
+ /**
129
+ * @category Webhooks
130
+ * @summary Notification data structure for system events
131
+ * @description Event payload sent to webhook endpoints when important events occur in the payment lifecycle
132
+ * @interface WebhookEvent
133
+ */
134
+ interface WebhookEvent {
135
+ id: string;
136
+ type: "payment.completed" | "payment.failed" | "refund.completed";
137
+ data: PaymentResponse | RefundResponse;
138
+ createdAt: string;
82
139
  }
83
- interface Address {
84
- street: string;
85
- city: string;
86
- country: string;
87
- postalCode: string;
140
+ /**
141
+ * @category Error Handling
142
+ * @summary Standardized error format returned by the API
143
+ * @description Structured error information with code, message and optional additional details
144
+ * @interface APIError
145
+ */
146
+ interface APIError {
147
+ code: string;
148
+ message: string;
149
+ details?: Record<string, any>;
150
+ }
151
+ /**
152
+ * @category HTTP
153
+ * @summary Generic API response wrapper for all endpoints
154
+ * @description Standard structure containing success status, data payload, and error information
155
+ * @interface APIResponse
156
+ */
157
+ interface APIResponse<T> {
158
+ success: boolean;
159
+ data?: T;
160
+ error?: {
161
+ message: string;
162
+ code: string;
163
+ details?: any;
164
+ };
165
+ status?: number;
166
+ headers?: Record<string, string>;
88
167
  }
168
+ /**
169
+ * @category HTTP
170
+ * @summary Query parameters for paginated API requests
171
+ * @description Controls paging behavior and sorting of list results with page numbers, limits, and sorting options
172
+ * @interface PaginationParams
173
+ */
89
174
  interface PaginationParams {
90
175
  page?: number;
91
176
  limit?: number;
92
177
  sortBy?: string;
93
178
  sortOrder?: "asc" | "desc";
94
179
  }
180
+ /**
181
+ * @category HTTP
182
+ * @summary Standardized response format for paginated list operations
183
+ * @description Contains both the requested data items and pagination metadata for navigation
184
+ * @interface PaginatedResponse
185
+ */
95
186
  interface PaginatedResponse<T> {
96
- page: number;
97
- per_page: number;
98
- rows: T[];
99
- total: number;
100
- total_pages: number;
101
- }
102
- interface WebhookEvent {
103
- id: string;
104
- type: "payment.completed" | "payment.failed" | "payment.cancelled" | "refund.completed" | "refund.failed";
105
- data: PaymentResponse | RefundResponse;
106
- createdAt: string;
107
- signature: string;
187
+ data: T[];
188
+ pagination: {
189
+ page: number;
190
+ limit: number;
191
+ total: number;
192
+ pages: number;
193
+ };
108
194
  }
109
195
  /**
110
- * Represents the buyer information.
111
- * Based on BuyerDTO from the Python SDK.
196
+ * @category Localization
197
+ * @summary Supported language codes for the API interface
198
+ * @description Language preferences that determine text content in API responses and UI elements
199
+ * @typedef {string} Locale
200
+ */
201
+ type Locale = "tr" | "en";
202
+ /**
203
+ * @category Order Management
204
+ * @summary Customer details required for order processing
205
+ * @description Comprehensive identification and contact information about the buyer including name, contact details, and addresses
206
+ * @interface Buyer
112
207
  */
113
- interface Buyer$1 {
208
+ interface Buyer {
114
209
  name: string;
115
210
  surname: string;
116
211
  email: string;
212
+ phone?: string;
213
+ identityNumber?: string;
214
+ shippingAddress?: Address;
215
+ billingAddress?: Address;
117
216
  }
118
217
  /**
119
- * Represents the response received after creating an order.
218
+ * @category Order Management
219
+ * @summary Data structure for creating a new payment order
220
+ * @description Contains all required and optional fields to initiate an order including amount, currency, customer information, and callback URLs
221
+ * @interface OrderCreateRequest
120
222
  */
121
- interface OrderCreateResponse$1 {
223
+ interface OrderCreateRequest {
224
+ amount: number;
225
+ currency: Currency;
226
+ locale: Locale;
227
+ buyer: Buyer;
228
+ description?: string;
229
+ callbackUrl?: string;
230
+ conversationId?: string;
231
+ metadata?: Record<string, unknown>;
232
+ }
233
+ /**
234
+ * @category Order Management
235
+ * @summary Data returned after successful order creation
236
+ * @description Contains order identifiers, tracking references, checkout URLs, and status information
237
+ * @interface OrderCreateResponse
238
+ */
239
+ interface OrderCreateResponse {
122
240
  referenceId: string;
123
241
  conversationId: string;
124
242
  checkoutUrl: string;
@@ -126,12 +244,15 @@ interface OrderCreateResponse$1 {
126
244
  qrCodeUrl?: string;
127
245
  }
128
246
  /**
129
- * Represents a full order object with all details.
247
+ * @category Order Management
248
+ * @summary Complete order information including buyer, payment, and status details
249
+ * @description Contains all information related to an order including creation and update timestamps
250
+ * @interface Order
130
251
  */
131
- interface Order extends OrderCreateResponse$1 {
252
+ interface Order extends OrderCreateResponse {
132
253
  amount: number | string;
133
254
  currency: Currency;
134
- buyer?: Buyer$1;
255
+ buyer?: Buyer;
135
256
  description?: string;
136
257
  createdAt?: string;
137
258
  updatedAt?: string;
@@ -145,14 +266,20 @@ interface Order extends OrderCreateResponse$1 {
145
266
  unpaid_amount?: number;
146
267
  }
147
268
  /**
148
- * Represents the data needed to request a refund for an order.
269
+ * @category Refunds
270
+ * @summary Refund request information for an order
271
+ * @description Contains the data needed to process a refund for a specific order
272
+ * @interface OrderRefundRequest
149
273
  */
150
274
  interface OrderRefundRequest {
151
275
  reference_id: string;
152
276
  amount: number;
153
277
  }
154
278
  /**
155
- * Represents the response received after a refund request.
279
+ * @category Refunds
280
+ * @summary Response data after processing a refund request
281
+ * @description Contains information about the processed refund including status and amount
282
+ * @interface OrderRefundResponse
156
283
  */
157
284
  interface OrderRefundResponse {
158
285
  refundId: string;
@@ -163,7 +290,10 @@ interface OrderRefundResponse {
163
290
  createdAt: string;
164
291
  }
165
292
  /**
166
- * Represents the status of an order.
293
+ * @category Order Management
294
+ * @summary Order status information
295
+ * @description Provides the current status of an order and when it was last updated
296
+ * @interface OrderStatusResponse
167
297
  */
168
298
  interface OrderStatusResponse {
169
299
  referenceId: string;
@@ -171,7 +301,10 @@ interface OrderStatusResponse {
171
301
  lastUpdatedAt: string;
172
302
  }
173
303
  /**
174
- * Represents the details of a payment transaction associated with an order.
304
+ * @category Payment Processing
305
+ * @summary Payment transaction details
306
+ * @description Contains information about a payment transaction including method, amount, and card details
307
+ * @interface OrderPaymentDetail
175
308
  */
176
309
  interface OrderPaymentDetail {
177
310
  transactionId: string;
@@ -186,174 +319,514 @@ interface OrderPaymentDetail {
186
319
  cardAssociation: string;
187
320
  };
188
321
  }
189
-
190
322
  /**
191
- * Supported locales for the Tapsilat API.
323
+ * @category API DTOs
324
+ * @summary API representation of buyer information
325
+ * @description Contains buyer details as formatted in the API responses
326
+ * @interface BuyerDTO
192
327
  */
193
- type Locale = "tr" | "en";
194
- /**
195
- * Represents the buyer information.
196
- * Based on BuyerDTO from the Python SDK.
197
- */
198
- interface Buyer {
328
+ interface BuyerDTO {
199
329
  name: string;
200
330
  surname: string;
201
- email: string;
202
- phone?: string;
203
- identityNumber?: string;
204
- shippingAddress?: Address;
205
- billingAddress?: Address;
331
+ birth_date?: string;
332
+ city?: string;
333
+ country?: string;
334
+ email?: string;
335
+ gsm_number?: string;
336
+ id?: string;
337
+ identity_number?: string;
338
+ ip?: string;
339
+ last_login_date?: string;
340
+ registration_address?: string;
341
+ registration_date?: string;
342
+ title?: string;
343
+ zip_code?: string;
206
344
  }
207
345
  /**
208
- * Represents the data required to create a new order.
209
- * Based on OrderCreateDTO from the Python SDK.
346
+ * @category API DTOs
347
+ * @summary Payment responsibility information for basket items
348
+ * @description Details of the entity responsible for paying a specific basket item
349
+ * @interface BasketItemPayerDTO
210
350
  */
211
- interface OrderCreateRequest {
351
+ interface BasketItemPayerDTO {
352
+ address?: string;
353
+ reference_id?: string;
354
+ tax_office?: string;
355
+ title?: string;
356
+ type?: string;
357
+ vat?: string;
358
+ }
359
+ /**
360
+ * @category API DTOs
361
+ * @summary Individual item in an order basket
362
+ * @description Details about a product or service being purchased including price and quantity
363
+ * @interface BasketItemDTO
364
+ */
365
+ interface BasketItemDTO {
366
+ category1?: string;
367
+ category2?: string;
368
+ commission_amount?: number;
369
+ coupon?: string;
370
+ coupon_discount?: number;
371
+ data?: string;
372
+ id?: string;
373
+ item_type?: string;
374
+ name?: string;
375
+ paid_amount?: number;
376
+ payer?: BasketItemPayerDTO;
377
+ price?: number;
378
+ quantity?: number;
379
+ quantity_float?: number;
380
+ quantity_unit?: string;
381
+ sub_merchant_key?: string;
382
+ sub_merchant_price?: string;
383
+ }
384
+ /**
385
+ * @category API DTOs
386
+ * @summary Address information for billing purposes
387
+ * @description Complete billing address information including tax details
388
+ * @interface BillingAddressDTO
389
+ */
390
+ interface BillingAddressDTO {
391
+ address?: string;
392
+ billing_type?: string;
393
+ citizenship?: string;
394
+ city?: string;
395
+ contact_name?: string;
396
+ contact_phone?: string;
397
+ country?: string;
398
+ district?: string;
399
+ tax_office?: string;
400
+ title?: string;
401
+ vat_number?: string;
402
+ zip_code?: string;
403
+ }
404
+ /**
405
+ * @category UI Customization
406
+ * @summary Customization options for the checkout page
407
+ * @description Visual design parameters for customizing the checkout experience
408
+ * @interface CheckoutDesignDTO
409
+ */
410
+ interface CheckoutDesignDTO {
411
+ input_background_color?: string;
412
+ input_text_color?: string;
413
+ label_text_color?: string;
414
+ left_background_color?: string;
415
+ logo?: string;
416
+ order_detail_html?: string;
417
+ pay_button_color?: string;
418
+ redirect_url?: string;
419
+ right_background_color?: string;
420
+ text_color?: string;
421
+ }
422
+ /**
423
+ * @category API DTOs
424
+ * @summary Custom metadata for orders and transactions
425
+ * @description Key-value pairs for storing additional information with orders
426
+ * @interface MetadataDTO
427
+ */
428
+ interface MetadataDTO {
429
+ key: string;
430
+ value: string;
431
+ }
432
+ /**
433
+ * @category Payment Processing
434
+ * @summary Card information for processing an order
435
+ * @description Identifies a saved card to use for payment
436
+ * @interface OrderCardDTO
437
+ */
438
+ interface OrderCardDTO {
439
+ card_id: string;
440
+ card_sequence: number;
441
+ }
442
+ /**
443
+ * @category Payment Processing
444
+ * @summary Individual payment term for an order
445
+ * @description Details for installment or partial payments with due dates and status
446
+ * @interface PaymentTermDTO
447
+ */
448
+ interface PaymentTermDTO {
449
+ amount?: number;
450
+ data?: string;
451
+ due_date?: string;
452
+ paid_date?: string;
453
+ required?: boolean;
454
+ status?: string;
455
+ term_reference_id?: string;
456
+ term_sequence?: number;
457
+ }
458
+ /**
459
+ * @category Submerchant
460
+ * @summary Payment facilitation submerchant details
461
+ * @description Information about a submerchant in a payment facilitation flow
462
+ * @interface OrderPFSubMerchantDTO
463
+ */
464
+ interface OrderPFSubMerchantDTO {
465
+ address?: string;
466
+ city?: string;
467
+ country?: string;
468
+ country_iso_code?: string;
469
+ id?: string;
470
+ mcc?: string;
471
+ name?: string;
472
+ org_id?: string;
473
+ postal_code?: string;
474
+ submerchant_nin?: string;
475
+ submerchant_url?: string;
476
+ terminal_no?: string;
477
+ }
478
+ /**
479
+ * @category API DTOs
480
+ * @summary Address information for shipping
481
+ * @description Complete shipping address information including tracking details
482
+ * @interface ShippingAddressDTO
483
+ */
484
+ interface ShippingAddressDTO {
485
+ address?: string;
486
+ city?: string;
487
+ contact_name?: string;
488
+ country?: string;
489
+ shipping_date?: string;
490
+ tracking_code?: string;
491
+ zip_code?: string;
492
+ }
493
+ /**
494
+ * @category Submerchant
495
+ * @summary Details for sub-organization relationships
496
+ * @description Information about a subsidiary organization for payment processing
497
+ * @interface SubOrganizationDTO
498
+ */
499
+ interface SubOrganizationDTO {
500
+ acquirer?: string;
501
+ address?: string;
502
+ contact_first_name?: string;
503
+ contact_last_name?: string;
504
+ currency?: string;
505
+ email?: string;
506
+ gsm_number?: string;
507
+ iban?: string;
508
+ identity_number?: string;
509
+ legal_company_title?: string;
510
+ organization_name?: string;
511
+ sub_merchant_external_id?: string;
512
+ sub_merchant_key?: string;
513
+ sub_merchant_type?: string;
514
+ tax_number?: string;
515
+ tax_office?: string;
516
+ }
517
+ /**
518
+ * @category Submerchant
519
+ * @summary Payment information for submerchants
520
+ * @description Defines how payments are split with submerchants
521
+ * @interface SubmerchantDTO
522
+ */
523
+ interface SubmerchantDTO {
524
+ amount?: number;
525
+ merchant_reference_id?: string;
526
+ order_basket_item_id?: string;
527
+ }
528
+ /**
529
+ * @category API DTOs
530
+ * @summary Comprehensive order creation request
531
+ * @description Full API request structure for creating an order with all possible options
532
+ * @interface OrderCreateDTO
533
+ */
534
+ interface OrderCreateDTO {
212
535
  amount: number;
213
- currency: Currency;
214
- locale: Locale;
215
- buyer: Buyer;
216
- description?: string;
217
- callbackUrl?: string;
218
- conversationId?: string;
219
- metadata?: Record<string, unknown>;
536
+ currency: string;
537
+ locale: string;
538
+ buyer: BuyerDTO;
539
+ basket_items?: BasketItemDTO[];
540
+ billing_address?: BillingAddressDTO;
541
+ checkout_design?: CheckoutDesignDTO;
542
+ conversation_id?: string;
543
+ enabled_installments?: number[];
544
+ external_reference_id?: string;
545
+ metadata?: MetadataDTO[];
546
+ order_cards?: OrderCardDTO;
547
+ paid_amount?: number;
548
+ partial_payment?: boolean;
549
+ payment_failure_url?: string;
550
+ payment_methods?: boolean;
551
+ payment_options?: string[];
552
+ payment_success_url?: string;
553
+ payment_terms?: PaymentTermDTO[];
554
+ pf_sub_merchant?: OrderPFSubMerchantDTO;
555
+ shipping_address?: ShippingAddressDTO;
556
+ sub_organization?: SubOrganizationDTO;
557
+ submerchants?: SubmerchantDTO[];
558
+ tax_amount?: number;
559
+ three_d_force?: boolean;
220
560
  }
221
561
  /**
222
- * Represents the response received after creating an order.
562
+ * @category Refunds
563
+ * @summary Data structure for requesting a refund
564
+ * @description Contains the necessary information to process a refund for an order
565
+ * @interface RefundOrderDTO
223
566
  */
224
- interface OrderCreateResponse {
225
- referenceId: string;
226
- conversationId: string;
227
- checkoutUrl: string;
567
+ interface RefundOrderDTO {
568
+ amount: number;
569
+ reference_id: string;
570
+ order_item_id?: string;
571
+ order_item_payment_id?: string;
572
+ }
573
+ /**
574
+ * @category Payment Terms
575
+ * @summary Data for creating a payment term
576
+ * @description Structure for creating a new payment term for an existing order
577
+ * @interface OrderPaymentTermCreateDTO
578
+ */
579
+ interface OrderPaymentTermCreateDTO {
580
+ order_id: string;
581
+ term_reference_id: string;
582
+ amount: number;
583
+ due_date: string;
584
+ term_sequence: number;
585
+ required: boolean;
228
586
  status: string;
229
- qrCodeUrl?: string;
587
+ data?: string;
588
+ paid_date?: string;
230
589
  }
231
590
  /**
232
- * Main SDK class for Tapsilat payment operations
233
- *
234
- * @example
235
- * ```typescript
236
- * const tapsilat = new TapsilatSDK({
237
- * bearerToken: 'your-bearer-token',
238
- * baseURL: 'https://api.tapsilat.com/v1'
239
- * });
240
- *
241
- * const payment = await tapsilat.createPayment({
242
- * amount: 100.50,
243
- * currency: 'TRY',
244
- * paymentMethod: 'credit_card'
245
- * });
246
- * ```
591
+ * @category Payment Terms
592
+ * @summary Data for updating a payment term
593
+ * @description Structure for updating an existing payment term
594
+ * @interface OrderPaymentTermUpdateDTO
247
595
  */
248
- declare class TapsilatSDK {
249
- private readonly httpClient;
250
- private readonly config;
596
+ interface OrderPaymentTermUpdateDTO {
597
+ term_reference_id: string;
598
+ amount?: number;
599
+ due_date?: string;
600
+ paid_date?: string;
601
+ required?: boolean;
602
+ status?: string;
603
+ term_sequence?: number;
604
+ }
605
+ /**
606
+ * @category Refunds
607
+ * @summary Request to refund a specific payment term
608
+ * @description Data required to process a refund for a specific payment term
609
+ * @interface OrderTermRefundRequest
610
+ */
611
+ interface OrderTermRefundRequest {
612
+ term_id: string;
613
+ amount: number;
614
+ reference_id?: string;
615
+ term_payment_id?: string;
616
+ }
617
+ /**
618
+ * @category Order Management
619
+ * @summary Basic order creation response
620
+ * @description Minimal response information after order creation
621
+ * @interface OrderResponse
622
+ */
623
+ interface OrderResponse {
624
+ reference_id: string;
625
+ checkout_url: string;
626
+ order_id?: string;
627
+ }
628
+
629
+ /**
630
+ * @category Configuration
631
+ * @module ConfigManager
632
+ */
633
+
634
+ /**
635
+ * @category Configuration
636
+ * @summary Configuration management for Tapsilat SDK
637
+ * @description Handles SDK configuration updates, validation, and secure access to configuration data
638
+ * @class ConfigManager
639
+ */
640
+ declare class ConfigManager {
641
+ private config;
251
642
  /**
252
- * Creates a new TapsilatSDK instance
643
+ * @summary Creates a new configuration manager
644
+ * @description Initializes the configuration manager with the provided configuration options
253
645
  *
254
- * @param config - SDK configuration options
255
- * @throws {TapsilatValidationError} When Bearer token is invalid
646
+ * @param config - Initial SDK configuration
256
647
  */
257
648
  constructor(config: TapsilatConfig);
258
649
  /**
259
- * Creates a new order and returns a checkout URL.
650
+ * @category Configuration Access
651
+ * @summary Get current SDK configuration without sensitive information
652
+ * @description Returns a copy of the current configuration with sensitive data (like bearer token) excluded
260
653
  *
261
- * @param orderRequest - The order details including amount, currency, and buyer information
262
- * @returns Promise resolving to the created order response including reference ID and checkout URL
263
- * @throws {TapsilatValidationError} When order request data is invalid
264
- * @throws {TapsilatNetworkError} When API request fails due to network issues
265
- * @throws {TapsilatError} When API returns an error response
654
+ * @returns Copy of current configuration without bearer token
655
+ */
656
+ getConfig(): Omit<TapsilatConfig, "bearerToken"> & {
657
+ hasBearerToken: boolean;
658
+ };
659
+ /**
660
+ * @category Configuration Management
661
+ * @summary Update SDK configuration with new values
662
+ * @description Updates the SDK configuration with provided values, validating bearer token if changed
266
663
  *
267
- * @example
268
- * ```typescript
269
- * try {
270
- * const orderResponse = await tapsilat.createOrder({
271
- * amount: 100.50,
272
- * currency: 'TRY',
273
- * locale: 'en',
274
- * buyer: {
275
- * name: 'John',
276
- * surname: 'Doe',
277
- * email: 'john.doe@example.com'
278
- * }
279
- * });
280
- * console.log(`Checkout URL: ${orderResponse.checkoutUrl}`);
281
- * } catch (error) {
282
- * console.error(`Order creation failed: ${error.message}`);
283
- * }
284
- * ```
664
+ * @param newConfig - Partial configuration to update
665
+ * @throws {TapsilatValidationError} When Bearer token is invalid
285
666
  */
286
- createOrder(orderRequest: OrderCreateRequest): Promise<OrderCreateResponse>;
667
+ updateConfig(newConfig: Partial<TapsilatConfig>): void;
287
668
  /**
288
- * Validates an order request object
289
- * @private
669
+ * @category Internal
670
+ * @summary Gets the internal configuration for SDK use
671
+ * @description Returns a full copy of the configuration for internal SDK operations
672
+ *
673
+ * @internal
674
+ * @returns Full configuration including sensitive data
290
675
  */
291
- private validateOrderRequest;
676
+ getInternalConfig(): TapsilatConfig;
292
677
  /**
293
- * Basic email validation
294
- * @private
678
+ * @category Authentication
679
+ * @summary Gets the bearer token for authentication
680
+ * @description Retrieves the configured bearer token for API authentication
681
+ *
682
+ * @internal
683
+ * @returns Bearer token
295
684
  */
296
- private isValidEmail;
685
+ getBearerToken(): string;
686
+ /**
687
+ * @category Endpoints
688
+ * @summary Gets the base URL for API requests
689
+ * @description Retrieves the configured base URL for API endpoints
690
+ *
691
+ * @internal
692
+ * @returns API base URL
693
+ */
694
+ getBaseUrl(): string | undefined;
695
+ /**
696
+ * @category Networking
697
+ * @summary Gets the request timeout value
698
+ * @description Retrieves the configured timeout value for API requests
699
+ *
700
+ * @internal
701
+ * @returns Request timeout in milliseconds
702
+ */
703
+ getTimeout(): number | undefined;
704
+ }
705
+
706
+ /**
707
+ * Main SDK class for Tapsilat payment operations
708
+ *
709
+ * @summary Enterprise-grade TypeScript SDK for Tapsilat Payment Processing Platform
710
+ * @description
711
+ * The TapsilatSDK class provides a comprehensive interface for integrating with the Tapsilat payment platform.
712
+ * It offers secure, efficient, and type-safe methods for managing orders, payments, refunds, and other
713
+ * payment-related operations. The SDK includes built-in error handling, request validation, retry logic,
714
+ * and comprehensive logging capabilities.
715
+ *
716
+ * Key features:
717
+ * - Type-safe API with TypeScript support
718
+ * - Built-in error handling with custom error types
719
+ * - Automatic request/response validation
720
+ * - Configurable retry mechanism
721
+ * - Full compliance with Tapsilat API specifications
722
+ */
723
+ declare class TapsilatSDK {
724
+ private readonly httpClient;
725
+ private readonly configManager;
297
726
  /**
298
- * Generic response handler - consistent way to handle API responses across SDK methods
299
- * @private
727
+ * Creates a new TapsilatSDK instance
728
+ *
729
+ * @summary Initializes the Tapsilat SDK with configuration options
730
+ * @description
731
+ * Creates and configures a new instance of the TapsilatSDK with the provided configuration.
732
+ * The constructor validates the bearer token, sets up the HTTP client with proper headers,
733
+ * configures retry mechanisms, and initializes internal state for API communication.
734
+ *
735
+ * The SDK instance is immutable after creation - configuration cannot be changed without
736
+ * creating a new instance. This ensures thread safety and predictable behavior.
300
737
  *
301
- * @param response - The API response to process
302
- * @param errorContext - Descriptive context for error messages
303
- * @returns The data from a successful response
304
- * @throws {TapsilatError} On any response error
738
+ * @param {TapsilatConfig} config - SDK configuration options
739
+ * @param {string} config.bearerToken - API authentication token (required)
740
+ * @param {string} [config.baseURL='https://api.tapsilat.com/v1'] - API base URL
741
+ * @param {number} [config.timeout=30000] - Request timeout in milliseconds
742
+ * @param {number} [config.maxRetries=3] - Maximum number of retry attempts
743
+ * @param {number} [config.retryDelay=1000] - Delay between retries in milliseconds
744
+ * @param {string} [config.version='v1'] - API version to use
745
+ * @param {boolean} [config.debug=false] - Enable debug logging
746
+ *
747
+ * @throws {TapsilatValidationError} When bearer token is invalid, missing, or malformed
748
+ * @throws {TypeError} When config parameter is not an object or missing required fields
305
749
  */
306
- private handleResponse;
750
+ constructor(config: TapsilatConfig);
307
751
  /**
308
- * Generic error handler - consistent way to handle errors across SDK methods
309
- * @private
752
+ * Creates a new order and returns a checkout URL
753
+ *
754
+ * @summary Initiates a new payment order with buyer information and generates checkout URL
755
+ * @description
756
+ * Creates a new payment order in the Tapsilat system with the provided order details.
757
+ * This method performs comprehensive validation of all input parameters, creates the order
758
+ * on the payment platform, and returns a checkout URL that customers can use to complete
759
+ * their payment. The method supports multiple currencies, locales, and comprehensive
760
+ * buyer information for compliance and fraud prevention.
761
+ *
762
+ * The returned checkout URL is valid for a limited time (typically 24 hours) and should
763
+ * be presented to the customer immediately. The order status can be tracked using the
764
+ * returned reference ID through the getOrderStatus method.
765
+ *
766
+ * @param {OrderCreateRequest} orderRequest - Complete order information
767
+ * @param {number} orderRequest.amount - Payment amount (must be positive, max 2 decimal places)
768
+ * @param {Currency} orderRequest.currency - Payment currency ('TRY', 'USD', 'EUR', 'GBP')
769
+ * @param {Locale} orderRequest.locale - Display language ('tr' for Turkish, 'en' for English)
770
+ * @param {Buyer} orderRequest.buyer - Customer information for payment processing
771
+ * @param {string} orderRequest.buyer.name - Customer's first name (required)
772
+ * @param {string} orderRequest.buyer.surname - Customer's last name (required)
773
+ * @param {string} orderRequest.buyer.email - Customer's email address (required, validated)
774
+ * @param {string} [orderRequest.buyer.phone] - Customer's phone number
775
+ * @param {string} [orderRequest.buyer.identityNumber] - National ID or tax number
776
+ * @param {Address} [orderRequest.buyer.shippingAddress] - Shipping address for physical goods
777
+ * @param {Address} [orderRequest.buyer.billingAddress] - Billing address for invoicing
778
+ * @param {string} [orderRequest.description] - Order description for customer reference
779
+ * @param {string} [orderRequest.callbackUrl] - URL to redirect after payment completion
780
+ * @param {string} [orderRequest.conversationId] - Custom tracking ID for your system
781
+ * @param {Record<string, unknown>} [orderRequest.metadata] - Additional custom data
782
+ *
783
+ * @returns {Promise<OrderCreateResponse>} Promise resolving to order creation response
784
+ * @returns {string} OrderCreateResponse.referenceId - Unique order identifier for tracking
785
+ * @returns {string} OrderCreateResponse.conversationId - Echo of provided conversation ID
786
+ * @returns {string} OrderCreateResponse.checkoutUrl - Payment page URL for customer
787
+ * @returns {string} OrderCreateResponse.status - Initial order status (typically 'CREATED')
788
+ * @returns {string} [OrderCreateResponse.qrCodeUrl] - QR code URL for mobile payments
310
789
  *
311
- * @param error - The caught error to process
312
- * @param errorContext - Descriptive context for error messages
313
- * @throws {TapsilatError} Always throws an appropriate error type
790
+ * @throws {TapsilatValidationError} When input validation fails:
791
+ * - Amount is not positive or has more than 2 decimal places
792
+ * - Currency is not supported
793
+ * - Buyer information is incomplete or invalid
794
+ * - Email format is invalid
795
+ * - Required fields are missing
796
+ * @throws {TapsilatNetworkError} When network request fails:
797
+ * - Connection timeout
798
+ * - DNS resolution failure
799
+ * - Network connectivity issues
800
+ * @throws {TapsilatError} When API returns business logic errors:
801
+ * - Insufficient merchant balance
802
+ * - Currency not enabled for merchant
803
+ * - Buyer blocked due to fraud detection
804
+ * - Rate limiting exceeded
314
805
  */
315
- private handleError;
806
+ createOrder(orderRequest: OrderCreateRequest): Promise<OrderCreateResponse>;
316
807
  /**
317
808
  * Gets an order by reference ID.
318
809
  *
810
+ * @summary Retrieve complete order details and information
811
+ * @description Gets complete order data including buyer info, amounts, and current status using the unique reference ID.
812
+ *
319
813
  * @param referenceId - The unique reference ID of the order
320
814
  * @returns Promise resolving to the complete order details
321
815
  * @throws {TapsilatValidationError} When referenceId is invalid
322
816
  * @throws {TapsilatNetworkError} When API request fails due to network issues
323
817
  * @throws {TapsilatError} When API returns an error response
324
- *
325
- * @example
326
- * ```typescript
327
- * try {
328
- * const order = await tapsilat.getOrder("ord_123456789");
329
- * console.log(`Order amount: ${order.amount} ${order.currency}`);
330
- * } catch (error) {
331
- * console.error(`Failed to get order: ${error.message}`);
332
- * }
333
- * ```
334
818
  */
335
819
  getOrder(referenceId: string): Promise<Order>;
336
820
  /**
337
821
  * Lists orders with pagination support.
338
822
  *
823
+ * @summary Retrieve paginated list of merchant orders
824
+ * @description Gets orders with pagination support, filtering, and sorting options.
825
+ *
339
826
  * @param params - Optional pagination parameters (page number and items per page)
340
827
  * @returns Promise resolving to paginated list of orders
341
828
  * @throws {TapsilatNetworkError} When API request fails due to network issues
342
829
  * @throws {TapsilatError} When API returns an error response
343
- *
344
- * @example
345
- * ```typescript
346
- * try {
347
- * // Get the second page with 20 items per page
348
- * const orderList = await tapsilat.getOrders({ page: 2, per_page: 20 });
349
- * console.log(`Total orders: ${orderList.total}`);
350
- * orderList.rows.forEach(order => {
351
- * console.log(`Order ${order.referenceId}: ${order.amount} ${order.currency}`);
352
- * });
353
- * } catch (error) {
354
- * console.error(`Failed to list orders: ${error.message}`);
355
- * }
356
- * ```
357
830
  */
358
831
  getOrders(params?: {
359
832
  page?: number;
@@ -361,70 +834,127 @@ declare class TapsilatSDK {
361
834
  }): Promise<PaginatedResponse<Order>>;
362
835
  /**
363
836
  * Cancels an order by reference_id.
837
+ *
838
+ * @summary Cancel a pending order before payment completion
839
+ * @description Cancels unpaid order and prevents further payment processing.
840
+ *
841
+ * @param referenceId - The unique reference ID of the order to cancel
842
+ * @returns Promise resolving to the canceled order details
843
+ * @throws {TapsilatValidationError} When referenceId is invalid
844
+ * @throws {TapsilatError} When API returns an error response or order cannot be canceled
364
845
  */
365
846
  cancelOrder(referenceId: string): Promise<Order>;
366
847
  /**
367
- * Gets the status of an order by reference ID.
848
+ * Gets the current status of an order by reference ID
368
849
  *
369
- * @param referenceId - The unique reference ID of the order
370
- * @returns Promise resolving to the current order status, including status code and last update time
371
- * @throws {TapsilatValidationError} When referenceId is invalid
372
- * @throws {TapsilatNetworkError} When API request fails due to network issues
373
- * @throws {TapsilatError} When API returns an error response
850
+ * @summary Retrieves real-time payment status and tracking information for a specific order
851
+ * @description
852
+ * Queries the Tapsilat payment platform to retrieve the current status of an order using its
853
+ * unique reference ID. This method provides real-time information about payment progress,
854
+ * completion status, and last update timestamp. It's essential for tracking payment flow
855
+ * and implementing proper order state management in your application.
374
856
  *
375
- * @example
376
- * ```typescript
377
- * try {
378
- * const orderStatus = await tapsilat.getOrderStatus("ord_123456789");
379
- * console.log(`Order status: ${orderStatus.status}`);
380
- * } catch (error) {
381
- * if (error instanceof TapsilatValidationError) {
382
- * console.error("Invalid reference ID format");
383
- * } else if (error instanceof TapsilatError) {
384
- * console.error(`API error: ${error.message}`);
385
- * }
386
- * }
387
- * ```
857
+ * The status information includes payment state (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED),
858
+ * last update timestamp, and any relevant status metadata. This method should be used to:
859
+ * - Check if a payment has been completed after redirecting from checkout
860
+ * - Monitor payment status for pending transactions
861
+ * - Verify order state before fulfilling goods/services
862
+ * - Implement webhook verification and status synchronization
863
+ *
864
+ * @param {string} referenceId - Unique order reference identifier from order creation
865
+ *
866
+ * @returns {Promise<OrderStatusResponse>} Promise resolving to current order status information
867
+ * @returns {string} OrderStatusResponse.referenceId - Echo of the provided reference ID
868
+ * @returns {string} OrderStatusResponse.status - Current payment status (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED, FAILED)
869
+ * @returns {string} OrderStatusResponse.lastUpdatedAt - ISO 8601 timestamp of last status change
870
+ *
871
+ * @throws {TapsilatValidationError} When input validation fails:
872
+ * - Reference ID is null, undefined, or empty string
873
+ * - Reference ID format is invalid (should match order ID pattern)
874
+ * @throws {TapsilatNetworkError} When network request fails:
875
+ * - Connection timeout during status check
876
+ * - DNS resolution failure
877
+ * - Network connectivity issues
878
+ * @throws {TapsilatError} When API returns business logic errors:
879
+ * - ORDER_NOT_FOUND: Order with given reference ID doesn't exist
880
+ * - ACCESS_DENIED: Order belongs to different merchant
881
+ * - RATE_LIMIT_EXCEEDED: Too many status check requests
388
882
  */
389
883
  getOrderStatus(referenceId: string): Promise<OrderStatusResponse>;
390
884
  /**
391
885
  * Partially refunds an order.
392
886
  * Based on `refund_order` from the Python SDK.
393
887
  *
888
+ * @summary Process partial refund for a completed order
889
+ * @description Refunds specified amount from a paid order and returns transaction details.
890
+ *
394
891
  * @param refundData - The refund details, including referenceId and amount.
395
892
  * @returns Promise resolving to the refund transaction details.
893
+ * @throws {TapsilatError} When API returns an error response or refund fails
396
894
  */
397
895
  refundOrder(refundData: OrderRefundRequest): Promise<OrderRefundResponse>;
398
896
  /**
399
897
  * Fully refunds an order by its reference ID.
400
898
  * Based on `refund_all_order` from the Python SDK.
401
899
  *
900
+ * @summary Process full refund for a completed order
901
+ * @description Refunds entire order amount and returns transaction details.
902
+ *
402
903
  * @param referenceId - The unique identifier of the order to fully refund.
403
904
  * @returns Promise resolving to the refund transaction details.
905
+ * @throws {TapsilatError} When API returns an error response or full refund fails
404
906
  */
405
907
  refundAllOrder(referenceId: string): Promise<OrderRefundResponse>;
406
908
  /**
407
909
  * Retrieves the payment details for an order.
408
910
  * Based on `get_order_payment_details` from the Python SDK.
409
911
  *
912
+ * @summary Retrieve detailed payment transaction information for an order
913
+ * @description Gets payment method, amount, status, and card info for order transactions.
914
+ *
410
915
  * @param referenceId - The unique identifier of the order.
411
916
  * @param conversationId - Optional conversation ID for more specific querying.
412
917
  * @returns Promise resolving to a list of payment details.
918
+ * @throws {TapsilatValidationError} When referenceId is invalid
919
+ * @throws {TapsilatError} When API returns an error response or payment details are missing
413
920
  */
414
921
  getOrderPaymentDetails(referenceId: string, conversationId?: string): Promise<OrderPaymentDetail[]>;
415
922
  /**
416
923
  * Gets an order by conversation_id.
417
924
  * Based on `get_order_by_conversation_id` from the Python SDK.
925
+ *
926
+ * @summary Find order using conversation ID instead of reference ID
927
+ * @description Alternative lookup method for orders using custom conversation identifier.
928
+ *
929
+ * @param conversationId - The custom conversation identifier used when creating the order
930
+ * @returns Promise resolving to the complete order details
931
+ * @throws {TapsilatValidationError} When conversationId is invalid
932
+ * @throws {TapsilatError} When API returns an error response
418
933
  */
419
934
  getOrderByConversationId(conversationId: string): Promise<Order>;
420
935
  /**
421
936
  * Gets order transactions by reference_id.
422
937
  * Based on `get_order_transactions` from the Python SDK.
938
+ *
939
+ * @summary Retrieve transaction history for an order
940
+ * @description Gets detailed transaction records and payment attempts for a specific order.
941
+ *
942
+ * @param referenceId - The unique reference ID of the order
943
+ * @returns Promise resolving to array of transaction records
944
+ * @throws {TapsilatValidationError} When referenceId is invalid
945
+ * @throws {TapsilatError} When API returns an error response
423
946
  */
424
947
  getOrderTransactions(referenceId: string): Promise<any[]>;
425
948
  /**
426
949
  * Gets order submerchants with pagination.
427
950
  * Based on `get_order_submerchants` from the Python SDK.
951
+ *
952
+ * @summary Retrieve paginated list of submerchants for orders
953
+ * @description Gets submerchant information with pagination support for order management.
954
+ *
955
+ * @param params - Optional pagination parameters (page number and items per page)
956
+ * @returns Promise resolving to paginated list of submerchants
957
+ * @throws {TapsilatError} When API returns an error response
428
958
  */
429
959
  getOrderSubmerchants(params?: {
430
960
  page?: number;
@@ -433,76 +963,177 @@ declare class TapsilatSDK {
433
963
  /**
434
964
  * Gets checkout URL for an order.
435
965
  * Based on `get_checkout_url` from the Python SDK.
966
+ *
967
+ * @summary Retrieve checkout URL for existing order
968
+ * @description Gets the payment checkout URL for an existing order using reference ID.
969
+ *
970
+ * @param referenceId - The unique reference ID of the order
971
+ * @returns Promise resolving to the checkout URL string
972
+ * @throws {TapsilatError} When checkout URL is not found in order response
436
973
  */
437
974
  getCheckoutUrl(referenceId: string): Promise<string>;
438
975
  /**
439
976
  * Verifies webhook signature for security
440
977
  *
978
+ * @summary Validate webhook signature for security verification
979
+ * @description Verifies the authenticity of webhook payloads using HMAC signature validation.
980
+ *
441
981
  * @param payload - Raw webhook payload string
442
982
  * @param signature - Webhook signature from headers
443
983
  * @param secret - Your webhook secret key
444
984
  * @returns Promise resolving to true if signature is valid
445
- *
446
- * @example
447
- * ```typescript
448
- * const isValid = await sdk.verifyWebhook(
449
- * JSON.stringify(req.body),
450
- * req.headers['x-tapsilat-signature'],
451
- * 'your-webhook-secret'
452
- * );
453
- * ```
985
+ * @throws {TapsilatValidationError} When input validation fails for payload, signature or secret
454
986
  */
455
987
  verifyWebhook(payload: string, signature: string, secret: string): Promise<boolean>;
456
988
  /**
457
989
  * Checks API service health and availability
458
990
  *
459
- * @returns Promise resolving to service status
991
+ * @summary Check API service health and availability
992
+ * @description Verifies that the Tapsilat API service is operational and accessible.
993
+ *
994
+ * @returns Promise resolving to service status with status string and timestamp
995
+ * @throws {TapsilatError} When API health check fails or returns invalid data
460
996
  */
461
997
  healthCheck(): Promise<{
462
998
  status: string;
463
999
  timestamp: string;
464
1000
  }>;
465
1001
  /**
466
- * Gets current SDK configuration (without sensitive data)
1002
+ * Gets the configuration manager instance
467
1003
  *
468
- * @returns Copy of current configuration
469
- */
470
- getConfig(): Omit<TapsilatConfig, "bearerToken"> & {
471
- hasBearerToken: boolean;
472
- };
473
- /**
474
- * Updates SDK configuration
1004
+ * @summary Access to the configuration manager for advanced configuration management
1005
+ * @description
1006
+ * Provides direct access to the ConfigManager instance for configuration operations.
1007
+ * Use this to get, update, or manage SDK configuration settings.
475
1008
  *
476
- * @param newConfig - Partial configuration to update
477
- * @throws {TapsilatValidationError} When Bearer token is invalid
1009
+ * @example
1010
+ * ```typescript
1011
+ * const sdk = new TapsilatSDK(config);
1012
+ * const configManager = sdk.getConfigManager();
1013
+ *
1014
+ * // Get config (without sensitive data)
1015
+ * console.log(configManager.getConfig());
1016
+ *
1017
+ * // Update config
1018
+ * configManager.updateConfig({ timeout: 60000 });
1019
+ * ```
1020
+ *
1021
+ * @returns ConfigManager instance for configuration operations
478
1022
  */
479
- updateConfig(newConfig: Partial<TapsilatConfig>): void;
1023
+ getConfigManager(): ConfigManager;
480
1024
  }
481
1025
 
1026
+ /**
1027
+ * @category Errors
1028
+ * @module TapsilatError
1029
+ */
1030
+
1031
+ /**
1032
+ * @category Errors
1033
+ * @summary Base error class for Tapsilat SDK
1034
+ * @description Foundation error class for all Tapsilat-specific errors with error code and details support
1035
+ * @class TapsilatError
1036
+ * @extends Error
1037
+ */
482
1038
  declare class TapsilatError extends Error {
483
1039
  readonly code: string;
484
1040
  readonly details?: Record<string, any>;
1041
+ /**
1042
+ * @summary Creates a new TapsilatError instance
1043
+ * @description Initializes base error with message, code and optional details
1044
+ *
1045
+ * @param message - Human-readable error message
1046
+ * @param code - Error code for programmatic identification
1047
+ * @param details - Optional additional error context
1048
+ */
485
1049
  constructor(message: string, code: string, details?: Record<string, any>);
1050
+ /**
1051
+ * @summary Creates a TapsilatError from an API error response
1052
+ * @description Factory method to convert API error format to a TapsilatError instance
1053
+ *
1054
+ * @param apiError - API error object from response
1055
+ * @returns New TapsilatError instance with properties from API error
1056
+ */
486
1057
  static fromAPIError(apiError: APIError): TapsilatError;
487
1058
  }
1059
+ /**
1060
+ * @category Errors
1061
+ * @summary Network-related error class for HTTP issues
1062
+ * @description Error class for network and HTTP-specific problems including status codes
1063
+ * @class TapsilatNetworkError
1064
+ * @extends TapsilatError
1065
+ */
488
1066
  declare class TapsilatNetworkError extends TapsilatError {
489
1067
  readonly statusCode?: number;
1068
+ /**
1069
+ * @summary Creates a new network error instance
1070
+ * @description Initializes network error with message, code, status code and optional details
1071
+ *
1072
+ * @param message - Human-readable error message
1073
+ * @param code - Error code for programmatic identification
1074
+ * @param statusCode - HTTP status code if applicable
1075
+ * @param details - Optional additional error context
1076
+ */
490
1077
  constructor(message: string, code: string, statusCode?: number, details?: Record<string, any>);
491
1078
  }
1079
+ /**
1080
+ * @category Errors
1081
+ * @summary Error class for validation failures
1082
+ * @description Error class for data validation issues with field-specific error details
1083
+ * @class TapsilatValidationError
1084
+ * @extends TapsilatError
1085
+ */
492
1086
  declare class TapsilatValidationError extends TapsilatError {
1087
+ /**
1088
+ * @summary Creates a new validation error instance
1089
+ * @description Initializes validation error with message and optional field-specific details
1090
+ *
1091
+ * @param message - Human-readable error message
1092
+ * @param details - Optional field-specific validation errors
1093
+ */
493
1094
  constructor(message: string, details?: Record<string, any>);
494
1095
  }
1096
+ /**
1097
+ * @category Errors
1098
+ * @summary Error class for authentication issues
1099
+ * @description Error class for problems related to API keys, authentication tokens, or permissions
1100
+ * @class TapsilatAuthenticationError
1101
+ * @extends TapsilatError
1102
+ */
495
1103
  declare class TapsilatAuthenticationError extends TapsilatError {
1104
+ /**
1105
+ * @summary Creates a new authentication error instance
1106
+ * @description Initializes authentication error with an optional custom message
1107
+ *
1108
+ * @param message - Human-readable error message (defaults to 'Authentication failed')
1109
+ */
496
1110
  constructor(message?: string);
497
1111
  }
1112
+ /**
1113
+ * @category Errors
1114
+ * @summary Error class for rate limit exceeded issues
1115
+ * @description Error class for API rate limiting with information about when to retry
1116
+ * @class TapsilatRateLimitError
1117
+ * @extends TapsilatError
1118
+ */
498
1119
  declare class TapsilatRateLimitError extends TapsilatError {
499
1120
  readonly retryAfter?: number;
1121
+ /**
1122
+ * @summary Creates a new rate limit error instance
1123
+ * @description Initializes rate limit error with message and optional retry-after seconds
1124
+ *
1125
+ * @param message - Human-readable error message (defaults to 'Rate limit exceeded')
1126
+ * @param retryAfter - Optional seconds to wait before retrying
1127
+ */
500
1128
  constructor(message?: string, retryAfter?: number);
501
1129
  }
502
1130
 
503
1131
  /**
504
1132
  * Validates payment request data comprehensively
505
1133
  *
1134
+ * @summary Comprehensive validation of payment request data
1135
+ * @description Validates all required and optional fields in a payment request for integrity and correctness
1136
+ *
506
1137
  * @param request - Payment request to validate
507
1138
  * @throws {TapsilatValidationError} When any field is invalid
508
1139
  */
@@ -510,21 +1141,39 @@ declare function validatePaymentRequest(request: unknown): asserts request is Pa
510
1141
  /**
511
1142
  * Validates email format using robust regex
512
1143
  *
1144
+ * @summary Validates email address format with comprehensive regex
1145
+ * @description Ensures email addresses conform to RFC standards with thorough pattern matching
1146
+ *
513
1147
  * @param email - Email address to validate
514
1148
  * @returns True if email format is valid
515
1149
  */
516
1150
  declare function validateEmail(email: string): boolean;
517
1151
  /**
518
1152
  * @deprecated Use isCurrency type guard instead
1153
+ *
1154
+ * @summary Legacy currency validation function
1155
+ * @description Maintained for backwards compatibility, redirects to the new type guard
1156
+ *
1157
+ * @param currency - Currency code to validate
1158
+ * @returns True if currency is supported
519
1159
  */
520
1160
  declare function isValidCurrency(currency: string): boolean;
521
1161
  /**
522
1162
  * @deprecated Use isPaymentMethod type guard instead
1163
+ *
1164
+ * @summary Legacy payment method validation function
1165
+ * @description Maintained for backwards compatibility, redirects to the new type guard
1166
+ *
1167
+ * @param paymentMethod - Payment method to validate
1168
+ * @returns True if payment method is supported
523
1169
  */
524
1170
  declare function isValidPaymentMethod(paymentMethod: string): boolean;
525
1171
  /**
526
1172
  * Validates URL format and protocol
527
1173
  *
1174
+ * @summary Validates URL format and ensures proper protocol
1175
+ * @description Checks that URLs are well-formed and use HTTP or HTTPS protocols for security
1176
+ *
528
1177
  * @param url - URL to validate
529
1178
  * @returns True if URL is valid HTTP/HTTPS
530
1179
  */
@@ -532,10 +1181,13 @@ declare function isValidUrl(url: string): boolean;
532
1181
  /**
533
1182
  * Sanitizes metadata by removing sensitive keys and cleaning values
534
1183
  *
1184
+ * @summary Removes sensitive data from metadata before processing
1185
+ * @description Filters out security-sensitive keys and normalizes values for safe transmission
1186
+ *
535
1187
  * @param metadata - Raw metadata object
536
1188
  * @returns Sanitized metadata object
537
1189
  */
538
1190
  declare function sanitizeMetadata(metadata: Record<string, unknown>): Record<string, unknown>;
539
1191
 
540
- export { TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validatePaymentRequest };
541
- export type { APIError, APIResponse, Address, Currency, Customer, PaginatedResponse, PaginationParams, PaymentMethod, PaymentRequest, PaymentResponse, PaymentStatus, RefundRequest, RefundResponse, TapsilatConfig, WebhookEvent };
1192
+ export { ConfigManager, TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validatePaymentRequest };
1193
+ export type { APIError, APIResponse, Address, BasketItemDTO, BasketItemPayerDTO, BillingAddressDTO, Buyer, BuyerDTO, CheckoutDesignDTO, Currency, Customer, Locale, MetadataDTO, Order, OrderCardDTO, OrderCreateDTO, OrderCreateRequest, OrderCreateResponse, OrderPFSubMerchantDTO, OrderPaymentDetail, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderRefundRequest, OrderRefundResponse, OrderResponse, OrderStatusResponse, OrderTermRefundRequest, PaginatedResponse, PaginationParams, PaymentMethod, PaymentRequest, PaymentResponse, PaymentStatus, PaymentTermDTO, RefundOrderDTO, RefundRequest, RefundResponse, ShippingAddressDTO, SubOrganizationDTO, SubmerchantDTO, TapsilatConfig, WebhookEvent };