@dalmore/api-contracts 0.0.0-dev.2dc8e92 → 0.0.0-dev.4bb6b7a

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 (206) hide show
  1. package/README.md +23 -19
  2. package/common/types/account-contact.types.ts +2 -1
  3. package/common/types/account-manager.types.ts +3 -7
  4. package/common/types/account-setting.types.ts +65 -0
  5. package/common/types/account.types.ts +1 -0
  6. package/common/types/activity.types.ts +1 -1
  7. package/common/types/api-key-logs.types.ts +1 -1
  8. package/common/types/asset.types.ts +14 -14
  9. package/common/types/auth.types.ts +7 -18
  10. package/common/types/bonus-tier.types.ts +33 -0
  11. package/common/types/cart.types.ts +4 -1
  12. package/common/types/common.types.ts +38 -6
  13. package/common/types/contact-us.types.ts +6 -2
  14. package/common/types/covered-person.types.ts +2 -1
  15. package/common/types/dashboard.types.ts +2 -9
  16. package/common/types/disbursements.types.ts +119 -3
  17. package/common/types/escrow-account.types.ts +3 -3
  18. package/common/types/file.types.ts +20 -4
  19. package/common/types/i-will-do-it-later.types.ts +68 -0
  20. package/common/types/index.ts +2 -0
  21. package/common/types/individuals.types.ts +5 -17
  22. package/common/types/investor-account.types.ts +2 -1
  23. package/common/types/invite.types.ts +27 -1
  24. package/common/types/issuer-offering.types.ts +113 -30
  25. package/common/types/issuer-payment-method.types.ts +41 -0
  26. package/common/types/issuer.types.ts +9 -0
  27. package/common/types/legal-entity.types.ts +3 -2
  28. package/common/types/mail-template.types.ts +34 -0
  29. package/common/types/note.types.ts +1 -1
  30. package/common/types/notification.types.ts +525 -29
  31. package/common/types/offering.types.ts +106 -20
  32. package/common/types/site-settings.types.ts +2 -1
  33. package/common/types/site.types.ts +2 -9
  34. package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
  35. package/common/types/trade.types.ts +118 -2
  36. package/common/types/transaction.types.ts +12 -1
  37. package/common/types/trusted-contact.types.ts +7 -7
  38. package/common/types/user.types.ts +17 -33
  39. package/common/types/webhook.types.ts +142 -0
  40. package/contracts/{investors → clients}/cart/index.ts +11 -6
  41. package/contracts/clients/index.ts +10 -0
  42. package/contracts/{investors → clients}/issuer-payment-methods/index.ts +5 -2
  43. package/contracts/{compliance → clients}/payment-methods/index.ts +40 -12
  44. package/contracts/{investors → clients}/trade-line-items/index.ts +19 -28
  45. package/contracts/clients/trades/index.ts +65 -1
  46. package/contracts/{investors → clients}/transactions/index.ts +3 -3
  47. package/index.ts +10 -0
  48. package/package.json +23 -32
  49. package/contracts/compliance/account-contacts/index.ts +0 -82
  50. package/contracts/compliance/account-managers/index.ts +0 -142
  51. package/contracts/compliance/accounts/index.ts +0 -187
  52. package/contracts/compliance/activities/index.ts +0 -55
  53. package/contracts/compliance/aic/index.ts +0 -60
  54. package/contracts/compliance/api-keys/index.ts +0 -91
  55. package/contracts/compliance/assets/index.ts +0 -122
  56. package/contracts/compliance/auth/index.ts +0 -134
  57. package/contracts/compliance/batch-jobs/index.ts +0 -62
  58. package/contracts/compliance/bonus-tiers/index.ts +0 -55
  59. package/contracts/compliance/checklist/index.ts +0 -87
  60. package/contracts/compliance/checklist-items/index.ts +0 -86
  61. package/contracts/compliance/covered-persons/index.ts +0 -97
  62. package/contracts/compliance/dashboard/index.ts +0 -111
  63. package/contracts/compliance/data-records/index.ts +0 -116
  64. package/contracts/compliance/data-rooms/index.ts +0 -113
  65. package/contracts/compliance/default-theme-configs/index.ts +0 -95
  66. package/contracts/compliance/disbursement/index.ts +0 -165
  67. package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  68. package/contracts/compliance/disbursement-transactions/index.ts +0 -37
  69. package/contracts/compliance/domain-filters/index.ts +0 -117
  70. package/contracts/compliance/email-themes/index.ts +0 -284
  71. package/contracts/compliance/escrow-accounts/index.ts +0 -85
  72. package/contracts/compliance/exchange-api-keys/index.ts +0 -129
  73. package/contracts/compliance/exchange-imports/index.ts +0 -137
  74. package/contracts/compliance/files/index.ts +0 -267
  75. package/contracts/compliance/files-public/index.ts +0 -188
  76. package/contracts/compliance/health/index.ts +0 -26
  77. package/contracts/compliance/index.ts +0 -147
  78. package/contracts/compliance/individuals/index.ts +0 -57
  79. package/contracts/compliance/investor-accounts/index.ts +0 -141
  80. package/contracts/compliance/invites/index.ts +0 -137
  81. package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  82. package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  83. package/contracts/compliance/issuers/index.ts +0 -97
  84. package/contracts/compliance/job-items/index.ts +0 -58
  85. package/contracts/compliance/jobs/index.ts +0 -59
  86. package/contracts/compliance/kyb/index.ts +0 -54
  87. package/contracts/compliance/kyc/index.ts +0 -77
  88. package/contracts/compliance/legal-entities/index.ts +0 -57
  89. package/contracts/compliance/login-histories/index.ts +0 -37
  90. package/contracts/compliance/notes/index.ts +0 -69
  91. package/contracts/compliance/notion-databases/index.ts +0 -107
  92. package/contracts/compliance/notion-pages/index.ts +0 -105
  93. package/contracts/compliance/offering-reports/index.ts +0 -149
  94. package/contracts/compliance/offerings/index.ts +0 -233
  95. package/contracts/compliance/pages/index.ts +0 -178
  96. package/contracts/compliance/rejection-reasons/index.ts +0 -32
  97. package/contracts/compliance/review/index.ts +0 -169
  98. package/contracts/compliance/roles/index.ts +0 -34
  99. package/contracts/compliance/secondary-customers/index.ts +0 -77
  100. package/contracts/compliance/secondary-orders/index.ts +0 -60
  101. package/contracts/compliance/secondary-trades/index.ts +0 -100
  102. package/contracts/compliance/secure-requests/index.ts +0 -54
  103. package/contracts/compliance/signer/index.ts +0 -369
  104. package/contracts/compliance/site-links/index.ts +0 -128
  105. package/contracts/compliance/site-settings/index.ts +0 -669
  106. package/contracts/compliance/sites/index.ts +0 -56
  107. package/contracts/compliance/state-machine/index.ts +0 -94
  108. package/contracts/compliance/tasks/index.ts +0 -91
  109. package/contracts/compliance/third-parties/index.ts +0 -52
  110. package/contracts/compliance/trade-line-items/index.ts +0 -59
  111. package/contracts/compliance/trades/index.ts +0 -230
  112. package/contracts/compliance/transactions/index.ts +0 -161
  113. package/contracts/compliance/user-manuals/index.ts +0 -271
  114. package/contracts/compliance/user-settings/index.ts +0 -189
  115. package/contracts/compliance/users/index.ts +0 -200
  116. package/contracts/compliance/webhooks/index.ts +0 -41
  117. package/contracts/compliance-apikey/accounts/index.ts +0 -58
  118. package/contracts/compliance-apikey/index.ts +0 -14
  119. package/contracts/index.ts +0 -6
  120. package/contracts/investors/account-contacts/index.ts +0 -58
  121. package/contracts/investors/aic/index.ts +0 -59
  122. package/contracts/investors/assets/index.ts +0 -61
  123. package/contracts/investors/auth/index.ts +0 -116
  124. package/contracts/investors/bonus-tiers/index.ts +0 -37
  125. package/contracts/investors/contact-us/index.ts +0 -48
  126. package/contracts/investors/data-records/index.ts +0 -113
  127. package/contracts/investors/data-rooms/index.ts +0 -96
  128. package/contracts/investors/files/index.ts +0 -167
  129. package/contracts/investors/files-public/index.ts +0 -185
  130. package/contracts/investors/index.ts +0 -72
  131. package/contracts/investors/individuals/index.ts +0 -99
  132. package/contracts/investors/investor-accounts/index.ts +0 -110
  133. package/contracts/investors/issuers/index.ts +0 -30
  134. package/contracts/investors/legal-entities/index.ts +0 -93
  135. package/contracts/investors/notes/index.ts +0 -69
  136. package/contracts/investors/offerings/index.ts +0 -93
  137. package/contracts/investors/pages/index.ts +0 -88
  138. package/contracts/investors/payment-methods/index.ts +0 -149
  139. package/contracts/investors/portfolios/index.ts +0 -53
  140. package/contracts/investors/sites/index.ts +0 -96
  141. package/contracts/investors/tasks/index.ts +0 -111
  142. package/contracts/investors/trades/index.ts +0 -114
  143. package/contracts/investors/trusted-contacts/index.ts +0 -93
  144. package/contracts/investors/user-manuals/index.ts +0 -62
  145. package/contracts/investors/user-settings/index.ts +0 -170
  146. package/contracts/investors/users/index.ts +0 -45
  147. package/contracts/investors/webhooks/index.ts +0 -30
  148. package/contracts/issuers/account-contacts/index.ts +0 -76
  149. package/contracts/issuers/account-integrations/index.ts +0 -97
  150. package/contracts/issuers/accounts/index.ts +0 -97
  151. package/contracts/issuers/activities/index.ts +0 -54
  152. package/contracts/issuers/aic/index.ts +0 -39
  153. package/contracts/issuers/api-key-logs/index.ts +0 -53
  154. package/contracts/issuers/api-keys/index.ts +0 -93
  155. package/contracts/issuers/assets/index.ts +0 -122
  156. package/contracts/issuers/auth/index.ts +0 -152
  157. package/contracts/issuers/bonus-tiers/index.ts +0 -55
  158. package/contracts/issuers/contact-us/index.ts +0 -48
  159. package/contracts/issuers/covered-persons/index.ts +0 -136
  160. package/contracts/issuers/dashboard/index.ts +0 -72
  161. package/contracts/issuers/data-records/index.ts +0 -257
  162. package/contracts/issuers/data-rooms/index.ts +0 -134
  163. package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  164. package/contracts/issuers/disbursement-transactions/index.ts +0 -53
  165. package/contracts/issuers/disbursements/index.ts +0 -153
  166. package/contracts/issuers/email-themes/index.ts +0 -242
  167. package/contracts/issuers/escrow-accounts/index.ts +0 -81
  168. package/contracts/issuers/exchange-api-keys/index.ts +0 -144
  169. package/contracts/issuers/files/index.ts +0 -166
  170. package/contracts/issuers/files-public/index.ts +0 -166
  171. package/contracts/issuers/health/index.ts +0 -24
  172. package/contracts/issuers/index.ts +0 -112
  173. package/contracts/issuers/investor-accounts/index.ts +0 -148
  174. package/contracts/issuers/invites/index.ts +0 -129
  175. package/contracts/issuers/issuer/index.ts +0 -94
  176. package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  177. package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  178. package/contracts/issuers/kyc/index.ts +0 -38
  179. package/contracts/issuers/login-histories/index.ts +0 -51
  180. package/contracts/issuers/notes/index.ts +0 -69
  181. package/contracts/issuers/offerings/index.ts +0 -206
  182. package/contracts/issuers/pages/index.ts +0 -138
  183. package/contracts/issuers/payment-methods/index.ts +0 -61
  184. package/contracts/issuers/portfolios/index.ts +0 -36
  185. package/contracts/issuers/rejection-reasons/index.ts +0 -32
  186. package/contracts/issuers/review/index.ts +0 -63
  187. package/contracts/issuers/secondary-customers/index.ts +0 -55
  188. package/contracts/issuers/secondary-orders/index.ts +0 -57
  189. package/contracts/issuers/secondary-trades/index.ts +0 -57
  190. package/contracts/issuers/secure-requests/index.ts +0 -34
  191. package/contracts/issuers/site-links/index.ts +0 -116
  192. package/contracts/issuers/site-settings/index.ts +0 -585
  193. package/contracts/issuers/sites/index.ts +0 -32
  194. package/contracts/issuers/tasks/index.ts +0 -111
  195. package/contracts/issuers/trades/index.ts +0 -132
  196. package/contracts/issuers/transactions/index.ts +0 -158
  197. package/contracts/issuers/user-manuals/index.ts +0 -62
  198. package/contracts/issuers/user-settings/index.ts +0 -170
  199. package/contracts/issuers/users/index.ts +0 -126
  200. package/contracts/secondaries/accounts/index.ts +0 -58
  201. package/contracts/secondaries/index.ts +0 -23
  202. package/contracts/secondaries/secondary-customers/index.ts +0 -55
  203. package/contracts/secondaries/secondary-issuers/index.ts +0 -94
  204. package/contracts/secondaries/secondary-orders/index.ts +0 -56
  205. package/contracts/secondaries/secondary-securities/index.ts +0 -95
  206. package/contracts/secondaries/secondary-trades/index.ts +0 -56
@@ -11,14 +11,17 @@ import {
11
11
  import { tradeIdSchema } from './trade.types';
12
12
  import { accountIdSchema } from './account.types';
13
13
  import { TypeID } from 'typeid-js';
14
- import { issuerIdSchema } from './issuer.types';
15
- import { issuerBankAccountIdSchema } from './issuer-bank-account.types';
14
+ import { IIssuer, issuerIdSchema } from './issuer.types';
15
+ import {
16
+ IIssuerBankAccount,
17
+ issuerBankAccountIdSchema,
18
+ } from './issuer-bank-account.types';
16
19
  import { userIdSchema, UserZod } from './user.types';
17
20
  import {
18
21
  PostDisbursementAdjustmentZod,
19
22
  DisbursementAdjustmentType,
20
23
  } from './disbursement-adjustment.types';
21
- import { escrowAccountIdSchema } from './escrow-account.types';
24
+ import { IEscrowAccount, escrowAccountIdSchema } from './escrow-account.types';
22
25
 
23
26
  export const disbursementIdSchema = z.string().refine(
24
27
  (value) => {
@@ -308,3 +311,116 @@ export const DisbursementSummaryZod = z.object({
308
311
  amountToBeTransferred: z.number(),
309
312
  });
310
313
  export type DisbursementSummaryZod = z.infer<typeof DisbursementSummaryZod>;
314
+
315
+ // GET /disbursements/preview query parameters
316
+ export const GetDisbursementPreviewQueryZod = z.object({
317
+ offeringId: offeringIdSchema,
318
+ selectedTrades: z
319
+ .string()
320
+ .optional()
321
+ .transform((str) => (str ? str.split(',') : []))
322
+ .refine(
323
+ (ids) =>
324
+ ids.every((id) => {
325
+ try {
326
+ const tid = TypeID.fromString(id);
327
+ return tid.getType() === 'trade';
328
+ } catch {
329
+ return false;
330
+ }
331
+ }),
332
+ {
333
+ message: 'All selected trades must be valid trade IDs',
334
+ },
335
+ )
336
+ .openapi({
337
+ example: 'trade_01abc123,trade_01def456',
338
+ }),
339
+ });
340
+ export type GetDisbursementPreviewQueryZod = z.infer<
341
+ typeof GetDisbursementPreviewQueryZod
342
+ >;
343
+
344
+ // Context fields for disbursement preview
345
+ export const DisbursementPreviewContextZod = z.object({
346
+ issuer: z.lazy(() => IIssuer).nullable(),
347
+ offering: z.lazy(() => IOffering).nullable(),
348
+ escrowAccount: z.lazy(() => IEscrowAccount).nullable(),
349
+ destinationBank: z.lazy(() => IIssuerBankAccount).nullable(),
350
+ });
351
+ export type DisbursementPreviewContextZod = z.infer<
352
+ typeof DisbursementPreviewContextZod
353
+ >;
354
+
355
+ // Balance values for disbursement preview
356
+ export const DisbursementPreviewBalanceZod = z.object({
357
+ totalRaised: z.number(),
358
+ totalDisbursed: z.number(),
359
+ pending: z.number(),
360
+ refundPool: z.number(),
361
+ availableForDisbursement: z.number(),
362
+ });
363
+ export type DisbursementPreviewBalanceZod = z.infer<
364
+ typeof DisbursementPreviewBalanceZod
365
+ >;
366
+
367
+ // Trade summary for disbursement preview
368
+ export const DisbursementPreviewTradeSummaryZod = z.object({
369
+ selectedTradesCount: z.number(),
370
+ selectedTradesTotalAmount: z.number(),
371
+ });
372
+ export type DisbursementPreviewTradeSummaryZod = z.infer<
373
+ typeof DisbursementPreviewTradeSummaryZod
374
+ >;
375
+
376
+ // Contingency validation result
377
+ export const DisbursementPreviewContingencyZod = z.object({
378
+ contingencyPassed: z.boolean(),
379
+ contingencyMessage: z.string().nullable(),
380
+ contingencyAmount: z.number(),
381
+ });
382
+ export type DisbursementPreviewContingencyZod = z.infer<
383
+ typeof DisbursementPreviewContingencyZod
384
+ >;
385
+
386
+ // Amount defaults and constraints
387
+ export const DisbursementPreviewAmountZod = z.object({
388
+ defaultAmount: z.number(),
389
+ minAmount: z.number(),
390
+ maxAmount: z.number(),
391
+ });
392
+ export type DisbursementPreviewAmountZod = z.infer<
393
+ typeof DisbursementPreviewAmountZod
394
+ >;
395
+
396
+ // Complete response for GET /disbursements/preview
397
+ export const DisbursementPreviewZod = z.object({
398
+ context: DisbursementPreviewContextZod,
399
+ balance: DisbursementPreviewBalanceZod,
400
+ tradeSummary: DisbursementPreviewTradeSummaryZod,
401
+ contingency: DisbursementPreviewContingencyZod,
402
+ amount: DisbursementPreviewAmountZod,
403
+ });
404
+ export type DisbursementPreviewZod = z.infer<typeof DisbursementPreviewZod>;
405
+
406
+ export const EligibleOfferingZod = z.object({
407
+ offeringId: offeringIdSchema,
408
+ offeringName: z.string(),
409
+ availableAmount: z.number(),
410
+ });
411
+ export type EligibleOfferingZod = z.infer<typeof EligibleOfferingZod>;
412
+
413
+ export const IPaginatedEligibleOffering = z.object({
414
+ items: z.array(EligibleOfferingZod),
415
+ meta: IPaginationMeta,
416
+ });
417
+ export type IPaginatedEligibleOffering = z.infer<
418
+ typeof IPaginatedEligibleOffering
419
+ >;
420
+
421
+ export const EligibleOfferingsFiltersZod = z.object({
422
+ search: z.string().optional(),
423
+ });
424
+ export type EligibleOfferingsFiltersZod = z.infer<
425
+ typeof EligibleOfferingsFiltersZod
426
+ >;
@@ -1,6 +1,6 @@
1
1
  import { extendZodWithOpenApi } from '@anatine/zod-openapi';
2
2
  import { z } from 'zod';
3
- import { AccountZod, IPaginationMeta } from './common.types';
3
+ import { AccountZod, EmailSchema, IPaginationMeta } from './common.types';
4
4
  import { IBaseEntity } from './entity.types';
5
5
  import { TypeID } from 'typeid-js';
6
6
  import { accountIdSchema } from './account.types';
@@ -43,7 +43,7 @@ export const PostEscrowAccount = z.object({
43
43
  accountNumber: z.string().optional().nullable(),
44
44
  routingNumber: z.string().min(9).max(9).optional().nullable(),
45
45
  agentName: z.string().min(2).max(50),
46
- agentEmail: z.string().email(),
46
+ agentEmail: EmailSchema,
47
47
  });
48
48
 
49
49
  export type PostEscrowAccount = z.infer<typeof PostEscrowAccount>;
@@ -65,7 +65,7 @@ export const PatchEscrowAccount = z.object({
65
65
  accountNumber: z.string().min(10).max(18).optional().nullable().optional(),
66
66
  routingNumber: z.string().min(9).max(9).optional().nullable().optional(),
67
67
  agentName: z.string().min(2).max(50).optional(),
68
- agentEmail: z.string().email().optional(),
68
+ agentEmail: EmailSchema.optional(),
69
69
  });
70
70
 
71
71
  export type PatchEscrowAccount = z.infer<typeof PatchEscrowAccount>;
@@ -17,7 +17,7 @@ import { KybZod } from './kyb.types';
17
17
  import { IIndividualZod, individualIdSchema } from './individuals.types';
18
18
  import { LegalEntityZod } from './legal-entity.types';
19
19
  import { IInvestorAccount } from './investor-account.types';
20
- import { TradeZod } from './trade.types';
20
+ import { tradeIdSchema, TradeZod } from './trade.types';
21
21
 
22
22
  extendZodWithOpenApi(z);
23
23
 
@@ -168,13 +168,13 @@ export type PostFileQueryParams = z.infer<typeof PostFileQueryParams>;
168
168
 
169
169
  /**
170
170
  * CLIENT portal specific schema for file uploads
171
- * Only allows INDIVIDUALS as target for file uploads
171
+ * Only allows INDIVIDUALS and TRADES as target for file uploads
172
172
  */
173
173
  export const ClientPostFileQueryParams = z.object({
174
174
  name: z.string().min(1).max(100).openapi({ example: 'file_name' }),
175
175
  category: z.string().max(50).openapi({ example: 'application' }),
176
176
  label: FileLabelsEnum.openapi({ example: FileLabels.OTHER }),
177
- targetId: individualIdSchema.openapi({
177
+ targetId: z.union([individualIdSchema, tradeIdSchema]).openapi({
178
178
  example: 'individual_01kcrsny60fb9rjc8bbqc3b80c',
179
179
  }),
180
180
  metadata: metadataSchema.nullable().optional(),
@@ -314,8 +314,23 @@ export const reviewFiles = z.object({
314
314
  });
315
315
  export type reviewFiles = z.infer<typeof reviewFiles>;
316
316
 
317
+ /**
318
+ * Zod preprocessor that trims strings and converts empty/whitespace-only strings to null
319
+ */
320
+ const trimAndNullifyString = z.preprocess((val) => {
321
+ if (typeof val === 'string') {
322
+ const trimmed = val.trim();
323
+ return trimmed === '' ? null : trimmed;
324
+ }
325
+ return val;
326
+ }, z.unknown());
327
+
317
328
  export const PatchFileMetadata = z.object({
318
- corrected: z.record(z.string(), z.unknown()),
329
+ corrected: z.record(z.string(), trimAndNullifyString),
330
+ expectedCorrected: z
331
+ .record(z.string(), trimAndNullifyString)
332
+ .nullable()
333
+ .optional(),
319
334
  });
320
335
  export type PatchFileMetadata = z.infer<typeof PatchFileMetadata>;
321
336
 
@@ -343,6 +358,7 @@ export const FileMetadataSchema = z.object({
343
358
  },
344
359
  ),
345
360
  corrected: z.record(z.any()).optional(),
361
+ expectedCorrected: z.record(z.any()).optional(),
346
362
  });
347
363
  export type FileMetadata = z.infer<typeof FileMetadataSchema>;
348
364
 
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ import { PortalType, TargetTableEnum } from './common.types';
3
+ import { TaskPriority, TaskType } from './task.types';
4
+
5
+ export enum IWillDoItLaterType {
6
+ KYC = 'KYC',
7
+ // Future types can be added here:
8
+ // AIC = 'AIC',
9
+ // AML = 'AML',
10
+ }
11
+
12
+ export const IWillDoItLaterBodySchema = z.object({
13
+ type: z.nativeEnum(IWillDoItLaterType).default(IWillDoItLaterType.KYC),
14
+ });
15
+
16
+ export type IWillDoItLaterBodyType = z.infer<typeof IWillDoItLaterBodySchema>;
17
+
18
+ export const IWillDoItLaterResponseSchema = z.object({
19
+ message: z.string(),
20
+ });
21
+
22
+ export type IWillDoItLaterResponseType = z.infer<
23
+ typeof IWillDoItLaterResponseSchema
24
+ >;
25
+
26
+ /**
27
+ * @description Context required for processing "I'll do it later" actions.
28
+ */
29
+ export interface IWillDoItLaterContext {
30
+ /** The ID of the target entity */
31
+ targetId: string;
32
+ /** The table name of the target entity */
33
+ targetTable: (typeof TargetTableEnum)[number];
34
+ /** The account ID associated with the action */
35
+ accountId: string;
36
+ /** The user ID who will be assigned the task */
37
+ assigneeId: string;
38
+ }
39
+
40
+ /**
41
+ * @description Configuration for each "I'll do it later" action type.
42
+ * Maps action types to their corresponding task configuration.
43
+ */
44
+ export interface IWillDoItLaterTaskConfig {
45
+ taskType: TaskType;
46
+ portalType: PortalType;
47
+ title: string;
48
+ description: string;
49
+ priority: TaskPriority;
50
+ }
51
+
52
+ /**
53
+ * @description Mapping of "I'll do it later" types to their task configurations.
54
+ * This allows for easy extension of new action types without modifying the service logic.
55
+ */
56
+ export const IWillDoItLaterTaskConfigMap: Record<
57
+ IWillDoItLaterType,
58
+ IWillDoItLaterTaskConfig
59
+ > = {
60
+ [IWillDoItLaterType.KYC]: {
61
+ taskType: TaskType.COMPLETE_KYC,
62
+ portalType: PortalType.INVESTOR,
63
+ title: 'Complete KYC',
64
+ description:
65
+ 'We are unable to verify your KYC information. Please complete your KYC.',
66
+ priority: TaskPriority.HIGH,
67
+ },
68
+ };
@@ -42,6 +42,8 @@ export * from './domain-filter.types';
42
42
  export * from './aic.types';
43
43
  export * from './default-theme-config.types';
44
44
  export * from './offering-reports.types';
45
+ export * from './i-will-do-it-later.types';
46
+ export * from './payment-methods.types';
45
47
 
46
48
  export enum Versions {
47
49
  V1 = 'v1',
@@ -12,12 +12,11 @@ import {
12
12
  InvestorAccountType,
13
13
  SetupStatusType,
14
14
  SetupStepType,
15
- ComplianceReview,
16
15
  RetirementAccountType,
17
- TradeStatus,
18
16
  EmploymentStatus,
19
17
  SourceOfIncome,
20
18
  AMLProvider,
19
+ EmailSchema,
21
20
  } from './common.types';
22
21
  import { IBaseEntity } from './entity.types';
23
22
  import { IInvestorAccount } from './investor-account.types';
@@ -60,8 +59,8 @@ export enum aicQuestionnaireQuestionType {
60
59
  }
61
60
 
62
61
  export enum FilterBy {
63
- TRADE = 'TRADE',
64
- INVESTOR = 'INVESTOR',
62
+ ALL = 'ALL',
63
+ PENDING_TRADES = 'PENDING_TRADES',
65
64
  }
66
65
 
67
66
  export const aicQuestionnaireQuestion = z.object({
@@ -243,17 +242,6 @@ export const IndividualFiltersZod = z.object({
243
242
 
244
243
  export const ComplianceIndividualFiltersZod = IndividualFiltersZod.extend({
245
244
  filterBy: z.nativeEnum(FilterBy).optional(),
246
- tradeStatus: z.nativeEnum(TradeStatus).optional(),
247
- complianceReview: z.nativeEnum(ComplianceReview).optional(),
248
- hasPendingTrades: z.preprocess(
249
- (val) =>
250
- val === 'true' || val === '1'
251
- ? true
252
- : val === 'false' || val === '0'
253
- ? false
254
- : val,
255
- z.boolean().optional(),
256
- ),
257
245
  });
258
246
 
259
247
  /**
@@ -301,7 +289,7 @@ export const PostIndividualBodySchema = z
301
289
  .string()
302
290
  .length(3, 'currencyCode must be 3 digits')
303
291
  .optional(),
304
- email: z.string().email().optional(),
292
+ email: EmailSchema.optional(),
305
293
  role: z.nativeEnum(IndividualRole),
306
294
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
307
295
  ownership: z.coerce
@@ -400,7 +388,7 @@ export const UpdateIndividualBodySchema = z
400
388
  .length(3, 'currencyCode must be 3 digits')
401
389
  .optional(),
402
390
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
403
- email: z.string().email().optional(),
391
+ email: EmailSchema.optional(),
404
392
  ownership: z.coerce
405
393
  .number()
406
394
  .min(0, 'Ownership is less than 0')
@@ -24,6 +24,7 @@ import {
24
24
  SortBy,
25
25
  SortOrder,
26
26
  AMLProvider,
27
+ EmailSchema,
27
28
  } from './common.types';
28
29
  import { accountIdSchema } from './account.types';
29
30
  import { SaStatus, tradeIdSchema, TradeZod } from './trade.types';
@@ -131,7 +132,7 @@ export type PostClientInvestorAccountBody = z.infer<
131
132
 
132
133
  export const UpdateInvestorAccountBodySchema = z.object({
133
134
  name: z.string().optional(),
134
- email: z.string().email().optional(),
135
+ email: EmailSchema.optional(),
135
136
  });
136
137
  export type UpdateInvestorAccountBody = z.infer<
137
138
  typeof UpdateInvestorAccountBodySchema
@@ -3,7 +3,9 @@ import {
3
3
  AccountZod,
4
4
  IPaginationMeta,
5
5
  IssuerRole,
6
+ PortalType,
6
7
  UserRole,
8
+ EmailSchema,
7
9
  } from './common.types';
8
10
  import { extendZodWithOpenApi } from '@anatine/zod-openapi';
9
11
  import { TypeID } from 'typeid-js';
@@ -48,7 +50,7 @@ export const InviteWithUrl = InviteWithoutSecretZod.extend({
48
50
  export type InviteWithUrl = z.infer<typeof InviteWithUrl>;
49
51
 
50
52
  export const PostIssuerInviteZod = z.object({
51
- email: z.string().email(),
53
+ email: EmailSchema,
52
54
  role: z.nativeEnum(IssuerRole),
53
55
  });
54
56
 
@@ -131,3 +133,27 @@ export const PatchInviteForComplianceZod = PatchInviteRoleZod.extend({
131
133
  export type PatchInviteForComplianceZod = z.infer<
132
134
  typeof PatchInviteForComplianceZod
133
135
  >;
136
+
137
+ export const PostInviteZod = z.object({
138
+ email: EmailSchema,
139
+ role: z.nativeEnum(UserRole).openapi({
140
+ example: UserRole.ADMIN,
141
+ }),
142
+ accountId: z.string().optional().openapi({
143
+ example: 'account_01j5y5ghx5fg68d663j1fvy2x7',
144
+ }),
145
+ portalType: z.nativeEnum(PortalType).optional().openapi({
146
+ example: PortalType.ISSUER,
147
+ }),
148
+ });
149
+
150
+ export type PostInviteZod = z.infer<typeof PostInviteZod>;
151
+
152
+ export const CompliancePostInviteZod = z.object({
153
+ email: EmailSchema,
154
+ role: z.nativeEnum(UserRole).openapi({
155
+ example: UserRole.ADMIN,
156
+ }),
157
+ });
158
+
159
+ export type CompliancePostInviteZod = z.infer<typeof CompliancePostInviteZod>;
@@ -8,10 +8,13 @@ import {
8
8
  ManagedByType,
9
9
  OfferingVersioningType,
10
10
  ComplianceReview,
11
+ DurationType,
12
+ AssetType,
13
+ StringToBooleanSchema,
11
14
  } from './common.types';
12
15
  import { IBaseEntity } from './entity.types';
13
16
  import { IIssuer, issuerIdSchema } from './issuer.types';
14
- import { IAsset } from './asset.types';
17
+ import { IAsset, postAssetRefinement, AssetTemplateType } from './asset.types';
15
18
  import { fileIdSchema, FileZod } from './file.types';
16
19
  import { accountIdSchema } from './account.types';
17
20
 
@@ -128,20 +131,60 @@ export const PostIssuerOffering = z
128
131
  .nullable()
129
132
  .openapi({ example: 'This is a description of the offering.' }),
130
133
  managedBy: z.nativeEnum(ManagedByType).optional(),
134
+ assetName: z.string().min(2).max(50).openapi({ example: 'Asset name' }),
135
+ assetType: z.nativeEnum(AssetType).openapi({ example: AssetType.STOCK }),
136
+ pricePerUnit: z
137
+ .number()
138
+ .min(0.01)
139
+ .max(10000000000)
140
+ .nullable()
141
+ .openapi({ example: 2000 }),
142
+ totalUnits: z
143
+ .number()
144
+ .min(1)
145
+ .max(10000000000)
146
+ .nullable()
147
+ .openapi({ example: 5200 }),
148
+ yield: z
149
+ .number()
150
+ .min(0.01)
151
+ .max(10000000000)
152
+ .nullable()
153
+ .optional()
154
+ .openapi({ example: 1200 }),
155
+ duration: z
156
+ .number()
157
+ .min(1)
158
+ .max(1000)
159
+ .nullable()
160
+ .optional()
161
+ .openapi({ example: 1 }),
162
+ durationType: z
163
+ .nativeEnum(DurationType)
164
+ .nullable()
165
+ .optional()
166
+ .openapi({ example: DurationType.DAY }),
167
+ template: z
168
+ .nativeEnum(AssetTemplateType)
169
+ .default(AssetTemplateType.STANDARD)
170
+ .openapi({ example: AssetTemplateType.STANDARD }),
171
+ tiers: z.array(z.number().positive()).nullable().optional(),
172
+ enableBonus: z.boolean().default(false).optional(),
131
173
  })
132
- .refine(
133
- (data) => {
134
- // Check if both values are present, and if so, ensure minInvestment is less than maxInvestment
135
- if (data.minInvestment && data.maxInvestment) {
136
- return data.minInvestment < data.maxInvestment;
174
+ .superRefine((data, ctx) => {
175
+ // Check if both values are present, and if so, ensure minInvestment is less than maxInvestment
176
+ if (data.minInvestment && data.maxInvestment) {
177
+ if (data.minInvestment >= data.maxInvestment) {
178
+ ctx.addIssue({
179
+ path: ['minInvestment'],
180
+ message: 'Minimum investment must be less than maximum investment.',
181
+ code: z.ZodIssueCode.custom,
182
+ });
137
183
  }
138
- return true; // If one or both values are undefined, skip this check
139
- },
140
- {
141
- message: 'Minimum investment must be less than maximum investment.',
142
- path: ['minInvestment'],
143
- },
144
- );
184
+ }
185
+ // Apply asset-specific refinements
186
+ postAssetRefinement(data, ctx);
187
+ });
145
188
 
146
189
  export type PostIssuerOffering = z.infer<typeof PostIssuerOffering>;
147
190
  export const PatchIssuerOffering = z.object({
@@ -151,38 +194,39 @@ export const PatchIssuerOffering = z.object({
151
194
  .max(100)
152
195
  .optional()
153
196
  .openapi({ example: 'Airbnb IPO' }),
197
+ type: z
198
+ .nativeEnum(OfferingType)
199
+ .optional()
200
+ .openapi({ example: OfferingType.REG_D }),
154
201
  targetAmount: z
155
202
  .number()
156
203
  .min(0)
157
204
  .max(10000000000)
158
205
  .optional()
159
206
  .openapi({ example: 120000 }),
160
- raiseAmount: z
161
- .number()
162
- .min(0)
163
- .max(10000000000)
164
- .optional()
165
- .openapi({ example: 200000 }),
166
207
  minInvestment: z
167
208
  .number()
168
209
  .min(0)
169
210
  .max(10000000000)
211
+ .nullable()
170
212
  .optional()
171
213
  .openapi({ example: 1000 }),
172
214
  maxInvestment: z
173
215
  .number()
174
216
  .min(0)
175
217
  .max(10000000000)
218
+ .nullable()
176
219
  .optional()
177
220
  .openapi({ example: 20000 }),
178
221
  contingencyAmount: z
179
222
  .number()
180
223
  .min(0)
181
224
  .max(10000000000)
225
+ .nullable()
182
226
  .optional()
183
227
  .openapi({ example: 5000 }),
184
- startAt: dateSchema.optional().openapi({ example: '10/20/2024' }),
185
- endAt: dateSchema.optional().openapi({ example: '10/27/2024' }),
228
+ startAt: dateSchema.nullable().optional().openapi({ example: '10/20/2024' }),
229
+ endAt: dateSchema.nullable().optional().openapi({ example: '10/27/2024' }),
186
230
  cancellationPeriod: z
187
231
  .number()
188
232
  .min(1)
@@ -212,6 +256,53 @@ export const PatchIssuerOffering = z.object({
212
256
  managedBy: z.nativeEnum(ManagedByType).optional(),
213
257
  showTotalRaised: z.boolean().optional(),
214
258
  issuerId: issuerIdSchema.optional(),
259
+ assetName: z.string().min(2).max(50).optional().openapi({ example: 'Z' }),
260
+ assetType: z
261
+ .nativeEnum(AssetType)
262
+ .optional()
263
+ .openapi({ example: AssetType.STOCK }),
264
+ pricePerUnit: z
265
+ .number()
266
+ .min(0.01)
267
+ .max(10000000000)
268
+ .nullable()
269
+ .optional()
270
+ .openapi({ example: 2000 }),
271
+ totalUnits: z
272
+ .number()
273
+ .min(1)
274
+ .max(10000000000)
275
+ .nullable()
276
+ .optional()
277
+ .openapi({ example: 5200 }),
278
+ yield: z
279
+ .number()
280
+ .min(0.01)
281
+ .max(10000000000)
282
+ .nullable()
283
+ .optional()
284
+ .openapi({ example: 1200 }),
285
+ duration: z
286
+ .number()
287
+ .min(1)
288
+ .max(1000)
289
+ .nullable()
290
+ .optional()
291
+ .openapi({ example: 1 }),
292
+ durationType: z
293
+ .nativeEnum(DurationType)
294
+ .nullable()
295
+ .optional()
296
+ .openapi({ example: DurationType.DAY }),
297
+ template: z
298
+ .nativeEnum(AssetTemplateType)
299
+ .default(AssetTemplateType.STANDARD)
300
+ .openapi({ example: AssetTemplateType.STANDARD })
301
+ .nullable()
302
+ .optional(),
303
+ tiers: z.array(z.number().positive()).nullable().optional(),
304
+ enabled: z.boolean().optional(),
305
+ enableBonus: z.boolean().optional(),
215
306
  });
216
307
  export type PatchIssuerOffering = z.infer<typeof PatchIssuerOffering>;
217
308
 
@@ -281,15 +372,7 @@ export const IssuerOfferingsFilterZod = z.object({
281
372
  issuerId: z.lazy(() => issuerIdSchema).optional(),
282
373
  type: z.nativeEnum(OfferingType).optional(),
283
374
  status: z.nativeEnum(ComplianceReview).optional(),
284
- enabled: z.preprocess(
285
- (val) =>
286
- val === 'true' || val === '1'
287
- ? true
288
- : val === 'false' || val === '0'
289
- ? false
290
- : val,
291
- z.boolean().optional(),
292
- ),
375
+ enabled: StringToBooleanSchema.optional(),
293
376
  managedBy: z.nativeEnum(ManagedByType).optional(),
294
377
  versioningType: z.nativeEnum(OfferingVersioningType).optional(),
295
378
  combinedStatus: z.nativeEnum(OfferingStatus).optional(),
@@ -222,10 +222,51 @@ export type IPaginatedIssuerPaymentMethod = z.infer<
222
222
  typeof IPaginatedIssuerPaymentMethod
223
223
  >;
224
224
 
225
+ const issuerPaymentMethodsInclude = z.enum(['issuer', 'integration']);
226
+
227
+ /**
228
+ * @description Query parameters for including related entities
229
+ * @example in contract use as -> query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(IssuerPaymentMethodsIncludeQuery)
230
+ */
231
+ export const IssuerPaymentMethodsIncludeQuery = z.object({
232
+ include: z
233
+ .string()
234
+ .optional()
235
+ .transform((str) => (str ? str.split(',') : []))
236
+ .refine(
237
+ (includes) =>
238
+ includes.every((include) =>
239
+ issuerPaymentMethodsInclude.options.includes(include as any),
240
+ ),
241
+ {
242
+ message: `Invalid include option provided. Valid options are: ${issuerPaymentMethodsInclude.options.join(',')}`,
243
+ },
244
+ )
245
+ .openapi({
246
+ example: `${issuerPaymentMethodsInclude.options.join(',')}`,
247
+ }),
248
+ });
249
+ export type IssuerPaymentMethodsIncludeQuery = z.infer<
250
+ typeof IssuerPaymentMethodsIncludeQuery
251
+ >;
252
+
225
253
  export const GetIssuerPaymentMethodZod = z.object({
226
254
  issuerId: issuerIdSchema.openapi({
227
255
  example: 'issuer_01jdq2crwke8xskjd840cj79pw',
228
256
  }),
257
+ enabled: z
258
+ .string()
259
+ .optional()
260
+ .refine((v) => !v || v === 'true' || v === 'false', {
261
+ message: 'enabled must be a boolean string',
262
+ })
263
+ .transform((v) => {
264
+ if (!v) return undefined;
265
+ return v === 'true';
266
+ })
267
+ .openapi({
268
+ example: 'true',
269
+ }),
229
270
  });
230
271
  export type GetIssuerPaymentMethodZod = z.infer<
231
272
  typeof GetIssuerPaymentMethodZod