@corsa-labs/sdk 1.0.0

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 (212) hide show
  1. package/README.md +282 -0
  2. package/dist/ComplianceClient.d.ts +22 -0
  3. package/dist/ComplianceClient.js +43 -0
  4. package/dist/ComplianceClient.js.map +1 -0
  5. package/dist/core/ApiError.d.ts +11 -0
  6. package/dist/core/ApiError.js +23 -0
  7. package/dist/core/ApiError.js.map +1 -0
  8. package/dist/core/ApiRequestOptions.d.ts +13 -0
  9. package/dist/core/ApiRequestOptions.js +3 -0
  10. package/dist/core/ApiRequestOptions.js.map +1 -0
  11. package/dist/core/ApiResult.d.ts +7 -0
  12. package/dist/core/ApiResult.js +3 -0
  13. package/dist/core/ApiResult.js.map +1 -0
  14. package/dist/core/BaseHttpRequest.d.ts +8 -0
  15. package/dist/core/BaseHttpRequest.js +11 -0
  16. package/dist/core/BaseHttpRequest.js.map +1 -0
  17. package/dist/core/CancelablePromise.d.ts +20 -0
  18. package/dist/core/CancelablePromise.js +105 -0
  19. package/dist/core/CancelablePromise.js.map +1 -0
  20. package/dist/core/FetchHttpRequest.d.ts +14 -0
  21. package/dist/core/FetchHttpRequest.js +21 -0
  22. package/dist/core/FetchHttpRequest.js.map +1 -0
  23. package/dist/core/OpenAPI.d.ts +16 -0
  24. package/dist/core/OpenAPI.js +15 -0
  25. package/dist/core/OpenAPI.js.map +1 -0
  26. package/dist/core/request.d.ts +30 -0
  27. package/dist/core/request.js +300 -0
  28. package/dist/core/request.js.map +1 -0
  29. package/dist/index.d.ts +61 -0
  30. package/dist/index.js +71 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/main.d.ts +2 -0
  33. package/dist/main.js +19 -0
  34. package/dist/main.js.map +1 -0
  35. package/dist/models/AdverseMediaDto.d.ts +6 -0
  36. package/dist/models/AdverseMediaDto.js +3 -0
  37. package/dist/models/AdverseMediaDto.js.map +1 -0
  38. package/dist/models/AlertAssociationResponseDto.d.ts +16 -0
  39. package/dist/models/AlertAssociationResponseDto.js +3 -0
  40. package/dist/models/AlertAssociationResponseDto.js.map +1 -0
  41. package/dist/models/AlertCustomFieldDataDto.d.ts +10 -0
  42. package/dist/models/AlertCustomFieldDataDto.js +3 -0
  43. package/dist/models/AlertCustomFieldDataDto.js.map +1 -0
  44. package/dist/models/AlertDto.d.ts +100 -0
  45. package/dist/models/AlertDto.js +41 -0
  46. package/dist/models/AlertDto.js.map +1 -0
  47. package/dist/models/AlertSourceDto.d.ts +18 -0
  48. package/dist/models/AlertSourceDto.js +3 -0
  49. package/dist/models/AlertSourceDto.js.map +1 -0
  50. package/dist/models/AlertStatusData.d.ts +25 -0
  51. package/dist/models/AlertStatusData.js +17 -0
  52. package/dist/models/AlertStatusData.js.map +1 -0
  53. package/dist/models/AssociatedClientDto.d.ts +10 -0
  54. package/dist/models/AssociatedClientDto.js +3 -0
  55. package/dist/models/AssociatedClientDto.js.map +1 -0
  56. package/dist/models/AssociatedTransactionDto.d.ts +10 -0
  57. package/dist/models/AssociatedTransactionDto.js +3 -0
  58. package/dist/models/AssociatedTransactionDto.js.map +1 -0
  59. package/dist/models/ClientRiskDto.d.ts +28 -0
  60. package/dist/models/ClientRiskDto.js +16 -0
  61. package/dist/models/ClientRiskDto.js.map +1 -0
  62. package/dist/models/CorporateClientAddressDto.d.ts +11 -0
  63. package/dist/models/CorporateClientAddressDto.js +3 -0
  64. package/dist/models/CorporateClientAddressDto.js.map +1 -0
  65. package/dist/models/CorporateClientAddressLineDto.d.ts +22 -0
  66. package/dist/models/CorporateClientAddressLineDto.js +3 -0
  67. package/dist/models/CorporateClientAddressLineDto.js.map +1 -0
  68. package/dist/models/CorporateClientApplicationDto.d.ts +14 -0
  69. package/dist/models/CorporateClientApplicationDto.js +3 -0
  70. package/dist/models/CorporateClientApplicationDto.js.map +1 -0
  71. package/dist/models/CorporateClientBusinessDto.d.ts +10 -0
  72. package/dist/models/CorporateClientBusinessDto.js +3 -0
  73. package/dist/models/CorporateClientBusinessDto.js.map +1 -0
  74. package/dist/models/CorporateClientCustomFieldDataDto.d.ts +26 -0
  75. package/dist/models/CorporateClientCustomFieldDataDto.js +18 -0
  76. package/dist/models/CorporateClientCustomFieldDataDto.js.map +1 -0
  77. package/dist/models/CorporateClientDto.d.ts +101 -0
  78. package/dist/models/CorporateClientDto.js +29 -0
  79. package/dist/models/CorporateClientDto.js.map +1 -0
  80. package/dist/models/CorporateClientGeneralDto.d.ts +14 -0
  81. package/dist/models/CorporateClientGeneralDto.js +3 -0
  82. package/dist/models/CorporateClientGeneralDto.js.map +1 -0
  83. package/dist/models/CreateAlertDto.d.ts +81 -0
  84. package/dist/models/CreateAlertDto.js +41 -0
  85. package/dist/models/CreateAlertDto.js.map +1 -0
  86. package/dist/models/CreateCorporateClientDto.d.ts +74 -0
  87. package/dist/models/CreateCorporateClientDto.js +29 -0
  88. package/dist/models/CreateCorporateClientDto.js.map +1 -0
  89. package/dist/models/CreateDepositOperationDto.d.ts +19 -0
  90. package/dist/models/CreateDepositOperationDto.js +3 -0
  91. package/dist/models/CreateDepositOperationDto.js.map +1 -0
  92. package/dist/models/CreateIndividualClientDto.d.ts +99 -0
  93. package/dist/models/CreateIndividualClientDto.js +29 -0
  94. package/dist/models/CreateIndividualClientDto.js.map +1 -0
  95. package/dist/models/CreateIndividualClientResponseDto.d.ts +60 -0
  96. package/dist/models/CreateIndividualClientResponseDto.js +27 -0
  97. package/dist/models/CreateIndividualClientResponseDto.js.map +1 -0
  98. package/dist/models/CreateOrUpdateRiskDto.d.ts +24 -0
  99. package/dist/models/CreateOrUpdateRiskDto.js +16 -0
  100. package/dist/models/CreateOrUpdateRiskDto.js.map +1 -0
  101. package/dist/models/CreateTradeOperationDto.d.ts +48 -0
  102. package/dist/models/CreateTradeOperationDto.js +15 -0
  103. package/dist/models/CreateTradeOperationDto.js.map +1 -0
  104. package/dist/models/CreateTransactionDto.d.ts +50 -0
  105. package/dist/models/CreateTransactionDto.js +3 -0
  106. package/dist/models/CreateTransactionDto.js.map +1 -0
  107. package/dist/models/CreateTransactionSourceOrDestinationClientDto.d.ts +10 -0
  108. package/dist/models/CreateTransactionSourceOrDestinationClientDto.js +3 -0
  109. package/dist/models/CreateTransactionSourceOrDestinationClientDto.js.map +1 -0
  110. package/dist/models/CreateWithdrawalOperationDto.d.ts +19 -0
  111. package/dist/models/CreateWithdrawalOperationDto.js +3 -0
  112. package/dist/models/CreateWithdrawalOperationDto.js.map +1 -0
  113. package/dist/models/DepositOperationDto.d.ts +32 -0
  114. package/dist/models/DepositOperationDto.js +3 -0
  115. package/dist/models/DepositOperationDto.js.map +1 -0
  116. package/dist/models/IndividualClientAddressDto.d.ts +22 -0
  117. package/dist/models/IndividualClientAddressDto.js +3 -0
  118. package/dist/models/IndividualClientAddressDto.js.map +1 -0
  119. package/dist/models/IndividualClientApplicationInformationDto.d.ts +14 -0
  120. package/dist/models/IndividualClientApplicationInformationDto.js +3 -0
  121. package/dist/models/IndividualClientApplicationInformationDto.js.map +1 -0
  122. package/dist/models/IndividualClientContactInformationDto.d.ts +10 -0
  123. package/dist/models/IndividualClientContactInformationDto.js +3 -0
  124. package/dist/models/IndividualClientContactInformationDto.js.map +1 -0
  125. package/dist/models/IndividualClientCustomFieldDataDto.d.ts +27 -0
  126. package/dist/models/IndividualClientCustomFieldDataDto.js +19 -0
  127. package/dist/models/IndividualClientCustomFieldDataDto.js.map +1 -0
  128. package/dist/models/IndividualClientDto.d.ts +127 -0
  129. package/dist/models/IndividualClientDto.js +29 -0
  130. package/dist/models/IndividualClientDto.js.map +1 -0
  131. package/dist/models/IndividualClientFinancialInformationDto.d.ts +6 -0
  132. package/dist/models/IndividualClientFinancialInformationDto.js +3 -0
  133. package/dist/models/IndividualClientFinancialInformationDto.js.map +1 -0
  134. package/dist/models/IndividualClientGeneralInformationDto.d.ts +39 -0
  135. package/dist/models/IndividualClientGeneralInformationDto.js +15 -0
  136. package/dist/models/IndividualClientGeneralInformationDto.js.map +1 -0
  137. package/dist/models/IndividualClientWorkInformationDto.d.ts +6 -0
  138. package/dist/models/IndividualClientWorkInformationDto.js +3 -0
  139. package/dist/models/IndividualClientWorkInformationDto.js.map +1 -0
  140. package/dist/models/OperationInitiatorDto.d.ts +10 -0
  141. package/dist/models/OperationInitiatorDto.js +3 -0
  142. package/dist/models/OperationInitiatorDto.js.map +1 -0
  143. package/dist/models/PoliticalExposureDto.d.ts +6 -0
  144. package/dist/models/PoliticalExposureDto.js +3 -0
  145. package/dist/models/PoliticalExposureDto.js.map +1 -0
  146. package/dist/models/SanctionsDto.d.ts +6 -0
  147. package/dist/models/SanctionsDto.js +3 -0
  148. package/dist/models/SanctionsDto.js.map +1 -0
  149. package/dist/models/TradeOperationDto.d.ts +61 -0
  150. package/dist/models/TradeOperationDto.js +15 -0
  151. package/dist/models/TradeOperationDto.js.map +1 -0
  152. package/dist/models/TransactionAmountDto.d.ts +14 -0
  153. package/dist/models/TransactionAmountDto.js +3 -0
  154. package/dist/models/TransactionAmountDto.js.map +1 -0
  155. package/dist/models/TransactionCustomFieldDto.d.ts +14 -0
  156. package/dist/models/TransactionCustomFieldDto.js +3 -0
  157. package/dist/models/TransactionCustomFieldDto.js.map +1 -0
  158. package/dist/models/TransactionDto.d.ts +82 -0
  159. package/dist/models/TransactionDto.js +24 -0
  160. package/dist/models/TransactionDto.js.map +1 -0
  161. package/dist/models/TransactionSourceOrDestinationClientDto.d.ts +10 -0
  162. package/dist/models/TransactionSourceOrDestinationClientDto.js +3 -0
  163. package/dist/models/TransactionSourceOrDestinationClientDto.js.map +1 -0
  164. package/dist/models/TransactionSourceOrDestinationDto.d.ts +11 -0
  165. package/dist/models/TransactionSourceOrDestinationDto.js +3 -0
  166. package/dist/models/TransactionSourceOrDestinationDto.js.map +1 -0
  167. package/dist/models/TransactionStatusDto.d.ts +29 -0
  168. package/dist/models/TransactionStatusDto.js +17 -0
  169. package/dist/models/TransactionStatusDto.js.map +1 -0
  170. package/dist/models/UpdateAlertDto.d.ts +60 -0
  171. package/dist/models/UpdateAlertDto.js +41 -0
  172. package/dist/models/UpdateAlertDto.js.map +1 -0
  173. package/dist/models/UpdateCorporateClientDto.d.ts +82 -0
  174. package/dist/models/UpdateCorporateClientDto.js +29 -0
  175. package/dist/models/UpdateCorporateClientDto.js.map +1 -0
  176. package/dist/models/UpdateIndividualClientDto.d.ts +107 -0
  177. package/dist/models/UpdateIndividualClientDto.js +29 -0
  178. package/dist/models/UpdateIndividualClientDto.js.map +1 -0
  179. package/dist/models/WithdrawalOperationDto.d.ts +33 -0
  180. package/dist/models/WithdrawalOperationDto.js +3 -0
  181. package/dist/models/WithdrawalOperationDto.js.map +1 -0
  182. package/dist/services/AlertsService.d.ts +48 -0
  183. package/dist/services/AlertsService.js +94 -0
  184. package/dist/services/AlertsService.js.map +1 -0
  185. package/dist/services/ClientsService.d.ts +56 -0
  186. package/dist/services/ClientsService.js +105 -0
  187. package/dist/services/ClientsService.js.map +1 -0
  188. package/dist/services/DepositsService.d.ts +22 -0
  189. package/dist/services/DepositsService.js +40 -0
  190. package/dist/services/DepositsService.js.map +1 -0
  191. package/dist/services/HealthService.d.ts +13 -0
  192. package/dist/services/HealthService.js +23 -0
  193. package/dist/services/HealthService.js.map +1 -0
  194. package/dist/services/TradesService.d.ts +32 -0
  195. package/dist/services/TradesService.js +62 -0
  196. package/dist/services/TradesService.js.map +1 -0
  197. package/dist/services/TransactionsService.d.ts +14 -0
  198. package/dist/services/TransactionsService.js +28 -0
  199. package/dist/services/TransactionsService.js.map +1 -0
  200. package/dist/services/WithdrawalsService.d.ts +22 -0
  201. package/dist/services/WithdrawalsService.js +40 -0
  202. package/dist/services/WithdrawalsService.js.map +1 -0
  203. package/dist/webhooks/index.d.ts +2 -0
  204. package/dist/webhooks/index.js +19 -0
  205. package/dist/webhooks/index.js.map +1 -0
  206. package/dist/webhooks/types.d.ts +56 -0
  207. package/dist/webhooks/types.js +30 -0
  208. package/dist/webhooks/types.js.map +1 -0
  209. package/dist/webhooks/verify-signature.d.ts +15 -0
  210. package/dist/webhooks/verify-signature.js +49 -0
  211. package/dist/webhooks/verify-signature.js.map +1 -0
  212. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,282 @@
1
+ # @paytweed/compliance-sdk
2
+
3
+ [![npm version](https://badge.fury.io/js/%40paytweed%2Fcompliance-sdk.svg)](https://badge.fury.io/js/%40paytweed%2Fcompliance-sdk)
4
+
5
+ SDK for Compliance API
6
+
7
+ ## Table of Contents
8
+
9
+ - [Installation](#installation)
10
+ - [API Client Usage](#api-client-usage)
11
+ - [Configuration](#configuration)
12
+ - [Available Services](#available-services)
13
+ - [Working Example For API requests](#working-example-for-api-requests)
14
+ - [Webhook Handling](#webhook-handling)
15
+ - [Webhook Headers](#webhook-headers)
16
+ - [Verifying Signatures](#verifying-signatures)
17
+ - [Event Types](#event-types)
18
+ - [Development](#development)
19
+ - [Building](#building)
20
+ - [Testing](#testing)
21
+ - [Contributing](#contributing)
22
+ - [License](#license)
23
+
24
+ ## Installation
25
+
26
+ You can install the package using npm or yarn:
27
+
28
+ ```bash
29
+ npm install @paytweed/compliance-sdk
30
+ # or
31
+ yarn add @paytweed/compliance-sdk
32
+ ```
33
+
34
+ ---
35
+
36
+ ## API Client Usage
37
+
38
+ This section covers how to use the SDK to interact with the Compliance API endpoints.
39
+
40
+ ### Configuration
41
+
42
+ First, import the `ComplianceClient` and configure it with your API details:
43
+
44
+ ```typescript
45
+ import { ComplianceClient, OpenAPI } from '@paytweed/compliance-sdk';
46
+
47
+ // Configure API key (or other authentication methods) via Headers
48
+ // OpenAPI.TOKEN = 'YOUR_API_KEY'; // Deprecated: Use HEADERS instead
49
+
50
+ // Configure the base URL
51
+ OpenAPI.BASE = 'https://api-compliance.prod.paytweed.com';
52
+
53
+ // Configure Headers for Authentication (Recommended)
54
+ OpenAPI.HEADERS = {
55
+ "Authorization": `Bearer ${process.env.API_TOKEN}`
56
+ };
57
+
58
+ const client = new ComplianceClient();
59
+
60
+ // Or configure directly in the constructor
61
+ const clientWithConfig = new ComplianceClient({
62
+ BASE: "https://api-compliance.prod.paytweed.com",
63
+ HEADERS: {
64
+ "Authorization": `Bearer ${process.env.API_TOKEN}`
65
+ }
66
+ });
67
+ ```
68
+
69
+ ### Available Services
70
+
71
+ The SDK provides access to the following services via the `ComplianceClient` instance:
72
+
73
+ * `client.alerts`: Manage compliance alerts.
74
+ * `client.clients`: Manage individual and corporate clients.
75
+ * `client.health`: Check the health status of the API.
76
+ * `client.operations`: Manage financial operations (deposits, withdrawals, trades).
77
+ * `client.transactions`: Manage transactions.
78
+
79
+ Each service exposes methods corresponding to the API endpoints. Refer to the type definitions (exported from `index.ts` and within the `models/` and `services/` directories) for detailed request and response structures.
80
+
81
+ ### Working Example For API requests
82
+ ```ts
83
+ import { ClientRiskDto, ComplianceClient, CreateIndividualClientDto, IndividualClientCustomFieldDataDto, IndividualClientGeneralInformationDto } from "@paytweed/compliance-sdk";
84
+ import { v4 as uuidv4 } from 'uuid';
85
+
86
+ async function main() {
87
+ const client = new ComplianceClient({
88
+ BASE: "https://api-compliance.prod.paytweed.com",
89
+ HEADERS: {
90
+ "Authorization": `Bearer ${process.env.API_TOKEN}` // Use Authorization header
91
+ }
92
+ });
93
+
94
+ const referenceId = uuidv4();
95
+ const { id } = await client.clients.createIndividualClient({
96
+ referenceId,
97
+ activityStatus: CreateIndividualClientDto.activityStatus.ACTIVE,
98
+ accountStatus: CreateIndividualClientDto.accountStatus.APPROVED,
99
+ currentRisk: {
100
+ score: 75,
101
+ level: ClientRiskDto.level.HIGH,
102
+ reason: "Multiple high-value transactions in high-risk jurisdictions",
103
+ calculatedAt: "2023-08-15T14:30:00Z"
104
+ },
105
+ tags: ["high-value", "vip-client"],
106
+ controls: ["enhanced-due-diligence", "quarterly-review"],
107
+ address: {
108
+ addressLine1: "123 Main Street",
109
+ addressLine2: "Apt 4B",
110
+ city: "New York",
111
+ country: "USA",
112
+ postalCode: "10001"
113
+ },
114
+ adverseMedia: {
115
+ isAdverseMedia: false
116
+ },
117
+ application: {
118
+ submittedAt: "2023-08-15T10:30:00Z",
119
+ onboardedAt: "2023-08-20T14:00:00Z",
120
+ onboardingRisk: {
121
+ score: 75,
122
+ level: ClientRiskDto.level.HIGH,
123
+ reason: "Multiple high-value transactions in high-risk jurisdictions",
124
+ calculatedAt: "2023-08-15T14:30:00Z"
125
+ },
126
+ nextPeriodicReview: "2024-08-20T14:00:00Z"
127
+ },
128
+ riskHistory: [{
129
+ score: 75,
130
+ level: ClientRiskDto.level.HIGH,
131
+ reason: "Multiple high-value transactions in high-risk jurisdictions",
132
+ calculatedAt: "2023-08-15T14:30:00Z"
133
+ }],
134
+ contact: {
135
+ emailAddress: "john.doe@example.com",
136
+ phoneNumber: "+1-555-123-4567"
137
+ },
138
+ customFields: {
139
+ additionalProp1: {
140
+ label: "Preferred Contact Time",
141
+ value: "Morning",
142
+ category: IndividualClientCustomFieldDataDto.category.GENERAL
143
+ },
144
+ additionalProp2: {
145
+ label: "Preferred Contact Time",
146
+ value: "Morning",
147
+ category: IndividualClientCustomFieldDataDto.category.GENERAL
148
+ },
149
+ additionalProp3: {
150
+ label: "Preferred Contact Time",
151
+ value: "Morning",
152
+ category: IndividualClientCustomFieldDataDto.category.GENERAL
153
+ }
154
+ },
155
+ financial: {
156
+ annualDepositEstimate: "100000"
157
+ },
158
+ general: {
159
+ firstName: "Yarin SDK",
160
+ lastName: "Test",
161
+ gender: IndividualClientGeneralInformationDto.gender.MALE,
162
+ dateOfBirth: "1980-01-15",
163
+ citizenship: "USA",
164
+ personalId: "123-45-6789"
165
+ },
166
+ politicalExposure: {
167
+ isPoliticallyExposed: false
168
+ },
169
+ sanctions: {
170
+ isSanctioned: false
171
+ },
172
+ work: {
173
+ occupation: "Software Engineer"
174
+ }
175
+ });
176
+
177
+ console.log(id);
178
+ await client.clients.updateIndividualClient(id, {
179
+ activityStatus: CreateIndividualClientDto.activityStatus.NOT_ACTIVE,
180
+ });
181
+ }
182
+
183
+ main();
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Webhook Handling
189
+
190
+ The SDK provides utilities for handling webhooks sent from the Compliance API.
191
+
192
+ ### Webhook Headers
193
+
194
+ When receiving webhooks, inspect the following HTTP headers:
195
+
196
+ * `x-hub-signature-256`: The HMAC SHA256 signature of the request payload. Used for verifying the webhook's authenticity. (See Verifying Signatures below).
197
+ * `x-tweed-event`: The type of event that triggered the webhook (e.g., `individual_client.created`).
198
+ * `x-tweed-hook-id`: The unique identifier of the webhook configuration that sent this request.
199
+ * `x-tweed-delivery`: A unique identifier for this specific delivery attempt.
200
+
201
+ ### Verifying Signatures
202
+
203
+ It's crucial to verify the signature of incoming webhooks to ensure they originated from the Compliance API and were not tampered with. Use the `verifyWebhookSignature` function exported from the SDK.
204
+
205
+ ```typescript
206
+ import { verifyWebhookSignature } from '@paytweed/compliance-sdk';
207
+
208
+ async function verifyWebhookRequest(request: Request) { // Assuming a standard Request object
209
+ const signature = request.headers.get('x-hub-signature-256');
210
+ const payload = await request.text(); // Raw request body
211
+ const secret = process.env.WEBHOOK_SECRET; // Your webhook secret
212
+
213
+ if (!signature || !secret) {
214
+ console.error("Missing signature or secret");
215
+ // Return an error response (e.g., HTTP 400 Bad Request)
216
+ return false;
217
+ }
218
+
219
+ const isValid = await verifyWebhookSignature(secret, payload, signature);
220
+
221
+ if (!isValid) {
222
+ console.error('Invalid webhook signature');
223
+ // Return an error response (e.g., HTTP 401 Unauthorized)
224
+ return false;
225
+ }
226
+
227
+ console.log("Webhook signature verified successfully!");
228
+ // Signature is valid, proceed with processing the webhook payload
229
+ // const webhookEvent = JSON.parse(payload);
230
+ // console.log('Received valid webhook:', webhookEvent.type);
231
+ // ... process event ...
232
+ return true;
233
+ }
234
+ ```
235
+
236
+ ### Event Types
237
+
238
+ The following webhook event types are available (defined in `WebhookEventType`):
239
+
240
+ * `individual_client.created`: Triggered when an individual client is created.
241
+ * `individual_client.updated`: Triggered when an individual client is updated.
242
+ * `corporate_client.created`: Triggered when a corporate client is created.
243
+ * `corporate_client.updated`: Triggered when a corporate client is updated.
244
+ * `alert.created`: Triggered when an alert is created.
245
+ * `alert.updated`: Triggered when an alert is updated.
246
+ * `case.created`: Triggered when a case is created.
247
+ * `case.updated`: Triggered when a case is updated.
248
+
249
+ The payload structure for each event type (`WebhookEvent`, `EntityCreatedPayload`, `EntityUpdatedPayload`) and the `WebhookEventType` enum can be imported from `@paytweed/compliance-sdk`.
250
+
251
+ For a practical example of how to set up a webhook handler, see the [Webhook Example](./docs/WEBHOOK_EXAMPLE.md).
252
+
253
+ ---
254
+
255
+ ## Development
256
+
257
+ ### Building
258
+
259
+ To build the project locally:
260
+
261
+ ```bash
262
+ yarn install
263
+ yarn build
264
+ ```
265
+
266
+ ### Testing
267
+
268
+ Run the tests using:
269
+
270
+ ```bash
271
+ yarn test
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Contributing
277
+
278
+ Contributions are welcome! Please follow standard practices for pull requests.
279
+
280
+ ## License
281
+
282
+ [MIT](LICENSE)
@@ -0,0 +1,22 @@
1
+ import type { BaseHttpRequest } from './core/BaseHttpRequest';
2
+ import type { OpenAPIConfig } from './core/OpenAPI';
3
+ import { AlertsService } from './services/AlertsService';
4
+ import { ClientsService } from './services/ClientsService';
5
+ import { DepositsService } from './services/DepositsService';
6
+ import { HealthService } from './services/HealthService';
7
+ import { TradesService } from './services/TradesService';
8
+ import { TransactionsService } from './services/TransactionsService';
9
+ import { WithdrawalsService } from './services/WithdrawalsService';
10
+ type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
11
+ export declare class ComplianceClient {
12
+ readonly alerts: AlertsService;
13
+ readonly clients: ClientsService;
14
+ readonly deposits: DepositsService;
15
+ readonly health: HealthService;
16
+ readonly trades: TradesService;
17
+ readonly transactions: TransactionsService;
18
+ readonly withdrawals: WithdrawalsService;
19
+ readonly request: BaseHttpRequest;
20
+ constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
21
+ }
22
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComplianceClient = void 0;
4
+ const FetchHttpRequest_1 = require("./core/FetchHttpRequest");
5
+ const AlertsService_1 = require("./services/AlertsService");
6
+ const ClientsService_1 = require("./services/ClientsService");
7
+ const DepositsService_1 = require("./services/DepositsService");
8
+ const HealthService_1 = require("./services/HealthService");
9
+ const TradesService_1 = require("./services/TradesService");
10
+ const TransactionsService_1 = require("./services/TransactionsService");
11
+ const WithdrawalsService_1 = require("./services/WithdrawalsService");
12
+ class ComplianceClient {
13
+ alerts;
14
+ clients;
15
+ deposits;
16
+ health;
17
+ trades;
18
+ transactions;
19
+ withdrawals;
20
+ request;
21
+ constructor(config, HttpRequest = FetchHttpRequest_1.FetchHttpRequest) {
22
+ this.request = new HttpRequest({
23
+ BASE: config?.BASE ?? '',
24
+ VERSION: config?.VERSION ?? '1.0',
25
+ WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
26
+ CREDENTIALS: config?.CREDENTIALS ?? 'include',
27
+ TOKEN: config?.TOKEN,
28
+ USERNAME: config?.USERNAME,
29
+ PASSWORD: config?.PASSWORD,
30
+ HEADERS: config?.HEADERS,
31
+ ENCODE_PATH: config?.ENCODE_PATH,
32
+ });
33
+ this.alerts = new AlertsService_1.AlertsService(this.request);
34
+ this.clients = new ClientsService_1.ClientsService(this.request);
35
+ this.deposits = new DepositsService_1.DepositsService(this.request);
36
+ this.health = new HealthService_1.HealthService(this.request);
37
+ this.trades = new TradesService_1.TradesService(this.request);
38
+ this.transactions = new TransactionsService_1.TransactionsService(this.request);
39
+ this.withdrawals = new WithdrawalsService_1.WithdrawalsService(this.request);
40
+ }
41
+ }
42
+ exports.ComplianceClient = ComplianceClient;
43
+ //# sourceMappingURL=ComplianceClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComplianceClient.js","sourceRoot":"","sources":["../ComplianceClient.ts"],"names":[],"mappings":";;;AAMA,8DA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,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,uCAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;CACJ;AA7BD,4CA6BC"}
@@ -0,0 +1,11 @@
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ import type { ApiResult } from './ApiResult';
3
+ export declare class ApiError extends Error {
4
+ readonly url: string;
5
+ readonly status: number;
6
+ readonly statusText: string;
7
+ readonly body: any;
8
+ readonly request: ApiRequestOptions;
9
+ readonly requestId: string;
10
+ constructor(request: ApiRequestOptions, response: ApiResult, message: string, requestId?: string);
11
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiError = void 0;
4
+ class ApiError extends Error {
5
+ url;
6
+ status;
7
+ statusText;
8
+ body;
9
+ request;
10
+ requestId;
11
+ constructor(request, response, message, requestId) {
12
+ super(`${message} - Request ID: ${requestId}`);
13
+ this.name = 'ApiError';
14
+ this.url = response.url;
15
+ this.status = response.status;
16
+ this.statusText = response.statusText;
17
+ this.body = response.body;
18
+ this.request = request;
19
+ this.requestId = requestId ?? '';
20
+ }
21
+ }
22
+ exports.ApiError = ApiError;
23
+ //# sourceMappingURL=ApiError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../../core/ApiError.ts"],"names":[],"mappings":";;;AAOA,MAAa,QAAS,SAAQ,KAAK;IACf,GAAG,CAAS;IACZ,MAAM,CAAS;IACf,UAAU,CAAS;IACnB,IAAI,CAAM;IACV,OAAO,CAAoB;IAC3B,SAAS,CAAS;IAElC,YAAY,OAA0B,EAAE,QAAmB,EAAE,OAAe,EAAE,SAAkB;QAC5F,KAAK,CAAC,GAAG,OAAO,kBAAkB,SAAS,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,EAAE,CAAC;IACrC,CAAC;CACJ;AAnBD,4BAmBC"}
@@ -0,0 +1,13 @@
1
+ export type ApiRequestOptions = {
2
+ readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
3
+ readonly url: string;
4
+ readonly path?: Record<string, any>;
5
+ readonly cookies?: Record<string, any>;
6
+ readonly headers?: Record<string, any>;
7
+ readonly query?: Record<string, any>;
8
+ readonly formData?: Record<string, any>;
9
+ readonly body?: any;
10
+ readonly mediaType?: string;
11
+ readonly responseHeader?: string;
12
+ readonly errors?: Record<number, string>;
13
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ApiRequestOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiRequestOptions.js","sourceRoot":"","sources":["../../core/ApiRequestOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export type ApiResult = {
2
+ readonly url: string;
3
+ readonly ok: boolean;
4
+ readonly status: number;
5
+ readonly statusText: string;
6
+ readonly body: any;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ApiResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiResult.js","sourceRoot":"","sources":["../../core/ApiResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ import type { CancelablePromise } from './CancelablePromise';
3
+ import type { OpenAPIConfig } from './OpenAPI';
4
+ export declare abstract class BaseHttpRequest {
5
+ readonly config: OpenAPIConfig;
6
+ constructor(config: OpenAPIConfig);
7
+ abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
8
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseHttpRequest = void 0;
4
+ class BaseHttpRequest {
5
+ config;
6
+ constructor(config) {
7
+ this.config = config;
8
+ }
9
+ }
10
+ exports.BaseHttpRequest = BaseHttpRequest;
11
+ //# sourceMappingURL=BaseHttpRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseHttpRequest.js","sourceRoot":"","sources":["../../core/BaseHttpRequest.ts"],"names":[],"mappings":";;;AAQA,MAAsB,eAAe;IAEL;IAA5B,YAA4B,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;CAGxD;AALD,0CAKC"}
@@ -0,0 +1,20 @@
1
+ export declare class CancelError extends Error {
2
+ constructor(message: string);
3
+ get isCancelled(): boolean;
4
+ }
5
+ export interface OnCancel {
6
+ readonly isResolved: boolean;
7
+ readonly isRejected: boolean;
8
+ readonly isCancelled: boolean;
9
+ (cancelHandler: () => void): void;
10
+ }
11
+ export declare class CancelablePromise<T> implements Promise<T> {
12
+ #private;
13
+ constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
14
+ get [Symbol.toStringTag](): string;
15
+ then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
16
+ catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
17
+ finally(onFinally?: (() => void) | null): Promise<T>;
18
+ cancel(): void;
19
+ get isCancelled(): boolean;
20
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelablePromise = exports.CancelError = void 0;
4
+ /* generated using openapi-typescript-codegen -- do not edit */
5
+ /* istanbul ignore file */
6
+ /* tslint:disable */
7
+ /* eslint-disable */
8
+ class CancelError extends Error {
9
+ constructor(message) {
10
+ super(message);
11
+ this.name = 'CancelError';
12
+ }
13
+ get isCancelled() {
14
+ return true;
15
+ }
16
+ }
17
+ exports.CancelError = CancelError;
18
+ class CancelablePromise {
19
+ #isResolved;
20
+ #isRejected;
21
+ #isCancelled;
22
+ #cancelHandlers;
23
+ #promise;
24
+ #resolve;
25
+ #reject;
26
+ constructor(executor) {
27
+ this.#isResolved = false;
28
+ this.#isRejected = false;
29
+ this.#isCancelled = false;
30
+ this.#cancelHandlers = [];
31
+ this.#promise = new Promise((resolve, reject) => {
32
+ this.#resolve = resolve;
33
+ this.#reject = reject;
34
+ const onResolve = (value) => {
35
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
36
+ return;
37
+ }
38
+ this.#isResolved = true;
39
+ if (this.#resolve)
40
+ this.#resolve(value);
41
+ };
42
+ const onReject = (reason) => {
43
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
44
+ return;
45
+ }
46
+ this.#isRejected = true;
47
+ if (this.#reject)
48
+ this.#reject(reason);
49
+ };
50
+ const onCancel = (cancelHandler) => {
51
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
52
+ return;
53
+ }
54
+ this.#cancelHandlers.push(cancelHandler);
55
+ };
56
+ Object.defineProperty(onCancel, 'isResolved', {
57
+ get: () => this.#isResolved,
58
+ });
59
+ Object.defineProperty(onCancel, 'isRejected', {
60
+ get: () => this.#isRejected,
61
+ });
62
+ Object.defineProperty(onCancel, 'isCancelled', {
63
+ get: () => this.#isCancelled,
64
+ });
65
+ return executor(onResolve, onReject, onCancel);
66
+ });
67
+ }
68
+ get [Symbol.toStringTag]() {
69
+ return "Cancellable Promise";
70
+ }
71
+ then(onFulfilled, onRejected) {
72
+ return this.#promise.then(onFulfilled, onRejected);
73
+ }
74
+ catch(onRejected) {
75
+ return this.#promise.catch(onRejected);
76
+ }
77
+ finally(onFinally) {
78
+ return this.#promise.finally(onFinally);
79
+ }
80
+ cancel() {
81
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
82
+ return;
83
+ }
84
+ this.#isCancelled = true;
85
+ if (this.#cancelHandlers.length) {
86
+ try {
87
+ for (const cancelHandler of this.#cancelHandlers) {
88
+ cancelHandler();
89
+ }
90
+ }
91
+ catch (error) {
92
+ console.warn('Cancellation threw an error', error);
93
+ return;
94
+ }
95
+ }
96
+ this.#cancelHandlers.length = 0;
97
+ if (this.#reject)
98
+ this.#reject(new CancelError('Request aborted'));
99
+ }
100
+ get isCancelled() {
101
+ return this.#isCancelled;
102
+ }
103
+ }
104
+ exports.CancelablePromise = CancelablePromise;
105
+ //# sourceMappingURL=CancelablePromise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CancelablePromise.js","sourceRoot":"","sources":["../../core/CancelablePromise.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AAC/D,0BAA0B;AAC1B,oBAAoB;AACpB,oBAAoB;AACpB,MAAa,WAAY,SAAQ,KAAK;IAElC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC9B,CAAC;IAED,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAVD,kCAUC;AAUD,MAAa,iBAAiB;IAC1B,WAAW,CAAU;IACrB,WAAW,CAAU;IACrB,YAAY,CAAU;IACb,eAAe,CAAiB;IAChC,QAAQ,CAAa;IAC9B,QAAQ,CAAuC;IAC/C,OAAO,CAA0B;IAEjC,YACI,QAIS;QAET,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,KAA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AC,6BAA6B,EAAE,KAAK,CAAC,CAAC;gBACnD,OAAO;YACX,CAAC;QACL,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;CACJ;AA1GD,8CA0GC"}
@@ -0,0 +1,14 @@
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ import { BaseHttpRequest } from './BaseHttpRequest';
3
+ import type { CancelablePromise } from './CancelablePromise';
4
+ import type { OpenAPIConfig } from './OpenAPI';
5
+ export declare class FetchHttpRequest extends BaseHttpRequest {
6
+ constructor(config: OpenAPIConfig);
7
+ /**
8
+ * Request method
9
+ * @param options The request options from the service
10
+ * @returns CancelablePromise<T>
11
+ * @throws ApiError
12
+ */
13
+ request<T>(options: ApiRequestOptions): CancelablePromise<T>;
14
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FetchHttpRequest = void 0;
4
+ const BaseHttpRequest_1 = require("./BaseHttpRequest");
5
+ const request_1 = require("./request");
6
+ class FetchHttpRequest extends BaseHttpRequest_1.BaseHttpRequest {
7
+ constructor(config) {
8
+ super(config);
9
+ }
10
+ /**
11
+ * Request method
12
+ * @param options The request options from the service
13
+ * @returns CancelablePromise<T>
14
+ * @throws ApiError
15
+ */
16
+ request(options) {
17
+ return (0, request_1.request)(this.config, options);
18
+ }
19
+ }
20
+ exports.FetchHttpRequest = FetchHttpRequest;
21
+ //# sourceMappingURL=FetchHttpRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetchHttpRequest.js","sourceRoot":"","sources":["../../core/FetchHttpRequest.ts"],"names":[],"mappings":";;;AAKA,uDAAoD;AAGpD,uCAAiD;AAEjD,MAAa,gBAAiB,SAAQ,iCAAe;IAEjD,YAAY,MAAqB;QAC7B,KAAK,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACa,OAAO,CAAI,OAA0B;QACjD,OAAO,IAAA,iBAAS,EAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACJ;AAfD,4CAeC"}
@@ -0,0 +1,16 @@
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
3
+ type Headers = Record<string, string>;
4
+ export type OpenAPIConfig = {
5
+ BASE: string;
6
+ VERSION: string;
7
+ WITH_CREDENTIALS: boolean;
8
+ CREDENTIALS: 'include' | 'omit' | 'same-origin';
9
+ TOKEN?: string | Resolver<string> | undefined;
10
+ USERNAME?: string | Resolver<string> | undefined;
11
+ PASSWORD?: string | Resolver<string> | undefined;
12
+ HEADERS?: Headers | Resolver<Headers> | undefined;
13
+ ENCODE_PATH?: ((path: string) => string) | undefined;
14
+ };
15
+ export declare const OpenAPI: OpenAPIConfig;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenAPI = void 0;
4
+ exports.OpenAPI = {
5
+ BASE: '',
6
+ VERSION: '1.0',
7
+ WITH_CREDENTIALS: false,
8
+ CREDENTIALS: 'include',
9
+ TOKEN: undefined,
10
+ USERNAME: undefined,
11
+ PASSWORD: undefined,
12
+ HEADERS: undefined,
13
+ ENCODE_PATH: undefined,
14
+ };
15
+ //# sourceMappingURL=OpenAPI.js.map