@tapsilat/tapsilat-js 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -348,7 +348,9 @@ class HttpClient {
348
348
  * Builds the complete URL for the request
349
349
  */
350
350
  buildUrl(url, customBaseURL, params) {
351
- const baseURL = customBaseURL || this.config.baseURL || "https://api.tapsilat.com/v1";
351
+ const baseURL = customBaseURL ||
352
+ this.config.baseURL ||
353
+ "https://acquiring.tapsilat.dev/api/v1";
352
354
  if (url.startsWith("http://") || url.startsWith("https://")) {
353
355
  return url;
354
356
  }
@@ -657,22 +659,62 @@ function sanitizeMetadata(metadata) {
657
659
  return sanitized;
658
660
  }
659
661
 
662
+ const isValidEmail = (email) => {
663
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
664
+ return emailRegex.test(email);
665
+ };
666
+ /**
667
+ * Generic response handler - consistent way to handle API responses
668
+ *
669
+ * @param response - The API response to process
670
+ * @param errorContext - Descriptive context for error messages
671
+ * @returns The data from a successful response
672
+ * @throws {TapsilatError} On any response error
673
+ */
674
+ const handleResponse = (response, errorContext) => {
675
+ if (!response.success || !response.data) {
676
+ // Convert API errors to domain-specific errors
677
+ if (response.error) {
678
+ throw TapsilatError.fromAPIError(response.error);
679
+ }
680
+ throw new TapsilatError(`${errorContext} failed with no error details`, "UNKNOWN_ERROR");
681
+ }
682
+ return response.data;
683
+ };
684
+ /**
685
+ * Generic error handler - consistent way to handle errors
686
+ *
687
+ * @param error - The caught error to process
688
+ * @param errorContext - Descriptive context for error messages
689
+ * @throws {TapsilatError} Always throws an appropriate error type
690
+ */
691
+ const handleError = (error, errorContext) => {
692
+ // Rethrow TapsilatErrors as-is
693
+ if (error instanceof TapsilatError) {
694
+ throw error;
695
+ }
696
+ // Convert generic errors to TapsilatNetworkError
697
+ throw new TapsilatNetworkError(error instanceof Error
698
+ ? error.message
699
+ : `Unknown error during ${errorContext}`, "NETWORK_ERROR");
700
+ };
701
+
660
702
  /**
661
703
  * Main SDK class for Tapsilat payment operations
662
704
  *
663
- * @example
664
- * ```typescript
665
- * const tapsilat = new TapsilatSDK({
666
- * bearerToken: 'your-bearer-token',
667
- * baseURL: 'https://api.tapsilat.com/v1'
668
- * });
705
+ * @summary Enterprise-grade TypeScript SDK for Tapsilat Payment Processing Platform
706
+ * @description
707
+ * The TapsilatSDK class provides a comprehensive interface for integrating with the Tapsilat payment platform.
708
+ * It offers secure, efficient, and type-safe methods for managing orders, payments, refunds, and other
709
+ * payment-related operations. The SDK includes built-in error handling, request validation, retry logic,
710
+ * and comprehensive logging capabilities.
669
711
  *
670
- * const payment = await tapsilat.createPayment({
671
- * amount: 100.50,
672
- * currency: 'TRY',
673
- * paymentMethod: 'credit_card'
674
- * });
675
- * ```
712
+ * Key features:
713
+ * - Type-safe API with TypeScript support
714
+ * - Built-in error handling with custom error types
715
+ * - Automatic request/response validation
716
+ * - Configurable retry mechanism
717
+ * - Full compliance with Tapsilat API specifications
676
718
  */
677
719
  class TapsilatSDK {
678
720
  httpClient;
@@ -680,70 +722,105 @@ class TapsilatSDK {
680
722
  /**
681
723
  * Creates a new TapsilatSDK instance
682
724
  *
683
- * @param config - SDK configuration options
684
- * @throws {TapsilatValidationError} When Bearer token is invalid
725
+ * @summary Initializes the Tapsilat SDK with configuration options
726
+ * @description
727
+ * Creates and configures a new instance of the TapsilatSDK with the provided configuration.
728
+ * The constructor validates the bearer token, sets up the HTTP client with proper headers,
729
+ * configures retry mechanisms, and initializes internal state for API communication.
730
+ *
731
+ * The SDK instance is immutable after creation - configuration cannot be changed without
732
+ * creating a new instance. This ensures thread safety and predictable behavior.
733
+ *
734
+ * @param {TapsilatConfig} config - SDK configuration options
735
+ * @param {string} config.bearerToken - API authentication token (required)
736
+ * @param {string} [config.baseURL='https://api.tapsilat.com/v1'] - API base URL
737
+ * @param {number} [config.timeout=30000] - Request timeout in milliseconds
738
+ * @param {number} [config.maxRetries=3] - Maximum number of retry attempts
739
+ * @param {number} [config.retryDelay=1000] - Delay between retries in milliseconds
740
+ * @param {string} [config.version='v1'] - API version to use
741
+ * @param {boolean} [config.debug=false] - Enable debug logging
742
+ *
743
+ * @throws {TapsilatValidationError} When bearer token is invalid, missing, or malformed
744
+ * @throws {TypeError} When config parameter is not an object or missing required fields
685
745
  */
686
746
  constructor(config) {
687
747
  validateBearerToken(config.bearerToken);
688
748
  this.config = config;
689
749
  this.httpClient = new HttpClient(config);
690
750
  }
691
- // Order Operations
751
+ // ORDER CREATION
752
+ // Summary: Create new payment order and get checkout URL
753
+ // Description: Initiates payment process with buyer info and returns secure checkout URL
692
754
  /**
693
- * Creates a new order and returns a checkout URL.
755
+ * Creates a new order and returns a checkout URL
694
756
  *
695
- * @param orderRequest - The order details including amount, currency, and buyer information
696
- * @returns Promise resolving to the created order response including reference ID and checkout URL
697
- * @throws {TapsilatValidationError} When order request data is invalid
698
- * @throws {TapsilatNetworkError} When API request fails due to network issues
699
- * @throws {TapsilatError} When API returns an error response
757
+ * @summary Initiates a new payment order with buyer information and generates checkout URL
758
+ * @description
759
+ * Creates a new payment order in the Tapsilat system with the provided order details.
760
+ * This method performs comprehensive validation of all input parameters, creates the order
761
+ * on the payment platform, and returns a checkout URL that customers can use to complete
762
+ * their payment. The method supports multiple currencies, locales, and comprehensive
763
+ * buyer information for compliance and fraud prevention.
764
+ *
765
+ * The returned checkout URL is valid for a limited time (typically 24 hours) and should
766
+ * be presented to the customer immediately. The order status can be tracked using the
767
+ * returned reference ID through the getOrderStatus method.
700
768
  *
701
- * @example
702
- * ```typescript
703
- * try {
704
- * const orderResponse = await tapsilat.createOrder({
705
- * amount: 100.50,
706
- * currency: 'TRY',
707
- * locale: 'en',
708
- * buyer: {
709
- * name: 'John',
710
- * surname: 'Doe',
711
- * email: 'john.doe@example.com'
712
- * }
713
- * });
714
- * console.log(`Checkout URL: ${orderResponse.checkoutUrl}`);
715
- * } catch (error) {
716
- * console.error(`Order creation failed: ${error.message}`);
717
- * }
718
- * ```
769
+ * @param {OrderCreateRequest} orderRequest - Complete order information
770
+ * @param {number} orderRequest.amount - Payment amount (must be positive, max 2 decimal places)
771
+ * @param {Currency} orderRequest.currency - Payment currency ('TRY', 'USD', 'EUR', 'GBP')
772
+ * @param {Locale} orderRequest.locale - Display language ('tr' for Turkish, 'en' for English)
773
+ * @param {Buyer} orderRequest.buyer - Customer information for payment processing
774
+ * @param {string} orderRequest.buyer.name - Customer's first name (required)
775
+ * @param {string} orderRequest.buyer.surname - Customer's last name (required)
776
+ * @param {string} orderRequest.buyer.email - Customer's email address (required, validated)
777
+ * @param {string} [orderRequest.buyer.phone] - Customer's phone number
778
+ * @param {string} [orderRequest.buyer.identityNumber] - National ID or tax number
779
+ * @param {Address} [orderRequest.buyer.shippingAddress] - Shipping address for physical goods
780
+ * @param {Address} [orderRequest.buyer.billingAddress] - Billing address for invoicing
781
+ * @param {string} [orderRequest.description] - Order description for customer reference
782
+ * @param {string} [orderRequest.callbackUrl] - URL to redirect after payment completion
783
+ * @param {string} [orderRequest.conversationId] - Custom tracking ID for your system
784
+ * @param {Record<string, unknown>} [orderRequest.metadata] - Additional custom data
785
+ *
786
+ * @returns {Promise<OrderCreateResponse>} Promise resolving to order creation response
787
+ * @returns {string} OrderCreateResponse.referenceId - Unique order identifier for tracking
788
+ * @returns {string} OrderCreateResponse.conversationId - Echo of provided conversation ID
789
+ * @returns {string} OrderCreateResponse.checkoutUrl - Payment page URL for customer
790
+ * @returns {string} OrderCreateResponse.status - Initial order status (typically 'CREATED')
791
+ * @returns {string} [OrderCreateResponse.qrCodeUrl] - QR code URL for mobile payments
792
+ *
793
+ * @throws {TapsilatValidationError} When input validation fails:
794
+ * - Amount is not positive or has more than 2 decimal places
795
+ * - Currency is not supported
796
+ * - Buyer information is incomplete or invalid
797
+ * - Email format is invalid
798
+ * - Required fields are missing
799
+ * @throws {TapsilatNetworkError} When network request fails:
800
+ * - Connection timeout
801
+ * - DNS resolution failure
802
+ * - Network connectivity issues
803
+ * @throws {TapsilatError} When API returns business logic errors:
804
+ * - Insufficient merchant balance
805
+ * - Currency not enabled for merchant
806
+ * - Buyer blocked due to fraud detection
807
+ * - Rate limiting exceeded
719
808
  */
720
809
  async createOrder(orderRequest) {
721
- // Validate the order request
722
- this.validateOrderRequest(orderRequest);
723
- try {
724
- // Make the API request
725
- const response = await this.httpClient.post("/order/create", orderRequest);
726
- // Use our generic response handler
727
- return this.handleResponse(response, "Order creation");
728
- }
729
- catch (error) {
730
- // Use our generic error handler
731
- this.handleError(error, "order creation");
732
- }
733
- }
734
- /**
735
- * Validates an order request object
736
- * @private
737
- */
738
- validateOrderRequest(orderRequest) {
810
+ // Validate the order request directly
739
811
  // Check if request is null/undefined
740
812
  if (!orderRequest) {
741
813
  throw new TapsilatValidationError("Order request cannot be null or undefined");
742
814
  }
743
- // Validate amount
744
- if (!isPositiveNumber(orderRequest.amount) ||
745
- !hasValidDecimalPlaces(orderRequest.amount)) {
746
- throw new TapsilatValidationError("Amount must be a positive number with maximum 2 decimal places", { provided: orderRequest.amount });
815
+ // Validate amount - check if positive
816
+ if (!isPositiveNumber(orderRequest.amount)) {
817
+ throw new TapsilatValidationError("Amount must be a positive number", {
818
+ provided: orderRequest.amount,
819
+ });
820
+ }
821
+ // Validate amount - check decimal places
822
+ if (!hasValidDecimalPlaces(orderRequest.amount)) {
823
+ throw new TapsilatValidationError("Amount must have maximum 2 decimal places", { provided: orderRequest.amount });
747
824
  }
748
825
  // Validate currency
749
826
  if (!isNonEmptyString(orderRequest.currency)) {
@@ -760,73 +837,39 @@ class TapsilatSDK {
760
837
  if (!isNonEmptyString(buyer.surname)) {
761
838
  throw new TapsilatValidationError("Buyer surname is required and must be a non-empty string", { provided: buyer.surname });
762
839
  }
763
- if (!isNonEmptyString(buyer.email) || !this.isValidEmail(buyer.email)) {
764
- throw new TapsilatValidationError("Buyer email is required and must be a valid email address", { provided: buyer.email });
840
+ // Validate buyer email - check if provided
841
+ if (!isNonEmptyString(buyer.email)) {
842
+ throw new TapsilatValidationError("Buyer email is required and must be a non-empty string", { provided: buyer.email });
765
843
  }
766
- }
767
- /**
768
- * Basic email validation
769
- * @private
770
- */
771
- isValidEmail(email) {
772
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
773
- return emailRegex.test(email);
774
- }
775
- /**
776
- * Generic response handler - consistent way to handle API responses across SDK methods
777
- * @private
778
- *
779
- * @param response - The API response to process
780
- * @param errorContext - Descriptive context for error messages
781
- * @returns The data from a successful response
782
- * @throws {TapsilatError} On any response error
783
- */
784
- handleResponse(response, errorContext) {
785
- if (!response.success || !response.data) {
786
- // Convert API errors to domain-specific errors
787
- if (response.error) {
788
- throw TapsilatError.fromAPIError(response.error);
789
- }
790
- throw new TapsilatError(`${errorContext} failed with no error details`, "UNKNOWN_ERROR");
844
+ // Validate buyer email - check format
845
+ if (!isValidEmail(buyer.email)) {
846
+ throw new TapsilatValidationError("Buyer email must be a valid email address", { provided: buyer.email });
791
847
  }
792
- return response.data;
793
- }
794
- /**
795
- * Generic error handler - consistent way to handle errors across SDK methods
796
- * @private
797
- *
798
- * @param error - The caught error to process
799
- * @param errorContext - Descriptive context for error messages
800
- * @throws {TapsilatError} Always throws an appropriate error type
801
- */
802
- handleError(error, errorContext) {
803
- // Rethrow TapsilatErrors as-is
804
- if (error instanceof TapsilatError) {
805
- throw error;
848
+ try {
849
+ // Make the API request
850
+ const response = await this.httpClient.post("/order/create", orderRequest);
851
+ // Use our generic response handler
852
+ return handleResponse(response, "Order creation");
853
+ }
854
+ catch (error) {
855
+ // Use our generic error handler
856
+ return handleError(error, "order creation");
806
857
  }
807
- // Convert generic errors to TapsilatNetworkError
808
- throw new TapsilatNetworkError(error instanceof Error
809
- ? error.message
810
- : `Unknown error during ${errorContext}`, "NETWORK_ERROR");
811
858
  }
859
+ // ORDER RETRIEVAL BY REFERENCE ID
860
+ // Summary: Get complete order details and information
861
+ // Description: Retrieves full order data including buyer info, amounts, and current status
812
862
  /**
813
863
  * Gets an order by reference ID.
814
864
  *
865
+ * @summary Retrieve complete order details and information
866
+ * @description Gets complete order data including buyer info, amounts, and current status using the unique reference ID.
867
+ *
815
868
  * @param referenceId - The unique reference ID of the order
816
869
  * @returns Promise resolving to the complete order details
817
870
  * @throws {TapsilatValidationError} When referenceId is invalid
818
871
  * @throws {TapsilatNetworkError} When API request fails due to network issues
819
872
  * @throws {TapsilatError} When API returns an error response
820
- *
821
- * @example
822
- * ```typescript
823
- * try {
824
- * const order = await tapsilat.getOrder("ord_123456789");
825
- * console.log(`Order amount: ${order.amount} ${order.currency}`);
826
- * } catch (error) {
827
- * console.error(`Failed to get order: ${error.message}`);
828
- * }
829
- * ```
830
873
  */
831
874
  async getOrder(referenceId) {
832
875
  // Validate input
@@ -837,34 +880,26 @@ class TapsilatSDK {
837
880
  // Make the API request
838
881
  const response = await this.httpClient.get(`/order/${referenceId}`);
839
882
  // Use our generic response handler
840
- return this.handleResponse(response, "Order retrieval");
883
+ return handleResponse(response, "Order retrieval");
841
884
  }
842
885
  catch (error) {
843
886
  // Use our generic error handler
844
- this.handleError(error, "order retrieval");
887
+ return handleError(error, "order retrieval");
845
888
  }
846
889
  }
890
+ // ORDER LISTING WITH PAGINATION
891
+ // Summary: Retrieve paginated list of merchant orders
892
+ // Description: Gets orders with pagination support, filtering, and sorting options
847
893
  /**
848
894
  * Lists orders with pagination support.
849
895
  *
896
+ * @summary Retrieve paginated list of merchant orders
897
+ * @description Gets orders with pagination support, filtering, and sorting options.
898
+ *
850
899
  * @param params - Optional pagination parameters (page number and items per page)
851
900
  * @returns Promise resolving to paginated list of orders
852
901
  * @throws {TapsilatNetworkError} When API request fails due to network issues
853
902
  * @throws {TapsilatError} When API returns an error response
854
- *
855
- * @example
856
- * ```typescript
857
- * try {
858
- * // Get the second page with 20 items per page
859
- * const orderList = await tapsilat.getOrders({ page: 2, per_page: 20 });
860
- * console.log(`Total orders: ${orderList.total}`);
861
- * orderList.rows.forEach(order => {
862
- * console.log(`Order ${order.referenceId}: ${order.amount} ${order.currency}`);
863
- * });
864
- * } catch (error) {
865
- * console.error(`Failed to list orders: ${error.message}`);
866
- * }
867
- * ```
868
903
  */
869
904
  async getOrders(params = {}) {
870
905
  try {
@@ -880,15 +915,21 @@ class TapsilatSDK {
880
915
  // Make the API request
881
916
  const response = await this.httpClient.get("/order/list", { params: params });
882
917
  // Use our generic response handler
883
- return this.handleResponse(response, "Order listing");
918
+ return handleResponse(response, "Order listing");
884
919
  }
885
920
  catch (error) {
886
921
  // Use our generic error handler
887
- this.handleError(error, "order listing");
922
+ return handleError(error, "order listing");
888
923
  }
889
924
  }
925
+ // ORDER CANCELLATION
926
+ // Summary: Cancel a pending order before payment completion
927
+ // Description: Cancels unpaid order and prevents further payment processing
890
928
  /**
891
929
  * Cancels an order by reference_id.
930
+ *
931
+ * @summary Cancel a pending order before payment completion
932
+ * @description Cancels unpaid order and prevents further payment processing.
892
933
  */
893
934
  async cancelOrder(referenceId) {
894
935
  if (!referenceId) {
@@ -903,27 +944,40 @@ class TapsilatSDK {
903
944
  return response.data;
904
945
  }
905
946
  /**
906
- * Gets the status of an order by reference ID.
947
+ * Gets the current status of an order by reference ID
907
948
  *
908
- * @param referenceId - The unique reference ID of the order
909
- * @returns Promise resolving to the current order status, including status code and last update time
910
- * @throws {TapsilatValidationError} When referenceId is invalid
911
- * @throws {TapsilatNetworkError} When API request fails due to network issues
912
- * @throws {TapsilatError} When API returns an error response
949
+ * @summary Retrieves real-time payment status and tracking information for a specific order
950
+ * @description
951
+ * Queries the Tapsilat payment platform to retrieve the current status of an order using its
952
+ * unique reference ID. This method provides real-time information about payment progress,
953
+ * completion status, and last update timestamp. It's essential for tracking payment flow
954
+ * and implementing proper order state management in your application.
913
955
  *
914
- * @example
915
- * ```typescript
916
- * try {
917
- * const orderStatus = await tapsilat.getOrderStatus("ord_123456789");
918
- * console.log(`Order status: ${orderStatus.status}`);
919
- * } catch (error) {
920
- * if (error instanceof TapsilatValidationError) {
921
- * console.error("Invalid reference ID format");
922
- * } else if (error instanceof TapsilatError) {
923
- * console.error(`API error: ${error.message}`);
924
- * }
925
- * }
926
- * ```
956
+ * The status information includes payment state (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED),
957
+ * last update timestamp, and any relevant status metadata. This method should be used to:
958
+ * - Check if a payment has been completed after redirecting from checkout
959
+ * - Monitor payment status for pending transactions
960
+ * - Verify order state before fulfilling goods/services
961
+ * - Implement webhook verification and status synchronization
962
+ *
963
+ * @param {string} referenceId - Unique order reference identifier from order creation
964
+ *
965
+ * @returns {Promise<OrderStatusResponse>} Promise resolving to current order status information
966
+ * @returns {string} OrderStatusResponse.referenceId - Echo of the provided reference ID
967
+ * @returns {string} OrderStatusResponse.status - Current payment status (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED, FAILED)
968
+ * @returns {string} OrderStatusResponse.lastUpdatedAt - ISO 8601 timestamp of last status change
969
+ *
970
+ * @throws {TapsilatValidationError} When input validation fails:
971
+ * - Reference ID is null, undefined, or empty string
972
+ * - Reference ID format is invalid (should match order ID pattern)
973
+ * @throws {TapsilatNetworkError} When network request fails:
974
+ * - Connection timeout during status check
975
+ * - DNS resolution failure
976
+ * - Network connectivity issues
977
+ * @throws {TapsilatError} When API returns business logic errors:
978
+ * - ORDER_NOT_FOUND: Order with given reference ID doesn't exist
979
+ * - ACCESS_DENIED: Order belongs to different merchant
980
+ * - RATE_LIMIT_EXCEEDED: Too many status check requests
927
981
  */
928
982
  async getOrderStatus(referenceId) {
929
983
  // Validate input using proper validation
@@ -934,17 +988,23 @@ class TapsilatSDK {
934
988
  // Make the API request
935
989
  const response = await this.httpClient.get(`/order/${referenceId}/status`);
936
990
  // Use our generic response handler
937
- return this.handleResponse(response, "Order status retrieval");
991
+ return handleResponse(response, "Order status retrieval");
938
992
  }
939
993
  catch (error) {
940
994
  // Use our generic error handler
941
- this.handleError(error, "order status retrieval");
995
+ return handleError(error, "order status retrieval");
942
996
  }
943
997
  }
998
+ // ORDER REFUND OPERATIONS
999
+ // Summary: Process partial refund for a completed order
1000
+ // Description: Refunds specified amount from a paid order and returns transaction details
944
1001
  /**
945
1002
  * Partially refunds an order.
946
1003
  * Based on `refund_order` from the Python SDK.
947
1004
  *
1005
+ * @summary Process partial refund for a completed order
1006
+ * @description Refunds specified amount from a paid order and returns transaction details.
1007
+ *
948
1008
  * @param refundData - The refund details, including referenceId and amount.
949
1009
  * @returns Promise resolving to the refund transaction details.
950
1010
  */
@@ -955,10 +1015,15 @@ class TapsilatSDK {
955
1015
  }
956
1016
  return response.data;
957
1017
  }
1018
+ // Summary: Process full refund for a completed order
1019
+ // Description: Refunds entire order amount and returns transaction details
958
1020
  /**
959
1021
  * Fully refunds an order by its reference ID.
960
1022
  * Based on `refund_all_order` from the Python SDK.
961
1023
  *
1024
+ * @summary Process full refund for a completed order
1025
+ * @description Refunds entire order amount and returns transaction details.
1026
+ *
962
1027
  * @param referenceId - The unique identifier of the order to fully refund.
963
1028
  * @returns Promise resolving to the refund transaction details.
964
1029
  */
@@ -969,10 +1034,16 @@ class TapsilatSDK {
969
1034
  }
970
1035
  return response.data;
971
1036
  }
1037
+ // ORDER PAYMENT DETAILS
1038
+ // Summary: Retrieve detailed payment transaction information for an order
1039
+ // Description: Gets payment method, amount, status, and card info for order transactions
972
1040
  /**
973
1041
  * Retrieves the payment details for an order.
974
1042
  * Based on `get_order_payment_details` from the Python SDK.
975
1043
  *
1044
+ * @summary Retrieve detailed payment transaction information for an order
1045
+ * @description Gets payment method, amount, status, and card info for order transactions.
1046
+ *
976
1047
  * @param referenceId - The unique identifier of the order.
977
1048
  * @param conversationId - Optional conversation ID for more specific querying.
978
1049
  * @returns Promise resolving to a list of payment details.
@@ -995,9 +1066,15 @@ class TapsilatSDK {
995
1066
  return response.data;
996
1067
  }
997
1068
  }
1069
+ // ORDER LOOKUP BY CONVERSATION ID
1070
+ // Summary: Find order using conversation ID instead of reference ID
1071
+ // Description: Alternative lookup method for orders using custom conversation identifier
998
1072
  /**
999
1073
  * Gets an order by conversation_id.
1000
1074
  * Based on `get_order_by_conversation_id` from the Python SDK.
1075
+ *
1076
+ * @summary Find order using conversation ID instead of reference ID
1077
+ * @description Alternative lookup method for orders using custom conversation identifier.
1001
1078
  */
1002
1079
  async getOrderByConversationId(conversationId) {
1003
1080
  if (!conversationId) {
@@ -1012,6 +1089,9 @@ class TapsilatSDK {
1012
1089
  /**
1013
1090
  * Gets order transactions by reference_id.
1014
1091
  * Based on `get_order_transactions` from the Python SDK.
1092
+ *
1093
+ * @summary Retrieve transaction history for an order
1094
+ * @description Gets detailed transaction records and payment attempts for a specific order.
1015
1095
  */
1016
1096
  async getOrderTransactions(referenceId) {
1017
1097
  if (!referenceId) {
@@ -1026,6 +1106,9 @@ class TapsilatSDK {
1026
1106
  /**
1027
1107
  * Gets order submerchants with pagination.
1028
1108
  * Based on `get_order_submerchants` from the Python SDK.
1109
+ *
1110
+ * @summary Retrieve paginated list of submerchants for orders
1111
+ * @description Gets submerchant information with pagination support for order management.
1029
1112
  */
1030
1113
  async getOrderSubmerchants(params = {}) {
1031
1114
  const response = await this.httpClient.get("/order/submerchants", {
@@ -1039,6 +1122,9 @@ class TapsilatSDK {
1039
1122
  /**
1040
1123
  * Gets checkout URL for an order.
1041
1124
  * Based on `get_checkout_url` from the Python SDK.
1125
+ *
1126
+ * @summary Retrieve checkout URL for existing order
1127
+ * @description Gets the payment checkout URL for an existing order using reference ID.
1042
1128
  */
1043
1129
  async getCheckoutUrl(referenceId) {
1044
1130
  const order = await this.getOrder(referenceId);
@@ -1051,19 +1137,13 @@ class TapsilatSDK {
1051
1137
  /**
1052
1138
  * Verifies webhook signature for security
1053
1139
  *
1140
+ * @summary Validate webhook signature for security verification
1141
+ * @description Verifies the authenticity of webhook payloads using HMAC signature validation.
1142
+ *
1054
1143
  * @param payload - Raw webhook payload string
1055
1144
  * @param signature - Webhook signature from headers
1056
1145
  * @param secret - Your webhook secret key
1057
1146
  * @returns Promise resolving to true if signature is valid
1058
- *
1059
- * @example
1060
- * ```typescript
1061
- * const isValid = await sdk.verifyWebhook(
1062
- * JSON.stringify(req.body),
1063
- * req.headers['x-tapsilat-signature'],
1064
- * 'your-webhook-secret'
1065
- * );
1066
- * ```
1067
1147
  */
1068
1148
  async verifyWebhook(payload, signature, secret) {
1069
1149
  // Implementation would depend on your webhook signature verification method
@@ -1078,6 +1158,9 @@ class TapsilatSDK {
1078
1158
  /**
1079
1159
  * Checks API service health and availability
1080
1160
  *
1161
+ * @summary Check API service health and availability
1162
+ * @description Verifies that the Tapsilat API service is operational and accessible.
1163
+ *
1081
1164
  * @returns Promise resolving to service status
1082
1165
  */
1083
1166
  async healthCheck() {
@@ -1091,6 +1174,9 @@ class TapsilatSDK {
1091
1174
  /**
1092
1175
  * Gets current SDK configuration (without sensitive data)
1093
1176
  *
1177
+ * @summary Get current SDK configuration without sensitive information
1178
+ * @description Returns a copy of the current configuration with sensitive data (like bearer token) excluded.
1179
+ *
1094
1180
  * @returns Copy of current configuration
1095
1181
  */
1096
1182
  getConfig() {
@@ -1103,6 +1189,9 @@ class TapsilatSDK {
1103
1189
  /**
1104
1190
  * Updates SDK configuration
1105
1191
  *
1192
+ * @summary Update SDK configuration with new values
1193
+ * @description Updates the SDK configuration with provided values, validating bearer token if changed.
1194
+ *
1106
1195
  * @param newConfig - Partial configuration to update
1107
1196
  * @throws {TapsilatValidationError} When Bearer token is invalid
1108
1197
  */