@deepintel-ltd/farmpro-contracts 1.5.14 → 1.5.16
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/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/routes/agents.routes.d.ts +3 -3
- package/dist/routes/agents.routes.js +1 -1
- package/dist/routes/auth.routes.d.ts +516 -0
- package/dist/routes/auth.routes.d.ts.map +1 -1
- package/dist/routes/auth.routes.js +26 -2
- package/dist/routes/index.d.ts +6 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +4 -0
- package/dist/routes/payments.routes.d.ts +1851 -0
- package/dist/routes/payments.routes.d.ts.map +1 -0
- package/dist/routes/payments.routes.js +91 -0
- package/dist/routes/subscriptions.routes.d.ts +3151 -0
- package/dist/routes/subscriptions.routes.d.ts.map +1 -0
- package/dist/routes/subscriptions.routes.js +155 -0
- package/dist/schemas/auth.schemas.d.ts +314 -0
- package/dist/schemas/auth.schemas.d.ts.map +1 -1
- package/dist/schemas/auth.schemas.js +27 -0
- package/dist/schemas/payments.schemas.d.ts +822 -0
- package/dist/schemas/payments.schemas.d.ts.map +1 -0
- package/dist/schemas/payments.schemas.js +105 -0
- package/dist/schemas/subscriptions.schemas.d.ts +1344 -0
- package/dist/schemas/subscriptions.schemas.d.ts.map +1 -0
- package/dist/schemas/subscriptions.schemas.js +150 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.routes.d.ts","sourceRoot":"","sources":["../../src/routes/payments.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFzB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { paymentResponseSchema, paymentListResponseSchema, flutterwaveInitPaymentSchema, flutterwaveInitPaymentResponseSchema, } from '../schemas/payments.schemas';
|
|
4
|
+
import { jsonApiErrorResponseSchema, jsonApiSuccessResponseSchema, jsonApiPaginationQuerySchema, jsonApiSortQuerySchema, jsonApiIncludeQuerySchema, jsonApiFilterQuerySchema } from '../schemas/common.schemas';
|
|
5
|
+
const c = initContract();
|
|
6
|
+
export const paymentsRouter = c.router({
|
|
7
|
+
// List payments
|
|
8
|
+
listPayments: {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
path: '/farms/:farmId/payments',
|
|
11
|
+
pathParams: z.object({ farmId: z.string().uuid() }),
|
|
12
|
+
query: jsonApiPaginationQuerySchema
|
|
13
|
+
.merge(jsonApiSortQuerySchema)
|
|
14
|
+
.merge(jsonApiIncludeQuerySchema)
|
|
15
|
+
.merge(jsonApiFilterQuerySchema)
|
|
16
|
+
.merge(z.object({
|
|
17
|
+
'filter[status]': z.enum(['pending', 'processing', 'completed', 'failed', 'cancelled']).optional(),
|
|
18
|
+
'filter[currency]': z.enum(['NGN', 'USD']).optional(),
|
|
19
|
+
})),
|
|
20
|
+
responses: {
|
|
21
|
+
200: paymentListResponseSchema,
|
|
22
|
+
404: jsonApiErrorResponseSchema,
|
|
23
|
+
401: jsonApiErrorResponseSchema,
|
|
24
|
+
},
|
|
25
|
+
summary: 'List payments',
|
|
26
|
+
description: 'Get all payments for a farm with optional filtering',
|
|
27
|
+
},
|
|
28
|
+
// Get payment by ID
|
|
29
|
+
getPayment: {
|
|
30
|
+
method: 'GET',
|
|
31
|
+
path: '/farms/:farmId/payments/:id',
|
|
32
|
+
pathParams: z.object({
|
|
33
|
+
farmId: z.string().uuid(),
|
|
34
|
+
id: z.string().uuid(),
|
|
35
|
+
}),
|
|
36
|
+
query: jsonApiIncludeQuerySchema,
|
|
37
|
+
responses: {
|
|
38
|
+
200: paymentResponseSchema,
|
|
39
|
+
404: jsonApiErrorResponseSchema,
|
|
40
|
+
401: jsonApiErrorResponseSchema,
|
|
41
|
+
},
|
|
42
|
+
summary: 'Get payment by ID',
|
|
43
|
+
description: 'Get detailed information about a specific payment',
|
|
44
|
+
},
|
|
45
|
+
// Initialize payment (create payment intent)
|
|
46
|
+
initializePayment: {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
path: '/farms/:farmId/payments/initialize',
|
|
49
|
+
pathParams: z.object({ farmId: z.string().uuid() }),
|
|
50
|
+
body: z.object({ data: flutterwaveInitPaymentSchema }),
|
|
51
|
+
responses: {
|
|
52
|
+
201: flutterwaveInitPaymentResponseSchema,
|
|
53
|
+
400: jsonApiErrorResponseSchema,
|
|
54
|
+
404: jsonApiErrorResponseSchema,
|
|
55
|
+
401: jsonApiErrorResponseSchema,
|
|
56
|
+
422: jsonApiErrorResponseSchema,
|
|
57
|
+
},
|
|
58
|
+
summary: 'Initialize payment',
|
|
59
|
+
description: 'Create a payment intent and get Flutterwave payment link',
|
|
60
|
+
},
|
|
61
|
+
// Verify payment
|
|
62
|
+
verifyPayment: {
|
|
63
|
+
method: 'POST',
|
|
64
|
+
path: '/farms/:farmId/payments/:id/verify',
|
|
65
|
+
pathParams: z.object({
|
|
66
|
+
farmId: z.string().uuid(),
|
|
67
|
+
id: z.string().uuid(),
|
|
68
|
+
}),
|
|
69
|
+
body: z.object({}), // Empty body for verification
|
|
70
|
+
responses: {
|
|
71
|
+
200: paymentResponseSchema,
|
|
72
|
+
404: jsonApiErrorResponseSchema,
|
|
73
|
+
401: jsonApiErrorResponseSchema,
|
|
74
|
+
400: jsonApiErrorResponseSchema,
|
|
75
|
+
},
|
|
76
|
+
summary: 'Verify payment',
|
|
77
|
+
description: 'Verify payment status with Flutterwave',
|
|
78
|
+
},
|
|
79
|
+
// Webhook endpoint (public, no auth required)
|
|
80
|
+
webhook: {
|
|
81
|
+
method: 'POST',
|
|
82
|
+
path: '/payments/webhook',
|
|
83
|
+
body: z.any(), // Flutterwave webhook payload
|
|
84
|
+
responses: {
|
|
85
|
+
200: jsonApiSuccessResponseSchema,
|
|
86
|
+
400: jsonApiErrorResponseSchema,
|
|
87
|
+
},
|
|
88
|
+
summary: 'Flutterwave webhook',
|
|
89
|
+
description: 'Webhook endpoint for Flutterwave payment callbacks',
|
|
90
|
+
},
|
|
91
|
+
});
|