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