@tapsilat/tapsilat-js 1.0.3 → 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/CHANGELOG.md +14 -0
- package/README.md +3 -3
- package/dist/TapsilatSDK.d.ts +50 -59
- package/dist/TapsilatSDK.d.ts.map +1 -1
- package/dist/config/ConfigManager.d.ts +77 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/errors/TapsilatError.d.ts +84 -1
- package/dist/errors/TapsilatError.d.ts.map +1 -1
- package/dist/http/HttpClient.d.ts +126 -27
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/interceptors.d.ts +117 -1
- package/dist/http/interceptors.d.ts.map +1 -1
- package/dist/index.d.ts +730 -116
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +702 -137
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +702 -136
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +539 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +28 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/validators.d.ts +74 -1
- package/dist/utils/validators.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types.d.ts +0 -401
- package/dist/types.d.ts.map +0 -1
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
*
|
|
111
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
252
|
+
interface Order extends OrderCreateResponse {
|
|
132
253
|
amount: number | string;
|
|
133
254
|
currency: Currency;
|
|
134
|
-
buyer?: Buyer
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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,48 +319,390 @@ interface OrderPaymentDetail {
|
|
|
186
319
|
cardAssociation: string;
|
|
187
320
|
};
|
|
188
321
|
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Supported locales for the Tapsilat API.
|
|
192
|
-
*/
|
|
193
|
-
type Locale = "tr" | "en";
|
|
194
322
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
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
|
|
197
327
|
*/
|
|
198
|
-
interface
|
|
328
|
+
interface BuyerDTO {
|
|
199
329
|
name: string;
|
|
200
330
|
surname: string;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
-
*
|
|
209
|
-
*
|
|
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
|
|
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:
|
|
214
|
-
locale:
|
|
215
|
-
buyer:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
*
|
|
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
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
587
|
+
data?: string;
|
|
588
|
+
paid_date?: string;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* @category Payment Terms
|
|
592
|
+
* @summary Data for updating a payment term
|
|
593
|
+
* @description Structure for updating an existing payment term
|
|
594
|
+
* @interface OrderPaymentTermUpdateDTO
|
|
595
|
+
*/
|
|
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;
|
|
642
|
+
/**
|
|
643
|
+
* @summary Creates a new configuration manager
|
|
644
|
+
* @description Initializes the configuration manager with the provided configuration options
|
|
645
|
+
*
|
|
646
|
+
* @param config - Initial SDK configuration
|
|
647
|
+
*/
|
|
648
|
+
constructor(config: TapsilatConfig);
|
|
649
|
+
/**
|
|
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
|
|
653
|
+
*
|
|
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
|
|
663
|
+
*
|
|
664
|
+
* @param newConfig - Partial configuration to update
|
|
665
|
+
* @throws {TapsilatValidationError} When Bearer token is invalid
|
|
666
|
+
*/
|
|
667
|
+
updateConfig(newConfig: Partial<TapsilatConfig>): void;
|
|
668
|
+
/**
|
|
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
|
|
675
|
+
*/
|
|
676
|
+
getInternalConfig(): TapsilatConfig;
|
|
677
|
+
/**
|
|
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
|
|
684
|
+
*/
|
|
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;
|
|
230
704
|
}
|
|
705
|
+
|
|
231
706
|
/**
|
|
232
707
|
* Main SDK class for Tapsilat payment operations
|
|
233
708
|
*
|
|
@@ -247,7 +722,7 @@ interface OrderCreateResponse {
|
|
|
247
722
|
*/
|
|
248
723
|
declare class TapsilatSDK {
|
|
249
724
|
private readonly httpClient;
|
|
250
|
-
private readonly
|
|
725
|
+
private readonly configManager;
|
|
251
726
|
/**
|
|
252
727
|
* Creates a new TapsilatSDK instance
|
|
253
728
|
*
|
|
@@ -362,6 +837,11 @@ declare class TapsilatSDK {
|
|
|
362
837
|
*
|
|
363
838
|
* @summary Cancel a pending order before payment completion
|
|
364
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
|
|
365
845
|
*/
|
|
366
846
|
cancelOrder(referenceId: string): Promise<Order>;
|
|
367
847
|
/**
|
|
@@ -410,6 +890,7 @@ declare class TapsilatSDK {
|
|
|
410
890
|
*
|
|
411
891
|
* @param refundData - The refund details, including referenceId and amount.
|
|
412
892
|
* @returns Promise resolving to the refund transaction details.
|
|
893
|
+
* @throws {TapsilatError} When API returns an error response or refund fails
|
|
413
894
|
*/
|
|
414
895
|
refundOrder(refundData: OrderRefundRequest): Promise<OrderRefundResponse>;
|
|
415
896
|
/**
|
|
@@ -421,6 +902,7 @@ declare class TapsilatSDK {
|
|
|
421
902
|
*
|
|
422
903
|
* @param referenceId - The unique identifier of the order to fully refund.
|
|
423
904
|
* @returns Promise resolving to the refund transaction details.
|
|
905
|
+
* @throws {TapsilatError} When API returns an error response or full refund fails
|
|
424
906
|
*/
|
|
425
907
|
refundAllOrder(referenceId: string): Promise<OrderRefundResponse>;
|
|
426
908
|
/**
|
|
@@ -433,6 +915,8 @@ declare class TapsilatSDK {
|
|
|
433
915
|
* @param referenceId - The unique identifier of the order.
|
|
434
916
|
* @param conversationId - Optional conversation ID for more specific querying.
|
|
435
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
|
|
436
920
|
*/
|
|
437
921
|
getOrderPaymentDetails(referenceId: string, conversationId?: string): Promise<OrderPaymentDetail[]>;
|
|
438
922
|
/**
|
|
@@ -441,6 +925,11 @@ declare class TapsilatSDK {
|
|
|
441
925
|
*
|
|
442
926
|
* @summary Find order using conversation ID instead of reference ID
|
|
443
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
|
|
444
933
|
*/
|
|
445
934
|
getOrderByConversationId(conversationId: string): Promise<Order>;
|
|
446
935
|
/**
|
|
@@ -449,6 +938,11 @@ declare class TapsilatSDK {
|
|
|
449
938
|
*
|
|
450
939
|
* @summary Retrieve transaction history for an order
|
|
451
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
|
|
452
946
|
*/
|
|
453
947
|
getOrderTransactions(referenceId: string): Promise<any[]>;
|
|
454
948
|
/**
|
|
@@ -457,6 +951,10 @@ declare class TapsilatSDK {
|
|
|
457
951
|
*
|
|
458
952
|
* @summary Retrieve paginated list of submerchants for orders
|
|
459
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
|
|
460
958
|
*/
|
|
461
959
|
getOrderSubmerchants(params?: {
|
|
462
960
|
page?: number;
|
|
@@ -468,6 +966,10 @@ declare class TapsilatSDK {
|
|
|
468
966
|
*
|
|
469
967
|
* @summary Retrieve checkout URL for existing order
|
|
470
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
|
|
471
973
|
*/
|
|
472
974
|
getCheckoutUrl(referenceId: string): Promise<string>;
|
|
473
975
|
/**
|
|
@@ -480,6 +982,7 @@ declare class TapsilatSDK {
|
|
|
480
982
|
* @param signature - Webhook signature from headers
|
|
481
983
|
* @param secret - Your webhook secret key
|
|
482
984
|
* @returns Promise resolving to true if signature is valid
|
|
985
|
+
* @throws {TapsilatValidationError} When input validation fails for payload, signature or secret
|
|
483
986
|
*/
|
|
484
987
|
verifyWebhook(payload: string, signature: string, secret: string): Promise<boolean>;
|
|
485
988
|
/**
|
|
@@ -488,59 +991,149 @@ declare class TapsilatSDK {
|
|
|
488
991
|
* @summary Check API service health and availability
|
|
489
992
|
* @description Verifies that the Tapsilat API service is operational and accessible.
|
|
490
993
|
*
|
|
491
|
-
* @returns Promise resolving to service status
|
|
994
|
+
* @returns Promise resolving to service status with status string and timestamp
|
|
995
|
+
* @throws {TapsilatError} When API health check fails or returns invalid data
|
|
492
996
|
*/
|
|
493
997
|
healthCheck(): Promise<{
|
|
494
998
|
status: string;
|
|
495
999
|
timestamp: string;
|
|
496
1000
|
}>;
|
|
497
1001
|
/**
|
|
498
|
-
* Gets
|
|
1002
|
+
* Gets the configuration manager instance
|
|
499
1003
|
*
|
|
500
|
-
* @summary
|
|
501
|
-
* @description
|
|
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.
|
|
502
1008
|
*
|
|
503
|
-
* @
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
};
|
|
508
|
-
/**
|
|
509
|
-
* Updates SDK configuration
|
|
1009
|
+
* @example
|
|
1010
|
+
* ```typescript
|
|
1011
|
+
* const sdk = new TapsilatSDK(config);
|
|
1012
|
+
* const configManager = sdk.getConfigManager();
|
|
510
1013
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
1014
|
+
* // Get config (without sensitive data)
|
|
1015
|
+
* console.log(configManager.getConfig());
|
|
513
1016
|
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
1017
|
+
* // Update config
|
|
1018
|
+
* configManager.updateConfig({ timeout: 60000 });
|
|
1019
|
+
* ```
|
|
1020
|
+
*
|
|
1021
|
+
* @returns ConfigManager instance for configuration operations
|
|
516
1022
|
*/
|
|
517
|
-
|
|
1023
|
+
getConfigManager(): ConfigManager;
|
|
518
1024
|
}
|
|
519
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
|
+
*/
|
|
520
1038
|
declare class TapsilatError extends Error {
|
|
521
1039
|
readonly code: string;
|
|
522
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
|
+
*/
|
|
523
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
|
+
*/
|
|
524
1057
|
static fromAPIError(apiError: APIError): TapsilatError;
|
|
525
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
|
+
*/
|
|
526
1066
|
declare class TapsilatNetworkError extends TapsilatError {
|
|
527
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
|
+
*/
|
|
528
1077
|
constructor(message: string, code: string, statusCode?: number, details?: Record<string, any>);
|
|
529
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
|
+
*/
|
|
530
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
|
+
*/
|
|
531
1094
|
constructor(message: string, details?: Record<string, any>);
|
|
532
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
|
+
*/
|
|
533
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
|
+
*/
|
|
534
1110
|
constructor(message?: string);
|
|
535
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
|
+
*/
|
|
536
1119
|
declare class TapsilatRateLimitError extends TapsilatError {
|
|
537
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
|
+
*/
|
|
538
1128
|
constructor(message?: string, retryAfter?: number);
|
|
539
1129
|
}
|
|
540
1130
|
|
|
541
1131
|
/**
|
|
542
1132
|
* Validates payment request data comprehensively
|
|
543
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
|
+
*
|
|
544
1137
|
* @param request - Payment request to validate
|
|
545
1138
|
* @throws {TapsilatValidationError} When any field is invalid
|
|
546
1139
|
*/
|
|
@@ -548,21 +1141,39 @@ declare function validatePaymentRequest(request: unknown): asserts request is Pa
|
|
|
548
1141
|
/**
|
|
549
1142
|
* Validates email format using robust regex
|
|
550
1143
|
*
|
|
1144
|
+
* @summary Validates email address format with comprehensive regex
|
|
1145
|
+
* @description Ensures email addresses conform to RFC standards with thorough pattern matching
|
|
1146
|
+
*
|
|
551
1147
|
* @param email - Email address to validate
|
|
552
1148
|
* @returns True if email format is valid
|
|
553
1149
|
*/
|
|
554
1150
|
declare function validateEmail(email: string): boolean;
|
|
555
1151
|
/**
|
|
556
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
|
|
557
1159
|
*/
|
|
558
1160
|
declare function isValidCurrency(currency: string): boolean;
|
|
559
1161
|
/**
|
|
560
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
|
|
561
1169
|
*/
|
|
562
1170
|
declare function isValidPaymentMethod(paymentMethod: string): boolean;
|
|
563
1171
|
/**
|
|
564
1172
|
* Validates URL format and protocol
|
|
565
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
|
+
*
|
|
566
1177
|
* @param url - URL to validate
|
|
567
1178
|
* @returns True if URL is valid HTTP/HTTPS
|
|
568
1179
|
*/
|
|
@@ -570,10 +1181,13 @@ declare function isValidUrl(url: string): boolean;
|
|
|
570
1181
|
/**
|
|
571
1182
|
* Sanitizes metadata by removing sensitive keys and cleaning values
|
|
572
1183
|
*
|
|
1184
|
+
* @summary Removes sensitive data from metadata before processing
|
|
1185
|
+
* @description Filters out security-sensitive keys and normalizes values for safe transmission
|
|
1186
|
+
*
|
|
573
1187
|
* @param metadata - Raw metadata object
|
|
574
1188
|
* @returns Sanitized metadata object
|
|
575
1189
|
*/
|
|
576
1190
|
declare function sanitizeMetadata(metadata: Record<string, unknown>): Record<string, unknown>;
|
|
577
1191
|
|
|
578
|
-
export { TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validatePaymentRequest };
|
|
579
|
-
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 };
|