@dalmore/api-contracts 0.0.0-dev.2047f71 → 0.0.0-dev.4c056b7
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/common/types/disbursements.types.ts +22 -0
- package/common/types/file.types.ts +3 -3
- package/common/types/index.ts +1 -0
- package/common/types/issuer-offering.types.ts +1 -7
- package/common/types/issuer-payment-method.types.ts +41 -0
- package/common/types/issuer.types.ts +9 -0
- package/common/types/offering.types.ts +1 -6
- package/common/types/trade.types.ts +63 -0
- package/contracts/clients/cart/index.ts +60 -0
- package/contracts/clients/index.ts +8 -0
- package/contracts/clients/issuer-payment-methods/index.ts +39 -0
- package/contracts/clients/payment-methods/index.ts +85 -0
- package/contracts/clients/trade-line-items/index.ts +66 -0
- package/contracts/clients/trades/index.ts +64 -0
- package/contracts/issuers/disbursements/index.ts +18 -0
- package/package.json +1 -1
|
@@ -308,3 +308,25 @@ export const DisbursementSummaryZod = z.object({
|
|
|
308
308
|
amountToBeTransferred: z.number(),
|
|
309
309
|
});
|
|
310
310
|
export type DisbursementSummaryZod = z.infer<typeof DisbursementSummaryZod>;
|
|
311
|
+
|
|
312
|
+
export const EligibleOfferingZod = z.object({
|
|
313
|
+
offeringId: offeringIdSchema,
|
|
314
|
+
offeringName: z.string(),
|
|
315
|
+
availableAmount: z.number(),
|
|
316
|
+
});
|
|
317
|
+
export type EligibleOfferingZod = z.infer<typeof EligibleOfferingZod>;
|
|
318
|
+
|
|
319
|
+
export const IPaginatedEligibleOffering = z.object({
|
|
320
|
+
items: z.array(EligibleOfferingZod),
|
|
321
|
+
meta: IPaginationMeta,
|
|
322
|
+
});
|
|
323
|
+
export type IPaginatedEligibleOffering = z.infer<
|
|
324
|
+
typeof IPaginatedEligibleOffering
|
|
325
|
+
>;
|
|
326
|
+
|
|
327
|
+
export const EligibleOfferingsFiltersZod = z.object({
|
|
328
|
+
search: z.string().optional(),
|
|
329
|
+
});
|
|
330
|
+
export type EligibleOfferingsFiltersZod = z.infer<
|
|
331
|
+
typeof EligibleOfferingsFiltersZod
|
|
332
|
+
>;
|
|
@@ -17,7 +17,7 @@ import { KybZod } from './kyb.types';
|
|
|
17
17
|
import { IIndividualZod, individualIdSchema } from './individuals.types';
|
|
18
18
|
import { LegalEntityZod } from './legal-entity.types';
|
|
19
19
|
import { IInvestorAccount } from './investor-account.types';
|
|
20
|
-
import { TradeZod } from './trade.types';
|
|
20
|
+
import { tradeIdSchema, TradeZod } from './trade.types';
|
|
21
21
|
|
|
22
22
|
extendZodWithOpenApi(z);
|
|
23
23
|
|
|
@@ -168,13 +168,13 @@ export type PostFileQueryParams = z.infer<typeof PostFileQueryParams>;
|
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
170
|
* CLIENT portal specific schema for file uploads
|
|
171
|
-
* Only allows INDIVIDUALS as target for file uploads
|
|
171
|
+
* Only allows INDIVIDUALS and TRADES as target for file uploads
|
|
172
172
|
*/
|
|
173
173
|
export const ClientPostFileQueryParams = z.object({
|
|
174
174
|
name: z.string().min(1).max(100).openapi({ example: 'file_name' }),
|
|
175
175
|
category: z.string().max(50).openapi({ example: 'application' }),
|
|
176
176
|
label: FileLabelsEnum.openapi({ example: FileLabels.OTHER }),
|
|
177
|
-
targetId: individualIdSchema.openapi({
|
|
177
|
+
targetId: z.union([individualIdSchema, tradeIdSchema]).openapi({
|
|
178
178
|
example: 'individual_01kcrsny60fb9rjc8bbqc3b80c',
|
|
179
179
|
}),
|
|
180
180
|
metadata: metadataSchema.nullable().optional(),
|
package/common/types/index.ts
CHANGED
|
@@ -13,12 +13,7 @@ import {
|
|
|
13
13
|
} from './common.types';
|
|
14
14
|
import { IBaseEntity } from './entity.types';
|
|
15
15
|
import { IIssuer, issuerIdSchema } from './issuer.types';
|
|
16
|
-
import {
|
|
17
|
-
IAsset,
|
|
18
|
-
postAssetRefinement,
|
|
19
|
-
AssetTemplateType,
|
|
20
|
-
assetIdSchema,
|
|
21
|
-
} from './asset.types';
|
|
16
|
+
import { IAsset, postAssetRefinement, AssetTemplateType } from './asset.types';
|
|
22
17
|
import { fileIdSchema, FileZod } from './file.types';
|
|
23
18
|
import { accountIdSchema } from './account.types';
|
|
24
19
|
|
|
@@ -258,7 +253,6 @@ export const PatchIssuerOffering = z.object({
|
|
|
258
253
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
259
254
|
showTotalRaised: z.boolean().optional(),
|
|
260
255
|
issuerId: issuerIdSchema.optional(),
|
|
261
|
-
assetId: assetIdSchema,
|
|
262
256
|
assetName: z.string().min(2).max(50).optional().openapi({ example: 'Z' }),
|
|
263
257
|
assetType: z
|
|
264
258
|
.nativeEnum(AssetType)
|
|
@@ -222,10 +222,51 @@ export type IPaginatedIssuerPaymentMethod = z.infer<
|
|
|
222
222
|
typeof IPaginatedIssuerPaymentMethod
|
|
223
223
|
>;
|
|
224
224
|
|
|
225
|
+
const issuerPaymentMethodsInclude = z.enum(['issuer', 'integration']);
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @description Query parameters for including related entities
|
|
229
|
+
* @example in contract use as -> query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(IssuerPaymentMethodsIncludeQuery)
|
|
230
|
+
*/
|
|
231
|
+
export const IssuerPaymentMethodsIncludeQuery = z.object({
|
|
232
|
+
include: z
|
|
233
|
+
.string()
|
|
234
|
+
.optional()
|
|
235
|
+
.transform((str) => (str ? str.split(',') : []))
|
|
236
|
+
.refine(
|
|
237
|
+
(includes) =>
|
|
238
|
+
includes.every((include) =>
|
|
239
|
+
issuerPaymentMethodsInclude.options.includes(include as any),
|
|
240
|
+
),
|
|
241
|
+
{
|
|
242
|
+
message: `Invalid include option provided. Valid options are: ${issuerPaymentMethodsInclude.options.join(',')}`,
|
|
243
|
+
},
|
|
244
|
+
)
|
|
245
|
+
.openapi({
|
|
246
|
+
example: `${issuerPaymentMethodsInclude.options.join(',')}`,
|
|
247
|
+
}),
|
|
248
|
+
});
|
|
249
|
+
export type IssuerPaymentMethodsIncludeQuery = z.infer<
|
|
250
|
+
typeof IssuerPaymentMethodsIncludeQuery
|
|
251
|
+
>;
|
|
252
|
+
|
|
225
253
|
export const GetIssuerPaymentMethodZod = z.object({
|
|
226
254
|
issuerId: issuerIdSchema.openapi({
|
|
227
255
|
example: 'issuer_01jdq2crwke8xskjd840cj79pw',
|
|
228
256
|
}),
|
|
257
|
+
enabled: z
|
|
258
|
+
.string()
|
|
259
|
+
.optional()
|
|
260
|
+
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
261
|
+
message: 'enabled must be a boolean string',
|
|
262
|
+
})
|
|
263
|
+
.transform((v) => {
|
|
264
|
+
if (!v) return undefined;
|
|
265
|
+
return v === 'true';
|
|
266
|
+
})
|
|
267
|
+
.openapi({
|
|
268
|
+
example: 'true',
|
|
269
|
+
}),
|
|
229
270
|
});
|
|
230
271
|
export type GetIssuerPaymentMethodZod = z.infer<
|
|
231
272
|
typeof GetIssuerPaymentMethodZod
|
|
@@ -152,6 +152,10 @@ export const PutIssuerZod = z
|
|
|
152
152
|
.lazy(() => fileIdSchema)
|
|
153
153
|
.optional()
|
|
154
154
|
.nullable(),
|
|
155
|
+
formationDocumentFileId: z
|
|
156
|
+
.lazy(() => fileIdSchema)
|
|
157
|
+
.optional()
|
|
158
|
+
.nullable(),
|
|
155
159
|
coverArtId: z
|
|
156
160
|
.lazy(() => fileIdSchema)
|
|
157
161
|
.optional()
|
|
@@ -188,6 +192,11 @@ export const IIssuer = IBaseEntity.extend({
|
|
|
188
192
|
accountId: z.string(),
|
|
189
193
|
account: AccountZod.optional().nullable(),
|
|
190
194
|
ss4LetterFileId: z.string().nullable(),
|
|
195
|
+
formationDocumentFileId: z.string().nullable(),
|
|
196
|
+
formationDocument: z
|
|
197
|
+
.lazy(() => FileZod)
|
|
198
|
+
.nullable()
|
|
199
|
+
.optional(),
|
|
191
200
|
status: z
|
|
192
201
|
.nativeEnum(IssuerStatus)
|
|
193
202
|
.openapi({ example: IssuerStatus.SUBMITTED }),
|
|
@@ -26,11 +26,7 @@ import {
|
|
|
26
26
|
InvestorsOfferingsIncludeQuery,
|
|
27
27
|
} from './investors-offering.types';
|
|
28
28
|
import { OfferingStatus } from './issuer-offering.types';
|
|
29
|
-
import {
|
|
30
|
-
assetIdSchema,
|
|
31
|
-
postAssetRefinement,
|
|
32
|
-
AssetTemplateType,
|
|
33
|
-
} from './asset.types';
|
|
29
|
+
import { postAssetRefinement, AssetTemplateType } from './asset.types';
|
|
34
30
|
|
|
35
31
|
export enum OfferingFeeType {
|
|
36
32
|
FIXED = 'FIXED',
|
|
@@ -184,7 +180,6 @@ export const PatchOfferingBase = z.object({
|
|
|
184
180
|
});
|
|
185
181
|
export const PatchOffering = PatchOfferingBase.merge(
|
|
186
182
|
z.object({
|
|
187
|
-
assetId: assetIdSchema,
|
|
188
183
|
assetName: z
|
|
189
184
|
.string()
|
|
190
185
|
.min(2)
|
|
@@ -55,8 +55,71 @@ import {
|
|
|
55
55
|
} from './secondary-trade.types';
|
|
56
56
|
import { InvestorAccount } from '../../investor-accounts/entities/investor-account.entity';
|
|
57
57
|
import { Trade } from '../../trades/entities/trade.entity';
|
|
58
|
+
import { fileIdSchema } from './file.types';
|
|
58
59
|
|
|
59
60
|
extendZodWithOpenApi(z);
|
|
61
|
+
|
|
62
|
+
// Zod schemas for attach subdoc endpoints
|
|
63
|
+
export const PostAttachSubdocBody = z.object({
|
|
64
|
+
lineItemId: tradeLineItemIdSchema.openapi({
|
|
65
|
+
example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja',
|
|
66
|
+
}),
|
|
67
|
+
fileId: z
|
|
68
|
+
.lazy(() => fileIdSchema)
|
|
69
|
+
.openapi({ example: 'file_01je6ht4b8fbmttkzh2hs82xqp' }),
|
|
70
|
+
primarySignatureStatus: z
|
|
71
|
+
.nativeEnum(SignatureStatus)
|
|
72
|
+
.openapi({ example: 'SIGNED' }),
|
|
73
|
+
secondarySignatureStatus: z
|
|
74
|
+
.nativeEnum(SignatureStatus)
|
|
75
|
+
.optional()
|
|
76
|
+
.openapi({ example: 'SIGNED' }),
|
|
77
|
+
});
|
|
78
|
+
export type PostAttachSubdocBody = z.infer<typeof PostAttachSubdocBody>;
|
|
79
|
+
|
|
80
|
+
export const PutAttachSubdocBody = z.object({
|
|
81
|
+
lineItemId: tradeLineItemIdSchema
|
|
82
|
+
.optional()
|
|
83
|
+
.openapi({ example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja' }),
|
|
84
|
+
fileId: z
|
|
85
|
+
.lazy(() => fileIdSchema)
|
|
86
|
+
.optional()
|
|
87
|
+
.openapi({ example: 'file_01je6ht4b8fbmttkzh2hs82xqp' }),
|
|
88
|
+
primarySignatureStatus: z
|
|
89
|
+
.nativeEnum(SignatureStatus)
|
|
90
|
+
.optional()
|
|
91
|
+
.openapi({ example: 'SIGNED' }),
|
|
92
|
+
secondarySignatureStatus: z
|
|
93
|
+
.nativeEnum(SignatureStatus)
|
|
94
|
+
.optional()
|
|
95
|
+
.openapi({ example: 'SIGNED' }),
|
|
96
|
+
});
|
|
97
|
+
export type PutAttachSubdocBody = z.infer<typeof PutAttachSubdocBody>;
|
|
98
|
+
|
|
99
|
+
export const PatchSubdocSignatureBody = z.object({
|
|
100
|
+
lineItemId: tradeLineItemIdSchema.optional().openapi({
|
|
101
|
+
example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja',
|
|
102
|
+
description:
|
|
103
|
+
'Optional. If not provided, updates the first line item with an attached subdoc. Required for trades with multiple line items.',
|
|
104
|
+
}),
|
|
105
|
+
primarySignatureStatus: z.nativeEnum(SignatureStatus).optional().openapi({
|
|
106
|
+
example: 'SIGNED',
|
|
107
|
+
description: 'Primary signer signature status',
|
|
108
|
+
}),
|
|
109
|
+
secondarySignatureStatus: z.nativeEnum(SignatureStatus).optional().openapi({
|
|
110
|
+
example: 'SIGNED',
|
|
111
|
+
description:
|
|
112
|
+
'Secondary signer signature status. Only applicable for JOINT investor accounts.',
|
|
113
|
+
}),
|
|
114
|
+
});
|
|
115
|
+
export type PatchSubdocSignatureBody = z.infer<typeof PatchSubdocSignatureBody>;
|
|
116
|
+
|
|
117
|
+
export const AttachSubdocResponse = z.object({
|
|
118
|
+
success: z.boolean(),
|
|
119
|
+
message: z.string(),
|
|
120
|
+
});
|
|
121
|
+
export type AttachSubdocResponse = z.infer<typeof AttachSubdocResponse>;
|
|
122
|
+
|
|
60
123
|
export const CheckResultsSchema = z.object({
|
|
61
124
|
fundingStatus: z.boolean(),
|
|
62
125
|
agreementStatus: z.boolean(),
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
UnauthorizedError,
|
|
5
|
+
ForbiddenError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
BadRequestError,
|
|
8
|
+
InternalError,
|
|
9
|
+
TradeZod,
|
|
10
|
+
userIdSchema,
|
|
11
|
+
tradeIdSchema,
|
|
12
|
+
} from '../../../common/types';
|
|
13
|
+
import { PatchCartBody } from '../../../common/types/cart.types';
|
|
14
|
+
|
|
15
|
+
const c = initContract();
|
|
16
|
+
|
|
17
|
+
export const cartContract = c.router(
|
|
18
|
+
{
|
|
19
|
+
getTradeCart: {
|
|
20
|
+
summary: 'Get carts (Trade.status = CART)',
|
|
21
|
+
method: 'GET',
|
|
22
|
+
path: '',
|
|
23
|
+
metadata: {
|
|
24
|
+
auth: true,
|
|
25
|
+
},
|
|
26
|
+
query: z.object({
|
|
27
|
+
userId: userIdSchema,
|
|
28
|
+
}),
|
|
29
|
+
responses: {
|
|
30
|
+
200: TradeZod,
|
|
31
|
+
401: UnauthorizedError,
|
|
32
|
+
403: ForbiddenError,
|
|
33
|
+
404: NotFoundError,
|
|
34
|
+
500: InternalError,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
patchCart: {
|
|
38
|
+
summary: 'Patch a cart',
|
|
39
|
+
method: 'PATCH',
|
|
40
|
+
path: '/:id',
|
|
41
|
+
metadata: {
|
|
42
|
+
auth: true,
|
|
43
|
+
},
|
|
44
|
+
pathParams: z.object({
|
|
45
|
+
id: tradeIdSchema,
|
|
46
|
+
}),
|
|
47
|
+
body: PatchCartBody,
|
|
48
|
+
responses: {
|
|
49
|
+
200: TradeZod,
|
|
50
|
+
400: BadRequestError,
|
|
51
|
+
401: UnauthorizedError,
|
|
52
|
+
403: ForbiddenError,
|
|
53
|
+
500: InternalError,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
pathPrefix: 'carts',
|
|
59
|
+
},
|
|
60
|
+
);
|
|
@@ -3,6 +3,7 @@ import { accountsContract } from './accounts';
|
|
|
3
3
|
import { apiKeysContract } from './api-keys';
|
|
4
4
|
import { clientApiKeyLogsContract } from './api-key-logs';
|
|
5
5
|
import { assetsContract } from './assets';
|
|
6
|
+
import { cartContract } from './cart';
|
|
6
7
|
import { filesContract } from './files';
|
|
7
8
|
import { individualsContract } from './individuals';
|
|
8
9
|
import { investorAccountsContract } from './investor-accounts';
|
|
@@ -15,6 +16,9 @@ import { secureRequestContract } from './secure-requests';
|
|
|
15
16
|
import { aicContract } from './aic';
|
|
16
17
|
import { authContract } from './auth';
|
|
17
18
|
import { sitesContract } from './sites';
|
|
19
|
+
import { paymentMethodsContract } from './payment-methods';
|
|
20
|
+
import { issuerPaymentMethodsContract } from './issuer-payment-methods';
|
|
21
|
+
import { tradeLineItemsContract } from './trade-line-items';
|
|
18
22
|
|
|
19
23
|
const c = initContract();
|
|
20
24
|
|
|
@@ -27,15 +31,19 @@ export const clientsContract = c.router(
|
|
|
27
31
|
apiKeys: apiKeysContract,
|
|
28
32
|
apiKeyLogs: clientApiKeyLogsContract,
|
|
29
33
|
assets: assetsContract,
|
|
34
|
+
cart: cartContract,
|
|
30
35
|
files: filesContract,
|
|
31
36
|
filesPublic: filesPublicContract,
|
|
32
37
|
individuals: individualsContract,
|
|
33
38
|
investorAccounts: investorAccountsContract,
|
|
39
|
+
issuerPaymentMethods: issuerPaymentMethodsContract,
|
|
34
40
|
issuers: issuersContract,
|
|
35
41
|
legalEntities: legalEntityContract,
|
|
36
42
|
offerings: offeringsContract,
|
|
43
|
+
paymentMethods: paymentMethodsContract,
|
|
37
44
|
secureRequests: secureRequestContract,
|
|
38
45
|
sites: sitesContract,
|
|
46
|
+
tradeLineItems: tradeLineItemsContract,
|
|
39
47
|
trades: tradesContract,
|
|
40
48
|
},
|
|
41
49
|
{
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import {
|
|
3
|
+
ForbiddenError,
|
|
4
|
+
InternalError,
|
|
5
|
+
NotFoundError,
|
|
6
|
+
UnauthorizedError,
|
|
7
|
+
GetIssuerPaymentMethodZod,
|
|
8
|
+
IPaginatedIssuerPaymentMethod,
|
|
9
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
10
|
+
PaginationOptionsZod,
|
|
11
|
+
} from '../../../common/types';
|
|
12
|
+
|
|
13
|
+
const c = initContract();
|
|
14
|
+
|
|
15
|
+
export const issuerPaymentMethodsContract = c.router(
|
|
16
|
+
{
|
|
17
|
+
getIssuerPaymentMethods: {
|
|
18
|
+
summary: 'Get issuer payment methods',
|
|
19
|
+
method: 'GET',
|
|
20
|
+
path: '',
|
|
21
|
+
metadata: {
|
|
22
|
+
auth: true,
|
|
23
|
+
},
|
|
24
|
+
query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(
|
|
25
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
26
|
+
),
|
|
27
|
+
responses: {
|
|
28
|
+
200: IPaginatedIssuerPaymentMethod,
|
|
29
|
+
401: UnauthorizedError,
|
|
30
|
+
403: ForbiddenError,
|
|
31
|
+
404: NotFoundError,
|
|
32
|
+
500: InternalError,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
pathPrefix: 'issuer-payment-methods',
|
|
38
|
+
},
|
|
39
|
+
);
|
|
@@ -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.type';
|
|
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,6 +16,10 @@ 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 {
|
|
@@ -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',
|
|
@@ -19,7 +19,9 @@ import {
|
|
|
19
19
|
DisbursementsMissingConfigQuery,
|
|
20
20
|
DisbursementSummaryZod,
|
|
21
21
|
DisbursementZod,
|
|
22
|
+
EligibleOfferingsFiltersZod,
|
|
22
23
|
IPaginatedDisbursement,
|
|
24
|
+
IPaginatedEligibleOffering,
|
|
23
25
|
PostDisbursementBalanceZod,
|
|
24
26
|
PostDisbursementSummaryZod,
|
|
25
27
|
PostDisbursementZod,
|
|
@@ -146,6 +148,22 @@ export const disbursementsContract = c.router(
|
|
|
146
148
|
500: InternalError,
|
|
147
149
|
},
|
|
148
150
|
},
|
|
151
|
+
getEligibleOfferings: {
|
|
152
|
+
summary: 'Get eligible offerings for disbursement',
|
|
153
|
+
method: 'GET',
|
|
154
|
+
path: '/eligible-offerings',
|
|
155
|
+
metadata: {
|
|
156
|
+
auth: true,
|
|
157
|
+
},
|
|
158
|
+
query: PaginationOptionsZod.merge(EligibleOfferingsFiltersZod),
|
|
159
|
+
responses: {
|
|
160
|
+
200: IPaginatedEligibleOffering,
|
|
161
|
+
401: UnauthorizedError,
|
|
162
|
+
403: ForbiddenError,
|
|
163
|
+
404: NotFoundError,
|
|
164
|
+
500: InternalError,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
149
167
|
},
|
|
150
168
|
{
|
|
151
169
|
pathPrefix: 'disbursements',
|
package/package.json
CHANGED