@tapsilat/tapsilat-js 2026.1.14 → 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
@@ -610,7 +610,7 @@ class HttpClient {
610
610
  ...config?.headers,
611
611
  });
612
612
  // Set content type for requests with body
613
- if (body && method !== "GET" && method !== "DELETE") {
613
+ if (body && method !== "GET") {
614
614
  if (!(body instanceof FormData)) {
615
615
  headers.set("Content-Type", "application/json");
616
616
  }
@@ -620,8 +620,8 @@ class HttpClient {
620
620
  headers,
621
621
  ...config,
622
622
  };
623
- // Add body for non-GET/DELETE requests
624
- if (body && method !== "GET" && method !== "DELETE") {
623
+ // Add body for non-GET requests
624
+ if (body && method !== "GET") {
625
625
  if (body instanceof FormData) {
626
626
  options.body = body;
627
627
  }
@@ -1129,7 +1129,7 @@ function validateInstallments(installments) {
1129
1129
  originalInput: String(originalInput)
1130
1130
  };
1131
1131
  }
1132
- let installmentArray = [];
1132
+ let installmentArray;
1133
1133
  try {
1134
1134
  if (typeof installments === 'number') {
1135
1135
  // Single number
@@ -1421,6 +1421,110 @@ class TapsilatSDK {
1421
1421
  this.configManager = new ConfigManager(config);
1422
1422
  this.httpClient = new HttpClient(this.configManager.getInternalConfig());
1423
1423
  }
1424
+ /**
1425
+ * Access to order operations
1426
+ */
1427
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1428
+ get orders() {
1429
+ return {
1430
+ create: (request) => this.createOrder(request),
1431
+ get: (referenceId) => this.getOrder(referenceId),
1432
+ list: (params) => this.getOrders(params),
1433
+ cancel: (referenceId) => this.cancelOrder(referenceId),
1434
+ status: (referenceId) => this.getOrderStatus(referenceId),
1435
+ refund: (request) => this.refundOrder(request),
1436
+ refundAll: (referenceId) => this.refundAllOrder(referenceId),
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),
1443
+ byConversationId: (conversationId) => this.getOrderByConversationId(conversationId),
1444
+ transactions: (referenceId) => this.getOrderTransactions(referenceId),
1445
+ submerchants: (params) => this.getOrderSubmerchants(params),
1446
+ checkoutUrl: (referenceId) => this.getCheckoutUrl(referenceId),
1447
+ accounting: (request) => this.orderAccounting(request),
1448
+ postAuth: (request) => this.orderPostAuth(request),
1449
+ manualCallback: (referenceId, conversationId) => this.orderManualCallback(referenceId, conversationId),
1450
+ relatedUpdate: (referenceId, relatedReferenceId) => this.orderRelatedUpdate(referenceId, relatedReferenceId),
1451
+ addBasketItem: (request) => this.addBasketItem(request),
1452
+ removeBasketItem: (request) => this.removeBasketItem(request),
1453
+ updateBasketItem: (request) => this.updateBasketItem(request),
1454
+ createTerm: (request) => this.createOrderTerm(request),
1455
+ updateTerm: (request) => this.updateOrderTerm(request),
1456
+ deleteTerm: (request) => this.deleteOrderTerm(request),
1457
+ refundTerm: (request) => this.refundOrderTerm(request),
1458
+ getTerm: (termReferenceId) => this.getOrderTerm(termReferenceId),
1459
+ terminateTerm: (request) => this.terminateOrderTerm(request),
1460
+ terminate: (request) => this.terminateOrder(request),
1461
+ };
1462
+ }
1463
+ /**
1464
+ * Access to subscription operations
1465
+ */
1466
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1467
+ get subscriptions() {
1468
+ return {
1469
+ create: (request) => this.createSubscription(request),
1470
+ get: (request) => this.getSubscription(request),
1471
+ list: (params) => this.listSubscriptions(params),
1472
+ cancel: (request) => this.cancelSubscription(request),
1473
+ redirect: (request) => this.redirectSubscription(request),
1474
+ };
1475
+ }
1476
+ /**
1477
+ * Access to organization operations
1478
+ */
1479
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1480
+ get organization() {
1481
+ return {
1482
+ settings: () => this.getOrganizationSettings(),
1483
+ callback: () => this.getOrganizationCallback(),
1484
+ updateCallback: (request) => this.updateOrganizationCallback(request),
1485
+ createBusiness: (request) => this.createOrganizationBusiness(request),
1486
+ currencies: () => this.getOrganizationCurrencies(),
1487
+ getLimitUser: (request) => this.getOrganizationLimitUser(request),
1488
+ setLimitUser: (request) => this.setOrganizationLimitUser(request),
1489
+ limits: () => this.getOrganizationLimits(),
1490
+ meta: (name) => this.getOrganizationMeta(name),
1491
+ scopes: () => this.getOrganizationScopes(),
1492
+ suborganizations: (params) => this.getOrganizationSuborganizations(params),
1493
+ createUser: (request) => this.createOrganizationUser(request),
1494
+ verifyUser: (request) => this.verifyOrganizationUser(request),
1495
+ verifyUserMobile: (request) => this.verifyOrganizationUserMobile(request),
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(),
1517
+ };
1518
+ }
1519
+ /**
1520
+ * Access to webhook operations
1521
+ */
1522
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1523
+ get webhooks() {
1524
+ return {
1525
+ verify: (payload, signature, secret) => this.verifyWebhook(payload, signature, secret),
1526
+ };
1527
+ }
1424
1528
  // ORDER CREATION
1425
1529
  // Summary: Create new payment order and get checkout URL
1426
1530
  // Description: Initiates payment process with buyer info and returns secure checkout URL
@@ -1455,10 +1559,10 @@ class TapsilatSDK {
1455
1559
  * @param {string} [orderRequest.payment_success_url] - URL to redirect after successful payment
1456
1560
  * @param {string} [orderRequest.payment_failure_url] - URL to redirect after failed payment
1457
1561
  * @param {number[]} [orderRequest.enabled_installments] - Allowed installment counts
1458
- * @param {Record<string, unknown>} [orderRequest.metadata] - Additional custom data
1562
+ * @param {OrderMetadata[]} [orderRequest.metadata] - Additional custom key/value data
1459
1563
  *
1460
1564
  * @returns {Promise<OrderCreateResponse>} Promise resolving to order creation response
1461
- * @returns {string} OrderCreateResponse.order_id - Internal order identifier
1565
+ * @returns {string} [OrderCreateResponse.id] - Internal order identifier
1462
1566
  * @returns {string} OrderCreateResponse.reference_id - Unique order reference for tracking
1463
1567
  * @returns {string} [OrderCreateResponse.checkout_url] - Payment page URL for customer
1464
1568
  * @returns {string} [OrderCreateResponse.conversation_id] - Echo of provided conversation ID
@@ -1514,16 +1618,6 @@ class TapsilatSDK {
1514
1618
  if (!isValidEmail(buyer.email)) {
1515
1619
  throw new TapsilatValidationError("Buyer email must be a valid email address", { provided: buyer.email });
1516
1620
  }
1517
- // Validate basket items
1518
- if (!orderRequest.basket_items ||
1519
- !Array.isArray(orderRequest.basket_items) ||
1520
- orderRequest.basket_items.length === 0) {
1521
- throw new TapsilatValidationError("Basket items are required and must be a non-empty array");
1522
- }
1523
- // Validate billing address
1524
- if (!orderRequest.billing_address) {
1525
- throw new TapsilatValidationError("Billing address is required");
1526
- }
1527
1621
  try {
1528
1622
  // Make the API request
1529
1623
  const createOrderResponse = await this.httpClient.post("/order/create", orderRequest);
@@ -1545,7 +1639,7 @@ class TapsilatSDK {
1545
1639
  * @description Handles accounting operations for a specific order using its reference ID.
1546
1640
  *
1547
1641
  * @param {OrderAccountingRequest} request - Accounting request details
1548
- * @returns {Promise<APIResponse<unknown>>} Promise resolving to the accounting response
1642
+ * @returns {Promise<OrderAccountingResponse>} Promise resolving to the accounting response
1549
1643
  * @throws {TapsilatValidationError} When input validation fails
1550
1644
  * @throws {TapsilatError} When API returns an error response
1551
1645
  */
@@ -1554,8 +1648,8 @@ class TapsilatSDK {
1554
1648
  throw new TapsilatValidationError("Order reference ID is required and must be a non-empty string", { provided: request.order_reference_id });
1555
1649
  }
1556
1650
  try {
1557
- const response = await this.httpClient.post("/order/accounting", request);
1558
- return handleResponse(response, "Order accounting");
1651
+ const orderAccountingResponse = await this.httpClient.post("/order/accounting", request);
1652
+ return handleResponse(orderAccountingResponse, "Order accounting");
1559
1653
  }
1560
1654
  catch (error) {
1561
1655
  return handleError(error, "order accounting");
@@ -1571,7 +1665,7 @@ class TapsilatSDK {
1571
1665
  * @description Handles post-authorization operations for a specific order.
1572
1666
  *
1573
1667
  * @param {OrderPostAuthRequest} request - Post-authorization request details
1574
- * @returns {Promise<APIResponse<unknown>>} Promise resolving to the post-auth response
1668
+ * @returns {Promise<OrderPostAuthResponse>} Promise resolving to the post-auth response
1575
1669
  * @throws {TapsilatValidationError} When input validation fails
1576
1670
  * @throws {TapsilatError} When API returns an error response
1577
1671
  */
@@ -1585,8 +1679,8 @@ class TapsilatSDK {
1585
1679
  });
1586
1680
  }
1587
1681
  try {
1588
- const response = await this.httpClient.post("/order/postauth", request);
1589
- return handleResponse(response, "Order post-auth");
1682
+ const orderPostAuthResponse = await this.httpClient.post("/order/postauth", request);
1683
+ return handleResponse(orderPostAuthResponse, "Order post-auth");
1590
1684
  }
1591
1685
  catch (error) {
1592
1686
  return handleError(error, "order post-auth");
@@ -1601,18 +1695,122 @@ class TapsilatSDK {
1601
1695
  * @summary Retrieve system order statuses
1602
1696
  * @description Gets a list of all possible order statuses in the system.
1603
1697
  *
1604
- * @returns {Promise<APIResponse<unknown>>} Promise resolving to system order statuses
1698
+ * @returns {Promise<GetSystemOrderStatusesResponse>} Promise resolving to system order statuses
1605
1699
  * @throws {TapsilatError} When API returns an error response
1606
1700
  */
1607
1701
  async getSystemOrderStatuses() {
1608
1702
  try {
1609
- const response = await this.httpClient.get("/system/order-statuses");
1610
- 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");
1611
1705
  }
1612
1706
  catch (error) {
1613
1707
  return handleError(error, "get system order statuses");
1614
1708
  }
1615
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
+ }
1616
1814
  // ORDER RETRIEVAL BY REFERENCE ID
1617
1815
  // Summary: Get complete order details and information
1618
1816
  // Description: Retrieves full order data including buyer info, amounts, and current status
@@ -1685,6 +1883,10 @@ class TapsilatSDK {
1685
1883
  throw new TapsilatValidationError("Items per page must be greater than 0", { provided: params.per_page });
1686
1884
  }
1687
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
+ }
1688
1890
  // Make the API request
1689
1891
  const getOrdersResponse = await this.httpClient.get("/order/list", { params: params });
1690
1892
  // Use our generic response handler
@@ -1710,23 +1912,28 @@ class TapsilatSDK {
1710
1912
  * @throws {TapsilatError} When API returns an error response or order cannot be canceled
1711
1913
  */
1712
1914
  async cancelOrder(referenceId) {
1713
- // Validate referenceId
1714
1915
  if (!isNonEmptyString(referenceId)) {
1715
1916
  throw new TapsilatValidationError("Order referenceId is required and must be a non-empty string", { provided: referenceId });
1716
1917
  }
1717
- const cancelOrderResponse = await this.httpClient.post("/order/cancel", {
1718
- reference_id: referenceId,
1719
- });
1720
- // Check if API call was successful
1721
- if (!cancelOrderResponse.success) {
1722
- throw new TapsilatError(cancelOrderResponse.error?.message ||
1723
- "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;
1724
1933
  }
1725
- // Check if response data exists
1726
- if (!cancelOrderResponse.data) {
1727
- throw new TapsilatError("Order cancellation response data is missing", "CANCELLATION_DATA_MISSING");
1934
+ catch (error) {
1935
+ return handleError(error, "order cancellation");
1728
1936
  }
1729
- return cancelOrderResponse.data;
1730
1937
  }
1731
1938
  // ORDER STATUS RETRIEVAL
1732
1939
  // Summary: Retrieves real-time payment status and tracking information for a specific order
@@ -1737,12 +1944,12 @@ class TapsilatSDK {
1737
1944
  * @summary Retrieves real-time payment status and tracking information for a specific order
1738
1945
  * @description
1739
1946
  * Queries the Tapsilat payment platform to retrieve the current status of an order using its
1740
- * unique reference ID. This method provides real-time information about payment progress,
1741
- * 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
1742
1949
  * and implementing proper order state management in your application.
1743
1950
  *
1744
- * The status information includes payment state (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED),
1745
- * 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:
1746
1953
  * - Check if a payment has been completed after redirecting from checkout
1747
1954
  * - Monitor payment status for pending transactions
1748
1955
  * - Verify order state before fulfilling goods/services
@@ -1751,13 +1958,11 @@ class TapsilatSDK {
1751
1958
  * @param {string} referenceId - Unique order reference identifier from order creation
1752
1959
  *
1753
1960
  * @returns {Promise<OrderStatusResponse>} Promise resolving to current order status information
1754
- * @returns {string} OrderStatusResponse.referenceId - Echo of the provided reference ID
1755
- * @returns {string} OrderStatusResponse.status - Current payment status (CREATED, PENDING_PAYMENT, COMPLETED, CANCELLED, FAILED)
1756
- * @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
1757
1963
  *
1758
1964
  * @throws {TapsilatValidationError} When input validation fails:
1759
1965
  * - Reference ID is null, undefined, or empty string
1760
- * - Reference ID format is invalid (should match order ID pattern)
1761
1966
  * @throws {TapsilatNetworkError} When network request fails:
1762
1967
  * - Connection timeout during status check
1763
1968
  * - DNS resolution failure
@@ -1798,14 +2003,19 @@ class TapsilatSDK {
1798
2003
  * @throws {TapsilatError} When API returns an error response or refund fails
1799
2004
  */
1800
2005
  async refundOrder(refundData) {
1801
- const refundOrderResponse = await this.httpClient.post("/order/refund", refundData);
1802
- if (!refundOrderResponse.success) {
1803
- 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;
1804
2015
  }
1805
- if (!refundOrderResponse.data) {
1806
- throw new TapsilatError("Order refund response data is missing", "REFUND_DATA_MISSING");
2016
+ catch (error) {
2017
+ return handleError(error, "order refund");
1807
2018
  }
1808
- return refundOrderResponse.data;
1809
2019
  }
1810
2020
  // ORDER FULL REFUND OPERATIONS
1811
2021
  // Summary: Process full refund for a completed order
@@ -1822,48 +2032,109 @@ class TapsilatSDK {
1822
2032
  * @throws {TapsilatError} When API returns an error response or full refund fails
1823
2033
  */
1824
2034
  async refundAllOrder(referenceId) {
1825
- const refundAllOrderResponse = await this.httpClient.post("/order/refund-all", {
1826
- reference_id: referenceId,
1827
- });
1828
- if (!refundAllOrderResponse.success) {
1829
- 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;
1830
2047
  }
1831
- if (!refundAllOrderResponse.data) {
1832
- throw new TapsilatError("Full order refund response data is missing", "FULL_REFUND_DATA_MISSING");
2048
+ catch (error) {
2049
+ return handleError(error, "full order refund");
1833
2050
  }
1834
- return refundAllOrderResponse.data;
1835
2051
  }
1836
2052
  // ORDER PAYMENT DETAILS
1837
2053
  // Summary: Retrieve detailed payment transaction information for an order
1838
2054
  // Description: Gets payment method, amount, status, and card info for order transactions
1839
2055
  /**
1840
- * Retrieves the payment details for an order.
2056
+ * Retrieves the payment details for an order via POST request.
1841
2057
  * Based on `get_order_payment_details` from the Python SDK.
1842
- *
1843
- * @summary Retrieve detailed payment transaction information for an order
1844
- * @description Gets payment method, amount, status, and card info for order transactions.
1845
- *
1846
- * @param referenceId - The unique identifier of the order.
1847
- * @param conversationId - Optional conversation ID for more specific querying.
1848
- * @returns Promise resolving to a list of payment details.
1849
- * @throws {TapsilatValidationError} When referenceId is invalid
1850
- * @throws {TapsilatError} When API returns an error response or payment details are missing
1851
2058
  */
1852
- 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) {
1853
2073
  if (!isNonEmptyString(referenceId))
1854
2074
  throw new TapsilatValidationError("Reference ID is required and must be a non-empty string");
1855
- const getOrderPaymentDetailsResponse = conversationId
1856
- ? await this.httpClient.post("/order/payment-details", {
1857
- conversation_id: conversationId,
1858
- })
1859
- : await this.httpClient.get(`/order/${referenceId}/payment-details`);
1860
- if (!getOrderPaymentDetailsResponse.success)
1861
- throw new TapsilatError(getOrderPaymentDetailsResponse.error?.message ||
1862
- "Payment details API call failed", getOrderPaymentDetailsResponse.error?.code ||
1863
- "PAYMENT_DETAILS_API_FAILED");
1864
- if (!getOrderPaymentDetailsResponse.data)
1865
- throw new TapsilatError("Payment details response data is missing", "PAYMENT_DETAILS_DATA_MISSING");
1866
- 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
+ }
1867
2138
  }
1868
2139
  // ORDER LOOKUP BY CONVERSATION ID
1869
2140
  // Summary: Find order using conversation ID instead of reference ID
@@ -1885,13 +2156,18 @@ class TapsilatSDK {
1885
2156
  if (!isNonEmptyString(conversationId)) {
1886
2157
  throw new TapsilatValidationError("Order conversationId is required and must be a non-empty string", { provided: conversationId });
1887
2158
  }
1888
- const getOrderByConversationIdResponse = await this.httpClient.get(`/order/conversation/${conversationId}`);
1889
- if (!getOrderByConversationIdResponse.success)
1890
- throw new TapsilatError(getOrderByConversationIdResponse.error?.message ||
1891
- "Order retrieval by conversation ID failed", getOrderByConversationIdResponse.error?.code || "ORDER_RETRIEVAL_FAILED");
1892
- if (!getOrderByConversationIdResponse.data)
1893
- throw new TapsilatError("Order response data is missing", "ORDER_DATA_MISSING");
1894
- 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
+ }
1895
2171
  }
1896
2172
  // ORDER TRANSACTION HISTORY
1897
2173
  // Summary: Retrieve transaction history for an order
@@ -1913,14 +2189,19 @@ class TapsilatSDK {
1913
2189
  if (!isNonEmptyString(referenceId)) {
1914
2190
  throw new TapsilatValidationError("Order referenceId is required and must be a non-empty string", { provided: referenceId });
1915
2191
  }
1916
- const getOrderTransactionsResponse = await this.httpClient.get(`/order/${referenceId}/transactions`);
1917
- if (!getOrderTransactionsResponse.success)
1918
- throw new TapsilatError(getOrderTransactionsResponse.error?.message ||
1919
- "Order transactions retrieval failed", getOrderTransactionsResponse.error?.code ||
1920
- "TRANSACTIONS_RETRIEVAL_FAILED");
1921
- if (!getOrderTransactionsResponse.data)
1922
- throw new TapsilatError("Order transactions response data is missing", "TRANSACTIONS_DATA_MISSING");
1923
- 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
+ }
1924
2205
  }
1925
2206
  // ORDER SUBMERCHANT LISTING
1926
2207
  // Summary: Retrieve paginated list of submerchants for orders
@@ -1937,16 +2218,15 @@ class TapsilatSDK {
1937
2218
  * @throws {TapsilatError} When API returns an error response
1938
2219
  */
1939
2220
  async getOrderSubmerchants(params = {}) {
1940
- const getOrderSubmerchantsResponse = await this.httpClient.get("/order/submerchants", {
1941
- params: params,
1942
- });
1943
- if (!getOrderSubmerchantsResponse.success)
1944
- throw new TapsilatError(getOrderSubmerchantsResponse.error?.message ||
1945
- "Order submerchants retrieval failed", getOrderSubmerchantsResponse.error?.code ||
1946
- "SUBMERCHANTS_RETRIEVAL_FAILED");
1947
- if (!getOrderSubmerchantsResponse.data)
1948
- throw new TapsilatError("Order submerchants response data is missing", "SUBMERCHANTS_DATA_MISSING");
1949
- 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
+ }
1950
2230
  }
1951
2231
  // ORDER CHECKOUT URL RETRIEVAL
1952
2232
  // Summary: Retrieve checkout URL for existing order
@@ -2006,19 +2286,22 @@ class TapsilatSDK {
2006
2286
  * @throws {TapsilatError} When API health check fails or returns invalid data
2007
2287
  */
2008
2288
  async healthCheck() {
2009
- // We use the direct /health endpoint which returns plain string "OK"
2010
- const healthCheckResponse = await this.httpClient.get("/health");
2011
- if (!healthCheckResponse.success) {
2012
- 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
+ };
2013
2301
  }
2014
- // The API returns "OK" string, verify consistency
2015
- if (healthCheckResponse.data !== "OK") {
2016
- throw new TapsilatError(`Unexpected health check response: ${healthCheckResponse.data}`, "HEALTH_CHECK_INVALID_RESPONSE");
2302
+ catch (error) {
2303
+ return handleError(error, "health check");
2017
2304
  }
2018
- return {
2019
- status: "UP",
2020
- timestamp: new Date().toISOString(),
2021
- };
2022
2305
  }
2023
2306
  // CONFIGURATION MANAGEMENT
2024
2307
  // Summary: Access to the configuration manager for advanced configuration management
@@ -2311,8 +2594,8 @@ class TapsilatSDK {
2311
2594
  payload.conversation_id = conversationId;
2312
2595
  }
2313
2596
  try {
2314
- const response = await this.httpClient.post("/order/manual-callback", payload);
2315
- return handleResponse(response, "Order manual callback");
2597
+ const orderManualCallbackResponse = await this.httpClient.post("/order/callback", payload);
2598
+ return handleResponse(orderManualCallbackResponse, "Order manual callback");
2316
2599
  }
2317
2600
  catch (error) {
2318
2601
  return handleError(error, "order manual callback");
@@ -2326,11 +2609,12 @@ class TapsilatSDK {
2326
2609
  throw new TapsilatValidationError("Related Reference ID is required and must be a non-empty string");
2327
2610
  }
2328
2611
  try {
2329
- const response = await this.httpClient.post("/order/related-update", {
2612
+ const payload = {
2330
2613
  reference_id: referenceId,
2331
2614
  related_reference_id: relatedReferenceId,
2332
- });
2333
- return handleResponse(response, "Order related update");
2615
+ };
2616
+ const orderRelatedUpdateResponse = await this.httpClient.patch("/order/releated", payload);
2617
+ return handleResponse(orderRelatedUpdateResponse, "Order related update");
2334
2618
  }
2335
2619
  catch (error) {
2336
2620
  return handleError(error, "order related update");
@@ -2338,8 +2622,8 @@ class TapsilatSDK {
2338
2622
  }
2339
2623
  async getOrganizationSettings() {
2340
2624
  try {
2341
- const response = await this.httpClient.get("/organization/settings");
2342
- return handleResponse(response, "Get organization settings");
2625
+ const organizationSettingsResponse = await this.httpClient.get("/organization/settings");
2626
+ return handleResponse(organizationSettingsResponse, "Get organization settings");
2343
2627
  }
2344
2628
  catch (error) {
2345
2629
  return handleError(error, "get organization settings");
@@ -2350,20 +2634,280 @@ class TapsilatSDK {
2350
2634
  throw new TapsilatValidationError("Term Reference ID is required and must be a non-empty string");
2351
2635
  }
2352
2636
  try {
2353
- const response = await this.httpClient.get(`/order/term`, {
2637
+ const orderTermResponse = await this.httpClient.get(`/order/term`, {
2354
2638
  params: { term_reference_id: termReferenceId },
2355
2639
  });
2356
- return handleResponse(response, "Get order term");
2640
+ return handleResponse(orderTermResponse, "Get order term");
2357
2641
  }
2358
2642
  catch (error) {
2359
2643
  return handleError(error, "get order term");
2360
2644
  }
2361
2645
  }
2362
2646
  // SUBSCRIPTION METHODS
2647
+ /**
2648
+ * Add a new item to an existing order basket
2649
+ */
2650
+ async addBasketItem(request) {
2651
+ try {
2652
+ const addBasketItemResponse = await this.httpClient.post("/order/basket-item", request);
2653
+ return handleResponse(addBasketItemResponse, "Add basket item");
2654
+ }
2655
+ catch (error) {
2656
+ return handleError(error, "add basket item");
2657
+ }
2658
+ }
2659
+ /**
2660
+ * Remove an item from an existing order basket
2661
+ */
2662
+ async removeBasketItem(request) {
2663
+ try {
2664
+ const removeBasketItemResponse = await this.httpClient.delete("/order/basket-item", request);
2665
+ return handleResponse(removeBasketItemResponse, "Remove basket item");
2666
+ }
2667
+ catch (error) {
2668
+ return handleError(error, "remove basket item");
2669
+ }
2670
+ }
2671
+ /**
2672
+ * Update an existing item in an order basket
2673
+ */
2674
+ async updateBasketItem(request) {
2675
+ try {
2676
+ const updateBasketItemResponse = await this.httpClient.patch("/order/basket-item", request);
2677
+ return handleResponse(updateBasketItemResponse, "Update basket item");
2678
+ }
2679
+ catch (error) {
2680
+ return handleError(error, "update basket item");
2681
+ }
2682
+ }
2683
+ /**
2684
+ * Retrieve organization callback (webhook) settings
2685
+ */
2686
+ async getOrganizationCallback() {
2687
+ try {
2688
+ const organizationCallbackResponse = await this.httpClient.get("/organization/callback");
2689
+ return handleResponse(organizationCallbackResponse, "Get organization callback");
2690
+ }
2691
+ catch (error) {
2692
+ return handleError(error, "get organization callback");
2693
+ }
2694
+ }
2695
+ /**
2696
+ * Update organization callback (webhook) settings
2697
+ */
2698
+ async updateOrganizationCallback(request) {
2699
+ try {
2700
+ const organizationCallbackResponse = await this.httpClient.patch("/organization/callback", request);
2701
+ return handleResponse(organizationCallbackResponse, "Update organization callback");
2702
+ }
2703
+ catch (error) {
2704
+ return handleError(error, "update organization callback");
2705
+ }
2706
+ }
2707
+ /**
2708
+ * Create a new business entity within the organization
2709
+ */
2710
+ async createOrganizationBusiness(request) {
2711
+ try {
2712
+ const organizationBusinessResponse = await this.httpClient.post("/organization/business/create", request);
2713
+ return handleResponse(organizationBusinessResponse, "Create organization business");
2714
+ }
2715
+ catch (error) {
2716
+ return handleError(error, "create organization business");
2717
+ }
2718
+ }
2719
+ /**
2720
+ * Retrieve supported currencies for the organization
2721
+ */
2722
+ async getOrganizationCurrencies() {
2723
+ try {
2724
+ const organizationCurrenciesResponse = await this.httpClient.get("/organization/currencies");
2725
+ return handleResponse(organizationCurrenciesResponse, "Get organization currencies");
2726
+ }
2727
+ catch (error) {
2728
+ return handleError(error, "get organization currencies");
2729
+ }
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
+ }
2774
+ /**
2775
+ * Retrieve limit information for a specific organization user
2776
+ */
2777
+ async getOrganizationLimitUser(request) {
2778
+ try {
2779
+ const organizationLimitUserResponse = await this.httpClient.get("/organization/limit/user", { params: request });
2780
+ return handleResponse(organizationLimitUserResponse, "Get organization user limit");
2781
+ }
2782
+ catch (error) {
2783
+ return handleError(error, "get organization user limit");
2784
+ }
2785
+ }
2786
+ /**
2787
+ * Set limit for a specific organization user
2788
+ */
2789
+ async setOrganizationLimitUser(request) {
2790
+ try {
2791
+ const organizationLimitUserResponse = await this.httpClient.post("/organization/limit/user", request);
2792
+ return handleResponse(organizationLimitUserResponse, "Set organization user limit");
2793
+ }
2794
+ catch (error) {
2795
+ return handleError(error, "set organization user limit");
2796
+ }
2797
+ }
2798
+ /**
2799
+ * Retrieve organization overall limits
2800
+ */
2801
+ async getOrganizationLimits() {
2802
+ try {
2803
+ const organizationLimitsResponse = await this.httpClient.get("/organization/limits");
2804
+ return handleResponse(organizationLimitsResponse, "Get organization limits");
2805
+ }
2806
+ catch (error) {
2807
+ return handleError(error, "get organization limits");
2808
+ }
2809
+ }
2810
+ /**
2811
+ * Retrieve meta information for the organization
2812
+ */
2813
+ async getOrganizationMeta(name) {
2814
+ if (!isNonEmptyString(name)) {
2815
+ throw new TapsilatValidationError("Meta name is required and must be a non-empty string");
2816
+ }
2817
+ try {
2818
+ const organizationMetaResponse = await this.httpClient.get(`/organization/meta/${name}`);
2819
+ return handleResponse(organizationMetaResponse, "Get organization meta");
2820
+ }
2821
+ catch (error) {
2822
+ return handleError(error, "get organization meta");
2823
+ }
2824
+ }
2825
+ /**
2826
+ * Retrieve supported scopes for the organization
2827
+ */
2828
+ async getOrganizationScopes() {
2829
+ try {
2830
+ const organizationScopesResponse = await this.httpClient.get("/organization/scopes");
2831
+ return handleResponse(organizationScopesResponse, "Get organization scopes");
2832
+ }
2833
+ catch (error) {
2834
+ return handleError(error, "get organization scopes");
2835
+ }
2836
+ }
2837
+ /**
2838
+ * Retrieve list of sub-organizations
2839
+ */
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
+ }
2851
+ try {
2852
+ const organizationSuborganizationsResponse = await this.httpClient.get("/organization/suborganizations", { params: params });
2853
+ return handleResponse(organizationSuborganizationsResponse, "Get organization suborganizations");
2854
+ }
2855
+ catch (error) {
2856
+ return handleError(error, "get organization suborganizations");
2857
+ }
2858
+ }
2859
+ /**
2860
+ * Create a new user within the organization
2861
+ */
2862
+ async createOrganizationUser(request) {
2863
+ try {
2864
+ const organizationUserResponse = await this.httpClient.post("/organization/user/create", request);
2865
+ return handleResponse(organizationUserResponse, "Create organization user");
2866
+ }
2867
+ catch (error) {
2868
+ return handleError(error, "create organization user");
2869
+ }
2870
+ }
2871
+ /**
2872
+ * Verify an organization user
2873
+ */
2874
+ async verifyOrganizationUser(request) {
2875
+ try {
2876
+ const organizationUserVerifyResponse = await this.httpClient.post("/organization/user/verify", request);
2877
+ return handleResponse(organizationUserVerifyResponse, "Verify organization user");
2878
+ }
2879
+ catch (error) {
2880
+ return handleError(error, "verify organization user");
2881
+ }
2882
+ }
2883
+ /**
2884
+ * Verify an organization user via mobile
2885
+ */
2886
+ async verifyOrganizationUserMobile(request) {
2887
+ try {
2888
+ const organizationUserMobileVerifyResponse = await this.httpClient.post("/organization/user/verify-mobile", request);
2889
+ return handleResponse(organizationUserMobileVerifyResponse, "Verify organization user mobile");
2890
+ }
2891
+ catch (error) {
2892
+ return handleError(error, "verify organization user mobile");
2893
+ }
2894
+ }
2895
+ /**
2896
+ * List virtual POS terminals for the organization
2897
+ */
2898
+ async listOrganizationVpos(request) {
2899
+ try {
2900
+ const organizationVposResponse = await this.httpClient.post("/organization/list-vpos", request);
2901
+ return handleResponse(organizationVposResponse, "List organization VPOs");
2902
+ }
2903
+ catch (error) {
2904
+ return handleError(error, "list organization VPOs");
2905
+ }
2906
+ }
2363
2907
  async createSubscription(request) {
2364
2908
  try {
2365
- const response = await this.httpClient.post("/subscription/create", request);
2366
- return handleResponse(response, "Create subscription");
2909
+ const subcriptionCreateResponse = await this.httpClient.post("/subscription/create", request);
2910
+ return handleResponse(subcriptionCreateResponse, "Create subscription");
2367
2911
  }
2368
2912
  catch (error) {
2369
2913
  return handleError(error, "create subscription");
@@ -2371,8 +2915,8 @@ class TapsilatSDK {
2371
2915
  }
2372
2916
  async getSubscription(request) {
2373
2917
  try {
2374
- const response = await this.httpClient.post("/subscription", request);
2375
- const data = handleResponse(response, "Get subscription");
2918
+ const subscriptionDetailResponse = await this.httpClient.post("/subscription", request);
2919
+ const data = handleResponse(subscriptionDetailResponse, "Get subscription");
2376
2920
  if (data.orders) {
2377
2921
  data.orders.forEach((order) => {
2378
2922
  if (order.payment_url && !order.payment_url.startsWith("http")) {
@@ -2388,8 +2932,8 @@ class TapsilatSDK {
2388
2932
  }
2389
2933
  async listSubscriptions(params = {}) {
2390
2934
  try {
2391
- const response = await this.httpClient.get("/subscription/list", { params });
2392
- return handleResponse(response, "List subscriptions");
2935
+ const listSubscriptionsResponse = await this.httpClient.get("/subscription/list", { params });
2936
+ return handleResponse(listSubscriptionsResponse, "List subscriptions");
2393
2937
  }
2394
2938
  catch (error) {
2395
2939
  return handleError(error, "list subscriptions");
@@ -2397,8 +2941,8 @@ class TapsilatSDK {
2397
2941
  }
2398
2942
  async cancelSubscription(request) {
2399
2943
  try {
2400
- const response = await this.httpClient.post("/subscription/cancel", request);
2401
- return handleResponse(response, "Cancel subscription");
2944
+ const subscriptionCancelResponse = await this.httpClient.post("/subscription/cancel", request);
2945
+ return handleResponse(subscriptionCancelResponse, "Cancel subscription");
2402
2946
  }
2403
2947
  catch (error) {
2404
2948
  return handleError(error, "cancel subscription");
@@ -2406,8 +2950,8 @@ class TapsilatSDK {
2406
2950
  }
2407
2951
  async redirectSubscription(request) {
2408
2952
  try {
2409
- const response = await this.httpClient.post("/subscription/redirect", request);
2410
- const data = handleResponse(response, "Redirect subscription");
2953
+ const subscriptionRedirectResponse = await this.httpClient.post("/subscription/redirect", request);
2954
+ const data = handleResponse(subscriptionRedirectResponse, "Redirect subscription");
2411
2955
  if (data.url) {
2412
2956
  // Extract subscription ID from the signed URL to create a clean link
2413
2957
  // api returns: /token/subscription/{id}
@@ -2428,5 +2972,23 @@ class TapsilatSDK {
2428
2972
  }
2429
2973
  }
2430
2974
 
2431
- 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 };
2432
2994
  //# sourceMappingURL=index.js.map