@tapsilat/tapsilat-js 1.0.7 → 2025.11.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 -0
- package/dist/TapsilatSDK.d.ts +148 -34
- 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/http/HttpClient.d.ts.map +1 -1
- package/dist/index.d.ts +356 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +486 -52
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +487 -51
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +169 -16
- 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 +16 -17
package/dist/index.d.ts
CHANGED
|
@@ -94,12 +94,51 @@ interface Customer {
|
|
|
94
94
|
* @interface Address
|
|
95
95
|
*/
|
|
96
96
|
interface Address {
|
|
97
|
-
|
|
97
|
+
address: string;
|
|
98
98
|
city: string;
|
|
99
|
-
|
|
100
|
-
postalCode: string;
|
|
99
|
+
contact_name: string;
|
|
101
100
|
country: string;
|
|
101
|
+
zip_code: string;
|
|
102
|
+
district?: string;
|
|
103
|
+
contact_phone?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @category Customer Data
|
|
107
|
+
* @summary Billing address with tax information
|
|
108
|
+
* @description Extended address structure for billing with tax and company details
|
|
109
|
+
* @interface BillingAddress
|
|
110
|
+
*/
|
|
111
|
+
interface BillingAddress extends Address {
|
|
112
|
+
billing_type: 'PERSONAL' | 'CORPORATE';
|
|
113
|
+
vat_number?: string;
|
|
114
|
+
tax_office?: string;
|
|
115
|
+
title?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @category Order Management
|
|
119
|
+
* @summary Item in the order basket
|
|
120
|
+
* @description Represents a product or service in the order with pricing and categorization
|
|
121
|
+
* @interface BasketItem
|
|
122
|
+
*/
|
|
123
|
+
interface BasketItem {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
category1: string;
|
|
127
|
+
category2?: string;
|
|
128
|
+
item_type: string;
|
|
129
|
+
price: number;
|
|
130
|
+
quantity: number;
|
|
131
|
+
coupon_discount?: number;
|
|
132
|
+
data?: string;
|
|
133
|
+
quantity_unit?: string;
|
|
102
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* @category Payment Processing
|
|
137
|
+
* @summary Available payment options for customers
|
|
138
|
+
* @description Different payment methods that can be enabled for an order
|
|
139
|
+
* @typedef {string} PaymentOption
|
|
140
|
+
*/
|
|
141
|
+
type PaymentOption = 'PAY_WITH_WALLET' | 'PAY_WITH_CARD' | 'PAY_WITH_LOAN' | 'PAY_WITH_CASH' | 'PAY_WITH_BANK';
|
|
103
142
|
/**
|
|
104
143
|
* @category Refunds
|
|
105
144
|
* @summary Information needed to process a refund
|
|
@@ -206,13 +245,19 @@ type Locale = "tr" | "en";
|
|
|
206
245
|
* @interface Buyer
|
|
207
246
|
*/
|
|
208
247
|
interface Buyer {
|
|
248
|
+
id?: string;
|
|
209
249
|
name: string;
|
|
210
250
|
surname: string;
|
|
211
251
|
email: string;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
252
|
+
gsm_number?: string;
|
|
253
|
+
identity_number?: string;
|
|
254
|
+
registration_address?: string;
|
|
255
|
+
city?: string;
|
|
256
|
+
country?: string;
|
|
257
|
+
zip_code?: string;
|
|
258
|
+
ip?: string;
|
|
259
|
+
registration_date?: string;
|
|
260
|
+
last_login_date?: string;
|
|
216
261
|
}
|
|
217
262
|
/**
|
|
218
263
|
* @category Order Management
|
|
@@ -222,12 +267,21 @@ interface Buyer {
|
|
|
222
267
|
*/
|
|
223
268
|
interface OrderCreateRequest {
|
|
224
269
|
amount: number;
|
|
225
|
-
|
|
270
|
+
tax_amount?: number;
|
|
226
271
|
locale: Locale;
|
|
272
|
+
three_d_force?: boolean;
|
|
273
|
+
currency: Currency;
|
|
274
|
+
shipping_address?: Address;
|
|
275
|
+
basket_items: BasketItem[];
|
|
276
|
+
billing_address: BillingAddress;
|
|
227
277
|
buyer: Buyer;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
278
|
+
conversation_id?: string;
|
|
279
|
+
partial_payment?: boolean;
|
|
280
|
+
payment_methods?: boolean;
|
|
281
|
+
payment_options?: PaymentOption[];
|
|
282
|
+
payment_success_url?: string;
|
|
283
|
+
payment_failure_url?: string;
|
|
284
|
+
enabled_installments?: number[];
|
|
231
285
|
metadata?: Record<string, unknown>;
|
|
232
286
|
}
|
|
233
287
|
/**
|
|
@@ -237,11 +291,12 @@ interface OrderCreateRequest {
|
|
|
237
291
|
* @interface OrderCreateResponse
|
|
238
292
|
*/
|
|
239
293
|
interface OrderCreateResponse {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
294
|
+
order_id: string;
|
|
295
|
+
reference_id: string;
|
|
296
|
+
checkout_url?: string;
|
|
297
|
+
conversation_id?: string;
|
|
298
|
+
status?: string;
|
|
299
|
+
qr_code_url?: string;
|
|
245
300
|
}
|
|
246
301
|
/**
|
|
247
302
|
* @category Order Management
|
|
@@ -625,6 +680,104 @@ interface OrderResponse {
|
|
|
625
680
|
checkout_url: string;
|
|
626
681
|
order_id?: string;
|
|
627
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* @category Payment Terms
|
|
685
|
+
* @summary Response data from payment term operations
|
|
686
|
+
* @description Standard response structure for payment term API operations
|
|
687
|
+
* @interface PaymentTermResponse
|
|
688
|
+
*/
|
|
689
|
+
interface PaymentTermResponse {
|
|
690
|
+
term_reference_id: string;
|
|
691
|
+
order_id: string;
|
|
692
|
+
amount: number;
|
|
693
|
+
due_date: string;
|
|
694
|
+
status: string;
|
|
695
|
+
term_sequence: number;
|
|
696
|
+
required: boolean;
|
|
697
|
+
created_at: string;
|
|
698
|
+
updated_at?: string;
|
|
699
|
+
paid_date?: string;
|
|
700
|
+
data?: string;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* @category Payment Terms
|
|
704
|
+
* @summary Request data for deleting a payment term
|
|
705
|
+
* @description Contains the identifier needed to delete a specific payment term
|
|
706
|
+
* @interface PaymentTermDeleteRequest
|
|
707
|
+
*/
|
|
708
|
+
interface PaymentTermDeleteRequest {
|
|
709
|
+
term_reference_id: string;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* @category Payment Terms
|
|
713
|
+
* @summary Response from payment term refund operation
|
|
714
|
+
* @description Contains details about a processed payment term refund
|
|
715
|
+
* @interface PaymentTermRefundResponse
|
|
716
|
+
*/
|
|
717
|
+
interface PaymentTermRefundResponse {
|
|
718
|
+
refund_id: string;
|
|
719
|
+
term_reference_id: string;
|
|
720
|
+
amount: number;
|
|
721
|
+
status: string;
|
|
722
|
+
created_at: string;
|
|
723
|
+
refund_reference_id?: string;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* @category Payment Terms
|
|
727
|
+
* @summary Request to terminate a payment term
|
|
728
|
+
* @description Data required to terminate an active payment term
|
|
729
|
+
* @interface PaymentTermTerminateRequest
|
|
730
|
+
*/
|
|
731
|
+
interface PaymentTermTerminateRequest {
|
|
732
|
+
term_reference_id: string;
|
|
733
|
+
reason?: string;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* @category Order Management
|
|
737
|
+
* @summary Request to terminate an order
|
|
738
|
+
* @description Data required to terminate an active order
|
|
739
|
+
* @interface OrderTerminateRequest
|
|
740
|
+
*/
|
|
741
|
+
interface OrderTerminateRequest {
|
|
742
|
+
reference_id: string;
|
|
743
|
+
reason?: string;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* @category Order Management
|
|
747
|
+
* @summary Response from order termination
|
|
748
|
+
* @description Contains details about a terminated order
|
|
749
|
+
* @interface OrderTerminateResponse
|
|
750
|
+
*/
|
|
751
|
+
interface OrderTerminateResponse {
|
|
752
|
+
reference_id: string;
|
|
753
|
+
status: string;
|
|
754
|
+
terminated_at: string;
|
|
755
|
+
reason?: string;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* @category Validation
|
|
759
|
+
* @summary GSM number validation result
|
|
760
|
+
* @description Contains the validation result and cleaned phone number
|
|
761
|
+
* @interface GsmValidationResult
|
|
762
|
+
*/
|
|
763
|
+
interface GsmValidationResult {
|
|
764
|
+
isValid: boolean;
|
|
765
|
+
cleanedNumber?: string;
|
|
766
|
+
error?: string;
|
|
767
|
+
originalNumber: string;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* @category Validation
|
|
771
|
+
* @summary Installments validation result
|
|
772
|
+
* @description Contains the validation result for installment values
|
|
773
|
+
* @interface InstallmentsValidationResult
|
|
774
|
+
*/
|
|
775
|
+
interface InstallmentsValidationResult {
|
|
776
|
+
isValid: boolean;
|
|
777
|
+
validatedInstallments: number[];
|
|
778
|
+
error?: string;
|
|
779
|
+
originalInput: string | number | number[];
|
|
780
|
+
}
|
|
628
781
|
|
|
629
782
|
/**
|
|
630
783
|
* @category Configuration
|
|
@@ -737,7 +890,7 @@ declare class TapsilatSDK {
|
|
|
737
890
|
*
|
|
738
891
|
* @param {TapsilatConfig} config - SDK configuration options
|
|
739
892
|
* @param {string} config.bearerToken - API authentication token (required)
|
|
740
|
-
* @param {string} [config.baseURL='https://
|
|
893
|
+
* @param {string} [config.baseURL='https://panel.tapsilat.dev/v1'] - API base URL
|
|
741
894
|
* @param {number} [config.timeout=30000] - Request timeout in milliseconds
|
|
742
895
|
* @param {number} [config.maxRetries=3] - Maximum number of retry attempts
|
|
743
896
|
* @param {number} [config.retryDelay=1000] - Delay between retries in milliseconds
|
|
@@ -751,57 +904,53 @@ declare class TapsilatSDK {
|
|
|
751
904
|
/**
|
|
752
905
|
* Creates a new order and returns a checkout URL
|
|
753
906
|
*
|
|
754
|
-
* @summary Initiates a new payment order with
|
|
907
|
+
* @summary Initiates a new payment order with comprehensive order details
|
|
755
908
|
* @description
|
|
756
909
|
* Creates a new payment order in the Tapsilat system with the provided order details.
|
|
757
910
|
* This method performs comprehensive validation of all input parameters, creates the order
|
|
758
|
-
* on the payment platform, and returns
|
|
759
|
-
*
|
|
760
|
-
* buyer information for compliance and fraud prevention.
|
|
911
|
+
* on the payment platform, and returns order identifiers including reference_id and order_id.
|
|
912
|
+
* The method supports multiple currencies, locales, payment options, basket items,
|
|
913
|
+
* and comprehensive buyer information for compliance and fraud prevention.
|
|
761
914
|
*
|
|
762
|
-
* The returned
|
|
763
|
-
*
|
|
764
|
-
* returned reference ID through the getOrderStatus method.
|
|
915
|
+
* The returned order_id and reference_id can be used to track order status through
|
|
916
|
+
* the getOrderStatus method.
|
|
765
917
|
*
|
|
766
918
|
* @param {OrderCreateRequest} orderRequest - Complete order information
|
|
767
919
|
* @param {number} orderRequest.amount - Payment amount (must be positive, max 2 decimal places)
|
|
920
|
+
* @param {number} [orderRequest.tax_amount] - Tax amount included in total
|
|
768
921
|
* @param {Currency} orderRequest.currency - Payment currency ('TRY', 'USD', 'EUR', 'GBP')
|
|
769
922
|
* @param {Locale} orderRequest.locale - Display language ('tr' for Turkish, 'en' for English)
|
|
923
|
+
* @param {boolean} [orderRequest.three_d_force] - Force 3D Secure authentication
|
|
924
|
+
* @param {Address} [orderRequest.shipping_address] - Shipping address for delivery
|
|
925
|
+
* @param {BasketItem[]} orderRequest.basket_items - Array of items in the order
|
|
926
|
+
* @param {BillingAddress} orderRequest.billing_address - Billing address with tax information
|
|
770
927
|
* @param {Buyer} orderRequest.buyer - Customer information for payment processing
|
|
771
|
-
* @param {string} orderRequest.
|
|
772
|
-
* @param {
|
|
773
|
-
* @param {
|
|
774
|
-
* @param {
|
|
775
|
-
* @param {string} [orderRequest.
|
|
776
|
-
* @param {
|
|
777
|
-
* @param {
|
|
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
|
|
928
|
+
* @param {string} [orderRequest.conversation_id] - Custom tracking ID for your system
|
|
929
|
+
* @param {boolean} [orderRequest.partial_payment] - Enable partial payment
|
|
930
|
+
* @param {boolean} [orderRequest.payment_methods] - Enable payment method selection
|
|
931
|
+
* @param {PaymentOption[]} [orderRequest.payment_options] - Available payment options
|
|
932
|
+
* @param {string} [orderRequest.payment_success_url] - URL to redirect after successful payment
|
|
933
|
+
* @param {string} [orderRequest.payment_failure_url] - URL to redirect after failed payment
|
|
934
|
+
* @param {number[]} [orderRequest.enabled_installments] - Allowed installment counts
|
|
781
935
|
* @param {Record<string, unknown>} [orderRequest.metadata] - Additional custom data
|
|
782
936
|
*
|
|
783
937
|
* @returns {Promise<OrderCreateResponse>} Promise resolving to order creation response
|
|
784
|
-
* @returns {string} OrderCreateResponse.
|
|
785
|
-
* @returns {string} OrderCreateResponse.
|
|
786
|
-
* @returns {string} OrderCreateResponse.
|
|
787
|
-
* @returns {string} OrderCreateResponse.
|
|
788
|
-
* @returns {string} [OrderCreateResponse.
|
|
938
|
+
* @returns {string} OrderCreateResponse.order_id - Internal order identifier
|
|
939
|
+
* @returns {string} OrderCreateResponse.reference_id - Unique order reference for tracking
|
|
940
|
+
* @returns {string} [OrderCreateResponse.checkout_url] - Payment page URL for customer
|
|
941
|
+
* @returns {string} [OrderCreateResponse.conversation_id] - Echo of provided conversation ID
|
|
942
|
+
* @returns {string} [OrderCreateResponse.status] - Initial order status
|
|
943
|
+
* @returns {string} [OrderCreateResponse.qr_code_url] - QR code URL for mobile payments
|
|
789
944
|
*
|
|
790
945
|
* @throws {TapsilatValidationError} When input validation fails:
|
|
791
946
|
* - Amount is not positive or has more than 2 decimal places
|
|
792
947
|
* - Currency is not supported
|
|
793
948
|
* - Buyer information is incomplete or invalid
|
|
794
|
-
* -
|
|
949
|
+
* - Basket items are missing or invalid
|
|
950
|
+
* - Billing address is missing
|
|
795
951
|
* - Required fields are missing
|
|
796
|
-
* @throws {TapsilatNetworkError} When network request fails
|
|
797
|
-
*
|
|
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
|
|
952
|
+
* @throws {TapsilatNetworkError} When network request fails
|
|
953
|
+
* @throws {TapsilatError} When API returns business logic errors
|
|
805
954
|
*/
|
|
806
955
|
createOrder(orderRequest: OrderCreateRequest): Promise<OrderCreateResponse>;
|
|
807
956
|
/**
|
|
@@ -1021,6 +1170,124 @@ declare class TapsilatSDK {
|
|
|
1021
1170
|
* @returns ConfigManager instance for configuration operations
|
|
1022
1171
|
*/
|
|
1023
1172
|
getConfigManager(): ConfigManager;
|
|
1173
|
+
/**
|
|
1174
|
+
* Creates a new payment term for an existing order
|
|
1175
|
+
*
|
|
1176
|
+
* @summary Create payment term for installment or partial payment
|
|
1177
|
+
* @description
|
|
1178
|
+
* Creates a new payment term for an existing order, enabling installment payments
|
|
1179
|
+
* or partial payment collection. Payment terms allow splitting order amounts
|
|
1180
|
+
* across multiple payments with specific due dates and requirements.
|
|
1181
|
+
*
|
|
1182
|
+
* @param {OrderPaymentTermCreateDTO} termData - Payment term creation data
|
|
1183
|
+
* @param {string} termData.order_id - Reference ID of the existing order
|
|
1184
|
+
* @param {string} termData.term_reference_id - Unique identifier for this payment term
|
|
1185
|
+
* @param {number} termData.amount - Amount for this payment term
|
|
1186
|
+
* @param {string} termData.due_date - Due date for this payment (ISO 8601 format)
|
|
1187
|
+
* @param {number} termData.term_sequence - Sequence number for this term
|
|
1188
|
+
* @param {boolean} termData.required - Whether this payment term is required
|
|
1189
|
+
* @param {string} termData.status - Initial status of the payment term
|
|
1190
|
+
* @param {string} [termData.data] - Additional metadata for the term
|
|
1191
|
+
* @param {string} [termData.paid_date] - Date when payment was completed
|
|
1192
|
+
*
|
|
1193
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to created payment term details
|
|
1194
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1195
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1196
|
+
*/
|
|
1197
|
+
createOrderTerm(termData: OrderPaymentTermCreateDTO): Promise<PaymentTermResponse>;
|
|
1198
|
+
/**
|
|
1199
|
+
* Updates an existing payment term
|
|
1200
|
+
*
|
|
1201
|
+
* @summary Update payment term details
|
|
1202
|
+
* @description
|
|
1203
|
+
* Updates an existing payment term with new information such as amount,
|
|
1204
|
+
* due date, status, or other metadata. This allows for flexible management
|
|
1205
|
+
* of installment payments and payment schedules.
|
|
1206
|
+
*
|
|
1207
|
+
* @param {OrderPaymentTermUpdateDTO} updateData - Payment term update data
|
|
1208
|
+
* @param {string} updateData.term_reference_id - Reference ID of the term to update
|
|
1209
|
+
* @param {number} [updateData.amount] - New amount for the payment term
|
|
1210
|
+
* @param {string} [updateData.due_date] - New due date (ISO 8601 format)
|
|
1211
|
+
* @param {string} [updateData.paid_date] - Date when payment was completed
|
|
1212
|
+
* @param {boolean} [updateData.required] - Whether this payment term is required
|
|
1213
|
+
* @param {string} [updateData.status] - New status of the payment term
|
|
1214
|
+
* @param {number} [updateData.term_sequence] - New sequence number
|
|
1215
|
+
*
|
|
1216
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to updated payment term details
|
|
1217
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1218
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1219
|
+
*/
|
|
1220
|
+
updateOrderTerm(updateData: OrderPaymentTermUpdateDTO): Promise<PaymentTermResponse>;
|
|
1221
|
+
/**
|
|
1222
|
+
* Deletes a payment term
|
|
1223
|
+
*
|
|
1224
|
+
* @summary Delete payment term
|
|
1225
|
+
* @description
|
|
1226
|
+
* Permanently deletes a payment term from an order. This action cannot be undone.
|
|
1227
|
+
* Only unpaid payment terms can be deleted.
|
|
1228
|
+
*
|
|
1229
|
+
* @param {PaymentTermDeleteRequest} deleteData - Payment term deletion data
|
|
1230
|
+
* @param {string} deleteData.term_reference_id - Reference ID of the term to delete
|
|
1231
|
+
*
|
|
1232
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to deleted payment term details
|
|
1233
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1234
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1235
|
+
*/
|
|
1236
|
+
deleteOrderTerm(deleteData: PaymentTermDeleteRequest): Promise<PaymentTermResponse>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Refunds a specific payment term
|
|
1239
|
+
*
|
|
1240
|
+
* @summary Refund payment term
|
|
1241
|
+
* @description
|
|
1242
|
+
* Processes a refund for a specific payment term. This allows partial refunds
|
|
1243
|
+
* at the payment term level rather than the entire order level.
|
|
1244
|
+
*
|
|
1245
|
+
* @param {OrderTermRefundRequest} refundData - Payment term refund data
|
|
1246
|
+
* @param {string} refundData.term_id - ID of the term to refund
|
|
1247
|
+
* @param {number} refundData.amount - Amount to refund
|
|
1248
|
+
* @param {string} [refundData.reference_id] - Optional reference ID
|
|
1249
|
+
* @param {string} [refundData.term_payment_id] - Optional term payment ID
|
|
1250
|
+
*
|
|
1251
|
+
* @returns {Promise<PaymentTermRefundResponse>} Promise resolving to refund details
|
|
1252
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1253
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1254
|
+
*/
|
|
1255
|
+
refundOrderTerm(refundData: OrderTermRefundRequest): Promise<PaymentTermRefundResponse>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Terminates a payment term
|
|
1258
|
+
*
|
|
1259
|
+
* @summary Terminate payment term
|
|
1260
|
+
* @description
|
|
1261
|
+
* Terminates an active payment term, preventing further payments.
|
|
1262
|
+
* This is useful for canceling installment plans or payment schedules.
|
|
1263
|
+
*
|
|
1264
|
+
* @param {PaymentTermTerminateRequest} terminateData - Payment term termination data
|
|
1265
|
+
* @param {string} terminateData.term_reference_id - Reference ID of the term to terminate
|
|
1266
|
+
* @param {string} [terminateData.reason] - Optional reason for termination
|
|
1267
|
+
*
|
|
1268
|
+
* @returns {Promise<PaymentTermResponse>} Promise resolving to terminated term details
|
|
1269
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1270
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1271
|
+
*/
|
|
1272
|
+
terminateOrderTerm(terminateData: PaymentTermTerminateRequest): Promise<PaymentTermResponse>;
|
|
1273
|
+
/**
|
|
1274
|
+
* Terminates an entire order
|
|
1275
|
+
*
|
|
1276
|
+
* @summary Terminate order
|
|
1277
|
+
* @description
|
|
1278
|
+
* Terminates an entire order, canceling all associated payment terms and
|
|
1279
|
+
* preventing any further payment processing. This is a more comprehensive
|
|
1280
|
+
* action than canceling individual payment terms.
|
|
1281
|
+
*
|
|
1282
|
+
* @param {OrderTerminateRequest} terminateData - Order termination data
|
|
1283
|
+
* @param {string} terminateData.reference_id - Reference ID of the order to terminate
|
|
1284
|
+
* @param {string} [terminateData.reason] - Optional reason for termination
|
|
1285
|
+
*
|
|
1286
|
+
* @returns {Promise<OrderTerminateResponse>} Promise resolving to terminated order details
|
|
1287
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1288
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1289
|
+
*/
|
|
1290
|
+
terminateOrder(terminateData: OrderTerminateRequest): Promise<OrderTerminateResponse>;
|
|
1024
1291
|
}
|
|
1025
1292
|
|
|
1026
1293
|
/**
|
|
@@ -1188,6 +1455,44 @@ declare function isValidUrl(url: string): boolean;
|
|
|
1188
1455
|
* @returns Sanitized metadata object
|
|
1189
1456
|
*/
|
|
1190
1457
|
declare function sanitizeMetadata(metadata: Record<string, unknown>): Record<string, unknown>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Validates and cleans GSM phone numbers
|
|
1460
|
+
*
|
|
1461
|
+
* @summary Validates and cleans Turkish GSM phone numbers
|
|
1462
|
+
* @description
|
|
1463
|
+
* Supports multiple phone number formats including international (+90), national (0),
|
|
1464
|
+
* and local formats. Automatically removes formatting characters and validates
|
|
1465
|
+
* against Turkish mobile number patterns.
|
|
1466
|
+
*
|
|
1467
|
+
* Supported formats:
|
|
1468
|
+
* - +90 5XX XXX XX XX
|
|
1469
|
+
* - 0 5XX XXX XX XX
|
|
1470
|
+
* - 5XX XXX XX XX
|
|
1471
|
+
* - Various formatting with spaces, dashes, parentheses
|
|
1472
|
+
*
|
|
1473
|
+
* @param {string | number} gsmNumber - GSM number to validate and clean
|
|
1474
|
+
* @returns {GsmValidationResult} Validation result with cleaned number or error
|
|
1475
|
+
*/
|
|
1476
|
+
declare function validateGsmNumber(gsmNumber: string | number): GsmValidationResult;
|
|
1477
|
+
/**
|
|
1478
|
+
* Validates installment values and converts to standardized format
|
|
1479
|
+
*
|
|
1480
|
+
* @summary Validates installment values and converts to standardized format
|
|
1481
|
+
* @description
|
|
1482
|
+
* Handles various input formats (string, number, array) and validates against
|
|
1483
|
+
* business rules. Converts single installment values to arrays and validates
|
|
1484
|
+
* that installment numbers are within acceptable ranges.
|
|
1485
|
+
*
|
|
1486
|
+
* Supported inputs:
|
|
1487
|
+
* - Single number: 3 -> [3]
|
|
1488
|
+
* - Comma-separated string: "1,3,6" -> [1,3,6]
|
|
1489
|
+
* - Array of numbers: [1,3,6,12] -> [1,3,6,12]
|
|
1490
|
+
* - Empty/null values default to [1]
|
|
1491
|
+
*
|
|
1492
|
+
* @param {string | number | number[]} installments - Installment values to validate
|
|
1493
|
+
* @returns {InstallmentsValidationResult} Validation result with standardized array
|
|
1494
|
+
*/
|
|
1495
|
+
declare function validateInstallments(installments: string | number | number[]): InstallmentsValidationResult;
|
|
1191
1496
|
|
|
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 };
|
|
1497
|
+
export { ConfigManager, TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validateGsmNumber, validateInstallments, validatePaymentRequest };
|
|
1498
|
+
export type { APIError, APIResponse, Address, BasketItem, BasketItemDTO, BasketItemPayerDTO, BillingAddress, 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, PaymentOption, 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,cAAc,EACd,UAAU,EACV,aAAa,EACb,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"}
|