@tapsilat/tapsilat-js 2026.4.2 → 2026.6.17

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.js CHANGED
@@ -1434,7 +1434,12 @@ class TapsilatSDK {
1434
1434
  status: (referenceId) => this.getOrderStatus(referenceId),
1435
1435
  refund: (request) => this.refundOrder(request),
1436
1436
  refundAll: (referenceId) => this.refundAllOrder(referenceId),
1437
- paymentDetails: (referenceId, conversationId) => this.getOrderPaymentDetails(referenceId, conversationId),
1437
+ paymentDetails: (request) => this.getOrderPaymentDetails(request),
1438
+ paymentDetailsById: (referenceId) => this.getOrderPaymentDetailsById(referenceId),
1439
+ callback: (id) => this.orderCallback(id),
1440
+ updatePaymentOptions: (request) => this.updatePaymentOptions(request),
1441
+ splitItemPayment: (request) => this.splitOrderItemPayment(request),
1442
+ vposQuery: (id) => this.orderVposQuery(id),
1438
1443
  byConversationId: (conversationId) => this.getOrderByConversationId(conversationId),
1439
1444
  transactions: (referenceId) => this.getOrderTransactions(referenceId),
1440
1445
  submerchants: (params) => this.getOrderSubmerchants(params),
@@ -1482,13 +1487,33 @@ class TapsilatSDK {
1482
1487
  getLimitUser: (request) => this.getOrganizationLimitUser(request),
1483
1488
  setLimitUser: (request) => this.setOrganizationLimitUser(request),
1484
1489
  limits: () => this.getOrganizationLimits(),
1485
- meta: () => this.getOrganizationMeta(),
1490
+ meta: (name) => this.getOrganizationMeta(name),
1486
1491
  scopes: () => this.getOrganizationScopes(),
1487
- suborganizations: () => this.getOrganizationSuborganizations(),
1492
+ suborganizations: (params) => this.getOrganizationSuborganizations(params),
1488
1493
  createUser: (request) => this.createOrganizationUser(request),
1489
1494
  verifyUser: (request) => this.verifyOrganizationUser(request),
1490
1495
  verifyUserMobile: (request) => this.verifyOrganizationUserMobile(request),
1491
1496
  listVpos: (request) => this.listOrganizationVpos(request),
1497
+ currencyPresets: () => this.getOrganizationCurrencyPresets(),
1498
+ suborganizationDetails: (id) => this.getOrganizationSuborganizationDetails(id),
1499
+ suborganizationSubmerchants: (id) => this.getOrganizationSuborganizationSubmerchants(id),
1500
+ };
1501
+ }
1502
+ /**
1503
+ * Access to system operations
1504
+ */
1505
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1506
+ get system() {
1507
+ return {
1508
+ orderStatuses: () => this.getSystemOrderStatuses(),
1509
+ basketItemTypes: () => this.getSystemBasketItemTypes(),
1510
+ errorCodes: () => this.getSystemErrorCodes(),
1511
+ paymentTermStatuses: () => this.getSystemPaymentTermStatuses(),
1512
+ productTypes: () => this.getSystemProductTypes(),
1513
+ shortcutTypes: () => this.getSystemShortcutTypes(),
1514
+ transactionPaymentTypes: () => this.getSystemTransactionPaymentTypes(),
1515
+ transactionPurposes: () => this.getSystemTransactionPurposes(),
1516
+ transactionStatuses: () => this.getSystemTransactionStatuses(),
1492
1517
  };
1493
1518
  }
1494
1519
  /**
@@ -1534,10 +1559,10 @@ class TapsilatSDK {
1534
1559
  * @param {string} [orderRequest.payment_success_url] - URL to redirect after successful payment
1535
1560
  * @param {string} [orderRequest.payment_failure_url] - URL to redirect after failed payment
1536
1561
  * @param {number[]} [orderRequest.enabled_installments] - Allowed installment counts
1537
- * @param {Record<string, unknown>} [orderRequest.metadata] - Additional custom data
1562
+ * @param {OrderMetadata[]} [orderRequest.metadata] - Additional custom key/value data
1538
1563
  *
1539
1564
  * @returns {Promise<OrderCreateResponse>} Promise resolving to order creation response
1540
- * @returns {string} OrderCreateResponse.order_id - Internal order identifier
1565
+ * @returns {string} [OrderCreateResponse.id] - Internal order identifier
1541
1566
  * @returns {string} OrderCreateResponse.reference_id - Unique order reference for tracking
1542
1567
  * @returns {string} [OrderCreateResponse.checkout_url] - Payment page URL for customer
1543
1568
  * @returns {string} [OrderCreateResponse.conversation_id] - Echo of provided conversation ID
@@ -1593,7 +1618,6 @@ class TapsilatSDK {
1593
1618
  if (!isValidEmail(buyer.email)) {
1594
1619
  throw new TapsilatValidationError("Buyer email must be a valid email address", { provided: buyer.email });
1595
1620
  }
1596
- // Basket items and billing address are optional in Python ref and Swagger
1597
1621
  try {
1598
1622
  // Make the API request
1599
1623
  const createOrderResponse = await this.httpClient.post("/order/create", orderRequest);
@@ -1615,7 +1639,7 @@ class TapsilatSDK {
1615
1639
  * @description Handles accounting operations for a specific order using its reference ID.
1616
1640
  *
1617
1641
  * @param {OrderAccountingRequest} request - Accounting request details
1618
- * @returns {Promise<APIResponse<unknown>>} Promise resolving to the accounting response
1642
+ * @returns {Promise<OrderAccountingResponse>} Promise resolving to the accounting response
1619
1643
  * @throws {TapsilatValidationError} When input validation fails
1620
1644
  * @throws {TapsilatError} When API returns an error response
1621
1645
  */
@@ -1624,8 +1648,8 @@ class TapsilatSDK {
1624
1648
  throw new TapsilatValidationError("Order reference ID is required and must be a non-empty string", { provided: request.order_reference_id });
1625
1649
  }
1626
1650
  try {
1627
- const response = await this.httpClient.post("/order/accounting", request);
1628
- return handleResponse(response, "Order accounting");
1651
+ const orderAccountingResponse = await this.httpClient.post("/order/accounting", request);
1652
+ return handleResponse(orderAccountingResponse, "Order accounting");
1629
1653
  }
1630
1654
  catch (error) {
1631
1655
  return handleError(error, "order accounting");
@@ -1641,7 +1665,7 @@ class TapsilatSDK {
1641
1665
  * @description Handles post-authorization operations for a specific order.
1642
1666
  *
1643
1667
  * @param {OrderPostAuthRequest} request - Post-authorization request details
1644
- * @returns {Promise<APIResponse<unknown>>} Promise resolving to the post-auth response
1668
+ * @returns {Promise<OrderPostAuthResponse>} Promise resolving to the post-auth response
1645
1669
  * @throws {TapsilatValidationError} When input validation fails
1646
1670
  * @throws {TapsilatError} When API returns an error response
1647
1671
  */
@@ -1655,8 +1679,8 @@ class TapsilatSDK {
1655
1679
  });
1656
1680
  }
1657
1681
  try {
1658
- const response = await this.httpClient.post("/order/postauth", request);
1659
- return handleResponse(response, "Order post-auth");
1682
+ const orderPostAuthResponse = await this.httpClient.post("/order/postauth", request);
1683
+ return handleResponse(orderPostAuthResponse, "Order post-auth");
1660
1684
  }
1661
1685
  catch (error) {
1662
1686
  return handleError(error, "order post-auth");
@@ -1671,18 +1695,122 @@ class TapsilatSDK {
1671
1695
  * @summary Retrieve system order statuses
1672
1696
  * @description Gets a list of all possible order statuses in the system.
1673
1697
  *
1674
- * @returns {Promise<APIResponse<unknown>>} Promise resolving to system order statuses
1698
+ * @returns {Promise<GetSystemOrderStatusesResponse>} Promise resolving to system order statuses
1675
1699
  * @throws {TapsilatError} When API returns an error response
1676
1700
  */
1677
1701
  async getSystemOrderStatuses() {
1678
1702
  try {
1679
- const response = await this.httpClient.get("/system/order-statuses");
1680
- return handleResponse(response, "Get system order statuses");
1703
+ const getSystemOrderStatusesResponse = await this.httpClient.get("/system/order-statuses");
1704
+ return handleResponse(getSystemOrderStatusesResponse, "Get system order statuses");
1681
1705
  }
1682
1706
  catch (error) {
1683
1707
  return handleError(error, "get system order statuses");
1684
1708
  }
1685
1709
  }
1710
+ /**
1711
+ * Retrieves system basket item types.
1712
+ * Based on `get_system_basket_item_types` from Python SDK.
1713
+ */
1714
+ async getSystemBasketItemTypes() {
1715
+ try {
1716
+ const response = await this.httpClient.get("/system/basket-item-types");
1717
+ return handleResponse(response, "Get system basket item types");
1718
+ }
1719
+ catch (error) {
1720
+ return handleError(error, "get system basket item types");
1721
+ }
1722
+ }
1723
+ /**
1724
+ * Retrieves system error codes.
1725
+ * Based on `get_system_error_codes` from Python SDK.
1726
+ */
1727
+ async getSystemErrorCodes() {
1728
+ try {
1729
+ const response = await this.httpClient.get("/system/error-codes");
1730
+ return handleResponse(response, "Get system error codes");
1731
+ }
1732
+ catch (error) {
1733
+ return handleError(error, "get system error codes");
1734
+ }
1735
+ }
1736
+ /**
1737
+ * Retrieves system payment term statuses.
1738
+ * Based on `get_system_payment_term_statuses` from Python SDK.
1739
+ */
1740
+ async getSystemPaymentTermStatuses() {
1741
+ try {
1742
+ const response = await this.httpClient.get("/system/payment-term-statuses");
1743
+ return handleResponse(response, "Get system payment term statuses");
1744
+ }
1745
+ catch (error) {
1746
+ return handleError(error, "get system payment term statuses");
1747
+ }
1748
+ }
1749
+ /**
1750
+ * Retrieves system product types.
1751
+ * Based on `get_system_product_types` from Python SDK.
1752
+ */
1753
+ async getSystemProductTypes() {
1754
+ try {
1755
+ const response = await this.httpClient.get("/system/product-types");
1756
+ return handleResponse(response, "Get system product types");
1757
+ }
1758
+ catch (error) {
1759
+ return handleError(error, "get system product types");
1760
+ }
1761
+ }
1762
+ /**
1763
+ * Retrieves system shortcut types.
1764
+ * Based on `get_system_shortcut_types` from Python SDK.
1765
+ */
1766
+ async getSystemShortcutTypes() {
1767
+ try {
1768
+ const response = await this.httpClient.get("/system/shortcut-types");
1769
+ return handleResponse(response, "Get system shortcut types");
1770
+ }
1771
+ catch (error) {
1772
+ return handleError(error, "get system shortcut types");
1773
+ }
1774
+ }
1775
+ /**
1776
+ * Retrieves system transaction payment types.
1777
+ * Based on `get_system_transaction_payment_types` from Python SDK.
1778
+ */
1779
+ async getSystemTransactionPaymentTypes() {
1780
+ try {
1781
+ const response = await this.httpClient.get("/system/transaction-payment-types");
1782
+ return handleResponse(response, "Get system transaction payment types");
1783
+ }
1784
+ catch (error) {
1785
+ return handleError(error, "get system transaction payment types");
1786
+ }
1787
+ }
1788
+ /**
1789
+ * Retrieves system transaction purposes.
1790
+ * Based on `get_system_transaction_purposes` from Python SDK.
1791
+ */
1792
+ async getSystemTransactionPurposes() {
1793
+ try {
1794
+ const response = await this.httpClient.get("/system/transaction-purposes");
1795
+ return handleResponse(response, "Get system transaction purposes");
1796
+ }
1797
+ catch (error) {
1798
+ return handleError(error, "get system transaction purposes");
1799
+ }
1800
+ }
1801
+ /**
1802
+ * Retrieves system transaction statuses.
1803
+ * Based on `get_system_transaction_statuses` from Python SDK.
1804
+ */
1805
+ async getSystemTransactionStatuses() {
1806
+ try {
1807
+ const response = await this.httpClient.get("/system/transaction-statuses");
1808
+ return handleResponse(response, "Get system transaction statuses");
1809
+ }
1810
+ catch (error) {
1811
+ return handleError(error, "get system transaction statuses");
1812
+ }
1813
+ }
1686
1814
  // ORDER RETRIEVAL BY REFERENCE ID
1687
1815
  // Summary: Get complete order details and information
1688
1816
  // Description: Retrieves full order data including buyer info, amounts, and current status
@@ -1755,6 +1883,10 @@ class TapsilatSDK {
1755
1883
  throw new TapsilatValidationError("Items per page must be greater than 0", { provided: params.per_page });
1756
1884
  }
1757
1885
  }
1886
+ // Check if status is defined
1887
+ if (params.status !== undefined && !isInteger(params.status)) {
1888
+ throw new TapsilatValidationError("Status must be an integer", { provided: params.status });
1889
+ }
1758
1890
  // Make the API request
1759
1891
  const getOrdersResponse = await this.httpClient.get("/order/list", { params: params });
1760
1892
  // Use our generic response handler
@@ -1780,23 +1912,28 @@ class TapsilatSDK {
1780
1912
  * @throws {TapsilatError} When API returns an error response or order cannot be canceled
1781
1913
  */
1782
1914
  async cancelOrder(referenceId) {
1783
- // Validate referenceId
1784
1915
  if (!isNonEmptyString(referenceId)) {
1785
1916
  throw new TapsilatValidationError("Order referenceId is required and must be a non-empty string", { provided: referenceId });
1786
1917
  }
1787
- const cancelOrderResponse = await this.httpClient.post("/order/cancel", {
1788
- reference_id: referenceId,
1789
- });
1790
- // Check if API call was successful
1791
- if (!cancelOrderResponse.success) {
1792
- throw new TapsilatError(cancelOrderResponse.error?.message ||
1793
- "Order cancellation API call failed", cancelOrderResponse.error?.code || "CANCELLATION_API_FAILED");
1918
+ try {
1919
+ const cancelOrderPayload = {
1920
+ reference_id: referenceId,
1921
+ };
1922
+ const cancelOrderResponse = await this.httpClient.post("/order/cancel", cancelOrderPayload);
1923
+ // Check if API call was successful
1924
+ if (!cancelOrderResponse.success) {
1925
+ throw new TapsilatError(cancelOrderResponse.error?.message ||
1926
+ "Order cancellation API call failed", cancelOrderResponse.error?.code || "CANCELLATION_API_FAILED");
1927
+ }
1928
+ // Check if response data exists
1929
+ if (!cancelOrderResponse.data) {
1930
+ throw new TapsilatError("Order cancellation response data is missing", "CANCELLATION_DATA_MISSING");
1931
+ }
1932
+ return cancelOrderResponse.data;
1794
1933
  }
1795
- // Check if response data exists
1796
- if (!cancelOrderResponse.data) {
1797
- throw new TapsilatError("Order cancellation response data is missing", "CANCELLATION_DATA_MISSING");
1934
+ catch (error) {
1935
+ return handleError(error, "order cancellation");
1798
1936
  }
1799
- return cancelOrderResponse.data;
1800
1937
  }
1801
1938
  // ORDER STATUS RETRIEVAL
1802
1939
  // Summary: Retrieves real-time payment status and tracking information for a specific order
@@ -1807,12 +1944,12 @@ class TapsilatSDK {
1807
1944
  * @summary Retrieves real-time payment status and tracking information for a specific order
1808
1945
  * @description
1809
1946
  * Queries the Tapsilat payment platform to retrieve the current status of an order using its
1810
- * unique reference ID. This method provides real-time information about payment progress,
1811
- * completion status, and last update timestamp. It's essential for tracking payment flow
1947
+ * unique reference ID. This method provides real-time information about payment processing
1948
+ * status and error code (if returned by the API). It's essential for tracking payment flow
1812
1949
  * and implementing proper order state management in your application.
1813
1950
  *
1814
- * The status information includes payment state (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED),
1815
- * last update timestamp, and any relevant status metadata. This method should be used to:
1951
+ * The status information includes payment state and API-level error code metadata.
1952
+ * This method should be used to:
1816
1953
  * - Check if a payment has been completed after redirecting from checkout
1817
1954
  * - Monitor payment status for pending transactions
1818
1955
  * - Verify order state before fulfilling goods/services
@@ -1821,13 +1958,11 @@ class TapsilatSDK {
1821
1958
  * @param {string} referenceId - Unique order reference identifier from order creation
1822
1959
  *
1823
1960
  * @returns {Promise<OrderStatusResponse>} Promise resolving to current order status information
1824
- * @returns {string} OrderStatusResponse.referenceId - Echo of the provided reference ID
1825
- * @returns {string} OrderStatusResponse.status - Current payment status (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED, FAILED)
1826
- * @returns {string} OrderStatusResponse.lastUpdatedAt - ISO 8601 timestamp of last status change
1961
+ * @returns {string} [OrderStatusResponse.error_code] - API-level error code when present
1962
+ * @returns {string} [OrderStatusResponse.status] - Current payment processing status
1827
1963
  *
1828
1964
  * @throws {TapsilatValidationError} When input validation fails:
1829
1965
  * - Reference ID is null, undefined, or empty string
1830
- * - Reference ID format is invalid (should match order ID pattern)
1831
1966
  * @throws {TapsilatNetworkError} When network request fails:
1832
1967
  * - Connection timeout during status check
1833
1968
  * - DNS resolution failure
@@ -1868,14 +2003,19 @@ class TapsilatSDK {
1868
2003
  * @throws {TapsilatError} When API returns an error response or refund fails
1869
2004
  */
1870
2005
  async refundOrder(refundData) {
1871
- const refundOrderResponse = await this.httpClient.post("/order/refund", refundData);
1872
- if (!refundOrderResponse.success) {
1873
- throw new TapsilatError(refundOrderResponse.error?.message || "Order refund failed", refundOrderResponse.error?.code || "REFUND_FAILED");
2006
+ try {
2007
+ const refundOrderResponse = await this.httpClient.post("/order/refund", refundData);
2008
+ if (!refundOrderResponse.success) {
2009
+ throw new TapsilatError(refundOrderResponse.error?.message || "Order refund failed", refundOrderResponse.error?.code || "REFUND_FAILED");
2010
+ }
2011
+ if (!refundOrderResponse.data) {
2012
+ throw new TapsilatError("Order refund response data is missing", "REFUND_DATA_MISSING");
2013
+ }
2014
+ return refundOrderResponse.data;
1874
2015
  }
1875
- if (!refundOrderResponse.data) {
1876
- throw new TapsilatError("Order refund response data is missing", "REFUND_DATA_MISSING");
2016
+ catch (error) {
2017
+ return handleError(error, "order refund");
1877
2018
  }
1878
- return refundOrderResponse.data;
1879
2019
  }
1880
2020
  // ORDER FULL REFUND OPERATIONS
1881
2021
  // Summary: Process full refund for a completed order
@@ -1892,48 +2032,109 @@ class TapsilatSDK {
1892
2032
  * @throws {TapsilatError} When API returns an error response or full refund fails
1893
2033
  */
1894
2034
  async refundAllOrder(referenceId) {
1895
- const refundAllOrderResponse = await this.httpClient.post("/order/refund-all", {
1896
- reference_id: referenceId,
1897
- });
1898
- if (!refundAllOrderResponse.success) {
1899
- throw new TapsilatError(refundAllOrderResponse.error?.message || "Full order refund failed", refundAllOrderResponse.error?.code || "FULL_REFUND_FAILED");
2035
+ try {
2036
+ const refundAllPayload = {
2037
+ reference_id: referenceId,
2038
+ };
2039
+ const refundAllOrderResponse = await this.httpClient.post("/order/refund-all", refundAllPayload);
2040
+ if (!refundAllOrderResponse.success) {
2041
+ throw new TapsilatError(refundAllOrderResponse.error?.message || "Full order refund failed", refundAllOrderResponse.error?.code || "FULL_REFUND_FAILED");
2042
+ }
2043
+ if (!refundAllOrderResponse.data) {
2044
+ throw new TapsilatError("Full order refund response data is missing", "FULL_REFUND_DATA_MISSING");
2045
+ }
2046
+ return refundAllOrderResponse.data;
1900
2047
  }
1901
- if (!refundAllOrderResponse.data) {
1902
- throw new TapsilatError("Full order refund response data is missing", "FULL_REFUND_DATA_MISSING");
2048
+ catch (error) {
2049
+ return handleError(error, "full order refund");
1903
2050
  }
1904
- return refundAllOrderResponse.data;
1905
2051
  }
1906
2052
  // ORDER PAYMENT DETAILS
1907
2053
  // Summary: Retrieve detailed payment transaction information for an order
1908
2054
  // Description: Gets payment method, amount, status, and card info for order transactions
1909
2055
  /**
1910
- * Retrieves the payment details for an order.
2056
+ * Retrieves the payment details for an order via POST request.
1911
2057
  * Based on `get_order_payment_details` from the Python SDK.
1912
- *
1913
- * @summary Retrieve detailed payment transaction information for an order
1914
- * @description Gets payment method, amount, status, and card info for order transactions.
1915
- *
1916
- * @param referenceId - The unique identifier of the order.
1917
- * @param conversationId - Optional conversation ID for more specific querying.
1918
- * @returns Promise resolving to a list of payment details.
1919
- * @throws {TapsilatValidationError} When referenceId is invalid
1920
- * @throws {TapsilatError} When API returns an error response or payment details are missing
1921
2058
  */
1922
- async getOrderPaymentDetails(referenceId, conversationId) {
2059
+ async getOrderPaymentDetails(request) {
2060
+ try {
2061
+ const getOrderPaymentDetailsResponse = await this.httpClient.post("/order/payment-details", request);
2062
+ return handleResponse(getOrderPaymentDetailsResponse, "Order payment details");
2063
+ }
2064
+ catch (error) {
2065
+ return handleError(error, "order payment details");
2066
+ }
2067
+ }
2068
+ /**
2069
+ * Retrieves the payment details for an order by ID.
2070
+ * Based on `get_order_payment_details_by_id` from the Python SDK.
2071
+ */
2072
+ async getOrderPaymentDetailsById(referenceId) {
1923
2073
  if (!isNonEmptyString(referenceId))
1924
2074
  throw new TapsilatValidationError("Reference ID is required and must be a non-empty string");
1925
- const getOrderPaymentDetailsResponse = conversationId
1926
- ? await this.httpClient.post("/order/payment-details", {
1927
- conversation_id: conversationId,
1928
- })
1929
- : await this.httpClient.get(`/order/${referenceId}/payment-details`);
1930
- if (!getOrderPaymentDetailsResponse.success)
1931
- throw new TapsilatError(getOrderPaymentDetailsResponse.error?.message ||
1932
- "Payment details API call failed", getOrderPaymentDetailsResponse.error?.code ||
1933
- "PAYMENT_DETAILS_API_FAILED");
1934
- if (!getOrderPaymentDetailsResponse.data)
1935
- throw new TapsilatError("Payment details response data is missing", "PAYMENT_DETAILS_DATA_MISSING");
1936
- return getOrderPaymentDetailsResponse.data;
2075
+ try {
2076
+ const getOrderPaymentDetailsResponse = await this.httpClient.get(`/order/${referenceId}/payment-details`);
2077
+ return handleResponse(getOrderPaymentDetailsResponse, "Order payment details by id");
2078
+ }
2079
+ catch (error) {
2080
+ return handleError(error, "order payment details by id");
2081
+ }
2082
+ }
2083
+ /**
2084
+ * Retrieves the order callback via GET request.
2085
+ * Based on `order_callback` from the Python SDK.
2086
+ */
2087
+ async orderCallback(id) {
2088
+ if (!isNonEmptyString(id))
2089
+ throw new TapsilatValidationError("ID is required and must be a non-empty string");
2090
+ try {
2091
+ const response = await this.httpClient.get(`/orders/${id}/callback`);
2092
+ return handleResponse(response, "Order callback");
2093
+ }
2094
+ catch (error) {
2095
+ return handleError(error, "order callback");
2096
+ }
2097
+ }
2098
+ /**
2099
+ * Updates payment options for an order.
2100
+ * Based on `update_payment_options` from the Python SDK.
2101
+ */
2102
+ async updatePaymentOptions(request) {
2103
+ try {
2104
+ const response = await this.httpClient.patch("/order/payment-options", request);
2105
+ return handleResponse(response, "Update payment options");
2106
+ }
2107
+ catch (error) {
2108
+ return handleError(error, "update payment options");
2109
+ }
2110
+ }
2111
+ /**
2112
+ * Splits order item payment.
2113
+ * Based on `split_order_item_payment` from the Python SDK.
2114
+ */
2115
+ async splitOrderItemPayment(request) {
2116
+ try {
2117
+ const response = await this.httpClient.post("/order/split", request);
2118
+ return handleResponse(response, "Split order item payment");
2119
+ }
2120
+ catch (error) {
2121
+ return handleError(error, "split order item payment");
2122
+ }
2123
+ }
2124
+ /**
2125
+ * Queries vpos for an order.
2126
+ * Based on `order_vpos_query` from the Python SDK.
2127
+ */
2128
+ async orderVposQuery(id) {
2129
+ if (!isNonEmptyString(id))
2130
+ throw new TapsilatValidationError("ID is required and must be a non-empty string");
2131
+ try {
2132
+ const response = await this.httpClient.get(`/orders/${id}/vpos-query`);
2133
+ return handleResponse(response, "Order vpos query");
2134
+ }
2135
+ catch (error) {
2136
+ return handleError(error, "order vpos query");
2137
+ }
1937
2138
  }
1938
2139
  // ORDER LOOKUP BY CONVERSATION ID
1939
2140
  // Summary: Find order using conversation ID instead of reference ID
@@ -1955,13 +2156,18 @@ class TapsilatSDK {
1955
2156
  if (!isNonEmptyString(conversationId)) {
1956
2157
  throw new TapsilatValidationError("Order conversationId is required and must be a non-empty string", { provided: conversationId });
1957
2158
  }
1958
- const getOrderByConversationIdResponse = await this.httpClient.get(`/order/conversation/${conversationId}`);
1959
- if (!getOrderByConversationIdResponse.success)
1960
- throw new TapsilatError(getOrderByConversationIdResponse.error?.message ||
1961
- "Order retrieval by conversation ID failed", getOrderByConversationIdResponse.error?.code || "ORDER_RETRIEVAL_FAILED");
1962
- if (!getOrderByConversationIdResponse.data)
1963
- throw new TapsilatError("Order response data is missing", "ORDER_DATA_MISSING");
1964
- return getOrderByConversationIdResponse.data;
2159
+ try {
2160
+ const getOrderByConversationIdResponse = await this.httpClient.get(`/order/conversation/${conversationId}`);
2161
+ if (!getOrderByConversationIdResponse.success)
2162
+ throw new TapsilatError(getOrderByConversationIdResponse.error?.message ||
2163
+ "Order retrieval by conversation ID failed", getOrderByConversationIdResponse.error?.code || "ORDER_RETRIEVAL_FAILED");
2164
+ if (!getOrderByConversationIdResponse.data)
2165
+ throw new TapsilatError("Order response data is missing", "ORDER_DATA_MISSING");
2166
+ return getOrderByConversationIdResponse.data;
2167
+ }
2168
+ catch (error) {
2169
+ return handleError(error, "order retrieval by conversation ID");
2170
+ }
1965
2171
  }
1966
2172
  // ORDER TRANSACTION HISTORY
1967
2173
  // Summary: Retrieve transaction history for an order
@@ -1983,14 +2189,19 @@ class TapsilatSDK {
1983
2189
  if (!isNonEmptyString(referenceId)) {
1984
2190
  throw new TapsilatValidationError("Order referenceId is required and must be a non-empty string", { provided: referenceId });
1985
2191
  }
1986
- const getOrderTransactionsResponse = await this.httpClient.get(`/order/${referenceId}/transactions`);
1987
- if (!getOrderTransactionsResponse.success)
1988
- throw new TapsilatError(getOrderTransactionsResponse.error?.message ||
1989
- "Order transactions retrieval failed", getOrderTransactionsResponse.error?.code ||
1990
- "TRANSACTIONS_RETRIEVAL_FAILED");
1991
- if (!getOrderTransactionsResponse.data)
1992
- throw new TapsilatError("Order transactions response data is missing", "TRANSACTIONS_DATA_MISSING");
1993
- return getOrderTransactionsResponse.data;
2192
+ try {
2193
+ const getOrderTransactionsResponse = await this.httpClient.get(`/order/${referenceId}/transactions`);
2194
+ if (!getOrderTransactionsResponse.success)
2195
+ throw new TapsilatError(getOrderTransactionsResponse.error?.message ||
2196
+ "Order transactions retrieval failed", getOrderTransactionsResponse.error?.code ||
2197
+ "TRANSACTIONS_RETRIEVAL_FAILED");
2198
+ if (!getOrderTransactionsResponse.data)
2199
+ throw new TapsilatError("Order transactions response data is missing", "TRANSACTIONS_DATA_MISSING");
2200
+ return getOrderTransactionsResponse.data;
2201
+ }
2202
+ catch (error) {
2203
+ return handleError(error, "order transactions retrieval");
2204
+ }
1994
2205
  }
1995
2206
  // ORDER SUBMERCHANT LISTING
1996
2207
  // Summary: Retrieve paginated list of submerchants for orders
@@ -2007,16 +2218,15 @@ class TapsilatSDK {
2007
2218
  * @throws {TapsilatError} When API returns an error response
2008
2219
  */
2009
2220
  async getOrderSubmerchants(params = {}) {
2010
- const getOrderSubmerchantsResponse = await this.httpClient.get("/order/submerchants", {
2011
- params: params,
2012
- });
2013
- if (!getOrderSubmerchantsResponse.success)
2014
- throw new TapsilatError(getOrderSubmerchantsResponse.error?.message ||
2015
- "Order submerchants retrieval failed", getOrderSubmerchantsResponse.error?.code ||
2016
- "SUBMERCHANTS_RETRIEVAL_FAILED");
2017
- if (!getOrderSubmerchantsResponse.data)
2018
- throw new TapsilatError("Order submerchants response data is missing", "SUBMERCHANTS_DATA_MISSING");
2019
- return getOrderSubmerchantsResponse.data;
2221
+ try {
2222
+ const getOrderSubmerchantsResponse = await this.httpClient.get("/order/submerchants", {
2223
+ params: params,
2224
+ });
2225
+ return handleResponse(getOrderSubmerchantsResponse, "Order submerchants retrieval");
2226
+ }
2227
+ catch (error) {
2228
+ return handleError(error, "order submerchants retrieval");
2229
+ }
2020
2230
  }
2021
2231
  // ORDER CHECKOUT URL RETRIEVAL
2022
2232
  // Summary: Retrieve checkout URL for existing order
@@ -2076,19 +2286,22 @@ class TapsilatSDK {
2076
2286
  * @throws {TapsilatError} When API health check fails or returns invalid data
2077
2287
  */
2078
2288
  async healthCheck() {
2079
- // We use the direct /health endpoint which returns plain string "OK"
2080
- const healthCheckResponse = await this.httpClient.get("/health");
2081
- if (!healthCheckResponse.success) {
2082
- throw new TapsilatError(healthCheckResponse.error?.message || "Health check failed", healthCheckResponse.error?.code || "HEALTH_CHECK_FAILED");
2289
+ try {
2290
+ // We use the direct /health endpoint which returns plain string "OK"
2291
+ const healthCheckResponse = await this.httpClient.get("/health");
2292
+ const healthData = handleResponse(healthCheckResponse, "Health check");
2293
+ // The API returns "OK" string, verify consistency
2294
+ if (healthData !== "OK") {
2295
+ throw new TapsilatError(`Unexpected health check response: ${healthData}`, "HEALTH_CHECK_INVALID_RESPONSE");
2296
+ }
2297
+ return {
2298
+ status: "UP",
2299
+ timestamp: new Date().toISOString(),
2300
+ };
2083
2301
  }
2084
- // The API returns "OK" string, verify consistency
2085
- if (healthCheckResponse.data !== "OK") {
2086
- throw new TapsilatError(`Unexpected health check response: ${healthCheckResponse.data}`, "HEALTH_CHECK_INVALID_RESPONSE");
2302
+ catch (error) {
2303
+ return handleError(error, "health check");
2087
2304
  }
2088
- return {
2089
- status: "UP",
2090
- timestamp: new Date().toISOString(),
2091
- };
2092
2305
  }
2093
2306
  // CONFIGURATION MANAGEMENT
2094
2307
  // Summary: Access to the configuration manager for advanced configuration management
@@ -2381,8 +2594,8 @@ class TapsilatSDK {
2381
2594
  payload.conversation_id = conversationId;
2382
2595
  }
2383
2596
  try {
2384
- const response = await this.httpClient.post("/order/manual-callback", payload);
2385
- return handleResponse(response, "Order manual callback");
2597
+ const orderManualCallbackResponse = await this.httpClient.post("/order/callback", payload);
2598
+ return handleResponse(orderManualCallbackResponse, "Order manual callback");
2386
2599
  }
2387
2600
  catch (error) {
2388
2601
  return handleError(error, "order manual callback");
@@ -2396,11 +2609,12 @@ class TapsilatSDK {
2396
2609
  throw new TapsilatValidationError("Related Reference ID is required and must be a non-empty string");
2397
2610
  }
2398
2611
  try {
2399
- const response = await this.httpClient.post("/order/related-update", {
2612
+ const payload = {
2400
2613
  reference_id: referenceId,
2401
2614
  related_reference_id: relatedReferenceId,
2402
- });
2403
- return handleResponse(response, "Order related update");
2615
+ };
2616
+ const orderRelatedUpdateResponse = await this.httpClient.patch("/order/releated", payload);
2617
+ return handleResponse(orderRelatedUpdateResponse, "Order related update");
2404
2618
  }
2405
2619
  catch (error) {
2406
2620
  return handleError(error, "order related update");
@@ -2408,8 +2622,8 @@ class TapsilatSDK {
2408
2622
  }
2409
2623
  async getOrganizationSettings() {
2410
2624
  try {
2411
- const response = await this.httpClient.get("/organization/settings");
2412
- return handleResponse(response, "Get organization settings");
2625
+ const organizationSettingsResponse = await this.httpClient.get("/organization/settings");
2626
+ return handleResponse(organizationSettingsResponse, "Get organization settings");
2413
2627
  }
2414
2628
  catch (error) {
2415
2629
  return handleError(error, "get organization settings");
@@ -2420,10 +2634,10 @@ class TapsilatSDK {
2420
2634
  throw new TapsilatValidationError("Term Reference ID is required and must be a non-empty string");
2421
2635
  }
2422
2636
  try {
2423
- const response = await this.httpClient.get(`/order/term`, {
2637
+ const orderTermResponse = await this.httpClient.get(`/order/term`, {
2424
2638
  params: { term_reference_id: termReferenceId },
2425
2639
  });
2426
- return handleResponse(response, "Get order term");
2640
+ return handleResponse(orderTermResponse, "Get order term");
2427
2641
  }
2428
2642
  catch (error) {
2429
2643
  return handleError(error, "get order term");
@@ -2435,8 +2649,8 @@ class TapsilatSDK {
2435
2649
  */
2436
2650
  async addBasketItem(request) {
2437
2651
  try {
2438
- const response = await this.httpClient.post("/order/basket-item", request);
2439
- return handleResponse(response, "Add basket item");
2652
+ const addBasketItemResponse = await this.httpClient.post("/order/basket-item", request);
2653
+ return handleResponse(addBasketItemResponse, "Add basket item");
2440
2654
  }
2441
2655
  catch (error) {
2442
2656
  return handleError(error, "add basket item");
@@ -2447,8 +2661,8 @@ class TapsilatSDK {
2447
2661
  */
2448
2662
  async removeBasketItem(request) {
2449
2663
  try {
2450
- const response = await this.httpClient.delete("/order/basket-item", request);
2451
- return handleResponse(response, "Remove basket item");
2664
+ const removeBasketItemResponse = await this.httpClient.delete("/order/basket-item", request);
2665
+ return handleResponse(removeBasketItemResponse, "Remove basket item");
2452
2666
  }
2453
2667
  catch (error) {
2454
2668
  return handleError(error, "remove basket item");
@@ -2459,8 +2673,8 @@ class TapsilatSDK {
2459
2673
  */
2460
2674
  async updateBasketItem(request) {
2461
2675
  try {
2462
- const response = await this.httpClient.patch("/order/basket-item", request);
2463
- return handleResponse(response, "Update basket item");
2676
+ const updateBasketItemResponse = await this.httpClient.patch("/order/basket-item", request);
2677
+ return handleResponse(updateBasketItemResponse, "Update basket item");
2464
2678
  }
2465
2679
  catch (error) {
2466
2680
  return handleError(error, "update basket item");
@@ -2471,8 +2685,8 @@ class TapsilatSDK {
2471
2685
  */
2472
2686
  async getOrganizationCallback() {
2473
2687
  try {
2474
- const response = await this.httpClient.get("/organization/callback");
2475
- return handleResponse(response, "Get organization callback");
2688
+ const organizationCallbackResponse = await this.httpClient.get("/organization/callback");
2689
+ return handleResponse(organizationCallbackResponse, "Get organization callback");
2476
2690
  }
2477
2691
  catch (error) {
2478
2692
  return handleError(error, "get organization callback");
@@ -2483,8 +2697,8 @@ class TapsilatSDK {
2483
2697
  */
2484
2698
  async updateOrganizationCallback(request) {
2485
2699
  try {
2486
- const response = await this.httpClient.patch("/organization/callback", request);
2487
- return handleResponse(response, "Update organization callback");
2700
+ const organizationCallbackResponse = await this.httpClient.patch("/organization/callback", request);
2701
+ return handleResponse(organizationCallbackResponse, "Update organization callback");
2488
2702
  }
2489
2703
  catch (error) {
2490
2704
  return handleError(error, "update organization callback");
@@ -2495,8 +2709,8 @@ class TapsilatSDK {
2495
2709
  */
2496
2710
  async createOrganizationBusiness(request) {
2497
2711
  try {
2498
- const response = await this.httpClient.post("/organization/business/create", request);
2499
- return handleResponse(response, "Create organization business");
2712
+ const organizationBusinessResponse = await this.httpClient.post("/organization/business/create", request);
2713
+ return handleResponse(organizationBusinessResponse, "Create organization business");
2500
2714
  }
2501
2715
  catch (error) {
2502
2716
  return handleError(error, "create organization business");
@@ -2507,20 +2721,63 @@ class TapsilatSDK {
2507
2721
  */
2508
2722
  async getOrganizationCurrencies() {
2509
2723
  try {
2510
- const response = await this.httpClient.get("/organization/currencies");
2511
- return handleResponse(response, "Get organization currencies");
2724
+ const organizationCurrenciesResponse = await this.httpClient.get("/organization/currencies");
2725
+ return handleResponse(organizationCurrenciesResponse, "Get organization currencies");
2512
2726
  }
2513
2727
  catch (error) {
2514
2728
  return handleError(error, "get organization currencies");
2515
2729
  }
2516
2730
  }
2731
+ /**
2732
+ * Retrieves organization currency presets.
2733
+ * Based on `get_organization_currency_presets` from Python SDK.
2734
+ */
2735
+ async getOrganizationCurrencyPresets() {
2736
+ try {
2737
+ const response = await this.httpClient.get("/organization/currency-presets");
2738
+ return handleResponse(response, "Get organization currency presets");
2739
+ }
2740
+ catch (error) {
2741
+ return handleError(error, "get organization currency presets");
2742
+ }
2743
+ }
2744
+ /**
2745
+ * Retrieves organization suborganization details.
2746
+ * Based on `get_organization_suborganization_details` from Python SDK.
2747
+ */
2748
+ async getOrganizationSuborganizationDetails(id) {
2749
+ if (!isNonEmptyString(id))
2750
+ throw new TapsilatValidationError("ID is required and must be a non-empty string");
2751
+ try {
2752
+ const response = await this.httpClient.get(`/organization/suborganizations/${id}`);
2753
+ return handleResponse(response, "Get suborganization details");
2754
+ }
2755
+ catch (error) {
2756
+ return handleError(error, "get suborganization details");
2757
+ }
2758
+ }
2759
+ /**
2760
+ * Retrieves organization suborganization submerchants.
2761
+ * Based on `get_organization_suborganization_submerchants` from Python SDK.
2762
+ */
2763
+ async getOrganizationSuborganizationSubmerchants(id) {
2764
+ if (!isNonEmptyString(id))
2765
+ throw new TapsilatValidationError("ID is required and must be a non-empty string");
2766
+ try {
2767
+ const response = await this.httpClient.get(`/organization/suborganizations/${id}/submerchant`);
2768
+ return handleResponse(response, "Get suborganization submerchants");
2769
+ }
2770
+ catch (error) {
2771
+ return handleError(error, "get suborganization submerchants");
2772
+ }
2773
+ }
2517
2774
  /**
2518
2775
  * Retrieve limit information for a specific organization user
2519
2776
  */
2520
2777
  async getOrganizationLimitUser(request) {
2521
2778
  try {
2522
- const response = await this.httpClient.get("/organization/limit/user", { params: request });
2523
- return handleResponse(response, "Get organization user limit");
2779
+ const organizationLimitUserResponse = await this.httpClient.get("/organization/limit/user", { params: request });
2780
+ return handleResponse(organizationLimitUserResponse, "Get organization user limit");
2524
2781
  }
2525
2782
  catch (error) {
2526
2783
  return handleError(error, "get organization user limit");
@@ -2531,8 +2788,8 @@ class TapsilatSDK {
2531
2788
  */
2532
2789
  async setOrganizationLimitUser(request) {
2533
2790
  try {
2534
- const response = await this.httpClient.post("/organization/limit/user", request);
2535
- return handleResponse(response, "Set organization user limit");
2791
+ const organizationLimitUserResponse = await this.httpClient.post("/organization/limit/user", request);
2792
+ return handleResponse(organizationLimitUserResponse, "Set organization user limit");
2536
2793
  }
2537
2794
  catch (error) {
2538
2795
  return handleError(error, "set organization user limit");
@@ -2543,8 +2800,8 @@ class TapsilatSDK {
2543
2800
  */
2544
2801
  async getOrganizationLimits() {
2545
2802
  try {
2546
- const response = await this.httpClient.get("/organization/limits");
2547
- return handleResponse(response, "Get organization limits");
2803
+ const organizationLimitsResponse = await this.httpClient.get("/organization/limits");
2804
+ return handleResponse(organizationLimitsResponse, "Get organization limits");
2548
2805
  }
2549
2806
  catch (error) {
2550
2807
  return handleError(error, "get organization limits");
@@ -2553,10 +2810,13 @@ class TapsilatSDK {
2553
2810
  /**
2554
2811
  * Retrieve meta information for the organization
2555
2812
  */
2556
- async getOrganizationMeta() {
2813
+ async getOrganizationMeta(name) {
2814
+ if (!isNonEmptyString(name)) {
2815
+ throw new TapsilatValidationError("Meta name is required and must be a non-empty string");
2816
+ }
2557
2817
  try {
2558
- const response = await this.httpClient.get("/organization/meta");
2559
- return handleResponse(response, "Get organization meta");
2818
+ const organizationMetaResponse = await this.httpClient.get(`/organization/meta/${name}`);
2819
+ return handleResponse(organizationMetaResponse, "Get organization meta");
2560
2820
  }
2561
2821
  catch (error) {
2562
2822
  return handleError(error, "get organization meta");
@@ -2567,8 +2827,8 @@ class TapsilatSDK {
2567
2827
  */
2568
2828
  async getOrganizationScopes() {
2569
2829
  try {
2570
- const response = await this.httpClient.get("/organization/scopes");
2571
- return handleResponse(response, "Get organization scopes");
2830
+ const organizationScopesResponse = await this.httpClient.get("/organization/scopes");
2831
+ return handleResponse(organizationScopesResponse, "Get organization scopes");
2572
2832
  }
2573
2833
  catch (error) {
2574
2834
  return handleError(error, "get organization scopes");
@@ -2577,10 +2837,20 @@ class TapsilatSDK {
2577
2837
  /**
2578
2838
  * Retrieve list of sub-organizations
2579
2839
  */
2580
- async getOrganizationSuborganizations() {
2840
+ async getOrganizationSuborganizations(params = {}) {
2841
+ if (params.page !== undefined) {
2842
+ if (!isInteger(params.page) || params.page < 1) {
2843
+ throw new TapsilatValidationError("Suborganization page must be a positive integer", { provided: params.page });
2844
+ }
2845
+ }
2846
+ if (params.per_page !== undefined) {
2847
+ if (!isInteger(params.per_page) || params.per_page < 1) {
2848
+ throw new TapsilatValidationError("Suborganization per_page must be a positive integer", { provided: params.per_page });
2849
+ }
2850
+ }
2581
2851
  try {
2582
- const response = await this.httpClient.get("/organization/suborganizations");
2583
- return handleResponse(response, "Get organization suborganizations");
2852
+ const organizationSuborganizationsResponse = await this.httpClient.get("/organization/suborganizations", { params: params });
2853
+ return handleResponse(organizationSuborganizationsResponse, "Get organization suborganizations");
2584
2854
  }
2585
2855
  catch (error) {
2586
2856
  return handleError(error, "get organization suborganizations");
@@ -2591,8 +2861,8 @@ class TapsilatSDK {
2591
2861
  */
2592
2862
  async createOrganizationUser(request) {
2593
2863
  try {
2594
- const response = await this.httpClient.post("/organization/user/create", request);
2595
- return handleResponse(response, "Create organization user");
2864
+ const organizationUserResponse = await this.httpClient.post("/organization/user/create", request);
2865
+ return handleResponse(organizationUserResponse, "Create organization user");
2596
2866
  }
2597
2867
  catch (error) {
2598
2868
  return handleError(error, "create organization user");
@@ -2603,8 +2873,8 @@ class TapsilatSDK {
2603
2873
  */
2604
2874
  async verifyOrganizationUser(request) {
2605
2875
  try {
2606
- const response = await this.httpClient.post("/organization/user/verify", request);
2607
- return handleResponse(response, "Verify organization user");
2876
+ const organizationUserVerifyResponse = await this.httpClient.post("/organization/user/verify", request);
2877
+ return handleResponse(organizationUserVerifyResponse, "Verify organization user");
2608
2878
  }
2609
2879
  catch (error) {
2610
2880
  return handleError(error, "verify organization user");
@@ -2615,8 +2885,8 @@ class TapsilatSDK {
2615
2885
  */
2616
2886
  async verifyOrganizationUserMobile(request) {
2617
2887
  try {
2618
- const response = await this.httpClient.post("/organization/user/verify-mobile", request);
2619
- return handleResponse(response, "Verify organization user mobile");
2888
+ const organizationUserMobileVerifyResponse = await this.httpClient.post("/organization/user/verify-mobile", request);
2889
+ return handleResponse(organizationUserMobileVerifyResponse, "Verify organization user mobile");
2620
2890
  }
2621
2891
  catch (error) {
2622
2892
  return handleError(error, "verify organization user mobile");
@@ -2627,8 +2897,8 @@ class TapsilatSDK {
2627
2897
  */
2628
2898
  async listOrganizationVpos(request) {
2629
2899
  try {
2630
- const response = await this.httpClient.post("/organization/list-vpos", request);
2631
- return handleResponse(response, "List organization VPOs");
2900
+ const organizationVposResponse = await this.httpClient.post("/organization/list-vpos", request);
2901
+ return handleResponse(organizationVposResponse, "List organization VPOs");
2632
2902
  }
2633
2903
  catch (error) {
2634
2904
  return handleError(error, "list organization VPOs");
@@ -2636,8 +2906,8 @@ class TapsilatSDK {
2636
2906
  }
2637
2907
  async createSubscription(request) {
2638
2908
  try {
2639
- const response = await this.httpClient.post("/subscription/create", request);
2640
- return handleResponse(response, "Create subscription");
2909
+ const subcriptionCreateResponse = await this.httpClient.post("/subscription/create", request);
2910
+ return handleResponse(subcriptionCreateResponse, "Create subscription");
2641
2911
  }
2642
2912
  catch (error) {
2643
2913
  return handleError(error, "create subscription");
@@ -2645,8 +2915,8 @@ class TapsilatSDK {
2645
2915
  }
2646
2916
  async getSubscription(request) {
2647
2917
  try {
2648
- const response = await this.httpClient.post("/subscription", request);
2649
- const data = handleResponse(response, "Get subscription");
2918
+ const subscriptionDetailResponse = await this.httpClient.post("/subscription", request);
2919
+ const data = handleResponse(subscriptionDetailResponse, "Get subscription");
2650
2920
  if (data.orders) {
2651
2921
  data.orders.forEach((order) => {
2652
2922
  if (order.payment_url && !order.payment_url.startsWith("http")) {
@@ -2662,8 +2932,8 @@ class TapsilatSDK {
2662
2932
  }
2663
2933
  async listSubscriptions(params = {}) {
2664
2934
  try {
2665
- const response = await this.httpClient.get("/subscription/list", { params });
2666
- return handleResponse(response, "List subscriptions");
2935
+ const listSubscriptionsResponse = await this.httpClient.get("/subscription/list", { params });
2936
+ return handleResponse(listSubscriptionsResponse, "List subscriptions");
2667
2937
  }
2668
2938
  catch (error) {
2669
2939
  return handleError(error, "list subscriptions");
@@ -2671,8 +2941,8 @@ class TapsilatSDK {
2671
2941
  }
2672
2942
  async cancelSubscription(request) {
2673
2943
  try {
2674
- const response = await this.httpClient.post("/subscription/cancel", request);
2675
- return handleResponse(response, "Cancel subscription");
2944
+ const subscriptionCancelResponse = await this.httpClient.post("/subscription/cancel", request);
2945
+ return handleResponse(subscriptionCancelResponse, "Cancel subscription");
2676
2946
  }
2677
2947
  catch (error) {
2678
2948
  return handleError(error, "cancel subscription");
@@ -2680,8 +2950,8 @@ class TapsilatSDK {
2680
2950
  }
2681
2951
  async redirectSubscription(request) {
2682
2952
  try {
2683
- const response = await this.httpClient.post("/subscription/redirect", request);
2684
- const data = handleResponse(response, "Redirect subscription");
2953
+ const subscriptionRedirectResponse = await this.httpClient.post("/subscription/redirect", request);
2954
+ const data = handleResponse(subscriptionRedirectResponse, "Redirect subscription");
2685
2955
  if (data.url) {
2686
2956
  // Extract subscription ID from the signed URL to create a clean link
2687
2957
  // api returns: /token/subscription/{id}
@@ -2702,5 +2972,23 @@ class TapsilatSDK {
2702
2972
  }
2703
2973
  }
2704
2974
 
2705
- export { ConfigManager, TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validateGsmNumber, validateInstallments, validatePaymentRequest };
2975
+ /**
2976
+ * @module Types
2977
+ * @description Tapsilat SDK type definitions, interfaces, and API data structures
2978
+ */
2979
+ /**
2980
+ * @category Organization
2981
+ * @summary Organization business types
2982
+ * @enum {number}
2983
+ */
2984
+ var BusinessType;
2985
+ (function (BusinessType) {
2986
+ BusinessType[BusinessType["INDIVIDUAL"] = 0] = "INDIVIDUAL";
2987
+ BusinessType[BusinessType["CORPORATE"] = 1] = "CORPORATE";
2988
+ BusinessType[BusinessType["NON_PROFIT"] = 2] = "NON_PROFIT";
2989
+ BusinessType[BusinessType["GOVERNMENT"] = 3] = "GOVERNMENT";
2990
+ BusinessType[BusinessType["UNKNOWN"] = 4] = "UNKNOWN";
2991
+ })(BusinessType || (BusinessType = {}));
2992
+
2993
+ export { BusinessType, ConfigManager, TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validateGsmNumber, validateInstallments, validatePaymentRequest };
2706
2994
  //# sourceMappingURL=index.js.map