@tapsilat/tapsilat-js 2026.1.14 → 2026.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/TapsilatSDK.d.ts +85 -1
- package/dist/TapsilatSDK.d.ts.map +1 -1
- package/dist/index.cjs +288 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +252 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +288 -14
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +167 -15
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +12 -10
package/README.md
CHANGED
package/dist/TapsilatSDK.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigManager } from "./config/ConfigManager";
|
|
2
|
-
import { TapsilatConfig, PaginatedResponse, Order, OrderRefundRequest, OrderRefundResponse, OrderStatusResponse, OrderPaymentDetail, OrderCreateRequest, OrderCreateResponse, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderTermRefundRequest, PaymentTermResponse, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermTerminateRequest, OrderTerminateRequest, OrderTerminateResponse, SubscriptionGetRequest, SubscriptionCancelRequest, SubscriptionCreateRequest, SubscriptionRedirectRequest, SubscriptionDetail, SubscriptionCreateResponse, SubscriptionRedirectResponse, OrganizationSettings, OrderTransaction, OrderSubmerchant, APIResponse, OrderAccountingRequest, OrderPostAuthRequest } from "./types/index";
|
|
2
|
+
import { TapsilatConfig, PaginatedResponse, Order, OrderRefundRequest, OrderRefundResponse, OrderStatusResponse, OrderPaymentDetail, OrderCreateRequest, OrderCreateResponse, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderTermRefundRequest, PaymentTermResponse, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermTerminateRequest, OrderTerminateRequest, OrderTerminateResponse, SubscriptionGetRequest, SubscriptionCancelRequest, SubscriptionCreateRequest, SubscriptionRedirectRequest, SubscriptionDetail, SubscriptionCreateResponse, SubscriptionRedirectResponse, OrganizationSettings, OrderTransaction, OrderSubmerchant, APIResponse, OrderAccountingRequest, OrderPostAuthRequest, AddBasketItemRequest, RemoveBasketItemRequest, UpdateBasketItemRequest, CallbackURLDTO, OrgCreateBusinessRequest, GetUserLimitRequest, SetLimitUserRequest, GetVposRequest, OrgCreateUserReq, OrgUserVerifyReq, OrgUserMobileVerifyReq } from "./types/index";
|
|
3
3
|
/**
|
|
4
4
|
* Main SDK class for Tapsilat payment operations
|
|
5
5
|
*
|
|
@@ -45,6 +45,22 @@ export declare class TapsilatSDK {
|
|
|
45
45
|
* @throws {TypeError} When config parameter is not an object or missing required fields
|
|
46
46
|
*/
|
|
47
47
|
constructor(config: TapsilatConfig);
|
|
48
|
+
/**
|
|
49
|
+
* Access to order operations
|
|
50
|
+
*/
|
|
51
|
+
get orders(): any;
|
|
52
|
+
/**
|
|
53
|
+
* Access to subscription operations
|
|
54
|
+
*/
|
|
55
|
+
get subscriptions(): any;
|
|
56
|
+
/**
|
|
57
|
+
* Access to organization operations
|
|
58
|
+
*/
|
|
59
|
+
get organization(): any;
|
|
60
|
+
/**
|
|
61
|
+
* Access to webhook operations
|
|
62
|
+
*/
|
|
63
|
+
get webhooks(): any;
|
|
48
64
|
/**
|
|
49
65
|
* Creates a new order and returns a checkout URL
|
|
50
66
|
*
|
|
@@ -475,6 +491,74 @@ export declare class TapsilatSDK {
|
|
|
475
491
|
orderRelatedUpdate(referenceId: string, relatedReferenceId: string): Promise<APIResponse<unknown>>;
|
|
476
492
|
getOrganizationSettings(): Promise<OrganizationSettings>;
|
|
477
493
|
getOrderTerm(termReferenceId: string): Promise<PaymentTermResponse>;
|
|
494
|
+
/**
|
|
495
|
+
* Add a new item to an existing order basket
|
|
496
|
+
*/
|
|
497
|
+
addBasketItem(request: AddBasketItemRequest): Promise<APIResponse<unknown>>;
|
|
498
|
+
/**
|
|
499
|
+
* Remove an item from an existing order basket
|
|
500
|
+
*/
|
|
501
|
+
removeBasketItem(request: RemoveBasketItemRequest): Promise<APIResponse<unknown>>;
|
|
502
|
+
/**
|
|
503
|
+
* Update an existing item in an order basket
|
|
504
|
+
*/
|
|
505
|
+
updateBasketItem(request: UpdateBasketItemRequest): Promise<APIResponse<unknown>>;
|
|
506
|
+
/**
|
|
507
|
+
* Retrieve organization callback (webhook) settings
|
|
508
|
+
*/
|
|
509
|
+
getOrganizationCallback(): Promise<APIResponse<CallbackURLDTO>>;
|
|
510
|
+
/**
|
|
511
|
+
* Update organization callback (webhook) settings
|
|
512
|
+
*/
|
|
513
|
+
updateOrganizationCallback(request: CallbackURLDTO): Promise<APIResponse<unknown>>;
|
|
514
|
+
/**
|
|
515
|
+
* Create a new business entity within the organization
|
|
516
|
+
*/
|
|
517
|
+
createOrganizationBusiness(request: OrgCreateBusinessRequest): Promise<APIResponse<unknown>>;
|
|
518
|
+
/**
|
|
519
|
+
* Retrieve supported currencies for the organization
|
|
520
|
+
*/
|
|
521
|
+
getOrganizationCurrencies(): Promise<APIResponse<unknown>>;
|
|
522
|
+
/**
|
|
523
|
+
* Retrieve limit information for a specific organization user
|
|
524
|
+
*/
|
|
525
|
+
getOrganizationLimitUser(request: GetUserLimitRequest): Promise<APIResponse<unknown>>;
|
|
526
|
+
/**
|
|
527
|
+
* Set limit for a specific organization user
|
|
528
|
+
*/
|
|
529
|
+
setOrganizationLimitUser(request: SetLimitUserRequest): Promise<APIResponse<unknown>>;
|
|
530
|
+
/**
|
|
531
|
+
* Retrieve organization overall limits
|
|
532
|
+
*/
|
|
533
|
+
getOrganizationLimits(): Promise<APIResponse<unknown>>;
|
|
534
|
+
/**
|
|
535
|
+
* Retrieve meta information for the organization
|
|
536
|
+
*/
|
|
537
|
+
getOrganizationMeta(): Promise<APIResponse<unknown>>;
|
|
538
|
+
/**
|
|
539
|
+
* Retrieve supported scopes for the organization
|
|
540
|
+
*/
|
|
541
|
+
getOrganizationScopes(): Promise<APIResponse<unknown>>;
|
|
542
|
+
/**
|
|
543
|
+
* Retrieve list of sub-organizations
|
|
544
|
+
*/
|
|
545
|
+
getOrganizationSuborganizations(): Promise<APIResponse<unknown>>;
|
|
546
|
+
/**
|
|
547
|
+
* Create a new user within the organization
|
|
548
|
+
*/
|
|
549
|
+
createOrganizationUser(request: OrgCreateUserReq): Promise<APIResponse<unknown>>;
|
|
550
|
+
/**
|
|
551
|
+
* Verify an organization user
|
|
552
|
+
*/
|
|
553
|
+
verifyOrganizationUser(request: OrgUserVerifyReq): Promise<APIResponse<unknown>>;
|
|
554
|
+
/**
|
|
555
|
+
* Verify an organization user via mobile
|
|
556
|
+
*/
|
|
557
|
+
verifyOrganizationUserMobile(request: OrgUserMobileVerifyReq): Promise<APIResponse<unknown>>;
|
|
558
|
+
/**
|
|
559
|
+
* List virtual POS terminals for the organization
|
|
560
|
+
*/
|
|
561
|
+
listOrganizationVpos(request: GetVposRequest): Promise<APIResponse<unknown>>;
|
|
478
562
|
createSubscription(request: SubscriptionCreateRequest): Promise<SubscriptionCreateResponse>;
|
|
479
563
|
getSubscription(request: SubscriptionGetRequest): Promise<SubscriptionDetail>;
|
|
480
564
|
listSubscriptions(params?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TapsilatSDK.d.ts","sourceRoot":"","sources":["../src/TapsilatSDK.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"TapsilatSDK.d.ts","sourceRoot":"","sources":["../src/TapsilatSDK.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,kBAA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AC,CAAC;IAY1B,oBAAoB,CACxB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,4BAA4B,CAAC;CAyBzC"}
|
package/dist/index.cjs
CHANGED
|
@@ -612,7 +612,7 @@ class HttpClient {
|
|
|
612
612
|
...config?.headers,
|
|
613
613
|
});
|
|
614
614
|
// Set content type for requests with body
|
|
615
|
-
if (body && method !== "GET"
|
|
615
|
+
if (body && method !== "GET") {
|
|
616
616
|
if (!(body instanceof FormData)) {
|
|
617
617
|
headers.set("Content-Type", "application/json");
|
|
618
618
|
}
|
|
@@ -622,8 +622,8 @@ class HttpClient {
|
|
|
622
622
|
headers,
|
|
623
623
|
...config,
|
|
624
624
|
};
|
|
625
|
-
// Add body for non-GET
|
|
626
|
-
if (body && method !== "GET"
|
|
625
|
+
// Add body for non-GET requests
|
|
626
|
+
if (body && method !== "GET") {
|
|
627
627
|
if (body instanceof FormData) {
|
|
628
628
|
options.body = body;
|
|
629
629
|
}
|
|
@@ -1131,7 +1131,7 @@ function validateInstallments(installments) {
|
|
|
1131
1131
|
originalInput: String(originalInput)
|
|
1132
1132
|
};
|
|
1133
1133
|
}
|
|
1134
|
-
let installmentArray
|
|
1134
|
+
let installmentArray;
|
|
1135
1135
|
try {
|
|
1136
1136
|
if (typeof installments === 'number') {
|
|
1137
1137
|
// Single number
|
|
@@ -1423,6 +1423,85 @@ class TapsilatSDK {
|
|
|
1423
1423
|
this.configManager = new ConfigManager(config);
|
|
1424
1424
|
this.httpClient = new HttpClient(this.configManager.getInternalConfig());
|
|
1425
1425
|
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Access to order operations
|
|
1428
|
+
*/
|
|
1429
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1430
|
+
get orders() {
|
|
1431
|
+
return {
|
|
1432
|
+
create: (request) => this.createOrder(request),
|
|
1433
|
+
get: (referenceId) => this.getOrder(referenceId),
|
|
1434
|
+
list: (params) => this.getOrders(params),
|
|
1435
|
+
cancel: (referenceId) => this.cancelOrder(referenceId),
|
|
1436
|
+
status: (referenceId) => this.getOrderStatus(referenceId),
|
|
1437
|
+
refund: (request) => this.refundOrder(request),
|
|
1438
|
+
refundAll: (referenceId) => this.refundAllOrder(referenceId),
|
|
1439
|
+
paymentDetails: (referenceId, conversationId) => this.getOrderPaymentDetails(referenceId, conversationId),
|
|
1440
|
+
byConversationId: (conversationId) => this.getOrderByConversationId(conversationId),
|
|
1441
|
+
transactions: (referenceId) => this.getOrderTransactions(referenceId),
|
|
1442
|
+
submerchants: (params) => this.getOrderSubmerchants(params),
|
|
1443
|
+
checkoutUrl: (referenceId) => this.getCheckoutUrl(referenceId),
|
|
1444
|
+
accounting: (request) => this.orderAccounting(request),
|
|
1445
|
+
postAuth: (request) => this.orderPostAuth(request),
|
|
1446
|
+
manualCallback: (referenceId, conversationId) => this.orderManualCallback(referenceId, conversationId),
|
|
1447
|
+
relatedUpdate: (referenceId, relatedReferenceId) => this.orderRelatedUpdate(referenceId, relatedReferenceId),
|
|
1448
|
+
addBasketItem: (request) => this.addBasketItem(request),
|
|
1449
|
+
removeBasketItem: (request) => this.removeBasketItem(request),
|
|
1450
|
+
updateBasketItem: (request) => this.updateBasketItem(request),
|
|
1451
|
+
createTerm: (request) => this.createOrderTerm(request),
|
|
1452
|
+
updateTerm: (request) => this.updateOrderTerm(request),
|
|
1453
|
+
deleteTerm: (request) => this.deleteOrderTerm(request),
|
|
1454
|
+
refundTerm: (request) => this.refundOrderTerm(request),
|
|
1455
|
+
getTerm: (termReferenceId) => this.getOrderTerm(termReferenceId),
|
|
1456
|
+
terminateTerm: (request) => this.terminateOrderTerm(request),
|
|
1457
|
+
terminate: (request) => this.terminateOrder(request),
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Access to subscription operations
|
|
1462
|
+
*/
|
|
1463
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1464
|
+
get subscriptions() {
|
|
1465
|
+
return {
|
|
1466
|
+
create: (request) => this.createSubscription(request),
|
|
1467
|
+
get: (request) => this.getSubscription(request),
|
|
1468
|
+
list: (params) => this.listSubscriptions(params),
|
|
1469
|
+
cancel: (request) => this.cancelSubscription(request),
|
|
1470
|
+
redirect: (request) => this.redirectSubscription(request),
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Access to organization operations
|
|
1475
|
+
*/
|
|
1476
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1477
|
+
get organization() {
|
|
1478
|
+
return {
|
|
1479
|
+
settings: () => this.getOrganizationSettings(),
|
|
1480
|
+
callback: () => this.getOrganizationCallback(),
|
|
1481
|
+
updateCallback: (request) => this.updateOrganizationCallback(request),
|
|
1482
|
+
createBusiness: (request) => this.createOrganizationBusiness(request),
|
|
1483
|
+
currencies: () => this.getOrganizationCurrencies(),
|
|
1484
|
+
getLimitUser: (request) => this.getOrganizationLimitUser(request),
|
|
1485
|
+
setLimitUser: (request) => this.setOrganizationLimitUser(request),
|
|
1486
|
+
limits: () => this.getOrganizationLimits(),
|
|
1487
|
+
meta: () => this.getOrganizationMeta(),
|
|
1488
|
+
scopes: () => this.getOrganizationScopes(),
|
|
1489
|
+
suborganizations: () => this.getOrganizationSuborganizations(),
|
|
1490
|
+
createUser: (request) => this.createOrganizationUser(request),
|
|
1491
|
+
verifyUser: (request) => this.verifyOrganizationUser(request),
|
|
1492
|
+
verifyUserMobile: (request) => this.verifyOrganizationUserMobile(request),
|
|
1493
|
+
listVpos: (request) => this.listOrganizationVpos(request),
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Access to webhook operations
|
|
1498
|
+
*/
|
|
1499
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1500
|
+
get webhooks() {
|
|
1501
|
+
return {
|
|
1502
|
+
verify: (payload, signature, secret) => this.verifyWebhook(payload, signature, secret),
|
|
1503
|
+
};
|
|
1504
|
+
}
|
|
1426
1505
|
// ORDER CREATION
|
|
1427
1506
|
// Summary: Create new payment order and get checkout URL
|
|
1428
1507
|
// Description: Initiates payment process with buyer info and returns secure checkout URL
|
|
@@ -1516,16 +1595,7 @@ class TapsilatSDK {
|
|
|
1516
1595
|
if (!isValidEmail(buyer.email)) {
|
|
1517
1596
|
throw new TapsilatValidationError("Buyer email must be a valid email address", { provided: buyer.email });
|
|
1518
1597
|
}
|
|
1519
|
-
//
|
|
1520
|
-
if (!orderRequest.basket_items ||
|
|
1521
|
-
!Array.isArray(orderRequest.basket_items) ||
|
|
1522
|
-
orderRequest.basket_items.length === 0) {
|
|
1523
|
-
throw new TapsilatValidationError("Basket items are required and must be a non-empty array");
|
|
1524
|
-
}
|
|
1525
|
-
// Validate billing address
|
|
1526
|
-
if (!orderRequest.billing_address) {
|
|
1527
|
-
throw new TapsilatValidationError("Billing address is required");
|
|
1528
|
-
}
|
|
1598
|
+
// Basket items and billing address are optional in Python ref and Swagger
|
|
1529
1599
|
try {
|
|
1530
1600
|
// Make the API request
|
|
1531
1601
|
const createOrderResponse = await this.httpClient.post("/order/create", orderRequest);
|
|
@@ -2362,6 +2432,210 @@ class TapsilatSDK {
|
|
|
2362
2432
|
}
|
|
2363
2433
|
}
|
|
2364
2434
|
// SUBSCRIPTION METHODS
|
|
2435
|
+
/**
|
|
2436
|
+
* Add a new item to an existing order basket
|
|
2437
|
+
*/
|
|
2438
|
+
async addBasketItem(request) {
|
|
2439
|
+
try {
|
|
2440
|
+
const response = await this.httpClient.post("/order/basket-item", request);
|
|
2441
|
+
return handleResponse(response, "Add basket item");
|
|
2442
|
+
}
|
|
2443
|
+
catch (error) {
|
|
2444
|
+
return handleError(error, "add basket item");
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
/**
|
|
2448
|
+
* Remove an item from an existing order basket
|
|
2449
|
+
*/
|
|
2450
|
+
async removeBasketItem(request) {
|
|
2451
|
+
try {
|
|
2452
|
+
const response = await this.httpClient.delete("/order/basket-item", request);
|
|
2453
|
+
return handleResponse(response, "Remove basket item");
|
|
2454
|
+
}
|
|
2455
|
+
catch (error) {
|
|
2456
|
+
return handleError(error, "remove basket item");
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Update an existing item in an order basket
|
|
2461
|
+
*/
|
|
2462
|
+
async updateBasketItem(request) {
|
|
2463
|
+
try {
|
|
2464
|
+
const response = await this.httpClient.patch("/order/basket-item", request);
|
|
2465
|
+
return handleResponse(response, "Update basket item");
|
|
2466
|
+
}
|
|
2467
|
+
catch (error) {
|
|
2468
|
+
return handleError(error, "update basket item");
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
/**
|
|
2472
|
+
* Retrieve organization callback (webhook) settings
|
|
2473
|
+
*/
|
|
2474
|
+
async getOrganizationCallback() {
|
|
2475
|
+
try {
|
|
2476
|
+
const response = await this.httpClient.get("/organization/callback");
|
|
2477
|
+
return handleResponse(response, "Get organization callback");
|
|
2478
|
+
}
|
|
2479
|
+
catch (error) {
|
|
2480
|
+
return handleError(error, "get organization callback");
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* Update organization callback (webhook) settings
|
|
2485
|
+
*/
|
|
2486
|
+
async updateOrganizationCallback(request) {
|
|
2487
|
+
try {
|
|
2488
|
+
const response = await this.httpClient.patch("/organization/callback", request);
|
|
2489
|
+
return handleResponse(response, "Update organization callback");
|
|
2490
|
+
}
|
|
2491
|
+
catch (error) {
|
|
2492
|
+
return handleError(error, "update organization callback");
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Create a new business entity within the organization
|
|
2497
|
+
*/
|
|
2498
|
+
async createOrganizationBusiness(request) {
|
|
2499
|
+
try {
|
|
2500
|
+
const response = await this.httpClient.post("/organization/business/create", request);
|
|
2501
|
+
return handleResponse(response, "Create organization business");
|
|
2502
|
+
}
|
|
2503
|
+
catch (error) {
|
|
2504
|
+
return handleError(error, "create organization business");
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
/**
|
|
2508
|
+
* Retrieve supported currencies for the organization
|
|
2509
|
+
*/
|
|
2510
|
+
async getOrganizationCurrencies() {
|
|
2511
|
+
try {
|
|
2512
|
+
const response = await this.httpClient.get("/organization/currencies");
|
|
2513
|
+
return handleResponse(response, "Get organization currencies");
|
|
2514
|
+
}
|
|
2515
|
+
catch (error) {
|
|
2516
|
+
return handleError(error, "get organization currencies");
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* Retrieve limit information for a specific organization user
|
|
2521
|
+
*/
|
|
2522
|
+
async getOrganizationLimitUser(request) {
|
|
2523
|
+
try {
|
|
2524
|
+
const response = await this.httpClient.get("/organization/limit/user", { params: request });
|
|
2525
|
+
return handleResponse(response, "Get organization user limit");
|
|
2526
|
+
}
|
|
2527
|
+
catch (error) {
|
|
2528
|
+
return handleError(error, "get organization user limit");
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
/**
|
|
2532
|
+
* Set limit for a specific organization user
|
|
2533
|
+
*/
|
|
2534
|
+
async setOrganizationLimitUser(request) {
|
|
2535
|
+
try {
|
|
2536
|
+
const response = await this.httpClient.post("/organization/limit/user", request);
|
|
2537
|
+
return handleResponse(response, "Set organization user limit");
|
|
2538
|
+
}
|
|
2539
|
+
catch (error) {
|
|
2540
|
+
return handleError(error, "set organization user limit");
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Retrieve organization overall limits
|
|
2545
|
+
*/
|
|
2546
|
+
async getOrganizationLimits() {
|
|
2547
|
+
try {
|
|
2548
|
+
const response = await this.httpClient.get("/organization/limits");
|
|
2549
|
+
return handleResponse(response, "Get organization limits");
|
|
2550
|
+
}
|
|
2551
|
+
catch (error) {
|
|
2552
|
+
return handleError(error, "get organization limits");
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
/**
|
|
2556
|
+
* Retrieve meta information for the organization
|
|
2557
|
+
*/
|
|
2558
|
+
async getOrganizationMeta() {
|
|
2559
|
+
try {
|
|
2560
|
+
const response = await this.httpClient.get("/organization/meta");
|
|
2561
|
+
return handleResponse(response, "Get organization meta");
|
|
2562
|
+
}
|
|
2563
|
+
catch (error) {
|
|
2564
|
+
return handleError(error, "get organization meta");
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
/**
|
|
2568
|
+
* Retrieve supported scopes for the organization
|
|
2569
|
+
*/
|
|
2570
|
+
async getOrganizationScopes() {
|
|
2571
|
+
try {
|
|
2572
|
+
const response = await this.httpClient.get("/organization/scopes");
|
|
2573
|
+
return handleResponse(response, "Get organization scopes");
|
|
2574
|
+
}
|
|
2575
|
+
catch (error) {
|
|
2576
|
+
return handleError(error, "get organization scopes");
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
/**
|
|
2580
|
+
* Retrieve list of sub-organizations
|
|
2581
|
+
*/
|
|
2582
|
+
async getOrganizationSuborganizations() {
|
|
2583
|
+
try {
|
|
2584
|
+
const response = await this.httpClient.get("/organization/suborganizations");
|
|
2585
|
+
return handleResponse(response, "Get organization suborganizations");
|
|
2586
|
+
}
|
|
2587
|
+
catch (error) {
|
|
2588
|
+
return handleError(error, "get organization suborganizations");
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Create a new user within the organization
|
|
2593
|
+
*/
|
|
2594
|
+
async createOrganizationUser(request) {
|
|
2595
|
+
try {
|
|
2596
|
+
const response = await this.httpClient.post("/organization/user/create", request);
|
|
2597
|
+
return handleResponse(response, "Create organization user");
|
|
2598
|
+
}
|
|
2599
|
+
catch (error) {
|
|
2600
|
+
return handleError(error, "create organization user");
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Verify an organization user
|
|
2605
|
+
*/
|
|
2606
|
+
async verifyOrganizationUser(request) {
|
|
2607
|
+
try {
|
|
2608
|
+
const response = await this.httpClient.post("/organization/user/verify", request);
|
|
2609
|
+
return handleResponse(response, "Verify organization user");
|
|
2610
|
+
}
|
|
2611
|
+
catch (error) {
|
|
2612
|
+
return handleError(error, "verify organization user");
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
/**
|
|
2616
|
+
* Verify an organization user via mobile
|
|
2617
|
+
*/
|
|
2618
|
+
async verifyOrganizationUserMobile(request) {
|
|
2619
|
+
try {
|
|
2620
|
+
const response = await this.httpClient.post("/organization/user/verify-mobile", request);
|
|
2621
|
+
return handleResponse(response, "Verify organization user mobile");
|
|
2622
|
+
}
|
|
2623
|
+
catch (error) {
|
|
2624
|
+
return handleError(error, "verify organization user mobile");
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* List virtual POS terminals for the organization
|
|
2629
|
+
*/
|
|
2630
|
+
async listOrganizationVpos(request) {
|
|
2631
|
+
try {
|
|
2632
|
+
const response = await this.httpClient.post("/organization/list-vpos", request);
|
|
2633
|
+
return handleResponse(response, "List organization VPOs");
|
|
2634
|
+
}
|
|
2635
|
+
catch (error) {
|
|
2636
|
+
return handleError(error, "list organization VPOs");
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2365
2639
|
async createSubscription(request) {
|
|
2366
2640
|
try {
|
|
2367
2641
|
const response = await this.httpClient.post("/subscription/create", request);
|