@tapsilat/tapsilat-js 1.0.6 → 2025.8.19
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/README.md +153 -5
- package/dist/TapsilatSDK.d.ts +119 -1
- package/dist/TapsilatSDK.d.ts.map +1 -1
- package/dist/__mocks__/HttpClient.d.ts +9 -0
- package/dist/__mocks__/HttpClient.d.ts.map +1 -0
- package/dist/index.d.ts +256 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +435 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +436 -0
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +98 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/validators.d.ts +39 -1
- package/dist/utils/validators.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,11 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
**Enterprise-grade TypeScript SDK for Tapsilat Payment Processing Platform**
|
|
8
8
|
|
|
9
|
-
[](https://www.npmjs.com/package/@tapsilat/tapsilat-js)
|
|
12
|
-
[](https://opensource.org/licenses/MIT)
|
|
13
|
-
|
|
14
9
|
</div>
|
|
15
10
|
|
|
16
11
|
## About Tapsilat
|
|
@@ -73,6 +68,53 @@ console.log("Order status:", status.status);
|
|
|
73
68
|
|
|
74
69
|
---
|
|
75
70
|
|
|
71
|
+
## Features
|
|
72
|
+
|
|
73
|
+
### Core Payment Operations
|
|
74
|
+
- Secure authentication with bearer tokens
|
|
75
|
+
- Complete payment lifecycle management
|
|
76
|
+
- Multi-currency support (TRY, USD, EUR, GBP)
|
|
77
|
+
- Advanced filtering and pagination
|
|
78
|
+
|
|
79
|
+
### Payment Term Management
|
|
80
|
+
- Create and manage installment plans
|
|
81
|
+
- Update payment terms (amount, dates, status)
|
|
82
|
+
- Delete payment terms
|
|
83
|
+
- Term-specific refunds and termination
|
|
84
|
+
- Complete order termination
|
|
85
|
+
|
|
86
|
+
### Validation & Utilities
|
|
87
|
+
- Turkish GSM number validation and formatting
|
|
88
|
+
- Installment validation with flexible input formats
|
|
89
|
+
- Input validation for all request parameters
|
|
90
|
+
- Webhook signature verification
|
|
91
|
+
|
|
92
|
+
### Technical Features
|
|
93
|
+
- Full TypeScript support
|
|
94
|
+
- Modern ES6+ architecture
|
|
95
|
+
- Automatic retry logic
|
|
96
|
+
- Configuration management
|
|
97
|
+
- Health monitoring
|
|
98
|
+
- Request/response interceptors
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## SDK Compatibility
|
|
103
|
+
|
|
104
|
+
This JavaScript SDK provides full feature parity with Tapsilat's Python and .NET SDKs:
|
|
105
|
+
|
|
106
|
+
| Feature Category | JavaScript | Python | .NET |
|
|
107
|
+
|-----------------|------------|--------|------|
|
|
108
|
+
| Order Management | Yes | Yes | Yes |
|
|
109
|
+
| Payment Terms | Yes | Yes | Yes |
|
|
110
|
+
| GSM Validation | Yes | Yes | Yes |
|
|
111
|
+
| Installment Validation | Yes | Yes | Yes |
|
|
112
|
+
| Webhook Verification | Yes | No | No |
|
|
113
|
+
| TypeScript Support | Yes | No | Yes |
|
|
114
|
+
| Health Monitoring | Yes | No | No |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
76
118
|
## API Methods & Examples
|
|
77
119
|
|
|
78
120
|
### Order Management
|
|
@@ -218,6 +260,112 @@ app.post('/webhooks/tapsilat', async (req, res) => {
|
|
|
218
260
|
});
|
|
219
261
|
```
|
|
220
262
|
|
|
263
|
+
### Payment Term Management
|
|
264
|
+
|
|
265
|
+
#### Create Payment Term
|
|
266
|
+
```typescript
|
|
267
|
+
const paymentTerm = await tapsilat.createOrderTerm({
|
|
268
|
+
order_id: 'order-reference-id',
|
|
269
|
+
term_reference_id: 'term-001',
|
|
270
|
+
amount: 250.00,
|
|
271
|
+
due_date: '2024-12-31',
|
|
272
|
+
term_sequence: 1,
|
|
273
|
+
required: true,
|
|
274
|
+
status: 'pending',
|
|
275
|
+
data: 'First installment'
|
|
276
|
+
});
|
|
277
|
+
console.log('Payment term created:', paymentTerm.term_reference_id);
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Update Payment Term
|
|
281
|
+
```typescript
|
|
282
|
+
const updatedTerm = await tapsilat.updateOrderTerm({
|
|
283
|
+
term_reference_id: 'term-001',
|
|
284
|
+
amount: 275.00,
|
|
285
|
+
due_date: '2025-01-15',
|
|
286
|
+
status: 'updated'
|
|
287
|
+
});
|
|
288
|
+
console.log('Payment term updated:', updatedTerm.status);
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
#### Delete Payment Term
|
|
292
|
+
```typescript
|
|
293
|
+
const deletedTerm = await tapsilat.deleteOrderTerm({
|
|
294
|
+
term_reference_id: 'term-001'
|
|
295
|
+
});
|
|
296
|
+
console.log('Payment term deleted:', deletedTerm.term_reference_id);
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### Refund Payment Term
|
|
300
|
+
```typescript
|
|
301
|
+
const termRefund = await tapsilat.refundOrderTerm({
|
|
302
|
+
term_id: 'term-001',
|
|
303
|
+
amount: 100.00,
|
|
304
|
+
reference_id: 'refund-ref-123'
|
|
305
|
+
});
|
|
306
|
+
console.log('Term refund processed:', termRefund.refund_id);
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
#### Terminate Payment Term
|
|
310
|
+
```typescript
|
|
311
|
+
const terminatedTerm = await tapsilat.terminateOrderTerm({
|
|
312
|
+
term_reference_id: 'term-001',
|
|
313
|
+
reason: 'Customer request'
|
|
314
|
+
});
|
|
315
|
+
console.log('Payment term terminated:', terminatedTerm.status);
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
#### Terminate Order
|
|
319
|
+
```typescript
|
|
320
|
+
const terminatedOrder = await tapsilat.terminateOrder({
|
|
321
|
+
reference_id: 'order-reference-id',
|
|
322
|
+
reason: 'Business decision'
|
|
323
|
+
});
|
|
324
|
+
console.log('Order terminated at:', terminatedOrder.terminated_at);
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Validation Utilities
|
|
328
|
+
|
|
329
|
+
#### GSM Number Validation
|
|
330
|
+
```typescript
|
|
331
|
+
import { validateGsmNumber } from "@tapsilat/tapsilat-js";
|
|
332
|
+
|
|
333
|
+
const gsmResult = validateGsmNumber('+90 555 123 45 67');
|
|
334
|
+
if (gsmResult.isValid) {
|
|
335
|
+
console.log('Cleaned number:', gsmResult.cleanedNumber); // +905551234567
|
|
336
|
+
} else {
|
|
337
|
+
console.error('Invalid GSM:', gsmResult.error);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Supports multiple formats
|
|
341
|
+
validateGsmNumber('0555 123 45 67'); // National format
|
|
342
|
+
validateGsmNumber('555 123 45 67'); // Local format
|
|
343
|
+
validateGsmNumber('5551234567'); // No formatting
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
#### Installments Validation
|
|
347
|
+
```typescript
|
|
348
|
+
import { validateInstallments } from "@tapsilat/tapsilat-js";
|
|
349
|
+
|
|
350
|
+
// Single installment
|
|
351
|
+
const single = validateInstallments(3);
|
|
352
|
+
console.log(single.validatedInstallments); // [3]
|
|
353
|
+
|
|
354
|
+
// Multiple installments
|
|
355
|
+
const multiple = validateInstallments('1,3,6,12');
|
|
356
|
+
console.log(multiple.validatedInstallments); // [1, 3, 6, 12]
|
|
357
|
+
|
|
358
|
+
// Array format
|
|
359
|
+
const array = validateInstallments([6, 3, 12, 1]);
|
|
360
|
+
console.log(array.validatedInstallments); // [1, 3, 6, 12] (sorted, unique)
|
|
361
|
+
|
|
362
|
+
// Error handling
|
|
363
|
+
const invalid = validateInstallments('abc');
|
|
364
|
+
if (!invalid.isValid) {
|
|
365
|
+
console.error('Validation error:', invalid.error);
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
221
369
|
### Health Monitoring
|
|
222
370
|
|
|
223
371
|
#### API Health Check
|
package/dist/TapsilatSDK.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigManager } from "./config/ConfigManager";
|
|
2
|
-
import { TapsilatConfig, PaginatedResponse, Order, OrderRefundRequest, OrderRefundResponse, OrderStatusResponse, OrderPaymentDetail, OrderCreateRequest, OrderCreateResponse } from "./types/index";
|
|
2
|
+
import { TapsilatConfig, PaginatedResponse, Order, OrderRefundRequest, OrderRefundResponse, OrderStatusResponse, OrderPaymentDetail, OrderCreateRequest, OrderCreateResponse, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderTermRefundRequest, PaymentTermResponse, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermTerminateRequest, OrderTerminateRequest, OrderTerminateResponse } from "./types/index";
|
|
3
3
|
/**
|
|
4
4
|
* Main SDK class for Tapsilat payment operations
|
|
5
5
|
*
|
|
@@ -318,5 +318,123 @@ export declare class TapsilatSDK {
|
|
|
318
318
|
* @returns ConfigManager instance for configuration operations
|
|
319
319
|
*/
|
|
320
320
|
getConfigManager(): ConfigManager;
|
|
321
|
+
/**
|
|
322
|
+
* Creates a new payment term for an existing order
|
|
323
|
+
*
|
|
324
|
+
* @summary Create payment term for installment or partial payment
|
|
325
|
+
* @description
|
|
326
|
+
* Creates a new payment term for an existing order, enabling installment payments
|
|
327
|
+
* or partial payment collection. Payment terms allow splitting order amounts
|
|
328
|
+
* across multiple payments with specific due dates and requirements.
|
|
329
|
+
*
|
|
330
|
+
* @param {OrderPaymentTermCreateDTO} termData - Payment term creation data
|
|
331
|
+
* @param {string} termData.order_id - Reference ID of the existing order
|
|
332
|
+
* @param {string} termData.term_reference_id - Unique identifier for this payment term
|
|
333
|
+
* @param {number} termData.amount - Amount for this payment term
|
|
334
|
+
* @param {string} termData.due_date - Due date for this payment (ISO 8601 format)
|
|
335
|
+
* @param {number} termData.term_sequence - Sequence number for this term
|
|
336
|
+
* @param {boolean} termData.required - Whether this payment term is required
|
|
337
|
+
* @param {string} termData.status - Initial status of the payment term
|
|
338
|
+
* @param {string} [termData.data] - Additional metadata for the term
|
|
339
|
+
* @param {string} [termData.paid_date] - Date when payment was completed
|
|
340
|
+
*
|
|
341
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to created payment term details
|
|
342
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
343
|
+
* @throws {TapsilatError} When API returns an error response
|
|
344
|
+
*/
|
|
345
|
+
createOrderTerm(termData: OrderPaymentTermCreateDTO): Promise<PaymentTermResponse>;
|
|
346
|
+
/**
|
|
347
|
+
* Updates an existing payment term
|
|
348
|
+
*
|
|
349
|
+
* @summary Update payment term details
|
|
350
|
+
* @description
|
|
351
|
+
* Updates an existing payment term with new information such as amount,
|
|
352
|
+
* due date, status, or other metadata. This allows for flexible management
|
|
353
|
+
* of installment payments and payment schedules.
|
|
354
|
+
*
|
|
355
|
+
* @param {OrderPaymentTermUpdateDTO} updateData - Payment term update data
|
|
356
|
+
* @param {string} updateData.term_reference_id - Reference ID of the term to update
|
|
357
|
+
* @param {number} [updateData.amount] - New amount for the payment term
|
|
358
|
+
* @param {string} [updateData.due_date] - New due date (ISO 8601 format)
|
|
359
|
+
* @param {string} [updateData.paid_date] - Date when payment was completed
|
|
360
|
+
* @param {boolean} [updateData.required] - Whether this payment term is required
|
|
361
|
+
* @param {string} [updateData.status] - New status of the payment term
|
|
362
|
+
* @param {number} [updateData.term_sequence] - New sequence number
|
|
363
|
+
*
|
|
364
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to updated payment term details
|
|
365
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
366
|
+
* @throws {TapsilatError} When API returns an error response
|
|
367
|
+
*/
|
|
368
|
+
updateOrderTerm(updateData: OrderPaymentTermUpdateDTO): Promise<PaymentTermResponse>;
|
|
369
|
+
/**
|
|
370
|
+
* Deletes a payment term
|
|
371
|
+
*
|
|
372
|
+
* @summary Delete payment term
|
|
373
|
+
* @description
|
|
374
|
+
* Permanently deletes a payment term from an order. This action cannot be undone.
|
|
375
|
+
* Only unpaid payment terms can be deleted.
|
|
376
|
+
*
|
|
377
|
+
* @param {PaymentTermDeleteRequest} deleteData - Payment term deletion data
|
|
378
|
+
* @param {string} deleteData.term_reference_id - Reference ID of the term to delete
|
|
379
|
+
*
|
|
380
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to deleted payment term details
|
|
381
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
382
|
+
* @throws {TapsilatError} When API returns an error response
|
|
383
|
+
*/
|
|
384
|
+
deleteOrderTerm(deleteData: PaymentTermDeleteRequest): Promise<PaymentTermResponse>;
|
|
385
|
+
/**
|
|
386
|
+
* Refunds a specific payment term
|
|
387
|
+
*
|
|
388
|
+
* @summary Refund payment term
|
|
389
|
+
* @description
|
|
390
|
+
* Processes a refund for a specific payment term. This allows partial refunds
|
|
391
|
+
* at the payment term level rather than the entire order level.
|
|
392
|
+
*
|
|
393
|
+
* @param {OrderTermRefundRequest} refundData - Payment term refund data
|
|
394
|
+
* @param {string} refundData.term_id - ID of the term to refund
|
|
395
|
+
* @param {number} refundData.amount - Amount to refund
|
|
396
|
+
* @param {string} [refundData.reference_id] - Optional reference ID
|
|
397
|
+
* @param {string} [refundData.term_payment_id] - Optional term payment ID
|
|
398
|
+
*
|
|
399
|
+
* @returns {Promise<PaymentTermRefundResponse>} Promise resolving to refund details
|
|
400
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
401
|
+
* @throws {TapsilatError} When API returns an error response
|
|
402
|
+
*/
|
|
403
|
+
refundOrderTerm(refundData: OrderTermRefundRequest): Promise<PaymentTermRefundResponse>;
|
|
404
|
+
/**
|
|
405
|
+
* Terminates a payment term
|
|
406
|
+
*
|
|
407
|
+
* @summary Terminate payment term
|
|
408
|
+
* @description
|
|
409
|
+
* Terminates an active payment term, preventing further payments.
|
|
410
|
+
* This is useful for canceling installment plans or payment schedules.
|
|
411
|
+
*
|
|
412
|
+
* @param {PaymentTermTerminateRequest} terminateData - Payment term termination data
|
|
413
|
+
* @param {string} terminateData.term_reference_id - Reference ID of the term to terminate
|
|
414
|
+
* @param {string} [terminateData.reason] - Optional reason for termination
|
|
415
|
+
*
|
|
416
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to terminated term details
|
|
417
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
418
|
+
* @throws {TapsilatError} When API returns an error response
|
|
419
|
+
*/
|
|
420
|
+
terminateOrderTerm(terminateData: PaymentTermTerminateRequest): Promise<PaymentTermResponse>;
|
|
421
|
+
/**
|
|
422
|
+
* Terminates an entire order
|
|
423
|
+
*
|
|
424
|
+
* @summary Terminate order
|
|
425
|
+
* @description
|
|
426
|
+
* Terminates an entire order, canceling all associated payment terms and
|
|
427
|
+
* preventing any further payment processing. This is a more comprehensive
|
|
428
|
+
* action than canceling individual payment terms.
|
|
429
|
+
*
|
|
430
|
+
* @param {OrderTerminateRequest} terminateData - Order termination data
|
|
431
|
+
* @param {string} terminateData.reference_id - Reference ID of the order to terminate
|
|
432
|
+
* @param {string} [terminateData.reason] - Optional reason for termination
|
|
433
|
+
*
|
|
434
|
+
* @returns {Promise<OrderTerminateResponse>} Promise resolving to terminated order details
|
|
435
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
436
|
+
* @throws {TapsilatError} When API returns an error response
|
|
437
|
+
*/
|
|
438
|
+
terminateOrder(terminateData: OrderTerminateRequest): Promise<OrderTerminateResponse>;
|
|
321
439
|
}
|
|
322
440
|
//# sourceMappingURL=TapsilatSDK.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TapsilatSDK.d.ts","sourceRoot":"","sources":["../src/TapsilatSDK.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"T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;;;;;;;;;;;;;;;OAqBG;IACG,eAAe,CACnB,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,mBAAmB,CAAC;IAyD/B;;;;;;;;;;;;;;OAcG;IACG,eAAe,CACnB,UAAU,EAAE,wBAAwB,GACnC,OAAO,CAAC,mBAAmB,CAAC;IAsB/B;;;;;;;;;;;;;;;;;OAiBG;IACG,eAAe,CACnB,UAAU,EAAE,sBAAsB,GACjC,OAAO,CAAC,yBAAyB,CAAC;IAmCrC;;;;;;;;;;;;;;;OAeG;IACG,kBAAkB,CACtB,aAAa,EAAE,2BAA2B,GACzC,OAAO,CAAC,mBAAmB,CAAC;IAsB/B;;;;;;;;;;;;;;;;OAgBG;IACG,cAAc,CAClB,aAAa,EAAE,qBAAqB,GACnC,OAAO,CAAC,sBAAsB,CAAC;CAqBnC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class HttpClient {
|
|
2
|
+
post: jest.Mock<any, any, any>;
|
|
3
|
+
get: jest.Mock<any, any, any>;
|
|
4
|
+
put: jest.Mock<any, any, any>;
|
|
5
|
+
delete: jest.Mock<any, any, any>;
|
|
6
|
+
patch: jest.Mock<any, any, any>;
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=HttpClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/__mocks__/HttpClient.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACd,IAAI,2BAAa;IACjB,GAAG,2BAAa;IAChB,GAAG,2BAAa;IAChB,MAAM,2BAAa;IACnB,KAAK,2BAAa;;CAS1B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -625,6 +625,104 @@ interface OrderResponse {
|
|
|
625
625
|
checkout_url: string;
|
|
626
626
|
order_id?: string;
|
|
627
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* @category Payment Terms
|
|
630
|
+
* @summary Response data from payment term operations
|
|
631
|
+
* @description Standard response structure for payment term API operations
|
|
632
|
+
* @interface PaymentTermResponse
|
|
633
|
+
*/
|
|
634
|
+
interface PaymentTermResponse {
|
|
635
|
+
term_reference_id: string;
|
|
636
|
+
order_id: string;
|
|
637
|
+
amount: number;
|
|
638
|
+
due_date: string;
|
|
639
|
+
status: string;
|
|
640
|
+
term_sequence: number;
|
|
641
|
+
required: boolean;
|
|
642
|
+
created_at: string;
|
|
643
|
+
updated_at?: string;
|
|
644
|
+
paid_date?: string;
|
|
645
|
+
data?: string;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* @category Payment Terms
|
|
649
|
+
* @summary Request data for deleting a payment term
|
|
650
|
+
* @description Contains the identifier needed to delete a specific payment term
|
|
651
|
+
* @interface PaymentTermDeleteRequest
|
|
652
|
+
*/
|
|
653
|
+
interface PaymentTermDeleteRequest {
|
|
654
|
+
term_reference_id: string;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* @category Payment Terms
|
|
658
|
+
* @summary Response from payment term refund operation
|
|
659
|
+
* @description Contains details about a processed payment term refund
|
|
660
|
+
* @interface PaymentTermRefundResponse
|
|
661
|
+
*/
|
|
662
|
+
interface PaymentTermRefundResponse {
|
|
663
|
+
refund_id: string;
|
|
664
|
+
term_reference_id: string;
|
|
665
|
+
amount: number;
|
|
666
|
+
status: string;
|
|
667
|
+
created_at: string;
|
|
668
|
+
refund_reference_id?: string;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* @category Payment Terms
|
|
672
|
+
* @summary Request to terminate a payment term
|
|
673
|
+
* @description Data required to terminate an active payment term
|
|
674
|
+
* @interface PaymentTermTerminateRequest
|
|
675
|
+
*/
|
|
676
|
+
interface PaymentTermTerminateRequest {
|
|
677
|
+
term_reference_id: string;
|
|
678
|
+
reason?: string;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* @category Order Management
|
|
682
|
+
* @summary Request to terminate an order
|
|
683
|
+
* @description Data required to terminate an active order
|
|
684
|
+
* @interface OrderTerminateRequest
|
|
685
|
+
*/
|
|
686
|
+
interface OrderTerminateRequest {
|
|
687
|
+
reference_id: string;
|
|
688
|
+
reason?: string;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* @category Order Management
|
|
692
|
+
* @summary Response from order termination
|
|
693
|
+
* @description Contains details about a terminated order
|
|
694
|
+
* @interface OrderTerminateResponse
|
|
695
|
+
*/
|
|
696
|
+
interface OrderTerminateResponse {
|
|
697
|
+
reference_id: string;
|
|
698
|
+
status: string;
|
|
699
|
+
terminated_at: string;
|
|
700
|
+
reason?: string;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* @category Validation
|
|
704
|
+
* @summary GSM number validation result
|
|
705
|
+
* @description Contains the validation result and cleaned phone number
|
|
706
|
+
* @interface GsmValidationResult
|
|
707
|
+
*/
|
|
708
|
+
interface GsmValidationResult {
|
|
709
|
+
isValid: boolean;
|
|
710
|
+
cleanedNumber?: string;
|
|
711
|
+
error?: string;
|
|
712
|
+
originalNumber: string;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* @category Validation
|
|
716
|
+
* @summary Installments validation result
|
|
717
|
+
* @description Contains the validation result for installment values
|
|
718
|
+
* @interface InstallmentsValidationResult
|
|
719
|
+
*/
|
|
720
|
+
interface InstallmentsValidationResult {
|
|
721
|
+
isValid: boolean;
|
|
722
|
+
validatedInstallments: number[];
|
|
723
|
+
error?: string;
|
|
724
|
+
originalInput: string | number | number[];
|
|
725
|
+
}
|
|
628
726
|
|
|
629
727
|
/**
|
|
630
728
|
* @category Configuration
|
|
@@ -1021,6 +1119,124 @@ declare class TapsilatSDK {
|
|
|
1021
1119
|
* @returns ConfigManager instance for configuration operations
|
|
1022
1120
|
*/
|
|
1023
1121
|
getConfigManager(): ConfigManager;
|
|
1122
|
+
/**
|
|
1123
|
+
* Creates a new payment term for an existing order
|
|
1124
|
+
*
|
|
1125
|
+
* @summary Create payment term for installment or partial payment
|
|
1126
|
+
* @description
|
|
1127
|
+
* Creates a new payment term for an existing order, enabling installment payments
|
|
1128
|
+
* or partial payment collection. Payment terms allow splitting order amounts
|
|
1129
|
+
* across multiple payments with specific due dates and requirements.
|
|
1130
|
+
*
|
|
1131
|
+
* @param {OrderPaymentTermCreateDTO} termData - Payment term creation data
|
|
1132
|
+
* @param {string} termData.order_id - Reference ID of the existing order
|
|
1133
|
+
* @param {string} termData.term_reference_id - Unique identifier for this payment term
|
|
1134
|
+
* @param {number} termData.amount - Amount for this payment term
|
|
1135
|
+
* @param {string} termData.due_date - Due date for this payment (ISO 8601 format)
|
|
1136
|
+
* @param {number} termData.term_sequence - Sequence number for this term
|
|
1137
|
+
* @param {boolean} termData.required - Whether this payment term is required
|
|
1138
|
+
* @param {string} termData.status - Initial status of the payment term
|
|
1139
|
+
* @param {string} [termData.data] - Additional metadata for the term
|
|
1140
|
+
* @param {string} [termData.paid_date] - Date when payment was completed
|
|
1141
|
+
*
|
|
1142
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to created payment term details
|
|
1143
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1144
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1145
|
+
*/
|
|
1146
|
+
createOrderTerm(termData: OrderPaymentTermCreateDTO): Promise<PaymentTermResponse>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Updates an existing payment term
|
|
1149
|
+
*
|
|
1150
|
+
* @summary Update payment term details
|
|
1151
|
+
* @description
|
|
1152
|
+
* Updates an existing payment term with new information such as amount,
|
|
1153
|
+
* due date, status, or other metadata. This allows for flexible management
|
|
1154
|
+
* of installment payments and payment schedules.
|
|
1155
|
+
*
|
|
1156
|
+
* @param {OrderPaymentTermUpdateDTO} updateData - Payment term update data
|
|
1157
|
+
* @param {string} updateData.term_reference_id - Reference ID of the term to update
|
|
1158
|
+
* @param {number} [updateData.amount] - New amount for the payment term
|
|
1159
|
+
* @param {string} [updateData.due_date] - New due date (ISO 8601 format)
|
|
1160
|
+
* @param {string} [updateData.paid_date] - Date when payment was completed
|
|
1161
|
+
* @param {boolean} [updateData.required] - Whether this payment term is required
|
|
1162
|
+
* @param {string} [updateData.status] - New status of the payment term
|
|
1163
|
+
* @param {number} [updateData.term_sequence] - New sequence number
|
|
1164
|
+
*
|
|
1165
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to updated payment term details
|
|
1166
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1167
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1168
|
+
*/
|
|
1169
|
+
updateOrderTerm(updateData: OrderPaymentTermUpdateDTO): Promise<PaymentTermResponse>;
|
|
1170
|
+
/**
|
|
1171
|
+
* Deletes a payment term
|
|
1172
|
+
*
|
|
1173
|
+
* @summary Delete payment term
|
|
1174
|
+
* @description
|
|
1175
|
+
* Permanently deletes a payment term from an order. This action cannot be undone.
|
|
1176
|
+
* Only unpaid payment terms can be deleted.
|
|
1177
|
+
*
|
|
1178
|
+
* @param {PaymentTermDeleteRequest} deleteData - Payment term deletion data
|
|
1179
|
+
* @param {string} deleteData.term_reference_id - Reference ID of the term to delete
|
|
1180
|
+
*
|
|
1181
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to deleted payment term details
|
|
1182
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1183
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1184
|
+
*/
|
|
1185
|
+
deleteOrderTerm(deleteData: PaymentTermDeleteRequest): Promise<PaymentTermResponse>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Refunds a specific payment term
|
|
1188
|
+
*
|
|
1189
|
+
* @summary Refund payment term
|
|
1190
|
+
* @description
|
|
1191
|
+
* Processes a refund for a specific payment term. This allows partial refunds
|
|
1192
|
+
* at the payment term level rather than the entire order level.
|
|
1193
|
+
*
|
|
1194
|
+
* @param {OrderTermRefundRequest} refundData - Payment term refund data
|
|
1195
|
+
* @param {string} refundData.term_id - ID of the term to refund
|
|
1196
|
+
* @param {number} refundData.amount - Amount to refund
|
|
1197
|
+
* @param {string} [refundData.reference_id] - Optional reference ID
|
|
1198
|
+
* @param {string} [refundData.term_payment_id] - Optional term payment ID
|
|
1199
|
+
*
|
|
1200
|
+
* @returns {Promise<PaymentTermRefundResponse>} Promise resolving to refund details
|
|
1201
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1202
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1203
|
+
*/
|
|
1204
|
+
refundOrderTerm(refundData: OrderTermRefundRequest): Promise<PaymentTermRefundResponse>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Terminates a payment term
|
|
1207
|
+
*
|
|
1208
|
+
* @summary Terminate payment term
|
|
1209
|
+
* @description
|
|
1210
|
+
* Terminates an active payment term, preventing further payments.
|
|
1211
|
+
* This is useful for canceling installment plans or payment schedules.
|
|
1212
|
+
*
|
|
1213
|
+
* @param {PaymentTermTerminateRequest} terminateData - Payment term termination data
|
|
1214
|
+
* @param {string} terminateData.term_reference_id - Reference ID of the term to terminate
|
|
1215
|
+
* @param {string} [terminateData.reason] - Optional reason for termination
|
|
1216
|
+
*
|
|
1217
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to terminated term details
|
|
1218
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1219
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1220
|
+
*/
|
|
1221
|
+
terminateOrderTerm(terminateData: PaymentTermTerminateRequest): Promise<PaymentTermResponse>;
|
|
1222
|
+
/**
|
|
1223
|
+
* Terminates an entire order
|
|
1224
|
+
*
|
|
1225
|
+
* @summary Terminate order
|
|
1226
|
+
* @description
|
|
1227
|
+
* Terminates an entire order, canceling all associated payment terms and
|
|
1228
|
+
* preventing any further payment processing. This is a more comprehensive
|
|
1229
|
+
* action than canceling individual payment terms.
|
|
1230
|
+
*
|
|
1231
|
+
* @param {OrderTerminateRequest} terminateData - Order termination data
|
|
1232
|
+
* @param {string} terminateData.reference_id - Reference ID of the order to terminate
|
|
1233
|
+
* @param {string} [terminateData.reason] - Optional reason for termination
|
|
1234
|
+
*
|
|
1235
|
+
* @returns {Promise<OrderTerminateResponse>} Promise resolving to terminated order details
|
|
1236
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1237
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1238
|
+
*/
|
|
1239
|
+
terminateOrder(terminateData: OrderTerminateRequest): Promise<OrderTerminateResponse>;
|
|
1024
1240
|
}
|
|
1025
1241
|
|
|
1026
1242
|
/**
|
|
@@ -1188,6 +1404,44 @@ declare function isValidUrl(url: string): boolean;
|
|
|
1188
1404
|
* @returns Sanitized metadata object
|
|
1189
1405
|
*/
|
|
1190
1406
|
declare function sanitizeMetadata(metadata: Record<string, unknown>): Record<string, unknown>;
|
|
1407
|
+
/**
|
|
1408
|
+
* Validates and cleans GSM phone numbers
|
|
1409
|
+
*
|
|
1410
|
+
* @summary Validates and cleans Turkish GSM phone numbers
|
|
1411
|
+
* @description
|
|
1412
|
+
* Supports multiple phone number formats including international (+90), national (0),
|
|
1413
|
+
* and local formats. Automatically removes formatting characters and validates
|
|
1414
|
+
* against Turkish mobile number patterns.
|
|
1415
|
+
*
|
|
1416
|
+
* Supported formats:
|
|
1417
|
+
* - +90 5XX XXX XX XX
|
|
1418
|
+
* - 0 5XX XXX XX XX
|
|
1419
|
+
* - 5XX XXX XX XX
|
|
1420
|
+
* - Various formatting with spaces, dashes, parentheses
|
|
1421
|
+
*
|
|
1422
|
+
* @param {string | number} gsmNumber - GSM number to validate and clean
|
|
1423
|
+
* @returns {GsmValidationResult} Validation result with cleaned number or error
|
|
1424
|
+
*/
|
|
1425
|
+
declare function validateGsmNumber(gsmNumber: string | number): GsmValidationResult;
|
|
1426
|
+
/**
|
|
1427
|
+
* Validates installment values and converts to standardized format
|
|
1428
|
+
*
|
|
1429
|
+
* @summary Validates installment values and converts to standardized format
|
|
1430
|
+
* @description
|
|
1431
|
+
* Handles various input formats (string, number, array) and validates against
|
|
1432
|
+
* business rules. Converts single installment values to arrays and validates
|
|
1433
|
+
* that installment numbers are within acceptable ranges.
|
|
1434
|
+
*
|
|
1435
|
+
* Supported inputs:
|
|
1436
|
+
* - Single number: 3 -> [3]
|
|
1437
|
+
* - Comma-separated string: "1,3,6" -> [1,3,6]
|
|
1438
|
+
* - Array of numbers: [1,3,6,12] -> [1,3,6,12]
|
|
1439
|
+
* - Empty/null values default to [1]
|
|
1440
|
+
*
|
|
1441
|
+
* @param {string | number | number[]} installments - Installment values to validate
|
|
1442
|
+
* @returns {InstallmentsValidationResult} Validation result with standardized array
|
|
1443
|
+
*/
|
|
1444
|
+
declare function validateInstallments(installments: string | number | number[]): InstallmentsValidationResult;
|
|
1191
1445
|
|
|
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 };
|
|
1446
|
+
export { ConfigManager, TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validateGsmNumber, validateInstallments, validatePaymentRequest };
|
|
1447
|
+
export type { APIError, APIResponse, Address, BasketItemDTO, BasketItemPayerDTO, BillingAddressDTO, Buyer, BuyerDTO, CheckoutDesignDTO, Currency, Customer, GsmValidationResult, InstallmentsValidationResult, Locale, MetadataDTO, Order, OrderCardDTO, OrderCreateDTO, OrderCreateRequest, OrderCreateResponse, OrderPFSubMerchantDTO, OrderPaymentDetail, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderRefundRequest, OrderRefundResponse, OrderResponse, OrderStatusResponse, OrderTermRefundRequest, OrderTerminateRequest, OrderTerminateResponse, PaginatedResponse, PaginationParams, PaymentMethod, PaymentRequest, PaymentResponse, PaymentStatus, PaymentTermDTO, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermResponse, PaymentTermTerminateRequest, RefundOrderDTO, RefundRequest, RefundResponse, ShippingAddressDTO, SubOrganizationDTO, SubmerchantDTO, TapsilatConfig, WebhookEvent };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,YAAY,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,OAAO,EACP,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,YAAY,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,OAAO,EACP,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC"}
|