@dalmore/api-contracts 1.0.3 → 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.
- package/README.md +34 -60
- package/index.d.mts +17 -0
- package/index.d.ts +17 -0
- package/index.mjs +1001 -18638
- package/package.json +7 -54
- package/clients/index.mjs +0 -10970
- package/compliance/index.mjs +0 -20016
- package/compliance-apikey/index.mjs +0 -9795
- package/helpers/index.mjs +0 -146
- package/investors/index.mjs +0 -12844
- package/issuers/index.mjs +0 -16168
- package/secondaries/index.mjs +0 -10282
- package/src/common/helpers/index.ts +0 -205
- package/src/common/types/account-contact.types.ts +0 -98
- package/src/common/types/account-detail.types.ts +0 -27
- package/src/common/types/account-integration.types.ts +0 -143
- package/src/common/types/account-manager.types.ts +0 -124
- package/src/common/types/account.types.ts +0 -296
- package/src/common/types/activity.types.ts +0 -274
- package/src/common/types/address.types.ts +0 -41
- package/src/common/types/aic.types.ts +0 -246
- package/src/common/types/aml.types.ts +0 -18
- package/src/common/types/api-key-logs.types.ts +0 -66
- package/src/common/types/api-keys.types.ts +0 -69
- package/src/common/types/asset.types.ts +0 -338
- package/src/common/types/auth.types.ts +0 -370
- package/src/common/types/batch-jobs.types.ts +0 -150
- package/src/common/types/bonus-tier.types.ts +0 -147
- package/src/common/types/cart.types.ts +0 -18
- package/src/common/types/checklist-items.types.ts +0 -70
- package/src/common/types/checklist.types.ts +0 -97
- package/src/common/types/common.types.ts +0 -1520
- package/src/common/types/comply-advantage-api.types.ts +0 -316
- package/src/common/types/comply-advantage.types.ts +0 -25
- package/src/common/types/contact-us.types.ts +0 -107
- package/src/common/types/contract-helpers.ts +0 -205
- package/src/common/types/countries.types.ts +0 -375
- package/src/common/types/covered-person.types.ts +0 -274
- package/src/common/types/dashboard.types.ts +0 -799
- package/src/common/types/data-record.types.ts +0 -325
- package/src/common/types/data-room.types.ts +0 -242
- package/src/common/types/default-theme-config.types.ts +0 -87
- package/src/common/types/disbursement-adjustment.types.ts +0 -32
- package/src/common/types/disbursement-approval-user.types.ts +0 -100
- package/src/common/types/disbursement-review.types.ts +0 -110
- package/src/common/types/disbursement-transaction.types.ts +0 -72
- package/src/common/types/disbursements.types.ts +0 -310
- package/src/common/types/domain-filter.types.ts +0 -55
- package/src/common/types/email-theme.types.ts +0 -442
- package/src/common/types/entity.types.ts +0 -15
- package/src/common/types/error-responses.types.ts +0 -135
- package/src/common/types/escrow-account.types.ts +0 -104
- package/src/common/types/exchange-api-key.types.ts +0 -121
- package/src/common/types/exchange-import.types.ts +0 -36
- package/src/common/types/exchange-provider.types.ts +0 -329
- package/src/common/types/file.types.ts +0 -461
- package/src/common/types/health.types.ts +0 -29
- package/src/common/types/index.ts +0 -48
- package/src/common/types/individuals.types.ts +0 -554
- package/src/common/types/investor-account.types.ts +0 -1239
- package/src/common/types/investorAccountIdSchema.type.ts +0 -0
- package/src/common/types/investors-offering.types.ts +0 -65
- package/src/common/types/invite.types.ts +0 -133
- package/src/common/types/issuer-bank-account.types.ts +0 -107
- package/src/common/types/issuer-offering.types.ts +0 -306
- package/src/common/types/issuer-payment-method.types.ts +0 -341
- package/src/common/types/issuer.types.ts +0 -312
- package/src/common/types/job-item.types.ts +0 -119
- package/src/common/types/jobs.types.ts +0 -171
- package/src/common/types/kyb.types.ts +0 -53
- package/src/common/types/kyc.types.ts +0 -188
- package/src/common/types/legal-entity.types.ts +0 -185
- package/src/common/types/login-history.types.ts +0 -46
- package/src/common/types/mail-template.types.ts +0 -436
- package/src/common/types/north-cap-integration.types.ts +0 -190
- package/src/common/types/note.types.ts +0 -109
- package/src/common/types/notification.types.ts +0 -58
- package/src/common/types/notion-api.types.ts +0 -374
- package/src/common/types/notion-database.types.ts +0 -125
- package/src/common/types/notion-page.types.ts +0 -267
- package/src/common/types/offering-reports.types.ts +0 -153
- package/src/common/types/offering-submission.types.ts +0 -314
- package/src/common/types/offering.types.ts +0 -590
- package/src/common/types/page-revision.types.ts +0 -86
- package/src/common/types/page.types.ts +0 -436
- package/src/common/types/password.type.ts +0 -15
- package/src/common/types/payment-methods.types.ts +0 -298
- package/src/common/types/phone.type.ts +0 -27
- package/src/common/types/portfolio.types.ts +0 -50
- package/src/common/types/privacy-policy-and-tos.types.ts +0 -231
- package/src/common/types/queue.types.ts +0 -111
- package/src/common/types/registered-reps.types.ts +0 -25
- package/src/common/types/rejection-reasons.types.ts +0 -56
- package/src/common/types/review.types.ts +0 -133
- package/src/common/types/role.types.ts +0 -26
- package/src/common/types/secondary-customer.types.ts +0 -66
- package/src/common/types/secondary-issuer.types.ts +0 -50
- package/src/common/types/secondary-order.types.ts +0 -58
- package/src/common/types/secondary-security.types.ts +0 -60
- package/src/common/types/secondary-trade.entity.ts +0 -16
- package/src/common/types/secondary-trade.types.ts +0 -95
- package/src/common/types/secure-request.types.ts +0 -68
- package/src/common/types/signer.types.ts +0 -651
- package/src/common/types/site-link.types.ts +0 -166
- package/src/common/types/site-settings.types.ts +0 -726
- package/src/common/types/site.types.ts +0 -270
- package/src/common/types/sms.types.ts +0 -30
- package/src/common/types/state-machine.types.ts +0 -177
- package/src/common/types/states.types.ts +0 -163
- package/src/common/types/subdoc-preview.types.ts +0 -35
- package/src/common/types/task.types.ts +0 -258
- package/src/common/types/trade-adjustment.type.ts +0 -33
- package/src/common/types/trade-line-item.type.ts +0 -132
- package/src/common/types/trade.types.ts +0 -931
- package/src/common/types/transaction.types.ts +0 -198
- package/src/common/types/trusted-contact.types.ts +0 -122
- package/src/common/types/typography.types.ts +0 -75
- package/src/common/types/user-manual.types.ts +0 -290
- package/src/common/types/user-setting.types.ts +0 -133
- package/src/common/types/user.types.ts +0 -320
- package/src/common/types/webhook.types.ts +0 -588
- package/src/common/types/zip.type.ts +0 -36
- package/src/contracts/clients/accounts/index.ts +0 -61
- package/src/contracts/clients/aic/index.ts +0 -59
- package/src/contracts/clients/api-key-logs/index.ts +0 -53
- package/src/contracts/clients/api-keys/index.ts +0 -73
- package/src/contracts/clients/assets/index.ts +0 -102
- package/src/contracts/clients/auth/index.ts +0 -50
- package/src/contracts/clients/files/index.ts +0 -166
- package/src/contracts/clients/files-public/index.ts +0 -166
- package/src/contracts/clients/index.ts +0 -44
- package/src/contracts/clients/individuals/index.ts +0 -93
- package/src/contracts/clients/investor-accounts/index.ts +0 -93
- package/src/contracts/clients/issuers/index.ts +0 -94
- package/src/contracts/clients/legal-entities/index.ts +0 -93
- package/src/contracts/clients/offerings/index.ts +0 -117
- package/src/contracts/clients/secure-requests/index.ts +0 -34
- package/src/contracts/clients/sites/index.ts +0 -56
- package/src/contracts/clients/trades/index.ts +0 -122
- package/src/contracts/compliance/account-contacts/index.ts +0 -82
- package/src/contracts/compliance/account-managers/index.ts +0 -142
- package/src/contracts/compliance/accounts/index.ts +0 -187
- package/src/contracts/compliance/activities/index.ts +0 -55
- package/src/contracts/compliance/aic/index.ts +0 -60
- package/src/contracts/compliance/api-keys/index.ts +0 -91
- package/src/contracts/compliance/assets/index.ts +0 -122
- package/src/contracts/compliance/auth/index.ts +0 -134
- package/src/contracts/compliance/batch-jobs/index.ts +0 -62
- package/src/contracts/compliance/bonus-tiers/index.ts +0 -55
- package/src/contracts/compliance/checklist/index.ts +0 -87
- package/src/contracts/compliance/checklist-items/index.ts +0 -86
- package/src/contracts/compliance/covered-persons/index.ts +0 -97
- package/src/contracts/compliance/dashboard/index.ts +0 -111
- package/src/contracts/compliance/data-records/index.ts +0 -116
- package/src/contracts/compliance/data-rooms/index.ts +0 -113
- package/src/contracts/compliance/default-theme-configs/index.ts +0 -95
- package/src/contracts/compliance/disbursement/index.ts +0 -165
- package/src/contracts/compliance/disbursement-approval-users/index.ts +0 -84
- package/src/contracts/compliance/disbursement-transactions/index.ts +0 -37
- package/src/contracts/compliance/domain-filters/index.ts +0 -117
- package/src/contracts/compliance/email-themes/index.ts +0 -284
- package/src/contracts/compliance/escrow-accounts/index.ts +0 -85
- package/src/contracts/compliance/exchange-api-keys/index.ts +0 -129
- package/src/contracts/compliance/exchange-imports/index.ts +0 -137
- package/src/contracts/compliance/files/index.ts +0 -267
- package/src/contracts/compliance/files-public/index.ts +0 -188
- package/src/contracts/compliance/health/index.ts +0 -26
- package/src/contracts/compliance/index.ts +0 -147
- package/src/contracts/compliance/individuals/index.ts +0 -57
- package/src/contracts/compliance/investor-accounts/index.ts +0 -141
- package/src/contracts/compliance/invites/index.ts +0 -137
- package/src/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
- package/src/contracts/compliance/issuer-payment-methods/index.ts +0 -81
- package/src/contracts/compliance/issuers/index.ts +0 -97
- package/src/contracts/compliance/job-items/index.ts +0 -58
- package/src/contracts/compliance/jobs/index.ts +0 -59
- package/src/contracts/compliance/kyb/index.ts +0 -54
- package/src/contracts/compliance/kyc/index.ts +0 -77
- package/src/contracts/compliance/legal-entities/index.ts +0 -57
- package/src/contracts/compliance/login-histories/index.ts +0 -37
- package/src/contracts/compliance/notes/index.ts +0 -69
- package/src/contracts/compliance/notion-databases/index.ts +0 -107
- package/src/contracts/compliance/notion-pages/index.ts +0 -105
- package/src/contracts/compliance/offering-reports/index.ts +0 -149
- package/src/contracts/compliance/offerings/index.ts +0 -233
- package/src/contracts/compliance/pages/index.ts +0 -178
- package/src/contracts/compliance/payment-methods/index.ts +0 -57
- package/src/contracts/compliance/rejection-reasons/index.ts +0 -32
- package/src/contracts/compliance/review/index.ts +0 -169
- package/src/contracts/compliance/roles/index.ts +0 -34
- package/src/contracts/compliance/secondary-customers/index.ts +0 -77
- package/src/contracts/compliance/secondary-orders/index.ts +0 -60
- package/src/contracts/compliance/secondary-trades/index.ts +0 -100
- package/src/contracts/compliance/secure-requests/index.ts +0 -54
- package/src/contracts/compliance/signer/index.ts +0 -369
- package/src/contracts/compliance/site-links/index.ts +0 -128
- package/src/contracts/compliance/site-settings/index.ts +0 -669
- package/src/contracts/compliance/sites/index.ts +0 -56
- package/src/contracts/compliance/state-machine/index.ts +0 -94
- package/src/contracts/compliance/tasks/index.ts +0 -91
- package/src/contracts/compliance/third-parties/index.ts +0 -52
- package/src/contracts/compliance/trade-line-items/index.ts +0 -59
- package/src/contracts/compliance/trades/index.ts +0 -230
- package/src/contracts/compliance/transactions/index.ts +0 -161
- package/src/contracts/compliance/user-manuals/index.ts +0 -271
- package/src/contracts/compliance/user-settings/index.ts +0 -189
- package/src/contracts/compliance/users/index.ts +0 -200
- package/src/contracts/compliance/webhooks/index.ts +0 -41
- package/src/contracts/compliance-apikey/accounts/index.ts +0 -58
- package/src/contracts/compliance-apikey/index.ts +0 -14
- package/src/contracts/index.ts +0 -6
- package/src/contracts/investors/account-contacts/index.ts +0 -58
- package/src/contracts/investors/aic/index.ts +0 -59
- package/src/contracts/investors/assets/index.ts +0 -61
- package/src/contracts/investors/auth/index.ts +0 -116
- package/src/contracts/investors/bonus-tiers/index.ts +0 -37
- package/src/contracts/investors/cart/index.ts +0 -75
- package/src/contracts/investors/contact-us/index.ts +0 -48
- package/src/contracts/investors/data-records/index.ts +0 -113
- package/src/contracts/investors/data-rooms/index.ts +0 -96
- package/src/contracts/investors/files/index.ts +0 -167
- package/src/contracts/investors/files-public/index.ts +0 -185
- package/src/contracts/investors/index.ts +0 -72
- package/src/contracts/investors/individuals/index.ts +0 -99
- package/src/contracts/investors/investor-accounts/index.ts +0 -110
- package/src/contracts/investors/issuer-payment-methods/index.ts +0 -36
- package/src/contracts/investors/issuers/index.ts +0 -30
- package/src/contracts/investors/legal-entities/index.ts +0 -93
- package/src/contracts/investors/notes/index.ts +0 -69
- package/src/contracts/investors/offerings/index.ts +0 -93
- package/src/contracts/investors/pages/index.ts +0 -88
- package/src/contracts/investors/payment-methods/index.ts +0 -149
- package/src/contracts/investors/portfolios/index.ts +0 -53
- package/src/contracts/investors/sites/index.ts +0 -96
- package/src/contracts/investors/tasks/index.ts +0 -111
- package/src/contracts/investors/trade-line-items/index.ts +0 -75
- package/src/contracts/investors/trades/index.ts +0 -114
- package/src/contracts/investors/transactions/index.ts +0 -37
- package/src/contracts/investors/trusted-contacts/index.ts +0 -93
- package/src/contracts/investors/user-manuals/index.ts +0 -62
- package/src/contracts/investors/user-settings/index.ts +0 -170
- package/src/contracts/investors/users/index.ts +0 -45
- package/src/contracts/investors/webhooks/index.ts +0 -30
- package/src/contracts/issuers/account-contacts/index.ts +0 -76
- package/src/contracts/issuers/account-integrations/index.ts +0 -97
- package/src/contracts/issuers/accounts/index.ts +0 -97
- package/src/contracts/issuers/activities/index.ts +0 -54
- package/src/contracts/issuers/aic/index.ts +0 -39
- package/src/contracts/issuers/api-key-logs/index.ts +0 -53
- package/src/contracts/issuers/api-keys/index.ts +0 -93
- package/src/contracts/issuers/assets/index.ts +0 -122
- package/src/contracts/issuers/auth/index.ts +0 -152
- package/src/contracts/issuers/bonus-tiers/index.ts +0 -55
- package/src/contracts/issuers/contact-us/index.ts +0 -48
- package/src/contracts/issuers/covered-persons/index.ts +0 -136
- package/src/contracts/issuers/dashboard/index.ts +0 -72
- package/src/contracts/issuers/data-records/index.ts +0 -257
- package/src/contracts/issuers/data-rooms/index.ts +0 -134
- package/src/contracts/issuers/disbursement-approval-users/index.ts +0 -82
- package/src/contracts/issuers/disbursement-transactions/index.ts +0 -53
- package/src/contracts/issuers/disbursements/index.ts +0 -153
- package/src/contracts/issuers/email-themes/index.ts +0 -242
- package/src/contracts/issuers/escrow-accounts/index.ts +0 -81
- package/src/contracts/issuers/exchange-api-keys/index.ts +0 -144
- package/src/contracts/issuers/files/index.ts +0 -166
- package/src/contracts/issuers/files-public/index.ts +0 -166
- package/src/contracts/issuers/health/index.ts +0 -24
- package/src/contracts/issuers/index.ts +0 -112
- package/src/contracts/issuers/investor-accounts/index.ts +0 -148
- package/src/contracts/issuers/invites/index.ts +0 -129
- package/src/contracts/issuers/issuer/index.ts +0 -94
- package/src/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
- package/src/contracts/issuers/issuer-payment-methods/index.ts +0 -136
- package/src/contracts/issuers/kyc/index.ts +0 -38
- package/src/contracts/issuers/login-histories/index.ts +0 -51
- package/src/contracts/issuers/notes/index.ts +0 -69
- package/src/contracts/issuers/offerings/index.ts +0 -206
- package/src/contracts/issuers/pages/index.ts +0 -138
- package/src/contracts/issuers/payment-methods/index.ts +0 -61
- package/src/contracts/issuers/portfolios/index.ts +0 -36
- package/src/contracts/issuers/rejection-reasons/index.ts +0 -32
- package/src/contracts/issuers/review/index.ts +0 -63
- package/src/contracts/issuers/secondary-customers/index.ts +0 -55
- package/src/contracts/issuers/secondary-orders/index.ts +0 -57
- package/src/contracts/issuers/secondary-trades/index.ts +0 -57
- package/src/contracts/issuers/secure-requests/index.ts +0 -34
- package/src/contracts/issuers/site-links/index.ts +0 -116
- package/src/contracts/issuers/site-settings/index.ts +0 -585
- package/src/contracts/issuers/sites/index.ts +0 -32
- package/src/contracts/issuers/tasks/index.ts +0 -111
- package/src/contracts/issuers/trades/index.ts +0 -132
- package/src/contracts/issuers/transactions/index.ts +0 -158
- package/src/contracts/issuers/user-manuals/index.ts +0 -62
- package/src/contracts/issuers/user-settings/index.ts +0 -170
- package/src/contracts/issuers/users/index.ts +0 -126
- package/src/contracts/secondaries/accounts/index.ts +0 -58
- package/src/contracts/secondaries/index.ts +0 -23
- package/src/contracts/secondaries/secondary-customers/index.ts +0 -55
- package/src/contracts/secondaries/secondary-issuers/index.ts +0 -94
- package/src/contracts/secondaries/secondary-orders/index.ts +0 -56
- package/src/contracts/secondaries/secondary-securities/index.ts +0 -95
- package/src/contracts/secondaries/secondary-trades/index.ts +0 -56
- package/types/index.mjs +0 -10320
|
@@ -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[];
|