@dalmore/api-contracts 0.0.0-dev.d30d175 → 0.0.0-dev.d6badc9

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 (44) hide show
  1. package/common/types/account-setting.types.ts +65 -0
  2. package/common/types/account.types.ts +1 -0
  3. package/common/types/activity.types.ts +1 -1
  4. package/common/types/bonus-tier.types.ts +33 -0
  5. package/common/types/cart.types.ts +4 -1
  6. package/common/types/common.types.ts +16 -6
  7. package/common/types/dashboard.types.ts +2 -9
  8. package/common/types/disbursements.types.ts +119 -3
  9. package/common/types/file.types.ts +20 -4
  10. package/common/types/i-will-do-it-later.types.ts +68 -0
  11. package/common/types/index.ts +2 -0
  12. package/common/types/individuals.types.ts +2 -15
  13. package/common/types/issuer-offering.types.ts +14 -24
  14. package/common/types/issuer-payment-method.types.ts +41 -0
  15. package/common/types/issuer.types.ts +9 -0
  16. package/common/types/notification.types.ts +515 -29
  17. package/common/types/offering.types.ts +5 -15
  18. package/common/types/site.types.ts +2 -9
  19. package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
  20. package/common/types/trade.types.ts +1 -1
  21. package/common/types/transaction.types.ts +12 -1
  22. package/common/types/user.types.ts +15 -28
  23. package/contracts/clients/cart/index.ts +80 -0
  24. package/contracts/clients/index.ts +10 -0
  25. package/contracts/clients/issuer-payment-methods/index.ts +39 -0
  26. package/contracts/clients/payment-methods/index.ts +85 -0
  27. package/contracts/clients/trade-line-items/index.ts +66 -0
  28. package/contracts/clients/trades/index.ts +1 -1
  29. package/contracts/clients/transactions/index.ts +37 -0
  30. package/contracts/compliance/account-settings/index.ts +59 -0
  31. package/contracts/compliance/bonus-tiers/index.ts +21 -2
  32. package/contracts/compliance/index.ts +4 -0
  33. package/contracts/compliance/notification-channels/index.ts +251 -0
  34. package/contracts/compliance/trade-line-items/index.ts +1 -1
  35. package/contracts/compliance/users/index.ts +21 -0
  36. package/contracts/investors/bonus-tiers/index.ts +18 -0
  37. package/contracts/investors/individuals/index.ts +22 -0
  38. package/contracts/investors/trade-line-items/index.ts +1 -1
  39. package/contracts/issuers/account-settings/index.ts +36 -0
  40. package/contracts/issuers/bonus-tiers/index.ts +18 -0
  41. package/contracts/issuers/disbursements/index.ts +36 -0
  42. package/contracts/issuers/index.ts +4 -0
  43. package/contracts/issuers/notification-channels/index.ts +251 -0
  44. package/package.json +1 -1
@@ -0,0 +1,251 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import {
4
+ CreateChannelInputSchema,
5
+ CreateTriggerInputSchema,
6
+ IAvailableTriggersResponse,
7
+ INotificationChannelTriggerZod,
8
+ INotificationChannelZod,
9
+ INotificationRecordZod,
10
+ IPaginatedNotificationChannel,
11
+ IPaginatedNotificationRecord,
12
+ NotificationChannelFilters,
13
+ NotificationChannelsIncludeQuery,
14
+ notificationChannelIdSchema,
15
+ notificationChannelTriggerIdSchema,
16
+ NotificationRecordFilters,
17
+ NotificationRecordsIncludeQuery,
18
+ notificationRecordIdSchema,
19
+ UpdateChannelInputSchema,
20
+ } from '../../../common/types/notification.types';
21
+ import {
22
+ BadRequestError,
23
+ InternalError,
24
+ NotFoundError,
25
+ PaginationOptionsZod,
26
+ UnauthorizedError,
27
+ } from '../../../common/types';
28
+
29
+ const c = initContract();
30
+
31
+ export const notificationChannelsContract = c.router(
32
+ {
33
+ getChannels: {
34
+ summary: 'Get notification channels',
35
+ method: 'GET',
36
+ path: '',
37
+ metadata: {
38
+ auth: true,
39
+ },
40
+ query: PaginationOptionsZod.merge(NotificationChannelFilters).merge(
41
+ NotificationChannelsIncludeQuery,
42
+ ),
43
+ responses: {
44
+ 200: IPaginatedNotificationChannel,
45
+ 401: UnauthorizedError,
46
+ 500: InternalError,
47
+ },
48
+ },
49
+ getChannel: {
50
+ summary: 'Get notification channel by id',
51
+ method: 'GET',
52
+ path: '/:id',
53
+ metadata: {
54
+ auth: true,
55
+ },
56
+ pathParams: z.object({
57
+ id: notificationChannelIdSchema,
58
+ }),
59
+ query: z.object({}).merge(NotificationChannelsIncludeQuery),
60
+ responses: {
61
+ 200: INotificationChannelZod,
62
+ 401: UnauthorizedError,
63
+ 404: NotFoundError,
64
+ 500: InternalError,
65
+ },
66
+ },
67
+ createChannel: {
68
+ summary: 'Create notification channel',
69
+ method: 'POST',
70
+ path: '',
71
+ metadata: {
72
+ auth: true,
73
+ },
74
+ body: CreateChannelInputSchema,
75
+ responses: {
76
+ 201: INotificationChannelZod,
77
+ 400: BadRequestError,
78
+ 401: UnauthorizedError,
79
+ 500: InternalError,
80
+ },
81
+ },
82
+ updateChannel: {
83
+ summary: 'Update notification channel',
84
+ method: 'PATCH',
85
+ path: '/:id',
86
+ metadata: {
87
+ auth: true,
88
+ },
89
+ pathParams: z.object({
90
+ id: notificationChannelIdSchema,
91
+ }),
92
+ body: UpdateChannelInputSchema,
93
+ responses: {
94
+ 200: INotificationChannelZod,
95
+ 400: BadRequestError,
96
+ 401: UnauthorizedError,
97
+ 404: NotFoundError,
98
+ 500: InternalError,
99
+ },
100
+ },
101
+ deleteChannel: {
102
+ summary: 'Delete notification channel',
103
+ method: 'DELETE',
104
+ path: '/:id',
105
+ metadata: {
106
+ auth: true,
107
+ },
108
+ pathParams: z.object({
109
+ id: notificationChannelIdSchema,
110
+ }),
111
+ body: z.object({}),
112
+ responses: {
113
+ 200: z.object({ success: z.boolean() }),
114
+ 401: UnauthorizedError,
115
+ 404: NotFoundError,
116
+ 500: InternalError,
117
+ },
118
+ },
119
+ createTrigger: {
120
+ summary: 'Create notification channel trigger',
121
+ method: 'POST',
122
+ path: '/:id/triggers',
123
+ metadata: {
124
+ auth: true,
125
+ },
126
+ pathParams: z.object({
127
+ id: notificationChannelIdSchema,
128
+ }),
129
+ body: CreateTriggerInputSchema.omit({ notificationChannelId: true }),
130
+ responses: {
131
+ 201: INotificationChannelTriggerZod,
132
+ 400: BadRequestError,
133
+ 401: UnauthorizedError,
134
+ 404: NotFoundError,
135
+ 500: InternalError,
136
+ },
137
+ },
138
+ getAvailableTriggers: {
139
+ summary: 'Get all available triggers for a channel',
140
+ method: 'GET',
141
+ path: '/:id/triggers/available',
142
+ metadata: {
143
+ auth: true,
144
+ },
145
+ pathParams: z.object({
146
+ id: notificationChannelIdSchema,
147
+ }),
148
+ responses: {
149
+ 200: IAvailableTriggersResponse,
150
+ 401: UnauthorizedError,
151
+ 404: NotFoundError,
152
+ 500: InternalError,
153
+ },
154
+ },
155
+ updateTrigger: {
156
+ summary: 'Update notification channel trigger',
157
+ method: 'PATCH',
158
+ path: '/:id/triggers/:triggerId',
159
+ metadata: {
160
+ auth: true,
161
+ },
162
+ pathParams: z.object({
163
+ id: notificationChannelIdSchema,
164
+ triggerId: notificationChannelTriggerIdSchema,
165
+ }),
166
+ body: z.object({ enabled: z.boolean() }),
167
+ responses: {
168
+ 200: INotificationChannelTriggerZod,
169
+ 400: BadRequestError,
170
+ 401: UnauthorizedError,
171
+ 404: NotFoundError,
172
+ 500: InternalError,
173
+ },
174
+ },
175
+ deleteTrigger: {
176
+ summary: 'Delete notification channel trigger',
177
+ method: 'DELETE',
178
+ path: '/:id/triggers/:triggerId',
179
+ metadata: {
180
+ auth: true,
181
+ },
182
+ pathParams: z.object({
183
+ id: notificationChannelIdSchema,
184
+ triggerId: notificationChannelTriggerIdSchema,
185
+ }),
186
+ body: z.object({}),
187
+ responses: {
188
+ 200: z.object({ success: z.boolean() }),
189
+ 401: UnauthorizedError,
190
+ 404: NotFoundError,
191
+ 500: InternalError,
192
+ },
193
+ },
194
+ getRecords: {
195
+ summary: 'Get notification records',
196
+ method: 'GET',
197
+ path: '/records',
198
+ metadata: {
199
+ auth: true,
200
+ },
201
+ query: PaginationOptionsZod.merge(NotificationRecordFilters).merge(
202
+ NotificationRecordsIncludeQuery,
203
+ ),
204
+ responses: {
205
+ 200: IPaginatedNotificationRecord,
206
+ 401: UnauthorizedError,
207
+ 500: InternalError,
208
+ },
209
+ },
210
+ getRecord: {
211
+ summary: 'Get notification record by id',
212
+ method: 'GET',
213
+ path: '/records/:recordId',
214
+ metadata: {
215
+ auth: true,
216
+ },
217
+ pathParams: z.object({
218
+ recordId: notificationRecordIdSchema,
219
+ }),
220
+ query: z.object({}).merge(NotificationRecordsIncludeQuery),
221
+ responses: {
222
+ 200: INotificationRecordZod,
223
+ 401: UnauthorizedError,
224
+ 404: NotFoundError,
225
+ 500: InternalError,
226
+ },
227
+ },
228
+ retryRecord: {
229
+ summary: 'Retry failed notification record',
230
+ method: 'POST',
231
+ path: '/records/:recordId/retry',
232
+ metadata: {
233
+ auth: true,
234
+ },
235
+ pathParams: z.object({
236
+ recordId: notificationRecordIdSchema,
237
+ }),
238
+ body: z.object({}),
239
+ responses: {
240
+ 200: INotificationRecordZod,
241
+ 400: BadRequestError,
242
+ 401: UnauthorizedError,
243
+ 404: NotFoundError,
244
+ 500: InternalError,
245
+ },
246
+ },
247
+ },
248
+ {
249
+ pathPrefix: 'notification-channels',
250
+ },
251
+ );
@@ -13,7 +13,7 @@ import {
13
13
  ReviewTradeLineItemStatus,
14
14
  TradeLineItemFiltersQuery,
15
15
  TradeLineItemResponse,
16
- } from '../../../common/types/trade-line-item.type';
16
+ } from '../../../common/types/trade-line-item.types';
17
17
 
18
18
  import { z } from 'zod';
19
19
  const c = initContract();
@@ -21,6 +21,7 @@ import {
21
21
  IssuersActiveStatusUpdateZod,
22
22
  UpdateLockedStatus,
23
23
  UpdateUserRoleZod,
24
+ UserRestoreResponse,
24
25
  } from '../../../common/types';
25
26
  import { z } from 'zod';
26
27
 
@@ -143,6 +144,26 @@ export const usersContract = c.router(
143
144
  500: InternalError,
144
145
  },
145
146
  },
147
+ restoreUser: {
148
+ summary: 'Restore user by id',
149
+ method: 'POST',
150
+ path: '/:id/restore',
151
+ metadata: {
152
+ auth: true,
153
+ },
154
+ pathParams: z.object({
155
+ id: userIdSchema,
156
+ }),
157
+ body: z.object({}),
158
+ responses: {
159
+ 200: UserRestoreResponse,
160
+ 400: BadRequestError,
161
+ 401: UnauthorizedError,
162
+ 403: ForbiddenError,
163
+ 404: NotFoundError,
164
+ 500: InternalError,
165
+ },
166
+ },
146
167
  updateActiveStatus: {
147
168
  summary: '[Admin] Update user active status',
148
169
  method: 'PATCH',
@@ -8,6 +8,8 @@ import {
8
8
  import {
9
9
  EstimateBonusTierCalculationResponseZod,
10
10
  EstimateBonusTierCalculationZod,
11
+ PurchaseCalculationResponseZod,
12
+ PurchaseCalculationZod,
11
13
  } from '../../../common/types/bonus-tier.types';
12
14
 
13
15
  const c = initContract();
@@ -30,6 +32,22 @@ export const bonusTiersContract = c.router(
30
32
  500: InternalError,
31
33
  },
32
34
  },
35
+ purchaseCalculation: {
36
+ summary: 'Calculate the bonus shares that would be awarded for a trade',
37
+ method: 'POST',
38
+ path: '/purchase-calculation',
39
+ metadata: {
40
+ auth: true,
41
+ },
42
+ body: PurchaseCalculationZod,
43
+ responses: {
44
+ 200: PurchaseCalculationResponseZod,
45
+ 400: BadRequestError,
46
+ 401: UnauthorizedError,
47
+ 403: ForbiddenError,
48
+ 500: InternalError,
49
+ },
50
+ },
33
51
  },
34
52
  {
35
53
  pathPrefix: 'bonus-tiers',
@@ -14,6 +14,8 @@ import {
14
14
  IIndividualZod,
15
15
  BadRequestError,
16
16
  InternalError,
17
+ IWillDoItLaterBodySchema,
18
+ IWillDoItLaterResponseSchema,
17
19
  } from '../../../common/types';
18
20
  import { z } from 'zod';
19
21
 
@@ -92,6 +94,26 @@ export const individualsContract = c.router(
92
94
  403: ForbiddenError,
93
95
  },
94
96
  },
97
+ iWillDoItLater: {
98
+ summary: "I'll do it later - Create a task for later completion",
99
+ method: 'POST',
100
+ path: '/:id/defer',
101
+ metadata: {
102
+ auth: true,
103
+ },
104
+ pathParams: z.object({
105
+ id: individualIdSchema,
106
+ }),
107
+ body: IWillDoItLaterBodySchema,
108
+ responses: {
109
+ 201: IWillDoItLaterResponseSchema,
110
+ 400: BadRequestError,
111
+ 401: UnauthorizedError,
112
+ 403: ForbiddenError,
113
+ 404: NotFoundError,
114
+ 500: InternalError,
115
+ },
116
+ },
95
117
  },
96
118
  {
97
119
  pathPrefix: 'individuals',
@@ -13,7 +13,7 @@ import {
13
13
  TradeLineItemResponse,
14
14
  TradeLineItemUpdate,
15
15
  TradeLineItemSignStatusUpdate,
16
- } from '../../../common/types/trade-line-item.type';
16
+ } from '../../../common/types/trade-line-item.types';
17
17
 
18
18
  const c = initContract();
19
19
 
@@ -0,0 +1,36 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import {
4
+ AccountSettingsIncludeQuery,
5
+ IAccountSettingZod,
6
+ } from '../../../common/types/account-setting.types';
7
+ import {
8
+ InternalError,
9
+ NotFoundError,
10
+ UnauthorizedError,
11
+ } from '../../../common/types';
12
+
13
+ const c = initContract();
14
+
15
+ export const issuerAccountSettingsContract = c.router(
16
+ {
17
+ getAccountSettings: {
18
+ summary: 'Get account settings for current account',
19
+ method: 'GET',
20
+ path: '',
21
+ metadata: {
22
+ auth: true,
23
+ },
24
+ query: z.object({}).merge(AccountSettingsIncludeQuery),
25
+ responses: {
26
+ 200: IAccountSettingZod,
27
+ 401: UnauthorizedError,
28
+ 404: NotFoundError,
29
+ 500: InternalError,
30
+ },
31
+ },
32
+ },
33
+ {
34
+ pathPrefix: 'account-settings',
35
+ },
36
+ );
@@ -10,6 +10,8 @@ import {
10
10
  EstimateBonusTierCalculationZod,
11
11
  IBonusTierList,
12
12
  PostBonusTierZod,
13
+ PurchaseCalculationResponseZod,
14
+ PurchaseCalculationZod,
13
15
  } from '../../../common/types/bonus-tier.types';
14
16
 
15
17
  const c = initContract();
@@ -32,6 +34,22 @@ export const bonusTiersContract = c.router(
32
34
  500: InternalError,
33
35
  },
34
36
  },
37
+ purchaseCalculation: {
38
+ summary: 'Calculate the bonus shares that would be awarded for a trade',
39
+ method: 'POST',
40
+ path: '/purchase-calculation',
41
+ metadata: {
42
+ auth: true,
43
+ },
44
+ body: PurchaseCalculationZod,
45
+ responses: {
46
+ 200: PurchaseCalculationResponseZod,
47
+ 400: BadRequestError,
48
+ 401: UnauthorizedError,
49
+ 403: ForbiddenError,
50
+ 500: InternalError,
51
+ },
52
+ },
35
53
  postBonusTier: {
36
54
  summary: 'Create a new bonus tier',
37
55
  method: 'POST',
@@ -17,9 +17,13 @@ import {
17
17
  DisbursementMissingConfigZod,
18
18
  DisbursementsIncludeQuery,
19
19
  DisbursementsMissingConfigQuery,
20
+ DisbursementPreviewZod,
20
21
  DisbursementSummaryZod,
21
22
  DisbursementZod,
23
+ GetDisbursementPreviewQueryZod,
24
+ EligibleOfferingsFiltersZod,
22
25
  IPaginatedDisbursement,
26
+ IPaginatedEligibleOffering,
23
27
  PostDisbursementBalanceZod,
24
28
  PostDisbursementSummaryZod,
25
29
  PostDisbursementZod,
@@ -146,6 +150,38 @@ export const disbursementsContract = c.router(
146
150
  500: InternalError,
147
151
  },
148
152
  },
153
+ getDisbursementPreview: {
154
+ summary: 'Get disbursement preview data for Step 2',
155
+ method: 'GET',
156
+ path: '/preview',
157
+ metadata: {
158
+ auth: true,
159
+ },
160
+ query: GetDisbursementPreviewQueryZod,
161
+ responses: {
162
+ 200: DisbursementPreviewZod,
163
+ 400: BadRequestError,
164
+ 401: UnauthorizedError,
165
+ 404: NotFoundError,
166
+ 500: InternalError,
167
+ },
168
+ },
169
+ getEligibleOfferings: {
170
+ summary: 'Get eligible offerings for disbursement',
171
+ method: 'GET',
172
+ path: '/eligible-offerings',
173
+ metadata: {
174
+ auth: true,
175
+ },
176
+ query: PaginationOptionsZod.merge(EligibleOfferingsFiltersZod),
177
+ responses: {
178
+ 200: IPaginatedEligibleOffering,
179
+ 401: UnauthorizedError,
180
+ 403: ForbiddenError,
181
+ 404: NotFoundError,
182
+ 500: InternalError,
183
+ },
184
+ },
149
185
  },
150
186
  {
151
187
  pathPrefix: 'disbursements',
@@ -2,7 +2,9 @@ import { initContract } from '@ts-rest/core';
2
2
  import { accountsContract } from './accounts';
3
3
  import { accountContactsContract } from './account-contacts';
4
4
  import { accountIntegrationsContract } from './account-integrations';
5
+ import { issuerAccountSettingsContract } from './account-settings';
5
6
  import { assetsContract } from './assets';
7
+ import { issuerNotificationChannelsContract } from './notification-channels';
6
8
  import { healthContract } from './health';
7
9
  import { issuerContract } from './issuer';
8
10
  import { authContract } from './auth';
@@ -57,6 +59,7 @@ export const issuersContract = c.router(
57
59
  accounts: accountsContract,
58
60
  accountContacts: accountContactsContract,
59
61
  accountIntegrations: accountIntegrationsContract,
62
+ accountSettings: issuerAccountSettingsContract,
60
63
  activities: activitiesContract,
61
64
  aic: aicContract,
62
65
  assets: assetsContract,
@@ -86,6 +89,7 @@ export const issuersContract = c.router(
86
89
  kycs: kycsContract,
87
90
  loginHistories: loginHistoriesContract,
88
91
  notes: issuerNotesContract,
92
+ notificationChannels: issuerNotificationChannelsContract,
89
93
  offerings: issuersOfferingsContract,
90
94
  pages: pagesContract,
91
95
  paymentMethods: paymentMethodsContract,