@adiba-banking-cloud/backoffice-console-ob-api-sdk 0.1.1

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.
Files changed (36) hide show
  1. package/README.md +129 -0
  2. package/dist/index.cjs.js +549 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.esm.js +527 -0
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/types/features/applications/api.d.ts +6 -0
  7. package/dist/types/features/applications/types.d.ts +166 -0
  8. package/dist/types/features/consents/api.d.ts +6 -0
  9. package/dist/types/features/consents/types.d.ts +85 -0
  10. package/dist/types/features/customers/api.d.ts +12 -0
  11. package/dist/types/features/customers/types.d.ts +185 -0
  12. package/dist/types/features/dashboard/api.d.ts +6 -0
  13. package/dist/types/features/dashboard/types.d.ts +67 -0
  14. package/dist/types/features/health/api.d.ts +2 -0
  15. package/dist/types/features/health/types.d.ts +1 -0
  16. package/dist/types/features/merchants/api.d.ts +7 -0
  17. package/dist/types/features/merchants/types.d.ts +115 -0
  18. package/dist/types/features/providers/api.d.ts +8 -0
  19. package/dist/types/features/providers/types.d.ts +136 -0
  20. package/dist/types/features/purposes/api.d.ts +8 -0
  21. package/dist/types/features/purposes/types.d.ts +135 -0
  22. package/dist/types/index.d.ts +20 -0
  23. package/dist/types/shared/api/client.d.ts +2 -0
  24. package/dist/types/shared/api/endpoints/applications.endpoints.d.ts +7 -0
  25. package/dist/types/shared/api/endpoints/consents.endpoints.d.ts +7 -0
  26. package/dist/types/shared/api/endpoints/customers.endpoints.d.ts +13 -0
  27. package/dist/types/shared/api/endpoints/dashboard.endpoints.d.ts +7 -0
  28. package/dist/types/shared/api/endpoints/health.endpoints.d.ts +3 -0
  29. package/dist/types/shared/api/endpoints/index.d.ts +66 -0
  30. package/dist/types/shared/api/endpoints/merchants.endpoints.d.ts +8 -0
  31. package/dist/types/shared/api/endpoints/providers.endpoints.d.ts +9 -0
  32. package/dist/types/shared/api/endpoints/purposes.endpoints.d.ts +9 -0
  33. package/dist/types/shared/api/endpoints.d.ts +1 -0
  34. package/dist/types/shared/config/api.config.d.ts +22 -0
  35. package/dist/types/shared/types/index.d.ts +37 -0
  36. package/package.json +29 -0
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # @adiba-banking-cloud/backoffice-console-ob-api-sdk
2
+
3
+ Open Banking API SDK for ADIBA backoffice console applications.
4
+
5
+ This package follows the same runtime/client/export paradigm as the Retail
6
+ Engine SDK, but is sourced from the Open Banking OpenAPI document at
7
+ [`document.yaml`](../document.yaml).
8
+
9
+ ## Collections
10
+
11
+ The SDK currently includes typed support for:
12
+
13
+ - `Applications`
14
+ - `Consents`
15
+ - `Customers`
16
+ - `Dashboard`
17
+ - `Health`
18
+ - `Merchants`
19
+ - `Providers`
20
+ - `Purposes`
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install @adiba-banking-cloud/backoffice-console-ob-api-sdk
26
+ ```
27
+
28
+ ## Configuration
29
+
30
+ Configure the SDK once at app startup:
31
+
32
+ ```ts
33
+ import { configureBackofficeOpenBankingSdk } from "@adiba-banking-cloud/backoffice-console-ob-api-sdk";
34
+
35
+ configureBackofficeOpenBankingSdk({
36
+ baseURL: "https://api.s2.adiba.app/automation/bo/ob/0.0.1",
37
+ requireAuth: true,
38
+ getAccessToken: async () => {
39
+ return localStorage.getItem("access_token") ?? undefined;
40
+ },
41
+ onUnauthorized: async () => {
42
+ // handle token expiry / redirect to login
43
+ },
44
+ });
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ### Applications
50
+
51
+ ```ts
52
+ import { ApplicationsApi } from "@adiba-banking-cloud/backoffice-console-ob-api-sdk";
53
+
54
+ const response = await ApplicationsApi.listApplications({
55
+ page: 1,
56
+ limit: 10,
57
+ applicationStatus: "ACTIVE",
58
+ });
59
+
60
+ console.log(response.data.data);
61
+ ```
62
+
63
+ ### Providers
64
+
65
+ ```ts
66
+ import { ProvidersApi } from "@adiba-banking-cloud/backoffice-console-ob-api-sdk";
67
+
68
+ const response = await ProvidersApi.getProviderByCode("TPP-001");
69
+
70
+ console.log(response.data.tppName);
71
+ ```
72
+
73
+ ## Public API
74
+
75
+ ### Runtime exports
76
+
77
+ - `configureBackofficeOpenBankingSdk`
78
+ - `setApiBaseUrl`
79
+ - `setAccessTokenProvider`
80
+ - `apiClient`
81
+ - `API_ENDPOINTS`
82
+
83
+ ### Feature exports
84
+
85
+ - `ApplicationsApi`
86
+ - `ConsentsApi`
87
+ - `CustomersApi`
88
+ - `DashboardApi`
89
+ - `HealthApi`
90
+ - `MerchantsApi`
91
+ - `ProvidersApi`
92
+ - `PurposesApi`
93
+
94
+ ### Type exports
95
+
96
+ The package re-exports feature types from each collection barrel, including:
97
+
98
+ - list query params and paginated response shapes
99
+ - create and update request payloads
100
+ - entity summary and detail payloads
101
+ - bulk operation payloads and success responses
102
+
103
+ ## Notes on typing
104
+
105
+ This SDK follows `document.yaml` as the source of truth.
106
+
107
+ Where the spec provides concrete request or response structures, those are typed
108
+ directly. Where the spec has malformed inline schemas or underspecified payloads
109
+ (for example the bulk merchant hold and purpose update bodies), the SDK keeps
110
+ those payloads intentionally conservative and documented instead of inventing
111
+ fields that were not reliably described.
112
+
113
+ The provider creation endpoint is documented as `multipart/form-data`. The SDK
114
+ accepts either a browser `FormData` instance or a typed field object and will
115
+ prepare multipart data when `FormData` is available at runtime.
116
+
117
+ ## Development
118
+
119
+ Build the package:
120
+
121
+ ```bash
122
+ npm run build
123
+ ```
124
+
125
+ Type-check the package:
126
+
127
+ ```bash
128
+ npx tsc --noEmit
129
+ ```
@@ -0,0 +1,549 @@
1
+ 'use strict';
2
+
3
+ var axios = require('axios');
4
+
5
+ const runtimeProcess = globalThis.process;
6
+ let API_BASE_URL = runtimeProcess?.env?.API_BASE_URL || "";
7
+ let ACCESS_TOKEN_PROVIDER;
8
+ let DEFAULT_HEADERS = {};
9
+ let UNAUTHORIZED_HANDLER;
10
+ let REQUEST_TIMEOUT = 30000;
11
+ let REQUIRE_AUTH = false;
12
+ class MissingAccessTokenError extends Error {
13
+ constructor() {
14
+ super("Missing access token. Configure the SDK with a getAccessToken provider before making authenticated API calls.");
15
+ this.name = "MissingAccessTokenError";
16
+ }
17
+ }
18
+ function setApiBaseUrl(url) {
19
+ API_BASE_URL = url;
20
+ }
21
+ function setAccessTokenProvider(provider) {
22
+ ACCESS_TOKEN_PROVIDER = provider;
23
+ }
24
+ function configureBackofficeOpenBankingSdk(config) {
25
+ if (config.baseURL) {
26
+ setApiBaseUrl(config.baseURL);
27
+ }
28
+ if (config.timeout) {
29
+ REQUEST_TIMEOUT = config.timeout;
30
+ }
31
+ if (config.headers) {
32
+ DEFAULT_HEADERS = { ...DEFAULT_HEADERS, ...config.headers };
33
+ }
34
+ if ("getAccessToken" in config) {
35
+ setAccessTokenProvider(config.getAccessToken);
36
+ }
37
+ if ("requireAuth" in config) {
38
+ REQUIRE_AUTH = Boolean(config.requireAuth);
39
+ }
40
+ if ("onUnauthorized" in config) {
41
+ UNAUTHORIZED_HANDLER = config.onUnauthorized;
42
+ }
43
+ }
44
+ function getApiBaseUrl() {
45
+ return API_BASE_URL;
46
+ }
47
+ function getAccessTokenProvider() {
48
+ return ACCESS_TOKEN_PROVIDER;
49
+ }
50
+ function getDefaultHeaders() {
51
+ return DEFAULT_HEADERS;
52
+ }
53
+ function getUnauthorizedHandler() {
54
+ return UNAUTHORIZED_HANDLER;
55
+ }
56
+ function getApiTimeout() {
57
+ return REQUEST_TIMEOUT;
58
+ }
59
+ function shouldRequireAuth() {
60
+ return REQUIRE_AUTH;
61
+ }
62
+ const API_TIMEOUT = REQUEST_TIMEOUT;
63
+
64
+ let _apiClient = null;
65
+ let _cachedBaseUrl = null;
66
+ let _cachedTimeout = null;
67
+ const ENVIRONMENT_STORAGE_KEY = "backoffice.environment";
68
+ function getSandboxHeaderValue() {
69
+ if (typeof window === "undefined") {
70
+ return "false";
71
+ }
72
+ try {
73
+ return window.localStorage.getItem(ENVIRONMENT_STORAGE_KEY) === "sandbox"
74
+ ? "true"
75
+ : "false";
76
+ }
77
+ catch {
78
+ return "false";
79
+ }
80
+ }
81
+ async function attachAuthHeaders(config) {
82
+ const headers = axios.AxiosHeaders.from(config.headers);
83
+ Object.entries(getDefaultHeaders()).forEach(([key, value]) => {
84
+ if (!headers.has(key)) {
85
+ headers.set(key, value);
86
+ }
87
+ });
88
+ headers.set("x-adb-sandbox", getSandboxHeaderValue());
89
+ const getAccessToken = getAccessTokenProvider();
90
+ const token = await getAccessToken?.();
91
+ if (shouldRequireAuth() && !token) {
92
+ throw new MissingAccessTokenError();
93
+ }
94
+ if (token) {
95
+ headers.set("Authorization", `Bearer ${token}`);
96
+ }
97
+ config.headers = headers;
98
+ return config;
99
+ }
100
+ async function handleUnauthorized(error) {
101
+ if (error.response?.status === 401) {
102
+ await getUnauthorizedHandler()?.(error);
103
+ }
104
+ return Promise.reject(error);
105
+ }
106
+ function getApiClient() {
107
+ const currentBaseUrl = getApiBaseUrl();
108
+ const currentTimeout = getApiTimeout();
109
+ if (!_apiClient ||
110
+ _cachedBaseUrl !== currentBaseUrl ||
111
+ _cachedTimeout !== currentTimeout) {
112
+ _apiClient = axios.create({
113
+ baseURL: currentBaseUrl,
114
+ timeout: currentTimeout,
115
+ headers: {
116
+ "Content-Type": "application/json",
117
+ },
118
+ });
119
+ _apiClient.interceptors.request.use(attachAuthHeaders, (error) => {
120
+ return Promise.reject(error);
121
+ });
122
+ _apiClient.interceptors.response.use((response) => response, handleUnauthorized);
123
+ _cachedBaseUrl = currentBaseUrl;
124
+ _cachedTimeout = currentTimeout;
125
+ }
126
+ return _apiClient;
127
+ }
128
+ const apiClient = new Proxy({}, {
129
+ get(target, prop) {
130
+ const client = getApiClient();
131
+ const value = client[prop];
132
+ return typeof value === "function" ? value.bind(client) : value;
133
+ },
134
+ });
135
+
136
+ const applicationsEndpoints = {
137
+ list: "/ob/applications",
138
+ create: "/ob/applications",
139
+ detail: (code) => `/ob/applications/${encodeURIComponent(code)}`,
140
+ updateStatus: (code) => `/ob/applications/${encodeURIComponent(code)}/status`,
141
+ updateConfiguration: (code) => `/ob/applications/${encodeURIComponent(code)}/configuration`,
142
+ };
143
+
144
+ const consentsEndpoints = {
145
+ list: "/ob/consents",
146
+ detail: (reference) => `/ob/consents/${encodeURIComponent(reference)}`,
147
+ updateStatus: (reference) => `/ob/consents/${encodeURIComponent(reference)}/status`,
148
+ notify: (reference) => `/ob/consents/${encodeURIComponent(reference)}/notify`,
149
+ bulkRevoke: "/ob/consents/bulk-revoke",
150
+ };
151
+
152
+ const customersEndpoints = {
153
+ list: "/ob/customers",
154
+ create: "/ob/customers",
155
+ detail: (reference) => `/ob/customers/${encodeURIComponent(reference)}`,
156
+ identification: (reference) => `/ob/customers/${encodeURIComponent(reference)}/identification`,
157
+ contactAddress: (reference) => `/ob/customers/${encodeURIComponent(reference)}/contact-address`,
158
+ employmentBusiness: (reference) => `/ob/customers/${encodeURIComponent(reference)}/employment-business`,
159
+ reviewKyc: (reference) => `/ob/customers/${encodeURIComponent(reference)}/kyc/review`,
160
+ reviewSteps: (reference) => `/ob/customers/${encodeURIComponent(reference)}/kyc/review-steps`,
161
+ consentHistory: (reference) => `/ob/customers/${encodeURIComponent(reference)}/consents/history`,
162
+ revokeConsent: (reference) => `/ob/customers/${encodeURIComponent(reference)}/consent/revoke`,
163
+ interactions: (reference) => `/ob/customers/${encodeURIComponent(reference)}/interactions`,
164
+ };
165
+
166
+ const dashboardEndpoints = {
167
+ summary: "/ob/dashboard/summary",
168
+ apiPerformance: "/ob/dashboard/analytics/api-performance",
169
+ topApis: "/ob/dashboard/analytics/top-apis",
170
+ topTpps: "/ob/dashboard/analytics/top-tpps",
171
+ recentAlarms: "/ob/dashboard/alarms/recent",
172
+ };
173
+
174
+ const healthEndpoints = {
175
+ check: "/healthz",
176
+ };
177
+
178
+ const merchantsEndpoints = {
179
+ list: "/ob/merchants",
180
+ create: "/ob/merchants",
181
+ detail: (code) => `/ob/merchants/${encodeURIComponent(code)}`,
182
+ updateStatus: (code) => `/ob/merchants/${encodeURIComponent(code)}/status`,
183
+ initiateSettlement: (code) => `/ob/merchants/${encodeURIComponent(code)}/settlements/initiate`,
184
+ bulkSettlementHold: "/ob/merchants/settlements/hold",
185
+ };
186
+
187
+ const providersEndpoints = {
188
+ list: "/ob/providers",
189
+ create: "/ob/providers",
190
+ detail: (code) => `/ob/providers/${encodeURIComponent(code)}`,
191
+ documents: (code) => `/ob/providers/${encodeURIComponent(code)}/documents`,
192
+ rotateKey: (code) => `/ob/providers/${encodeURIComponent(code)}/rotate-key`,
193
+ merchants: (code) => `/ob/providers/${encodeURIComponent(code)}/merchants`,
194
+ applications: (code) => `/ob/providers/${encodeURIComponent(code)}/applications`,
195
+ };
196
+
197
+ const purposesEndpoints = {
198
+ list: "/ob/purposes",
199
+ create: "/ob/purposes",
200
+ detail: (code) => `/ob/purposes/${encodeURIComponent(code)}`,
201
+ update: (code) => `/ob/purposes/${encodeURIComponent(code)}`,
202
+ updateStatus: (code) => `/ob/purposes/${encodeURIComponent(code)}/status`,
203
+ usage: (code) => `/ob/purposes/${encodeURIComponent(code)}/usage`,
204
+ bulkStatusUpdate: "/ob/purposes/status/bulk",
205
+ };
206
+
207
+ const API_ENDPOINTS = {
208
+ applications: applicationsEndpoints,
209
+ consents: consentsEndpoints,
210
+ customers: customersEndpoints,
211
+ dashboard: dashboardEndpoints,
212
+ health: healthEndpoints,
213
+ merchants: merchantsEndpoints,
214
+ providers: providersEndpoints,
215
+ purposes: purposesEndpoints,
216
+ };
217
+
218
+ const listApplications = async (params) => {
219
+ const { data } = await apiClient.get(API_ENDPOINTS.applications.list, { params });
220
+ return data;
221
+ };
222
+ const createApplication = async (payload) => {
223
+ const { data } = await apiClient.post(API_ENDPOINTS.applications.create, payload);
224
+ return data;
225
+ };
226
+ const getApplicationByCode = async (code) => {
227
+ const { data } = await apiClient.get(API_ENDPOINTS.applications.detail(code));
228
+ return data;
229
+ };
230
+ const updateApplicationStatus = async (code, payload) => {
231
+ const { data } = await apiClient.patch(API_ENDPOINTS.applications.updateStatus(code), payload);
232
+ return data;
233
+ };
234
+ const updateApplicationConfiguration = async (code, payload) => {
235
+ const { data } = await apiClient.patch(API_ENDPOINTS.applications.updateConfiguration(code), payload);
236
+ return data;
237
+ };
238
+
239
+ var api$7 = /*#__PURE__*/Object.freeze({
240
+ __proto__: null,
241
+ createApplication: createApplication,
242
+ getApplicationByCode: getApplicationByCode,
243
+ listApplications: listApplications,
244
+ updateApplicationConfiguration: updateApplicationConfiguration,
245
+ updateApplicationStatus: updateApplicationStatus
246
+ });
247
+
248
+ const listConsents = async (params) => {
249
+ const { data } = await apiClient.get(API_ENDPOINTS.consents.list, { params });
250
+ return data;
251
+ };
252
+ const getConsentByReference = async (reference) => {
253
+ const { data } = await apiClient.get(API_ENDPOINTS.consents.detail(reference));
254
+ return data;
255
+ };
256
+ const updateConsentStatus = async (reference, payload) => {
257
+ const { data } = await apiClient.patch(API_ENDPOINTS.consents.updateStatus(reference), payload);
258
+ return data;
259
+ };
260
+ const notifyConsent = async (reference, payload) => {
261
+ const { data } = await apiClient.post(API_ENDPOINTS.consents.notify(reference), payload);
262
+ return data;
263
+ };
264
+ const bulkRevokeConsents = async (payload) => {
265
+ const { data } = await apiClient.post(API_ENDPOINTS.consents.bulkRevoke, payload);
266
+ return data;
267
+ };
268
+
269
+ var api$6 = /*#__PURE__*/Object.freeze({
270
+ __proto__: null,
271
+ bulkRevokeConsents: bulkRevokeConsents,
272
+ getConsentByReference: getConsentByReference,
273
+ listConsents: listConsents,
274
+ notifyConsent: notifyConsent,
275
+ updateConsentStatus: updateConsentStatus
276
+ });
277
+
278
+ const listCustomers = async (params) => {
279
+ const { data } = await apiClient.get(API_ENDPOINTS.customers.list, { params });
280
+ return data;
281
+ };
282
+ const createCustomer = async (payload) => {
283
+ const { data } = await apiClient.post(API_ENDPOINTS.customers.create, payload);
284
+ return data;
285
+ };
286
+ const getCustomerByReference = async (reference) => {
287
+ const { data } = await apiClient.get(API_ENDPOINTS.customers.detail(reference));
288
+ return data;
289
+ };
290
+ const getCustomerIdentification = async (reference) => {
291
+ const { data } = await apiClient.get(API_ENDPOINTS.customers.identification(reference));
292
+ return data;
293
+ };
294
+ const getCustomerContactAddress = async (reference) => {
295
+ const { data } = await apiClient.get(API_ENDPOINTS.customers.contactAddress(reference));
296
+ return data;
297
+ };
298
+ const getCustomerEmploymentBusiness = async (reference) => {
299
+ const { data } = await apiClient.get(API_ENDPOINTS.customers.employmentBusiness(reference));
300
+ return data;
301
+ };
302
+ const reviewCustomerKyc = async (reference, payload) => {
303
+ const { data } = await apiClient.post(API_ENDPOINTS.customers.reviewKyc(reference), payload);
304
+ return data;
305
+ };
306
+ const getCustomerKycReviewSteps = async (reference) => {
307
+ const { data } = await apiClient.get(API_ENDPOINTS.customers.reviewSteps(reference));
308
+ return data;
309
+ };
310
+ const getCustomerConsentHistory = async (reference, params) => {
311
+ const { data } = await apiClient.get(API_ENDPOINTS.customers.consentHistory(reference), { params });
312
+ return data;
313
+ };
314
+ const revokeCustomerConsent = async (reference, payload) => {
315
+ const { data } = await apiClient.post(API_ENDPOINTS.customers.revokeConsent(reference), payload);
316
+ return data;
317
+ };
318
+ const createCustomerInteraction = async (reference, payload) => {
319
+ const { data } = await apiClient.post(API_ENDPOINTS.customers.interactions(reference), payload);
320
+ return data;
321
+ };
322
+
323
+ var api$5 = /*#__PURE__*/Object.freeze({
324
+ __proto__: null,
325
+ createCustomer: createCustomer,
326
+ createCustomerInteraction: createCustomerInteraction,
327
+ getCustomerByReference: getCustomerByReference,
328
+ getCustomerConsentHistory: getCustomerConsentHistory,
329
+ getCustomerContactAddress: getCustomerContactAddress,
330
+ getCustomerEmploymentBusiness: getCustomerEmploymentBusiness,
331
+ getCustomerIdentification: getCustomerIdentification,
332
+ getCustomerKycReviewSteps: getCustomerKycReviewSteps,
333
+ listCustomers: listCustomers,
334
+ reviewCustomerKyc: reviewCustomerKyc,
335
+ revokeCustomerConsent: revokeCustomerConsent
336
+ });
337
+
338
+ const getDashboardSummary = async () => {
339
+ const { data } = await apiClient.get(API_ENDPOINTS.dashboard.summary);
340
+ return data;
341
+ };
342
+ const getApiPerformanceAnalytics = async (params) => {
343
+ const { data } = await apiClient.get(API_ENDPOINTS.dashboard.apiPerformance, {
344
+ params,
345
+ });
346
+ return data;
347
+ };
348
+ const getTopApis = async (params) => {
349
+ const { data } = await apiClient.get(API_ENDPOINTS.dashboard.topApis, { params });
350
+ return data;
351
+ };
352
+ const getTopTpps = async (params) => {
353
+ const { data } = await apiClient.get(API_ENDPOINTS.dashboard.topTpps, { params });
354
+ return data;
355
+ };
356
+ const getRecentAlarms = async (params) => {
357
+ const { data } = await apiClient.get(API_ENDPOINTS.dashboard.recentAlarms, {
358
+ params,
359
+ });
360
+ return data;
361
+ };
362
+
363
+ var api$4 = /*#__PURE__*/Object.freeze({
364
+ __proto__: null,
365
+ getApiPerformanceAnalytics: getApiPerformanceAnalytics,
366
+ getDashboardSummary: getDashboardSummary,
367
+ getRecentAlarms: getRecentAlarms,
368
+ getTopApis: getTopApis,
369
+ getTopTpps: getTopTpps
370
+ });
371
+
372
+ const getHealth = async () => {
373
+ const { data } = await apiClient.get(API_ENDPOINTS.health.check);
374
+ return data;
375
+ };
376
+
377
+ var api$3 = /*#__PURE__*/Object.freeze({
378
+ __proto__: null,
379
+ getHealth: getHealth
380
+ });
381
+
382
+ const listMerchants = async (params) => {
383
+ const { data } = await apiClient.get(API_ENDPOINTS.merchants.list, { params });
384
+ return data;
385
+ };
386
+ const createMerchant = async (payload) => {
387
+ const { data } = await apiClient.post(API_ENDPOINTS.merchants.create, payload);
388
+ return data;
389
+ };
390
+ const getMerchantByCode = async (code) => {
391
+ const { data } = await apiClient.get(API_ENDPOINTS.merchants.detail(code));
392
+ return data;
393
+ };
394
+ const updateMerchantStatus = async (code, payload) => {
395
+ const { data } = await apiClient.patch(API_ENDPOINTS.merchants.updateStatus(code), payload);
396
+ return data;
397
+ };
398
+ const initiateMerchantSettlement = async (code, payload) => {
399
+ const { data } = await apiClient.post(API_ENDPOINTS.merchants.initiateSettlement(code), payload);
400
+ return data;
401
+ };
402
+ const bulkHoldMerchantSettlements = async (payload, params) => {
403
+ const { data } = await apiClient.post(API_ENDPOINTS.merchants.bulkSettlementHold, payload, { params });
404
+ return data;
405
+ };
406
+
407
+ var api$2 = /*#__PURE__*/Object.freeze({
408
+ __proto__: null,
409
+ bulkHoldMerchantSettlements: bulkHoldMerchantSettlements,
410
+ createMerchant: createMerchant,
411
+ getMerchantByCode: getMerchantByCode,
412
+ initiateMerchantSettlement: initiateMerchantSettlement,
413
+ listMerchants: listMerchants,
414
+ updateMerchantStatus: updateMerchantStatus
415
+ });
416
+
417
+ function isFormData(value) {
418
+ return typeof FormData !== "undefined" && value instanceof FormData;
419
+ }
420
+ function toProviderFormData(payload) {
421
+ if (typeof FormData === "undefined") {
422
+ return payload;
423
+ }
424
+ const formData = new FormData();
425
+ formData.append("tppName", payload.tppName);
426
+ formData.append("tppCode", payload.tppCode);
427
+ formData.append("clientUuid", payload.clientUuid);
428
+ formData.append("dpoName", payload.dpoName);
429
+ formData.append("tppType", payload.tppType);
430
+ formData.append("cbnLicenseNumber", payload.cbnLicenseNumber);
431
+ formData.append("cbnLicenseExpiryDate", payload.cbnLicenseExpiryDate);
432
+ formData.append("complianceStatus", payload.complianceStatus);
433
+ payload.onboardingDocuments.forEach((document) => {
434
+ formData.append("onboardingDocuments", document);
435
+ });
436
+ return formData;
437
+ }
438
+ const listProviders = async (params) => {
439
+ const { data } = await apiClient.get(API_ENDPOINTS.providers.list, { params });
440
+ return data;
441
+ };
442
+ const createProvider = async (payload) => {
443
+ const requestBody = isFormData(payload) ? payload : toProviderFormData(payload);
444
+ const config = isFormData(requestBody)
445
+ ? { headers: { "Content-Type": "multipart/form-data" } }
446
+ : undefined;
447
+ const { data } = await apiClient.post(API_ENDPOINTS.providers.create, requestBody, config);
448
+ return data;
449
+ };
450
+ const getProviderByCode = async (code) => {
451
+ const { data } = await apiClient.get(API_ENDPOINTS.providers.detail(code));
452
+ return data;
453
+ };
454
+ const getProviderDocuments = async (code, params) => {
455
+ const { data } = await apiClient.get(API_ENDPOINTS.providers.documents(code), {
456
+ params,
457
+ });
458
+ return data;
459
+ };
460
+ const rotateProviderKey = async (code, payload) => {
461
+ const { data } = await apiClient.post(API_ENDPOINTS.providers.rotateKey(code), payload);
462
+ return data;
463
+ };
464
+ const getProviderMerchants = async (code, params) => {
465
+ const { data } = await apiClient.get(API_ENDPOINTS.providers.merchants(code), {
466
+ params,
467
+ });
468
+ return data;
469
+ };
470
+ const getProviderApplications = async (code, params) => {
471
+ const { data } = await apiClient.get(API_ENDPOINTS.providers.applications(code), { params });
472
+ return data;
473
+ };
474
+
475
+ var api$1 = /*#__PURE__*/Object.freeze({
476
+ __proto__: null,
477
+ createProvider: createProvider,
478
+ getProviderApplications: getProviderApplications,
479
+ getProviderByCode: getProviderByCode,
480
+ getProviderDocuments: getProviderDocuments,
481
+ getProviderMerchants: getProviderMerchants,
482
+ listProviders: listProviders,
483
+ rotateProviderKey: rotateProviderKey
484
+ });
485
+
486
+ const listPurposes = async (params) => {
487
+ const { data } = await apiClient.get(API_ENDPOINTS.purposes.list, { params });
488
+ return data;
489
+ };
490
+ const createPurpose = async (payload) => {
491
+ const { data } = await apiClient.post(API_ENDPOINTS.purposes.create, payload);
492
+ return data;
493
+ };
494
+ const getPurposeByCode = async (code) => {
495
+ const { data } = await apiClient.get(API_ENDPOINTS.purposes.detail(code));
496
+ return data;
497
+ };
498
+ const updatePurpose = async (code, payload) => {
499
+ const { data } = await apiClient.put(API_ENDPOINTS.purposes.update(code), payload);
500
+ return data;
501
+ };
502
+ const updatePurposeStatus = async (code, payload) => {
503
+ const { data } = await apiClient.patch(API_ENDPOINTS.purposes.updateStatus(code), payload);
504
+ return data;
505
+ };
506
+ const getPurposeUsage = async (code, params) => {
507
+ const { data } = await apiClient.get(API_ENDPOINTS.purposes.usage(code), {
508
+ params,
509
+ });
510
+ return data;
511
+ };
512
+ const bulkUpdatePurposeStatus = async (payload) => {
513
+ const { data } = await apiClient.patch(API_ENDPOINTS.purposes.bulkStatusUpdate, payload);
514
+ return data;
515
+ };
516
+
517
+ var api = /*#__PURE__*/Object.freeze({
518
+ __proto__: null,
519
+ bulkUpdatePurposeStatus: bulkUpdatePurposeStatus,
520
+ createPurpose: createPurpose,
521
+ getPurposeByCode: getPurposeByCode,
522
+ getPurposeUsage: getPurposeUsage,
523
+ listPurposes: listPurposes,
524
+ updatePurpose: updatePurpose,
525
+ updatePurposeStatus: updatePurposeStatus
526
+ });
527
+
528
+ exports.API_ENDPOINTS = API_ENDPOINTS;
529
+ exports.API_TIMEOUT = API_TIMEOUT;
530
+ exports.ApplicationsApi = api$7;
531
+ exports.ConsentsApi = api$6;
532
+ exports.CustomersApi = api$5;
533
+ exports.DashboardApi = api$4;
534
+ exports.HealthApi = api$3;
535
+ exports.MerchantsApi = api$2;
536
+ exports.MissingAccessTokenError = MissingAccessTokenError;
537
+ exports.ProvidersApi = api$1;
538
+ exports.PurposesApi = api;
539
+ exports.apiClient = apiClient;
540
+ exports.configureBackofficeOpenBankingSdk = configureBackofficeOpenBankingSdk;
541
+ exports.getAccessTokenProvider = getAccessTokenProvider;
542
+ exports.getApiBaseUrl = getApiBaseUrl;
543
+ exports.getApiTimeout = getApiTimeout;
544
+ exports.getDefaultHeaders = getDefaultHeaders;
545
+ exports.getUnauthorizedHandler = getUnauthorizedHandler;
546
+ exports.setAccessTokenProvider = setAccessTokenProvider;
547
+ exports.setApiBaseUrl = setApiBaseUrl;
548
+ exports.shouldRequireAuth = shouldRequireAuth;
549
+ //# sourceMappingURL=index.cjs.js.map