@dalmore/api-contracts 0.0.0-dev.2dc8e92 → 0.0.0-dev.3af7603

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 (39) hide show
  1. package/common/types/account-setting.types.ts +31 -0
  2. package/common/types/activity.types.ts +1 -1
  3. package/common/types/api-key-logs.types.ts +1 -1
  4. package/common/types/asset.types.ts +14 -14
  5. package/common/types/bonus-tier.types.ts +33 -0
  6. package/common/types/cart.types.ts +4 -1
  7. package/common/types/common.types.ts +16 -6
  8. package/common/types/dashboard.types.ts +2 -9
  9. package/common/types/disbursements.types.ts +119 -3
  10. package/common/types/file.types.ts +20 -4
  11. package/common/types/i-will-do-it-later.types.ts +68 -0
  12. package/common/types/index.ts +2 -0
  13. package/common/types/individuals.types.ts +2 -15
  14. package/common/types/issuer-offering.types.ts +113 -30
  15. package/common/types/issuer-payment-method.types.ts +41 -0
  16. package/common/types/issuer.types.ts +9 -0
  17. package/common/types/notification.types.ts +239 -29
  18. package/common/types/offering.types.ts +106 -20
  19. package/common/types/site.types.ts +2 -9
  20. package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
  21. package/common/types/trade.types.ts +71 -1
  22. package/common/types/transaction.types.ts +12 -1
  23. package/common/types/user.types.ts +15 -28
  24. package/contracts/clients/cart/index.ts +80 -0
  25. package/contracts/clients/index.ts +10 -0
  26. package/contracts/clients/issuer-payment-methods/index.ts +39 -0
  27. package/contracts/clients/payment-methods/index.ts +85 -0
  28. package/contracts/clients/trade-line-items/index.ts +66 -0
  29. package/contracts/clients/trades/index.ts +65 -1
  30. package/contracts/clients/transactions/index.ts +37 -0
  31. package/contracts/compliance/bonus-tiers/index.ts +21 -2
  32. package/contracts/compliance/trade-line-items/index.ts +1 -1
  33. package/contracts/compliance/users/index.ts +21 -0
  34. package/contracts/investors/bonus-tiers/index.ts +18 -0
  35. package/contracts/investors/individuals/index.ts +22 -0
  36. package/contracts/investors/trade-line-items/index.ts +1 -1
  37. package/contracts/issuers/bonus-tiers/index.ts +18 -0
  38. package/contracts/issuers/disbursements/index.ts +36 -0
  39. package/package.json +1 -1
@@ -0,0 +1,85 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import {
4
+ UnauthorizedError,
5
+ ForbiddenError,
6
+ NotFoundError,
7
+ userIdSchema,
8
+ BadRequestError,
9
+ InternalError,
10
+ } from '../../../common/types';
11
+ import {
12
+ PaymentMethodResponseArray,
13
+ PaymentMethodResponse,
14
+ PostPaymentMethod,
15
+ PostSetupIntentBody,
16
+ SetupIntentResponse,
17
+ } from '../../../common/types/payment-methods.types';
18
+
19
+ const c = initContract();
20
+
21
+ export const paymentMethodsContract = c.router(
22
+ {
23
+ getPaymentMethods: {
24
+ summary: 'Get payment methods for a user',
25
+ method: 'GET',
26
+ path: '',
27
+ metadata: {
28
+ auth: true,
29
+ },
30
+ query: z.object({
31
+ userId: userIdSchema,
32
+ }),
33
+ responses: {
34
+ 200: PaymentMethodResponseArray,
35
+ 401: UnauthorizedError,
36
+ 403: ForbiddenError,
37
+ 404: NotFoundError,
38
+ 500: InternalError,
39
+ },
40
+ },
41
+ createPaymentMethod: {
42
+ summary: 'Create payment method for a user',
43
+ method: 'POST',
44
+ path: '',
45
+ metadata: {
46
+ auth: true,
47
+ },
48
+ query: z.object({
49
+ userId: userIdSchema,
50
+ }),
51
+ body: PostPaymentMethod,
52
+ responses: {
53
+ 201: PaymentMethodResponse,
54
+ 400: BadRequestError,
55
+ 401: UnauthorizedError,
56
+ 403: ForbiddenError,
57
+ 404: NotFoundError,
58
+ 500: InternalError,
59
+ },
60
+ },
61
+ createSetupIntent: {
62
+ summary: 'Create payment method setup intent for a user',
63
+ method: 'POST',
64
+ path: '/intent',
65
+ metadata: {
66
+ auth: true,
67
+ },
68
+ query: z.object({
69
+ userId: userIdSchema,
70
+ }),
71
+ body: PostSetupIntentBody,
72
+ responses: {
73
+ 201: SetupIntentResponse,
74
+ 400: BadRequestError,
75
+ 401: UnauthorizedError,
76
+ 403: ForbiddenError,
77
+ 404: NotFoundError,
78
+ 500: InternalError,
79
+ },
80
+ },
81
+ },
82
+ {
83
+ pathPrefix: 'payment-methods',
84
+ },
85
+ );
@@ -0,0 +1,66 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import {
4
+ BadRequestError,
5
+ ForbiddenError,
6
+ InternalError,
7
+ NotFoundError,
8
+ UnauthorizedError,
9
+ userIdSchema,
10
+ } from '../../../common/types';
11
+ import {
12
+ PostTradeLineItem,
13
+ TradeLineItemParams,
14
+ TradeLineItemQuery,
15
+ TradeLineItemResponse,
16
+ TradeLineItemUpdate,
17
+ } from '../../../common/types/trade-line-item.types';
18
+
19
+ const c = initContract();
20
+
21
+ export const tradeLineItemsContract = c.router(
22
+ {
23
+ postTradeLineItem: {
24
+ summary: 'Create Trade Line Item',
25
+ method: 'POST',
26
+ path: '/',
27
+ metadata: {
28
+ auth: true,
29
+ },
30
+ body: PostTradeLineItem,
31
+ query: TradeLineItemQuery.merge(
32
+ z.object({
33
+ userId: userIdSchema,
34
+ }),
35
+ ),
36
+ responses: {
37
+ 201: TradeLineItemResponse,
38
+ 401: UnauthorizedError,
39
+ 403: ForbiddenError,
40
+ 400: BadRequestError,
41
+ 500: InternalError,
42
+ },
43
+ },
44
+ updateTradeLineItem: {
45
+ summary: 'Update Trade Line Item - Can delete if you pass quantity = 0',
46
+ method: 'PATCH',
47
+ path: '/:id',
48
+ metadata: {
49
+ auth: true,
50
+ },
51
+ pathParams: TradeLineItemParams,
52
+ body: TradeLineItemUpdate,
53
+ responses: {
54
+ 200: TradeLineItemResponse,
55
+ 401: UnauthorizedError,
56
+ 403: ForbiddenError,
57
+ 404: NotFoundError,
58
+ 500: InternalError,
59
+ 400: BadRequestError,
60
+ },
61
+ },
62
+ },
63
+ {
64
+ pathPrefix: 'trade-line-items',
65
+ },
66
+ );
@@ -16,13 +16,17 @@ import {
16
16
  tradeIdOrTidSchema,
17
17
  TradesIncludeQuery,
18
18
  TradeZod,
19
+ PostAttachSubdocBody,
20
+ PutAttachSubdocBody,
21
+ PatchSubdocSignatureBody,
22
+ AttachSubdocResponse,
19
23
  } from '../../../common/types/trade.types';
20
24
  import { z } from 'zod';
21
25
  import {
22
26
  PostTradeLineItem,
23
27
  TradeLineItemQuery,
24
28
  TradeLineItemResponse,
25
- } from '../../../common/types/trade-line-item.type';
29
+ } from '../../../common/types/trade-line-item.types';
26
30
 
27
31
  const c = initContract();
28
32
 
@@ -115,6 +119,66 @@ export const tradesContract = c.router(
115
119
  500: InternalError,
116
120
  },
117
121
  },
122
+ postAttachSubdoc: {
123
+ summary: 'Attach subdoc to trade',
124
+ method: 'POST',
125
+ path: '/:id/attach-subdoc',
126
+ pathParams: z.object({
127
+ id: tradeIdOrTidSchema,
128
+ }),
129
+ metadata: {
130
+ auth: true,
131
+ },
132
+ body: PostAttachSubdocBody,
133
+ responses: {
134
+ 200: AttachSubdocResponse,
135
+ 400: BadRequestError,
136
+ 401: UnauthorizedError,
137
+ 403: ForbiddenError,
138
+ 404: NotFoundError,
139
+ 500: InternalError,
140
+ },
141
+ },
142
+ putAttachSubdoc: {
143
+ summary: 'Update attached subdoc for trade',
144
+ method: 'PUT',
145
+ path: '/:id/attach-subdoc',
146
+ pathParams: z.object({
147
+ id: tradeIdOrTidSchema,
148
+ }),
149
+ metadata: {
150
+ auth: true,
151
+ },
152
+ body: PutAttachSubdocBody,
153
+ responses: {
154
+ 200: AttachSubdocResponse,
155
+ 400: BadRequestError,
156
+ 401: UnauthorizedError,
157
+ 403: ForbiddenError,
158
+ 404: NotFoundError,
159
+ 500: InternalError,
160
+ },
161
+ },
162
+ patchSubdocSign: {
163
+ summary: 'Update subdoc signature statuses for trade',
164
+ method: 'PATCH',
165
+ path: '/:id/sign',
166
+ pathParams: z.object({
167
+ id: tradeIdOrTidSchema,
168
+ }),
169
+ metadata: {
170
+ auth: true,
171
+ },
172
+ body: PatchSubdocSignatureBody,
173
+ responses: {
174
+ 200: AttachSubdocResponse,
175
+ 400: BadRequestError,
176
+ 401: UnauthorizedError,
177
+ 403: ForbiddenError,
178
+ 404: NotFoundError,
179
+ 500: InternalError,
180
+ },
181
+ },
118
182
  },
119
183
  {
120
184
  pathPrefix: 'trades',
@@ -0,0 +1,37 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import {
3
+ BadRequestError,
4
+ InternalError,
5
+ NotFoundError,
6
+ UnauthorizedError,
7
+ } from '../../../common/types';
8
+ import {
9
+ ClientPostTransactionZod,
10
+ TransactionZod,
11
+ } from '../../../common/types/transaction.types';
12
+
13
+ const c = initContract();
14
+
15
+ export const clientsTransactionsContract = c.router(
16
+ {
17
+ postTransaction: {
18
+ summary: 'Create a transaction',
19
+ method: 'POST',
20
+ path: '',
21
+ metadata: {
22
+ auth: true,
23
+ },
24
+ body: ClientPostTransactionZod,
25
+ responses: {
26
+ 201: TransactionZod,
27
+ 400: BadRequestError,
28
+ 401: UnauthorizedError,
29
+ 404: NotFoundError,
30
+ 500: InternalError,
31
+ },
32
+ },
33
+ },
34
+ {
35
+ pathPrefix: 'transactions',
36
+ },
37
+ );
@@ -6,10 +6,12 @@ import {
6
6
  UnauthorizedError,
7
7
  } from '../../../common/types';
8
8
  import {
9
+ ComplianceEstimateBonusTierCalculationZod,
9
10
  CompliancePostBonusTierZod,
10
11
  EstimateBonusTierCalculationResponseZod,
11
- EstimateBonusTierCalculationZod,
12
12
  IBonusTierList,
13
+ PurchaseCalculationResponseZod,
14
+ PurchaseCalculationZod,
13
15
  } from '../../../common/types/bonus-tier.types';
14
16
 
15
17
  const c = initContract();
@@ -23,7 +25,7 @@ export const bonusTiersContract = c.router(
23
25
  metadata: {
24
26
  auth: true,
25
27
  },
26
- body: EstimateBonusTierCalculationZod,
28
+ body: ComplianceEstimateBonusTierCalculationZod,
27
29
  responses: {
28
30
  200: EstimateBonusTierCalculationResponseZod,
29
31
  400: BadRequestError,
@@ -32,6 +34,23 @@ export const bonusTiersContract = c.router(
32
34
  500: InternalError,
33
35
  },
34
36
  },
37
+ purchaseCalculation: {
38
+ summary:
39
+ '[ADMIN] Calculate the bonus shares that would be awarded for a trade',
40
+ method: 'POST',
41
+ path: '/purchase-calculation',
42
+ metadata: {
43
+ auth: true,
44
+ },
45
+ body: PurchaseCalculationZod,
46
+ responses: {
47
+ 200: PurchaseCalculationResponseZod,
48
+ 400: BadRequestError,
49
+ 401: UnauthorizedError,
50
+ 403: ForbiddenError,
51
+ 500: InternalError,
52
+ },
53
+ },
35
54
  postBonusTier: {
36
55
  summary: 'Create a new bonus tier',
37
56
  method: 'POST',
@@ -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
 
@@ -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',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalmore/api-contracts",
3
- "version": "0.0.0-dev.2dc8e92",
3
+ "version": "0.0.0-dev.3af7603",
4
4
  "description": "Type-safe API contracts for Dalmore Client Portal",
5
5
  "main": "./contracts/index.ts",
6
6
  "types": "./contracts/index.ts",