@dalmore/api-contracts 1.0.2 → 1.0.5

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 (295) hide show
  1. package/README.md +34 -55
  2. package/index.d.mts +17 -0
  3. package/index.d.ts +17 -0
  4. package/index.mjs +10970 -0
  5. package/package.json +10 -46
  6. package/common/helpers/index.ts +0 -205
  7. package/common/types/account-contact.types.ts +0 -98
  8. package/common/types/account-detail.types.ts +0 -27
  9. package/common/types/account-integration.types.ts +0 -143
  10. package/common/types/account-manager.types.ts +0 -124
  11. package/common/types/account.types.ts +0 -296
  12. package/common/types/activity.types.ts +0 -274
  13. package/common/types/address.types.ts +0 -41
  14. package/common/types/aic.types.ts +0 -246
  15. package/common/types/aml.types.ts +0 -18
  16. package/common/types/api-key-logs.types.ts +0 -66
  17. package/common/types/api-keys.types.ts +0 -69
  18. package/common/types/asset.types.ts +0 -338
  19. package/common/types/auth.types.ts +0 -370
  20. package/common/types/batch-jobs.types.ts +0 -150
  21. package/common/types/bonus-tier.types.ts +0 -147
  22. package/common/types/cart.types.ts +0 -18
  23. package/common/types/checklist-items.types.ts +0 -70
  24. package/common/types/checklist.types.ts +0 -97
  25. package/common/types/common.types.ts +0 -1520
  26. package/common/types/comply-advantage-api.types.ts +0 -316
  27. package/common/types/comply-advantage.types.ts +0 -25
  28. package/common/types/contact-us.types.ts +0 -107
  29. package/common/types/contract-helpers.ts +0 -205
  30. package/common/types/countries.types.ts +0 -375
  31. package/common/types/covered-person.types.ts +0 -274
  32. package/common/types/dashboard.types.ts +0 -799
  33. package/common/types/data-record.types.ts +0 -325
  34. package/common/types/data-room.types.ts +0 -242
  35. package/common/types/default-theme-config.types.ts +0 -87
  36. package/common/types/disbursement-adjustment.types.ts +0 -32
  37. package/common/types/disbursement-approval-user.types.ts +0 -100
  38. package/common/types/disbursement-review.types.ts +0 -110
  39. package/common/types/disbursement-transaction.types.ts +0 -72
  40. package/common/types/disbursements.types.ts +0 -310
  41. package/common/types/domain-filter.types.ts +0 -55
  42. package/common/types/email-theme.types.ts +0 -442
  43. package/common/types/entity.types.ts +0 -15
  44. package/common/types/error-responses.types.ts +0 -135
  45. package/common/types/escrow-account.types.ts +0 -104
  46. package/common/types/exchange-api-key.types.ts +0 -121
  47. package/common/types/exchange-import.types.ts +0 -36
  48. package/common/types/exchange-provider.types.ts +0 -329
  49. package/common/types/file.types.ts +0 -461
  50. package/common/types/health.types.ts +0 -29
  51. package/common/types/index.ts +0 -48
  52. package/common/types/individuals.types.ts +0 -554
  53. package/common/types/investor-account.types.ts +0 -1239
  54. package/common/types/investorAccountIdSchema.type.ts +0 -0
  55. package/common/types/investors-offering.types.ts +0 -65
  56. package/common/types/invite.types.ts +0 -133
  57. package/common/types/issuer-bank-account.types.ts +0 -107
  58. package/common/types/issuer-offering.types.ts +0 -306
  59. package/common/types/issuer-payment-method.types.ts +0 -341
  60. package/common/types/issuer.types.ts +0 -312
  61. package/common/types/job-item.types.ts +0 -119
  62. package/common/types/jobs.types.ts +0 -171
  63. package/common/types/kyb.types.ts +0 -53
  64. package/common/types/kyc.types.ts +0 -188
  65. package/common/types/legal-entity.types.ts +0 -185
  66. package/common/types/login-history.types.ts +0 -46
  67. package/common/types/mail-template.types.ts +0 -436
  68. package/common/types/north-cap-integration.types.ts +0 -190
  69. package/common/types/note.types.ts +0 -109
  70. package/common/types/notification.types.ts +0 -58
  71. package/common/types/notion-api.types.ts +0 -374
  72. package/common/types/notion-database.types.ts +0 -125
  73. package/common/types/notion-page.types.ts +0 -267
  74. package/common/types/offering-reports.types.ts +0 -153
  75. package/common/types/offering-submission.types.ts +0 -314
  76. package/common/types/offering.types.ts +0 -590
  77. package/common/types/page-revision.types.ts +0 -86
  78. package/common/types/page.types.ts +0 -436
  79. package/common/types/password.type.ts +0 -15
  80. package/common/types/payment-methods.types.ts +0 -298
  81. package/common/types/phone.type.ts +0 -27
  82. package/common/types/portfolio.types.ts +0 -50
  83. package/common/types/privacy-policy-and-tos.types.ts +0 -231
  84. package/common/types/queue.types.ts +0 -111
  85. package/common/types/registered-reps.types.ts +0 -25
  86. package/common/types/rejection-reasons.types.ts +0 -56
  87. package/common/types/review.types.ts +0 -133
  88. package/common/types/role.types.ts +0 -26
  89. package/common/types/secondary-customer.types.ts +0 -66
  90. package/common/types/secondary-issuer.types.ts +0 -50
  91. package/common/types/secondary-order.types.ts +0 -58
  92. package/common/types/secondary-security.types.ts +0 -60
  93. package/common/types/secondary-trade.entity.ts +0 -16
  94. package/common/types/secondary-trade.types.ts +0 -95
  95. package/common/types/secure-request.types.ts +0 -68
  96. package/common/types/signer.types.ts +0 -651
  97. package/common/types/site-link.types.ts +0 -166
  98. package/common/types/site-settings.types.ts +0 -726
  99. package/common/types/site.types.ts +0 -270
  100. package/common/types/sms.types.ts +0 -30
  101. package/common/types/state-machine.types.ts +0 -177
  102. package/common/types/states.types.ts +0 -163
  103. package/common/types/subdoc-preview.types.ts +0 -35
  104. package/common/types/task.types.ts +0 -258
  105. package/common/types/trade-adjustment.type.ts +0 -33
  106. package/common/types/trade-line-item.type.ts +0 -132
  107. package/common/types/trade.types.ts +0 -931
  108. package/common/types/transaction.types.ts +0 -198
  109. package/common/types/trusted-contact.types.ts +0 -122
  110. package/common/types/typography.types.ts +0 -75
  111. package/common/types/user-manual.types.ts +0 -290
  112. package/common/types/user-setting.types.ts +0 -133
  113. package/common/types/user.types.ts +0 -320
  114. package/common/types/webhook.types.ts +0 -588
  115. package/common/types/zip.type.ts +0 -36
  116. package/contracts/clients/accounts/index.ts +0 -61
  117. package/contracts/clients/aic/index.ts +0 -59
  118. package/contracts/clients/api-key-logs/index.ts +0 -53
  119. package/contracts/clients/api-keys/index.ts +0 -73
  120. package/contracts/clients/assets/index.ts +0 -102
  121. package/contracts/clients/auth/index.ts +0 -50
  122. package/contracts/clients/files/index.ts +0 -166
  123. package/contracts/clients/files-public/index.ts +0 -166
  124. package/contracts/clients/index.ts +0 -44
  125. package/contracts/clients/individuals/index.ts +0 -93
  126. package/contracts/clients/investor-accounts/index.ts +0 -93
  127. package/contracts/clients/issuers/index.ts +0 -94
  128. package/contracts/clients/legal-entities/index.ts +0 -93
  129. package/contracts/clients/offerings/index.ts +0 -117
  130. package/contracts/clients/secure-requests/index.ts +0 -34
  131. package/contracts/clients/sites/index.ts +0 -56
  132. package/contracts/clients/trades/index.ts +0 -122
  133. package/contracts/compliance/account-contacts/index.ts +0 -82
  134. package/contracts/compliance/account-managers/index.ts +0 -142
  135. package/contracts/compliance/accounts/index.ts +0 -187
  136. package/contracts/compliance/activities/index.ts +0 -55
  137. package/contracts/compliance/aic/index.ts +0 -60
  138. package/contracts/compliance/api-keys/index.ts +0 -91
  139. package/contracts/compliance/assets/index.ts +0 -122
  140. package/contracts/compliance/auth/index.ts +0 -134
  141. package/contracts/compliance/batch-jobs/index.ts +0 -62
  142. package/contracts/compliance/bonus-tiers/index.ts +0 -55
  143. package/contracts/compliance/checklist/index.ts +0 -87
  144. package/contracts/compliance/checklist-items/index.ts +0 -86
  145. package/contracts/compliance/covered-persons/index.ts +0 -97
  146. package/contracts/compliance/dashboard/index.ts +0 -111
  147. package/contracts/compliance/data-records/index.ts +0 -116
  148. package/contracts/compliance/data-rooms/index.ts +0 -113
  149. package/contracts/compliance/default-theme-configs/index.ts +0 -95
  150. package/contracts/compliance/disbursement/index.ts +0 -165
  151. package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  152. package/contracts/compliance/disbursement-transactions/index.ts +0 -37
  153. package/contracts/compliance/domain-filters/index.ts +0 -117
  154. package/contracts/compliance/email-themes/index.ts +0 -284
  155. package/contracts/compliance/escrow-accounts/index.ts +0 -85
  156. package/contracts/compliance/exchange-api-keys/index.ts +0 -129
  157. package/contracts/compliance/exchange-imports/index.ts +0 -137
  158. package/contracts/compliance/files/index.ts +0 -267
  159. package/contracts/compliance/files-public/index.ts +0 -188
  160. package/contracts/compliance/health/index.ts +0 -26
  161. package/contracts/compliance/index.ts +0 -147
  162. package/contracts/compliance/individuals/index.ts +0 -57
  163. package/contracts/compliance/investor-accounts/index.ts +0 -141
  164. package/contracts/compliance/invites/index.ts +0 -137
  165. package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  166. package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  167. package/contracts/compliance/issuers/index.ts +0 -97
  168. package/contracts/compliance/job-items/index.ts +0 -58
  169. package/contracts/compliance/jobs/index.ts +0 -59
  170. package/contracts/compliance/kyb/index.ts +0 -54
  171. package/contracts/compliance/kyc/index.ts +0 -77
  172. package/contracts/compliance/legal-entities/index.ts +0 -57
  173. package/contracts/compliance/login-histories/index.ts +0 -37
  174. package/contracts/compliance/notes/index.ts +0 -69
  175. package/contracts/compliance/notion-databases/index.ts +0 -107
  176. package/contracts/compliance/notion-pages/index.ts +0 -105
  177. package/contracts/compliance/offering-reports/index.ts +0 -149
  178. package/contracts/compliance/offerings/index.ts +0 -233
  179. package/contracts/compliance/pages/index.ts +0 -178
  180. package/contracts/compliance/payment-methods/index.ts +0 -57
  181. package/contracts/compliance/rejection-reasons/index.ts +0 -32
  182. package/contracts/compliance/review/index.ts +0 -169
  183. package/contracts/compliance/roles/index.ts +0 -34
  184. package/contracts/compliance/secondary-customers/index.ts +0 -77
  185. package/contracts/compliance/secondary-orders/index.ts +0 -60
  186. package/contracts/compliance/secondary-trades/index.ts +0 -100
  187. package/contracts/compliance/secure-requests/index.ts +0 -54
  188. package/contracts/compliance/signer/index.ts +0 -369
  189. package/contracts/compliance/site-links/index.ts +0 -128
  190. package/contracts/compliance/site-settings/index.ts +0 -669
  191. package/contracts/compliance/sites/index.ts +0 -56
  192. package/contracts/compliance/state-machine/index.ts +0 -94
  193. package/contracts/compliance/tasks/index.ts +0 -91
  194. package/contracts/compliance/third-parties/index.ts +0 -52
  195. package/contracts/compliance/trade-line-items/index.ts +0 -59
  196. package/contracts/compliance/trades/index.ts +0 -230
  197. package/contracts/compliance/transactions/index.ts +0 -161
  198. package/contracts/compliance/user-manuals/index.ts +0 -271
  199. package/contracts/compliance/user-settings/index.ts +0 -189
  200. package/contracts/compliance/users/index.ts +0 -200
  201. package/contracts/compliance/webhooks/index.ts +0 -41
  202. package/contracts/compliance-apikey/accounts/index.ts +0 -58
  203. package/contracts/compliance-apikey/index.ts +0 -14
  204. package/contracts/index.ts +0 -6
  205. package/contracts/investors/account-contacts/index.ts +0 -58
  206. package/contracts/investors/aic/index.ts +0 -59
  207. package/contracts/investors/assets/index.ts +0 -61
  208. package/contracts/investors/auth/index.ts +0 -116
  209. package/contracts/investors/bonus-tiers/index.ts +0 -37
  210. package/contracts/investors/cart/index.ts +0 -75
  211. package/contracts/investors/contact-us/index.ts +0 -48
  212. package/contracts/investors/data-records/index.ts +0 -113
  213. package/contracts/investors/data-rooms/index.ts +0 -96
  214. package/contracts/investors/files/index.ts +0 -167
  215. package/contracts/investors/files-public/index.ts +0 -185
  216. package/contracts/investors/index.ts +0 -72
  217. package/contracts/investors/individuals/index.ts +0 -99
  218. package/contracts/investors/investor-accounts/index.ts +0 -110
  219. package/contracts/investors/issuer-payment-methods/index.ts +0 -36
  220. package/contracts/investors/issuers/index.ts +0 -30
  221. package/contracts/investors/legal-entities/index.ts +0 -93
  222. package/contracts/investors/notes/index.ts +0 -69
  223. package/contracts/investors/offerings/index.ts +0 -93
  224. package/contracts/investors/pages/index.ts +0 -88
  225. package/contracts/investors/payment-methods/index.ts +0 -149
  226. package/contracts/investors/portfolios/index.ts +0 -53
  227. package/contracts/investors/sites/index.ts +0 -96
  228. package/contracts/investors/tasks/index.ts +0 -111
  229. package/contracts/investors/trade-line-items/index.ts +0 -75
  230. package/contracts/investors/trades/index.ts +0 -114
  231. package/contracts/investors/transactions/index.ts +0 -37
  232. package/contracts/investors/trusted-contacts/index.ts +0 -93
  233. package/contracts/investors/user-manuals/index.ts +0 -62
  234. package/contracts/investors/user-settings/index.ts +0 -170
  235. package/contracts/investors/users/index.ts +0 -45
  236. package/contracts/investors/webhooks/index.ts +0 -30
  237. package/contracts/issuers/account-contacts/index.ts +0 -76
  238. package/contracts/issuers/account-integrations/index.ts +0 -97
  239. package/contracts/issuers/accounts/index.ts +0 -97
  240. package/contracts/issuers/activities/index.ts +0 -54
  241. package/contracts/issuers/aic/index.ts +0 -39
  242. package/contracts/issuers/api-key-logs/index.ts +0 -53
  243. package/contracts/issuers/api-keys/index.ts +0 -93
  244. package/contracts/issuers/assets/index.ts +0 -122
  245. package/contracts/issuers/auth/index.ts +0 -152
  246. package/contracts/issuers/bonus-tiers/index.ts +0 -55
  247. package/contracts/issuers/contact-us/index.ts +0 -48
  248. package/contracts/issuers/covered-persons/index.ts +0 -136
  249. package/contracts/issuers/dashboard/index.ts +0 -72
  250. package/contracts/issuers/data-records/index.ts +0 -257
  251. package/contracts/issuers/data-rooms/index.ts +0 -134
  252. package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  253. package/contracts/issuers/disbursement-transactions/index.ts +0 -53
  254. package/contracts/issuers/disbursements/index.ts +0 -153
  255. package/contracts/issuers/email-themes/index.ts +0 -242
  256. package/contracts/issuers/escrow-accounts/index.ts +0 -81
  257. package/contracts/issuers/exchange-api-keys/index.ts +0 -144
  258. package/contracts/issuers/files/index.ts +0 -166
  259. package/contracts/issuers/files-public/index.ts +0 -166
  260. package/contracts/issuers/health/index.ts +0 -24
  261. package/contracts/issuers/index.ts +0 -112
  262. package/contracts/issuers/investor-accounts/index.ts +0 -148
  263. package/contracts/issuers/invites/index.ts +0 -129
  264. package/contracts/issuers/issuer/index.ts +0 -94
  265. package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  266. package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  267. package/contracts/issuers/kyc/index.ts +0 -38
  268. package/contracts/issuers/login-histories/index.ts +0 -51
  269. package/contracts/issuers/notes/index.ts +0 -69
  270. package/contracts/issuers/offerings/index.ts +0 -206
  271. package/contracts/issuers/pages/index.ts +0 -138
  272. package/contracts/issuers/payment-methods/index.ts +0 -61
  273. package/contracts/issuers/portfolios/index.ts +0 -36
  274. package/contracts/issuers/rejection-reasons/index.ts +0 -32
  275. package/contracts/issuers/review/index.ts +0 -63
  276. package/contracts/issuers/secondary-customers/index.ts +0 -55
  277. package/contracts/issuers/secondary-orders/index.ts +0 -57
  278. package/contracts/issuers/secondary-trades/index.ts +0 -57
  279. package/contracts/issuers/secure-requests/index.ts +0 -34
  280. package/contracts/issuers/site-links/index.ts +0 -116
  281. package/contracts/issuers/site-settings/index.ts +0 -585
  282. package/contracts/issuers/sites/index.ts +0 -32
  283. package/contracts/issuers/tasks/index.ts +0 -111
  284. package/contracts/issuers/trades/index.ts +0 -132
  285. package/contracts/issuers/transactions/index.ts +0 -158
  286. package/contracts/issuers/user-manuals/index.ts +0 -62
  287. package/contracts/issuers/user-settings/index.ts +0 -170
  288. package/contracts/issuers/users/index.ts +0 -126
  289. package/contracts/secondaries/accounts/index.ts +0 -58
  290. package/contracts/secondaries/index.ts +0 -23
  291. package/contracts/secondaries/secondary-customers/index.ts +0 -55
  292. package/contracts/secondaries/secondary-issuers/index.ts +0 -94
  293. package/contracts/secondaries/secondary-orders/index.ts +0 -56
  294. package/contracts/secondaries/secondary-securities/index.ts +0 -95
  295. package/contracts/secondaries/secondary-trades/index.ts +0 -56
@@ -1,931 +0,0 @@
1
- import { z } from 'zod';
2
- import {
3
- InvestmentType,
4
- IPaginationMeta,
5
- FundingStatus,
6
- TxnCheck,
7
- PaginationOptionsZod,
8
- dateSchema,
9
- BaseStatus,
10
- ComplianceReview,
11
- OfferingType,
12
- ManagedByType,
13
- SignatureStatus,
14
- TradeType,
15
- TradeStatus,
16
- SortOrder,
17
- SortBy,
18
- AicStatus,
19
- AMLStatus,
20
- KYCStatus,
21
- createDateSchema,
22
- AccountStatus,
23
- SavedQuery,
24
- } from './common.types';
25
- import { offeringIdSchema } from './offering.types';
26
- import { IBaseEntity } from './entity.types';
27
- import { extendZodWithOpenApi } from '@anatine/zod-openapi';
28
- import { TypeID } from 'typeid-js';
29
- import {
30
- paymentMethodIdSchema,
31
- PaymentMethodType,
32
- } from './payment-methods.types';
33
- import {
34
- investorAccountIdSchema,
35
- InvestorAccountExportFilters,
36
- ComplianceInvestorAccountExportFilters,
37
- RegisteredInvestorUserRawZod,
38
- } from './investor-account.types';
39
- import {
40
- tradeLineItemIdSchema,
41
- TradeLineItemZod,
42
- } from './trade-line-item.type';
43
- import { TradeAdjustmentZod } from './trade-adjustment.type';
44
- import { TransactionZod } from './transaction.types';
45
- import { accountIdSchema } from './account.types';
46
- import { userIdSchema } from './user.types';
47
- import { issuerIdSchema } from './issuer.types';
48
- import {
49
- GetSecondaryCustomerFiltersZod,
50
- SecondaryCustomer,
51
- } from './secondary-customer.types';
52
- import {
53
- SecondaryTrade,
54
- SecondaryTradeFiltersZod,
55
- } from './secondary-trade.types';
56
-
57
- // Stub types for backend entities (not included in contracts package)
58
- type InvestorAccount = Record<string, unknown>;
59
- type Trade = Record<string, unknown>;
60
-
61
- extendZodWithOpenApi(z);
62
- export const CheckResultsSchema = z.object({
63
- fundingStatus: z.boolean(),
64
- agreementStatus: z.boolean(),
65
- subscriptionAgreementCheck: z.boolean(),
66
- kycStatus: z.boolean(),
67
- sanctionsStatus: z.boolean(),
68
- accreditationStatus: z.boolean(),
69
- kybStatus: z.boolean(),
70
- });
71
- export type CheckResults = z.infer<typeof CheckResultsSchema>;
72
-
73
- export const TradeIdPrefix = 'trade';
74
-
75
- export const tradeIdSchema = z.string().refine(
76
- (value) => {
77
- try {
78
- const tid = TypeID.fromString(value);
79
- return tid.getType() === TradeIdPrefix;
80
- } catch {
81
- return false;
82
- }
83
- },
84
- {
85
- message:
86
- 'Invalid trade ID format. Must be a valid TypeID with "trade" prefix. ex: trade_00041061050r3gg28a1c60t3gf',
87
- },
88
- );
89
-
90
- export const tradeIdOrTidSchema = z.union([
91
- z.string().refine(
92
- (value) => {
93
- try {
94
- const tid = TypeID.fromString(value);
95
- return tid.getType() === TradeIdPrefix;
96
- } catch {
97
- return false;
98
- }
99
- },
100
- {
101
- message:
102
- 'Invalid trade ID format. Must be a valid TypeID with "trade" prefix. ex: trade_00041061050r3gg28a1c60t3gf',
103
- },
104
- ),
105
- z
106
- .string()
107
- .min(1)
108
- .max(50)
109
- .openapi({ example: 'tid_00041061050r3gg28a1c60t3gf' }),
110
- ]);
111
-
112
- export enum SaStatus {
113
- PENDING = BaseStatus.PENDING,
114
- SIGNED = BaseStatus.SIGNED,
115
- DECLINED = BaseStatus.DECLINED,
116
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
117
- }
118
-
119
- export enum TradeSystemLogType {
120
- SUB_DOC_CHECK = 'Subscription Agreement Check',
121
- ADDRESS_CHECK = 'Address Check',
122
- COUNTRY_CHECK = 'Country Check',
123
- CONCENTRATION_CHECK = 'Concentration Check',
124
- KYC_CHECK = 'KYC Check',
125
- AML_CHECK = 'AML Check',
126
- AIC_CHECK = 'AIC Check',
127
- USER_AGE_CHECK = 'User Age Check',
128
- KYC_NAME_CHECK = 'KYC Name Check',
129
- AML_NAME_CHECK = 'AML Name Check',
130
- AIC_NAME_CHECK = 'AIC Name Check',
131
- KYC_DOB_CHECK = 'KYC DOB Check',
132
- AIC_SSN_CHECK = 'AIC SSN Check',
133
- // Data Integrity Checks For Imported Trades
134
- SHARES_CHECK = 'Shares Check',
135
- PRICE_PER_UNIT_CHECK = 'Price Per Unit Check',
136
- ISSUER_CHECK = 'Issuer Check',
137
- INVESTOR_CHECK = 'Investor Check',
138
- OFFERING_CHECK = 'Offering Check',
139
- ASSETS_CHECK = 'Assets Check',
140
- INDIVIDUALS_CHECK = 'Individuals Check',
141
- }
142
-
143
- export enum SaCheck {
144
- PENDING = BaseStatus.PENDING,
145
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
146
- APPROVED = BaseStatus.APPROVED,
147
- REJECTED = BaseStatus.REJECTED,
148
- }
149
-
150
- // cart NEEDS_INFO PLACED IN_REVIEW AWAITING_FUNDING CANCELLED SETTLED
151
-
152
- export enum SystemReviewCheck {
153
- PENDING = BaseStatus.PENDING,
154
- APPROVED = BaseStatus.APPROVED,
155
- REJECTED = BaseStatus.REJECTED,
156
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
157
- WARNING = BaseStatus.WARNING,
158
- INCOMPLETE = BaseStatus.INCOMPLETE,
159
- }
160
-
161
- export enum Platforms {
162
- DALMORE = 'DALMORE',
163
- IMPORT = 'IMPORT',
164
- }
165
-
166
- export enum MatchResultStatus {
167
- MATCHED = 'MATCHED',
168
- UNMATCHED = 'UNMATCHED',
169
- }
170
-
171
- export enum TradeSystemReviewLogStatus {
172
- PASSED = 'PASSED',
173
- WARNING = 'WARNING',
174
- }
175
-
176
- export const matchResultSchema = z.object({
177
- actual: z.string().min(1).max(200),
178
- status: z.nativeEnum(MatchResultStatus),
179
- extracted: z.string().min(1).max(200),
180
- corrected: z.string().min(1).max(200).optional().nullable(),
181
- });
182
- export type matchResultSchema = z.infer<typeof matchResultSchema>;
183
-
184
- const saLogItemSchema = z.object({
185
- tradeLineItemId: tradeLineItemIdSchema,
186
- signerName: matchResultSchema.optional(),
187
- totalAmount: matchResultSchema.optional(),
188
- investorName: matchResultSchema.optional(),
189
- numberOfShares: matchResultSchema.optional(),
190
- });
191
-
192
- export type saLogItemSchema = z.infer<typeof saLogItemSchema>;
193
-
194
- export const SaLogSchema = z.object({
195
- finalStatus: z.nativeEnum(SaStatus),
196
- matchResults: z.array(saLogItemSchema),
197
- });
198
-
199
- export type saLogSchema = z.infer<typeof SaLogSchema>;
200
-
201
- export const PatchSaLogSchema = z.object({
202
- matchResults: z.array(saLogItemSchema),
203
- });
204
-
205
- export type PatchSaLogSchema = z.infer<typeof PatchSaLogSchema>;
206
-
207
- export const TradeZod = IBaseEntity.extend({
208
- investorAccountId: z.lazy(() => investorAccountIdSchema.nullable()),
209
- accountId: accountIdSchema.nullable(),
210
- offeringId: z.lazy(() => offeringIdSchema.nullable()),
211
- paymentMethodId: z.lazy(() => paymentMethodIdSchema).nullable(),
212
- userId: z.lazy(() => userIdSchema.nullable()),
213
- tradeNumber: z.string(),
214
- ip: z.string().nullable(),
215
- tid: z.string().nullable(),
216
- investmentType: z.nativeEnum(InvestmentType),
217
- numberOfShares: z.number().int(),
218
- pricePerShare: z.number().multipleOf(0.01),
219
- lineItems: z.array(z.lazy(() => TradeLineItemZod)),
220
- adjustments: z.array(z.lazy(() => TradeAdjustmentZod)),
221
- transactions: z.array(z.lazy(() => TransactionZod)),
222
- totalAmount: z.number().multipleOf(0.01).nullable(),
223
- tradeStatus: z.nativeEnum(TradeStatus),
224
- tradeStatusUnmapped: z.string().nullable(),
225
- tradeDate: z.date().nullable(),
226
- saStatus: z.nativeEnum(SaStatus),
227
- saStatusUnmapped: z.string().nullable(),
228
- saUrl: z.string().nullable(),
229
- saSignedAt: z.date().nullable(),
230
- saExtractedNumberOfShares: z.string().nullable(),
231
- saExtractedTotalAmount: z.string().nullable(),
232
- saExtractedPricePerShare: z.string().nullable(),
233
- saExtractedInvestorType: z.string().nullable(),
234
- saExtractedSigner: z.string().nullable(),
235
- saExtractedSignatureDate: z.date().nullable(),
236
- saExtractedSigner2: z.string().nullable(),
237
- saExtractedSignatureDate2: z.date().nullable(),
238
- saCheck: z.nativeEnum(SaCheck),
239
- saCheckedAt: z.date().nullable(),
240
- saLog: SaLogSchema.nullable(),
241
- txnTid: z.string().nullable(),
242
- txnResponse: z.string().nullable(),
243
- txnPaymentMethod: z.nativeEnum(PaymentMethodType).nullable(),
244
- txnCurrencyCode: z.string().length(3).nullable(),
245
- txnChargedAmount: z.number().multipleOf(0.01).nullable(),
246
- txnDate: z.date().nullable(),
247
- txnSettledDate: z.date().nullable(),
248
- fundingStatus: z.nativeEnum(FundingStatus).nullable(),
249
- fundingStatusUnmapped: z.string().nullable(),
250
- txnCheck: z.nativeEnum(TxnCheck).nullable(),
251
- txnCheckedAt: z.date().nullable(),
252
- txnLog: z.string().nullable(),
253
- systemReviewCheck: z.nativeEnum(SystemReviewCheck).nullable(),
254
- systemReviewCheckedAt: z.date().nullable(),
255
- systemReviewLog: z.string().nullable(),
256
- complianceReview: z.nativeEnum(ComplianceReview).nullable(),
257
- complianceReviewNotes: z.string().nullable(),
258
- complianceReviewerId: z.string().nullable(),
259
- issuerId: z.lazy(() => issuerIdSchema.nullable()),
260
- complianceReviewName: z.string().nullable(),
261
- complianceReviewAt: z.date().nullable(),
262
- tradeType: z.nativeEnum(TradeType).nullable(),
263
- placedAt: z.date().nullable(),
264
- platform: z.string(),
265
- cancelledAt: z.date().nullable(),
266
- cancelledById: z.string().nullable(),
267
- cancelledReason: z.string().nullable(),
268
- cancellationPeriod: z.number().nullable(),
269
- disbursed: z.boolean().optional(),
270
- tradeAdjustments: z.number().nullable().optional(),
271
- chargedAmount: z.number().nullable().optional(),
272
- balance: z.number().nullable().optional(),
273
- isUncleared24h: z.boolean(),
274
- });
275
- export type TradeZod = z.infer<typeof TradeZod>;
276
-
277
- export const IPaginatedTrade = z.object({
278
- items: z.array(TradeZod),
279
- meta: IPaginationMeta,
280
- });
281
- export type IPaginatedTrade = z.infer<typeof IPaginatedTrade>;
282
-
283
- export const IPaginatedReviewTrade = z.object({
284
- totalCount: z.number().int(),
285
- currentPosition: z.number().int(),
286
- tradeIds: z.array(tradeIdSchema),
287
- });
288
- export type IPaginatedReviewTrade = z.infer<typeof IPaginatedReviewTrade>;
289
-
290
- export const TradeSummaryZod = z.object({
291
- accountId: accountIdSchema,
292
- accountName: z.string(),
293
- regACount: z.number().int(),
294
- regCfCount: z.number().int(),
295
- regDCount: z.number().int(),
296
- totalCount: z.number().int(),
297
- totalReadyToApproveCount: z.number().int(),
298
- regAReadyToApproveCount: z.number().int(),
299
- regCfReadyToApproveCount: z.number().int(),
300
- regDReadyToApproveCount: z.number().int(),
301
- });
302
- export type TradeSummaryZod = z.infer<typeof TradeSummaryZod>;
303
-
304
- export const IPaginatedTradeSummaryResponse = z.object({
305
- items: z.array(TradeSummaryZod),
306
- meta: IPaginationMeta,
307
- });
308
- export type IPaginatedTradeSummaryResponse = z.infer<
309
- typeof IPaginatedTradeSummaryResponse
310
- >;
311
-
312
- export const TradeSummaryFilterZod = z.object({
313
- reviewStatus: z.nativeEnum(ComplianceReview).optional(),
314
- managedBy: z.nativeEnum(ManagedByType).optional(),
315
- });
316
-
317
- const tradeStatusValues = Object.values(TradeStatus) as string[];
318
-
319
- export const TradeFiltersZod = z.object({
320
- investmentType: z.nativeEnum(InvestmentType).optional(),
321
- tradeStatus: z
322
- .string()
323
- .optional()
324
- .transform((str) => (str ? str.split(',') : []))
325
- .refine(
326
- (statuses) =>
327
- statuses.every((status) => tradeStatusValues.includes(status as any)),
328
- {
329
- message: `Invalid trade status option provided. Valid options are: ${tradeStatusValues.join(',')}`,
330
- },
331
- )
332
- .openapi({
333
- example: `${tradeStatusValues.join(',')}`,
334
- }),
335
- from: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
336
- to: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
337
- saStatus: z.nativeEnum(SaStatus).optional(),
338
- saCheck: z.nativeEnum(SaCheck).optional(),
339
- txnPaymentMethod: z.nativeEnum(PaymentMethodType).optional(),
340
- fundingStatus: z.nativeEnum(FundingStatus).optional(),
341
- txnCheck: z.nativeEnum(TxnCheck).optional(),
342
- systemReviewCheck: z.nativeEnum(SystemReviewCheck).optional(),
343
- complianceReview: z.nativeEnum(ComplianceReview).optional(),
344
- beenDisbursed: z.enum(['true', 'false']).optional(),
345
- search: z.string().max(50).optional(),
346
- offeringId: z
347
- .lazy(() => offeringIdSchema)
348
- .optional()
349
- .openapi({
350
- example: 'offering_00041061050r3gg28a1c60t3gf',
351
- }),
352
- accountId: accountIdSchema.optional(),
353
- issuerId: z
354
- .lazy(() => issuerIdSchema)
355
- .optional()
356
- .openapi({
357
- example: 'issuer_01jfw4q6qef30s6fpqtsxw94ya',
358
- }),
359
- offeringType: z.nativeEnum(OfferingType).optional(),
360
- managedBy: z.nativeEnum(ManagedByType).optional(),
361
- platform: z.nativeEnum(Platforms).optional(),
362
- investorAccountId: z.lazy(() => investorAccountIdSchema).optional(),
363
- });
364
-
365
- export const ComplianceTradesFiltersZod = z.object({
366
- kycStatus: z.nativeEnum(KYCStatus).optional(),
367
- aicStatus: z.nativeEnum(AicStatus).optional(),
368
- amlStatus: z.nativeEnum(AMLStatus).optional(),
369
- accountStatus: z.nativeEnum(AccountStatus).optional(),
370
- savedQuery: z.nativeEnum(SavedQuery).optional(),
371
- });
372
-
373
- export type ComplianceTradesFiltersZod = z.infer<
374
- typeof ComplianceTradesFiltersZod
375
- >;
376
-
377
- export const TradeSortZod = z.object({
378
- sort: z
379
- .enum([SortBy.PLACEDAT, SortBy.CREATED_AT, SortBy.UPDATED_AT])
380
- .optional(),
381
- dir: z.nativeEnum(SortOrder).optional(),
382
- });
383
- export type TradeSortZod = z.infer<typeof TradeSortZod>;
384
-
385
- export const reviewTrades = z.object({
386
- complianceReview: z.nativeEnum(ComplianceReview),
387
- force: z.boolean().optional(),
388
- forceApprovals: z
389
- .array(z.enum(['kyc', 'aic', 'aml', 'subdoc']))
390
- .optional()
391
- .openapi({
392
- example: ['kyc', 'aml'],
393
- }), // items we are trying to force approve along with the trade
394
- trades: z
395
- .array(tradeIdSchema)
396
- .min(1, 'At least one trade is required')
397
- .max(1000, 'Maximum of 1000 trades allowed')
398
- .openapi({
399
- example: [
400
- 'trade_00041061050r3gg28a1c60t3gf',
401
- 'trade_00041061050r3gg28a1c60t3g',
402
- ],
403
- }),
404
- rejectionReason: z.string().min(1).max(1000).optional().nullable(),
405
- });
406
- export type reviewTrades = z.infer<typeof reviewTrades>;
407
-
408
- export const reviewAllTrades = z.object({
409
- complianceReview: z.enum([
410
- ComplianceReview.APPROVED,
411
- ]) /* only approved is supported for now */,
412
- });
413
- export type reviewAllTrades = z.infer<typeof reviewAllTrades>;
414
-
415
- export const PatchTradeStatus = z.object({
416
- tradeStatus: z.nativeEnum(TradeStatus),
417
- });
418
- export type PatchTradeStatus = z.infer<typeof PatchTradeStatus>;
419
-
420
- export const tradesInclude = z.enum([
421
- 'tradeDisbursements',
422
- 'adjustments',
423
- 'account',
424
- 'issuer',
425
- 'lineItems',
426
- 'transactions',
427
- 'investorAccount',
428
- 'offering',
429
- 'paymentMethod',
430
- ]);
431
-
432
- /**
433
- * @description Query parameters for including related entities
434
- * @xample in contract us as -> query: z.object({}).merge(UsersIncludeQuery),
435
- */
436
- export const TradesIncludeQuery = z.object({
437
- include: z
438
- .string()
439
- .optional()
440
- .transform((str) => (str ? str.split(',') : []))
441
- .refine(
442
- (includes) =>
443
- includes.every((include) =>
444
- tradesInclude.options.includes(include as any),
445
- ),
446
- {
447
- message: `Invalid include option provided. Valid options are: ${tradesInclude.options.join(',')}`,
448
- },
449
- )
450
- .openapi({
451
- example: `${tradesInclude.options.join(',')}`,
452
- }),
453
- });
454
-
455
- export interface TradesIncludeQuery
456
- extends z.infer<typeof TradesIncludeQuery> {}
457
-
458
- export enum TradeExportType {
459
- PAGE = 'PAGE',
460
- ALL = 'ALL',
461
- }
462
-
463
- export const ExportTradesQuery = PaginationOptionsZod.merge(TradeFiltersZod)
464
- .merge(ComplianceTradesFiltersZod)
465
- .merge(TradesIncludeQuery)
466
- .merge(TradeSortZod)
467
- .extend({
468
- exportType: z
469
- .nativeEnum(TradeExportType)
470
- .optional()
471
- .default(TradeExportType.PAGE),
472
- });
473
- export type ExportTradesQuery = z.infer<typeof ExportTradesQuery>;
474
-
475
- const tradesColumn = z.enum([
476
- 'id',
477
- 'investorAccountId',
478
- 'investorAccount',
479
- 'accountId',
480
- 'account',
481
- 'offeringId',
482
- 'offering',
483
- 'paymentMethodId',
484
- 'paymentMethod',
485
- 'userId',
486
- 'user',
487
- 'disbursementId',
488
- 'disbursement',
489
- 'tradeNumber',
490
- 'ip',
491
- 'tid',
492
- 'platform',
493
- 'investmentType',
494
- 'numberOfShares',
495
- 'pricePerShare',
496
- 'lineItems',
497
- 'transactions',
498
- 'totalAmount',
499
- 'tradeStatus',
500
- 'tradeStatusUnmapped',
501
- 'tradeDate',
502
- 'saStatus',
503
- 'saStatusUnmapped',
504
- 'saUrl',
505
- 'saSignedAt',
506
- 'saExtractedNumberOfShares',
507
- 'saExtractedTotalAmount',
508
- 'saExtractedPricePerShare',
509
- 'saExtractedInvestorType',
510
- 'saExtractedSigner',
511
- 'saExtractedSignatureDate',
512
- 'saExtractedSigner2',
513
- 'saExtractedSignatureDate2',
514
- 'saCheck',
515
- 'saCheckedAt',
516
- 'saLog',
517
- 'txnTid',
518
- 'txnResponse',
519
- 'txnPaymentMethod',
520
- 'txnCurrencyCode',
521
- 'txnChargedAmount',
522
- 'txnDate',
523
- 'txnSettledDate',
524
- 'fundingStatus',
525
- 'fundingStatusUnmapped',
526
- 'txnCheck',
527
- 'txnCheckedAt',
528
- 'txnLog',
529
- 'systemReviewCheck',
530
- 'systemReviewLog',
531
- 'complianceReview',
532
- 'complianceReviewNotes',
533
- 'complianceReviewerId',
534
- 'managedBy',
535
- 'complianceReviewer',
536
- 'issuer',
537
- 'issuerId',
538
- 'complianceReviewName',
539
- 'complianceReviewAt',
540
- 'tradeType',
541
- 'placedAt',
542
- 'cancelledAt',
543
- 'cancelledById',
544
- 'cancelledReason',
545
- 'cancellationPeriod',
546
- ]);
547
-
548
- /**
549
- * @description Query parameters for including related entities
550
- * @xample in contract us as -> query: z.object({}).merge(UsersIncludeQuery),
551
- */
552
- export const TradesColumnQuery = z.object({
553
- column: z
554
- .string()
555
- .optional()
556
- .transform((str) => (str ? str.split(',') : []))
557
- .refine(
558
- (columns) =>
559
- columns.every((col) => tradesColumn.options.includes(col as any)),
560
- {
561
- message: `Invalid column option provided. Valid options are: ${tradesColumn.options.join(',')}`,
562
- },
563
- )
564
- .openapi({
565
- example: `${tradesColumn.options.join(',')}`,
566
- }),
567
- });
568
-
569
- export const InvestorsTradeFiltersZod = z.object({
570
- investorAccountId: z.lazy(() => investorAccountIdSchema).optional(),
571
- tradeStatus: z.nativeEnum(TradeStatus).optional(),
572
- search: z.string().min(1).max(50).optional(),
573
- });
574
-
575
- const investorsTradesInclude = z.enum([
576
- 'lineItems',
577
- 'investorAccount',
578
- 'issuer',
579
- 'offering',
580
- ]);
581
-
582
- /**
583
- * @description Query parameters for including related entities
584
- * @xample in contract us as -> query: z.object({}).merge(UsersIncludeQuery),
585
- */
586
- export const InvestorsTradesIncludeQuery = z.object({
587
- include: z
588
- .string()
589
- .optional()
590
- .transform((str) => (str ? str.split(',') : []))
591
- .refine(
592
- (includes) =>
593
- includes.every((include) =>
594
- investorsTradesInclude.options.includes(include as any),
595
- ),
596
- {
597
- message: `Invalid include option provided. Valid options are: ${investorsTradesInclude.options.join(',')}`,
598
- },
599
- )
600
- .openapi({
601
- example: `${investorsTradesInclude.options.join(',')}`,
602
- }),
603
- });
604
- export interface InvestorsTradesIncludeQuery
605
- extends z.infer<typeof InvestorsTradesIncludeQuery> {}
606
-
607
- export const InvestorsGetTradesQuery = PaginationOptionsZod.merge(
608
- InvestorsTradeFiltersZod,
609
- ).merge(InvestorsTradesIncludeQuery);
610
-
611
- export const UpdateTradeBody = z.object({
612
- paymentMethodId: z.lazy(() => paymentMethodIdSchema),
613
- });
614
-
615
- export type UpdateTradeBodyType = z.infer<typeof UpdateTradeBody>;
616
-
617
- export const PostTradeBody = z.object({
618
- investorAccountId: z.lazy(() => investorAccountIdSchema).optional(),
619
- investmentType: z.nativeEnum(InvestmentType).optional(),
620
- });
621
-
622
- export type PostTradeBodyType = z.infer<typeof PostTradeBody>;
623
-
624
- export const InvestorsTradeResponse = IBaseEntity.extend({
625
- investorAccountId: z.lazy(() => investorAccountIdSchema).nullable(),
626
- accountId: z.string(),
627
- offeringId: z.string().nullable(),
628
- tid: z.string().nullable(),
629
- investmentType: z.nativeEnum(InvestmentType),
630
- numberOfShares: z.number().int(),
631
- pricePerShare: z.number().multipleOf(0.01),
632
- totalAmount: z.number().multipleOf(0.01).nullable(),
633
- tradeStatus: z.nativeEnum(TradeStatus),
634
- tradeStatusUnmapped: z.string().nullable(),
635
- tradeDate: z.date().nullable(),
636
- paymentMethodId: z.lazy(() => paymentMethodIdSchema).nullable(),
637
- });
638
-
639
- export const InvestorsPaginatedTrade = z.object({
640
- items: z.array(InvestorsTradeResponse),
641
- meta: IPaginationMeta,
642
- });
643
- export const IssuersTradeFiltersZod = z.object({
644
- investmentType: z.nativeEnum(InvestmentType).optional(),
645
- tradeStatus: z.nativeEnum(TradeStatus).optional(),
646
- saStatus: z.nativeEnum(SaStatus).optional(),
647
- saCheck: z.nativeEnum(SaCheck).optional(),
648
- txnPaymentMethod: z.nativeEnum(PaymentMethodType).optional(),
649
- fundingStatus: z.nativeEnum(FundingStatus).optional(),
650
- txnCheck: z.nativeEnum(TxnCheck).optional(),
651
- systemReviewCheck: z.nativeEnum(SystemReviewCheck).optional(),
652
- complianceReview: z.nativeEnum(ComplianceReview).optional(),
653
- beenDisbursed: z.enum(['true', 'false']).optional(),
654
- search: z.string().optional().openapi({ example: 'Mike' }),
655
- offeringId: z
656
- .lazy(() => offeringIdSchema)
657
- .optional()
658
- .openapi({
659
- example: 'offering_00041061050r3gg28a1c60t3gf',
660
- }),
661
- from: createDateSchema('START').optional().openapi({ example: 'MM/DD/YYYY' }),
662
- to: createDateSchema('END').optional().openapi({ example: 'MM/DD/YYYY' }),
663
- minAmount: z
664
- .string()
665
- .transform((num) => Number(num))
666
- .pipe(z.number().multipleOf(0.01).min(0.01).max(10000000000))
667
- .optional()
668
- .openapi({ example: '2500.00' }),
669
- maxAmount: z
670
- .string()
671
- .transform((num) => Number(num))
672
- .pipe(z.number().multipleOf(0.01).min(0.01).max(10000000000))
673
- .optional()
674
- .openapi({ example: '15000000.50' }),
675
- managedBy: z.nativeEnum(ManagedByType).optional(),
676
- investorAccountId: z.lazy(() => investorAccountIdSchema).optional(),
677
- });
678
- export type IssuersTradeFiltersZod = z.infer<typeof IssuersTradeFiltersZod>;
679
-
680
- /**
681
- * Zod schema representing a union of all possible filter types based on portal type.
682
- * This schema can be used for runtime validation of filter parameters.
683
- */
684
- export const GetTradeFiltersSchema = z.union([
685
- TradeFiltersZod,
686
- IssuersTradeFiltersZod,
687
- InvestorsTradeFiltersZod,
688
- ]);
689
-
690
- /**
691
- * Type representing the filters parameter for getTradeWithCalculatedFields.
692
- * This is a union of all possible filter types based on portal type:
693
- * - TradeFiltersZod (Compliance portal)
694
- * - IssuersTradeFiltersZod (Issuer portal)
695
- * - InvestorsTradeFiltersZod (Investor portal)
696
- */
697
- export type GetTradeFiltersType = z.infer<typeof GetTradeFiltersSchema>;
698
-
699
- export const CancelTradeResponse = z.object({
700
- message: z.string(),
701
- });
702
- export type CancelTradeResponse = z.infer<typeof CancelTradeResponse>;
703
-
704
- export const FailedTradeZod = z.object({
705
- id: tradeIdSchema,
706
- tradeNo: z.string(),
707
- errors: z.string().array(),
708
- });
709
-
710
- export type FailedTradeZod = z.infer<typeof FailedTradeZod>;
711
-
712
- export const ReviewTradeZod = z.object({
713
- success: z.boolean(),
714
- message: z.string(),
715
- failedTrades: z.array(FailedTradeZod),
716
- });
717
-
718
- export type ReviewTradeZod = z.infer<typeof ReviewTradeZod>;
719
-
720
- export const CancelTradeZod = z.object({
721
- reason: z
722
- .string()
723
- .min(2)
724
- .max(1000)
725
- .openapi({ example: 'cancellation reason' }),
726
- });
727
-
728
- export type CancelTradeZod = z.infer<typeof CancelTradeZod>;
729
-
730
- export const ComplianceCancelTradeZod = z.object({
731
- reason: z
732
- .string()
733
- .min(2)
734
- .max(1000)
735
- .openapi({ example: 'cancellation reason' }),
736
- accountId: accountIdSchema.openapi({
737
- example: 'account_00041061050r3gg28a1c60t3gf',
738
- }),
739
- });
740
- export type ComplianceCancelTradeZod = z.infer<typeof ComplianceCancelTradeZod>;
741
-
742
- export const ProcessPaymentZod = z.object({
743
- tradeId: tradeIdSchema,
744
- amount: z.number().min(0.01).max(10000000000),
745
- });
746
-
747
- export type ProcessPaymentZod = z.infer<typeof ProcessPaymentZod>;
748
-
749
- export const ProcessPaymentResponse = z.object({
750
- success: z.boolean(),
751
- });
752
-
753
- export type ProcessPaymentResponse = z.infer<typeof ProcessPaymentResponse>;
754
-
755
- const TradeLineItemDataZod = z.object({
756
- signaturePlatform: z.string(),
757
- signatureDocumentId: z.string(),
758
- signatureUrl: z.string(),
759
- signatureStatus: z.nativeEnum(SignatureStatus),
760
- });
761
-
762
- export type TradeLineItemDataZod = z.infer<typeof TradeLineItemDataZod>;
763
-
764
- export const TradeSystemReviewLogZod = z.object({
765
- type: z.nativeEnum(TradeSystemLogType),
766
- data: z.record(z.string(), z.any()),
767
- error: z.string().nullable(),
768
- message: z.string().nullable(),
769
- status: z.nativeEnum(TradeSystemReviewLogStatus),
770
- });
771
- export type TradeSystemReviewLogZod = z.infer<typeof TradeSystemReviewLogZod>;
772
-
773
- export enum BoldsignTemplateType {
774
- INDIVIDUAL = 'INDIVIDUAL',
775
- JOINT = 'JOINT',
776
- ENTITY = 'ENTITY',
777
- }
778
-
779
- export const GetTemplateVariablesForTradeZod = z.object({
780
- templateType: z.nativeEnum(BoldsignTemplateType),
781
- templateId: z.string(),
782
- mergeVars: z.array(
783
- z.object({
784
- field: z.string(),
785
- value: z.string(),
786
- }),
787
- ),
788
- });
789
-
790
- export type GetTemplateVariablesForTradeZod = z.infer<
791
- typeof GetTemplateVariablesForTradeZod
792
- >;
793
-
794
- /**
795
- * Zod schema for CSV export data with all formatted fields ready for export
796
- * All extraction and formatting logic is handled in trades.service.ts
797
- */
798
- export const TradeForCsvExportZod = z.object({
799
- tradeNumber: z.string(),
800
- investorName: z.string(),
801
- signerName: z.string(),
802
- offeringName: z.string(),
803
- tradeType: z.string(),
804
- numberOfShares: z.number(),
805
- pricePerShare: z.string(), // Formatted with $ prefix
806
- totalAmount: z.string(), // Formatted with $ prefix
807
- tradeStatus: z.string(),
808
- fundingStatus: z.string(),
809
- kycStatus: z.boolean(),
810
- amlStatus: z.boolean(),
811
- aicStatus: z.boolean(),
812
- saStatus: z.string(),
813
- placedAt: z.string(), // Formatted date string
814
- closedAt: z.string(), // Formatted date string
815
- txnPaymentMethod: z.string(),
816
- txnChargedAmount: z.string(), // Formatted with $ prefix
817
- registeredRepId: z.string(),
818
- managedBy: z.string(),
819
- platform: z.string(),
820
- // Entity fields (for LEGAL_ENTITY type)
821
- entityName: z.string(),
822
- entityEin: z.string(),
823
- entityAddress: z.string(),
824
- entityAddress2: z.string(),
825
- entityCity: z.string(),
826
- entityCountry: z.string(),
827
- entityState: z.string(),
828
- entityZip: z.string(),
829
- entityEmail: z.string(),
830
- entityPhone: z.string(),
831
- entityCompanyType: z.string(),
832
- // Primary individual fields
833
- primaryFirstName: z.string(),
834
- primaryLastName: z.string(),
835
- primaryDob: z.string(), // Formatted date string
836
- primarySsn: z.string(), // Formatted SSN
837
- primaryAddress: z.string(),
838
- primaryAddress2: z.string(),
839
- primaryCity: z.string(),
840
- primaryCountry: z.string(),
841
- primaryState: z.string(),
842
- primaryZip: z.string(),
843
- primaryEmail: z.string(),
844
- primaryPhone: z.string(),
845
- // Secondary individual fields (for JOINT and LEGAL_ENTITY types)
846
- secondaryFirstName: z.string(),
847
- secondaryLastName: z.string(),
848
- secondaryDob: z.string(), // Formatted date string
849
- secondarySsn: z.string(), // Formatted SSN
850
- secondaryAddress: z.string(),
851
- secondaryAddress2: z.string(),
852
- secondaryCity: z.string(),
853
- secondaryCountry: z.string(),
854
- secondaryState: z.string(),
855
- secondaryZip: z.string(),
856
- secondaryEmail: z.string(),
857
- secondaryPhone: z.string(),
858
- });
859
-
860
- export type TradeForCsvExport = z.infer<typeof TradeForCsvExportZod>;
861
-
862
- export const CANCELLABLE_TRADE_STATUSES = [
863
- TradeStatus.PLACED,
864
- TradeStatus.IN_REVIEW,
865
- TradeStatus.NEEDS_INFO,
866
- TradeStatus.FUNDING,
867
- ];
868
-
869
- export const NON_CANCELABLE_COMPLIANCE_REVIEW_STATUSES = [
870
- ComplianceReview.APPROVED,
871
- ComplianceReview.REJECTED,
872
- ComplianceReview.CANCELLED,
873
- ];
874
-
875
- /**
876
- * Filter type for Investor Account exports in workers
877
- * Extends the base InvestorAccountExportFilters with additional optional fields needed for bulk exports
878
- */
879
- export type WorkerInvestorAccountExportFilters = Partial<
880
- (InvestorAccountExportFilters | ComplianceInvestorAccountExportFilters) & {
881
- isRegisteredUsersExport: boolean | null;
882
- search: string | null;
883
- startDate: Date | null;
884
- endDate: Date | null;
885
- userType: string | null;
886
- accountId: string | null;
887
- }
888
- >;
889
- /**
890
- * Filter type for Trade exports
891
- * Extends IssuersTradeFiltersZod with accountId
892
- */
893
- export type TradeExportFilters = Partial<
894
- IssuersTradeFiltersZod & {
895
- accountId: string | null;
896
- }
897
- >;
898
-
899
- /**
900
- * Filter type for Compliance Trade exports
901
- */
902
- export type ComplianceTradeExportFilters = Partial<ExportTradesQuery>;
903
-
904
- /**
905
- * Filter type for Secondary Customer exports
906
- */
907
- export type SecondaryCustomerExportFilters =
908
- Partial<GetSecondaryCustomerFiltersZod>;
909
-
910
- /**
911
- * Filter type for Secondary Trade exports
912
- */
913
- export type SecondaryTradeExportFilters = Partial<SecondaryTradeFiltersZod>;
914
-
915
- /**
916
- * Combined filter type for all bulk export types
917
- * Used in the ExportBulkDataDto
918
- */
919
- export type BulkExportFilters =
920
- | WorkerInvestorAccountExportFilters
921
- | TradeExportFilters
922
- | ComplianceTradeExportFilters
923
- | SecondaryCustomerExportFilters
924
- | SecondaryTradeExportFilters;
925
-
926
- export type BulkExportResponse =
927
- | InvestorAccount[]
928
- | RegisteredInvestorUserRawZod[]
929
- | Trade[]
930
- | SecondaryCustomer[]
931
- | SecondaryTrade[];