@deepintel-ltd/farmpro-contracts 1.5.17 → 1.5.19
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/routes/payments.routes.d.ts +4 -4
- package/dist/routes/payments.routes.js +8 -8
- package/dist/routes/subscriptions.routes.d.ts +288 -56
- package/dist/routes/subscriptions.routes.d.ts.map +1 -1
- package/dist/routes/subscriptions.routes.js +25 -2
- package/dist/schemas/payments.schemas.d.ts +65 -48
- package/dist/schemas/payments.schemas.d.ts.map +1 -1
- package/dist/schemas/payments.schemas.js +18 -15
- package/dist/schemas/subscriptions.schemas.d.ts +32 -32
- package/dist/schemas/subscriptions.schemas.d.ts.map +1 -1
- package/dist/schemas/subscriptions.schemas.js +0 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.routes.d.ts","sourceRoot":"","sources":["../../src/routes/subscriptions.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"subscriptions.routes.d.ts","sourceRoot":"","sources":["../../src/routes/subscriptions.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmO9B,CAAC"}
|
|
@@ -172,7 +172,6 @@ export const subscriptionsRouter = c.router({
|
|
|
172
172
|
summary: 'Get current usage',
|
|
173
173
|
description: 'Get current usage for a specific resource type in the current period',
|
|
174
174
|
},
|
|
175
|
-
// Verify and activate subscription after payment
|
|
176
175
|
verifyAndActivateSubscription: {
|
|
177
176
|
method: 'POST',
|
|
178
177
|
path: '/farms/:farmId/subscriptions/verify-payment',
|
|
@@ -181,7 +180,7 @@ export const subscriptionsRouter = c.router({
|
|
|
181
180
|
data: z.object({
|
|
182
181
|
type: z.literal('subscriptions'),
|
|
183
182
|
attributes: z.object({
|
|
184
|
-
paymentReference: z.string(),
|
|
183
|
+
paymentReference: z.string(),
|
|
185
184
|
}),
|
|
186
185
|
}),
|
|
187
186
|
}),
|
|
@@ -194,4 +193,28 @@ export const subscriptionsRouter = c.router({
|
|
|
194
193
|
summary: 'Verify and activate subscription',
|
|
195
194
|
description: 'Verify payment and automatically upgrade subscription. Typically called after payment redirect or when webhook fails.',
|
|
196
195
|
},
|
|
196
|
+
confirmSubscriptionPayment: {
|
|
197
|
+
method: 'GET',
|
|
198
|
+
path: '/subscriptions/confirm',
|
|
199
|
+
query: z.object({
|
|
200
|
+
trxref: z.string().optional(),
|
|
201
|
+
reference: z.string().optional(),
|
|
202
|
+
}),
|
|
203
|
+
responses: {
|
|
204
|
+
200: z.object({
|
|
205
|
+
status: z.literal('success'),
|
|
206
|
+
message: z.string(),
|
|
207
|
+
data: z.object({
|
|
208
|
+
subscriptionId: z.string().uuid(),
|
|
209
|
+
farmId: z.string().uuid(),
|
|
210
|
+
tier: z.string(),
|
|
211
|
+
}),
|
|
212
|
+
}),
|
|
213
|
+
302: z.any(),
|
|
214
|
+
400: jsonApiErrorResponseSchema,
|
|
215
|
+
404: jsonApiErrorResponseSchema,
|
|
216
|
+
},
|
|
217
|
+
summary: 'Confirm subscription payment',
|
|
218
|
+
description: 'Public endpoint for payment gateway redirect callback. Verifies payment and activates subscription. Redirects to success page or returns JSON response.',
|
|
219
|
+
},
|
|
197
220
|
});
|
|
@@ -548,7 +548,7 @@ export declare const paymentListResponseSchema: z.ZodObject<{
|
|
|
548
548
|
meta?: Record<string, unknown> | undefined;
|
|
549
549
|
}[] | undefined;
|
|
550
550
|
}>;
|
|
551
|
-
export declare const
|
|
551
|
+
export declare const initPaymentSchema: z.ZodObject<{
|
|
552
552
|
amount: z.ZodNumber;
|
|
553
553
|
currency: z.ZodEnum<["NGN", "USD"]>;
|
|
554
554
|
email: z.ZodString;
|
|
@@ -576,7 +576,7 @@ export declare const flutterwaveInitPaymentSchema: z.ZodObject<{
|
|
|
576
576
|
description?: string | undefined;
|
|
577
577
|
paymentMethod?: "card" | "bank_transfer" | "mobile_money" | "ussd" | "account" | undefined;
|
|
578
578
|
}>;
|
|
579
|
-
export declare const
|
|
579
|
+
export declare const initPaymentResponseSchema: z.ZodObject<{
|
|
580
580
|
status: z.ZodLiteral<"success">;
|
|
581
581
|
message: z.ZodString;
|
|
582
582
|
data: z.ZodObject<{
|
|
@@ -604,18 +604,19 @@ export declare const flutterwaveInitPaymentResponseSchema: z.ZodObject<{
|
|
|
604
604
|
tx_ref: string;
|
|
605
605
|
};
|
|
606
606
|
}>;
|
|
607
|
-
export declare const
|
|
607
|
+
export declare const webhookPayloadSchema: z.ZodObject<{
|
|
608
608
|
event: z.ZodString;
|
|
609
609
|
data: z.ZodObject<{
|
|
610
610
|
id: z.ZodNumber;
|
|
611
|
-
tx_ref: z.ZodString
|
|
612
|
-
|
|
611
|
+
tx_ref: z.ZodOptional<z.ZodString>;
|
|
612
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
613
|
+
flw_ref: z.ZodOptional<z.ZodString>;
|
|
613
614
|
device_fingerprint: z.ZodOptional<z.ZodString>;
|
|
614
615
|
amount: z.ZodNumber;
|
|
615
616
|
currency: z.ZodString;
|
|
616
|
-
charged_amount: z.ZodNumber
|
|
617
|
-
app_fee: z.ZodNumber
|
|
618
|
-
merchant_fee: z.ZodNumber
|
|
617
|
+
charged_amount: z.ZodOptional<z.ZodNumber>;
|
|
618
|
+
app_fee: z.ZodOptional<z.ZodNumber>;
|
|
619
|
+
merchant_fee: z.ZodOptional<z.ZodNumber>;
|
|
619
620
|
processor_response: z.ZodOptional<z.ZodString>;
|
|
620
621
|
auth_model: z.ZodOptional<z.ZodString>;
|
|
621
622
|
card: z.ZodOptional<z.ZodObject<{
|
|
@@ -643,50 +644,48 @@ export declare const flutterwaveWebhookSchema: z.ZodObject<{
|
|
|
643
644
|
country?: string | undefined;
|
|
644
645
|
expiry?: string | undefined;
|
|
645
646
|
}>>;
|
|
646
|
-
account_id: z.ZodNumber
|
|
647
|
+
account_id: z.ZodOptional<z.ZodNumber>;
|
|
647
648
|
customer: z.ZodObject<{
|
|
648
649
|
id: z.ZodNumber;
|
|
649
650
|
name: z.ZodString;
|
|
650
651
|
phone_number: z.ZodOptional<z.ZodString>;
|
|
652
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
651
653
|
email: z.ZodString;
|
|
652
|
-
created_at: z.ZodString
|
|
654
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
653
655
|
}, "strip", z.ZodTypeAny, {
|
|
654
656
|
id: number;
|
|
655
657
|
email: string;
|
|
656
658
|
name: string;
|
|
657
|
-
|
|
659
|
+
phone?: string | undefined;
|
|
658
660
|
phone_number?: string | undefined;
|
|
661
|
+
created_at?: string | undefined;
|
|
659
662
|
}, {
|
|
660
663
|
id: number;
|
|
661
664
|
email: string;
|
|
662
665
|
name: string;
|
|
663
|
-
|
|
666
|
+
phone?: string | undefined;
|
|
664
667
|
phone_number?: string | undefined;
|
|
668
|
+
created_at?: string | undefined;
|
|
665
669
|
}>;
|
|
666
670
|
status: z.ZodString;
|
|
667
|
-
payment_type: z.ZodString
|
|
671
|
+
payment_type: z.ZodOptional<z.ZodString>;
|
|
668
672
|
created_at: z.ZodString;
|
|
673
|
+
paid_at: z.ZodOptional<z.ZodString>;
|
|
669
674
|
amount_settled: z.ZodOptional<z.ZodNumber>;
|
|
670
675
|
}, "strip", z.ZodTypeAny, {
|
|
671
676
|
status: string;
|
|
672
677
|
id: number;
|
|
673
678
|
currency: string;
|
|
674
679
|
amount: number;
|
|
675
|
-
tx_ref: string;
|
|
676
|
-
flw_ref: string;
|
|
677
|
-
charged_amount: number;
|
|
678
|
-
app_fee: number;
|
|
679
|
-
merchant_fee: number;
|
|
680
|
-
account_id: number;
|
|
681
680
|
customer: {
|
|
682
681
|
id: number;
|
|
683
682
|
email: string;
|
|
684
683
|
name: string;
|
|
685
|
-
|
|
684
|
+
phone?: string | undefined;
|
|
686
685
|
phone_number?: string | undefined;
|
|
686
|
+
created_at?: string | undefined;
|
|
687
687
|
};
|
|
688
688
|
created_at: string;
|
|
689
|
-
payment_type: string;
|
|
690
689
|
card?: {
|
|
691
690
|
type?: string | undefined;
|
|
692
691
|
token?: string | undefined;
|
|
@@ -696,30 +695,33 @@ export declare const flutterwaveWebhookSchema: z.ZodObject<{
|
|
|
696
695
|
country?: string | undefined;
|
|
697
696
|
expiry?: string | undefined;
|
|
698
697
|
} | undefined;
|
|
698
|
+
tx_ref?: string | undefined;
|
|
699
|
+
reference?: string | undefined;
|
|
700
|
+
flw_ref?: string | undefined;
|
|
699
701
|
device_fingerprint?: string | undefined;
|
|
702
|
+
charged_amount?: number | undefined;
|
|
703
|
+
app_fee?: number | undefined;
|
|
704
|
+
merchant_fee?: number | undefined;
|
|
700
705
|
processor_response?: string | undefined;
|
|
701
706
|
auth_model?: string | undefined;
|
|
707
|
+
account_id?: number | undefined;
|
|
708
|
+
payment_type?: string | undefined;
|
|
709
|
+
paid_at?: string | undefined;
|
|
702
710
|
amount_settled?: number | undefined;
|
|
703
711
|
}, {
|
|
704
712
|
status: string;
|
|
705
713
|
id: number;
|
|
706
714
|
currency: string;
|
|
707
715
|
amount: number;
|
|
708
|
-
tx_ref: string;
|
|
709
|
-
flw_ref: string;
|
|
710
|
-
charged_amount: number;
|
|
711
|
-
app_fee: number;
|
|
712
|
-
merchant_fee: number;
|
|
713
|
-
account_id: number;
|
|
714
716
|
customer: {
|
|
715
717
|
id: number;
|
|
716
718
|
email: string;
|
|
717
719
|
name: string;
|
|
718
|
-
|
|
720
|
+
phone?: string | undefined;
|
|
719
721
|
phone_number?: string | undefined;
|
|
722
|
+
created_at?: string | undefined;
|
|
720
723
|
};
|
|
721
724
|
created_at: string;
|
|
722
|
-
payment_type: string;
|
|
723
725
|
card?: {
|
|
724
726
|
type?: string | undefined;
|
|
725
727
|
token?: string | undefined;
|
|
@@ -729,9 +731,18 @@ export declare const flutterwaveWebhookSchema: z.ZodObject<{
|
|
|
729
731
|
country?: string | undefined;
|
|
730
732
|
expiry?: string | undefined;
|
|
731
733
|
} | undefined;
|
|
734
|
+
tx_ref?: string | undefined;
|
|
735
|
+
reference?: string | undefined;
|
|
736
|
+
flw_ref?: string | undefined;
|
|
732
737
|
device_fingerprint?: string | undefined;
|
|
738
|
+
charged_amount?: number | undefined;
|
|
739
|
+
app_fee?: number | undefined;
|
|
740
|
+
merchant_fee?: number | undefined;
|
|
733
741
|
processor_response?: string | undefined;
|
|
734
742
|
auth_model?: string | undefined;
|
|
743
|
+
account_id?: number | undefined;
|
|
744
|
+
payment_type?: string | undefined;
|
|
745
|
+
paid_at?: string | undefined;
|
|
735
746
|
amount_settled?: number | undefined;
|
|
736
747
|
}>;
|
|
737
748
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -740,21 +751,15 @@ export declare const flutterwaveWebhookSchema: z.ZodObject<{
|
|
|
740
751
|
id: number;
|
|
741
752
|
currency: string;
|
|
742
753
|
amount: number;
|
|
743
|
-
tx_ref: string;
|
|
744
|
-
flw_ref: string;
|
|
745
|
-
charged_amount: number;
|
|
746
|
-
app_fee: number;
|
|
747
|
-
merchant_fee: number;
|
|
748
|
-
account_id: number;
|
|
749
754
|
customer: {
|
|
750
755
|
id: number;
|
|
751
756
|
email: string;
|
|
752
757
|
name: string;
|
|
753
|
-
|
|
758
|
+
phone?: string | undefined;
|
|
754
759
|
phone_number?: string | undefined;
|
|
760
|
+
created_at?: string | undefined;
|
|
755
761
|
};
|
|
756
762
|
created_at: string;
|
|
757
|
-
payment_type: string;
|
|
758
763
|
card?: {
|
|
759
764
|
type?: string | undefined;
|
|
760
765
|
token?: string | undefined;
|
|
@@ -764,9 +769,18 @@ export declare const flutterwaveWebhookSchema: z.ZodObject<{
|
|
|
764
769
|
country?: string | undefined;
|
|
765
770
|
expiry?: string | undefined;
|
|
766
771
|
} | undefined;
|
|
772
|
+
tx_ref?: string | undefined;
|
|
773
|
+
reference?: string | undefined;
|
|
774
|
+
flw_ref?: string | undefined;
|
|
767
775
|
device_fingerprint?: string | undefined;
|
|
776
|
+
charged_amount?: number | undefined;
|
|
777
|
+
app_fee?: number | undefined;
|
|
778
|
+
merchant_fee?: number | undefined;
|
|
768
779
|
processor_response?: string | undefined;
|
|
769
780
|
auth_model?: string | undefined;
|
|
781
|
+
account_id?: number | undefined;
|
|
782
|
+
payment_type?: string | undefined;
|
|
783
|
+
paid_at?: string | undefined;
|
|
770
784
|
amount_settled?: number | undefined;
|
|
771
785
|
};
|
|
772
786
|
event: string;
|
|
@@ -776,21 +790,15 @@ export declare const flutterwaveWebhookSchema: z.ZodObject<{
|
|
|
776
790
|
id: number;
|
|
777
791
|
currency: string;
|
|
778
792
|
amount: number;
|
|
779
|
-
tx_ref: string;
|
|
780
|
-
flw_ref: string;
|
|
781
|
-
charged_amount: number;
|
|
782
|
-
app_fee: number;
|
|
783
|
-
merchant_fee: number;
|
|
784
|
-
account_id: number;
|
|
785
793
|
customer: {
|
|
786
794
|
id: number;
|
|
787
795
|
email: string;
|
|
788
796
|
name: string;
|
|
789
|
-
|
|
797
|
+
phone?: string | undefined;
|
|
790
798
|
phone_number?: string | undefined;
|
|
799
|
+
created_at?: string | undefined;
|
|
791
800
|
};
|
|
792
801
|
created_at: string;
|
|
793
|
-
payment_type: string;
|
|
794
802
|
card?: {
|
|
795
803
|
type?: string | undefined;
|
|
796
804
|
token?: string | undefined;
|
|
@@ -800,9 +808,18 @@ export declare const flutterwaveWebhookSchema: z.ZodObject<{
|
|
|
800
808
|
country?: string | undefined;
|
|
801
809
|
expiry?: string | undefined;
|
|
802
810
|
} | undefined;
|
|
811
|
+
tx_ref?: string | undefined;
|
|
812
|
+
reference?: string | undefined;
|
|
813
|
+
flw_ref?: string | undefined;
|
|
803
814
|
device_fingerprint?: string | undefined;
|
|
815
|
+
charged_amount?: number | undefined;
|
|
816
|
+
app_fee?: number | undefined;
|
|
817
|
+
merchant_fee?: number | undefined;
|
|
804
818
|
processor_response?: string | undefined;
|
|
805
819
|
auth_model?: string | undefined;
|
|
820
|
+
account_id?: number | undefined;
|
|
821
|
+
payment_type?: string | undefined;
|
|
822
|
+
paid_at?: string | undefined;
|
|
806
823
|
amount_settled?: number | undefined;
|
|
807
824
|
};
|
|
808
825
|
event: string;
|
|
@@ -816,7 +833,7 @@ export type CreatePaymentInput = z.infer<typeof createPaymentAttributesSchema>;
|
|
|
816
833
|
export type UpdatePaymentInput = z.infer<typeof updatePaymentAttributesSchema>;
|
|
817
834
|
export type PaymentResponse = z.infer<typeof paymentResponseSchema>;
|
|
818
835
|
export type PaymentListResponse = z.infer<typeof paymentListResponseSchema>;
|
|
819
|
-
export type
|
|
820
|
-
export type
|
|
821
|
-
export type
|
|
836
|
+
export type InitPaymentRequest = z.infer<typeof initPaymentSchema>;
|
|
837
|
+
export type InitPaymentResponse = z.infer<typeof initPaymentResponseSchema>;
|
|
838
|
+
export type WebhookPayload = z.infer<typeof webhookPayloadSchema>;
|
|
822
839
|
//# sourceMappingURL=payments.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/payments.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;GAEG;AAGH,eAAO,MAAM,mBAAmB,0EAAwE,CAAC;AAGzG,eAAO,MAAM,qBAAqB,2BAAyB,CAAC;AAG5D,eAAO,MAAM,mBAAmB,yEAAuE,CAAC;AAGxG,eAAO,MAAM,oBAAoB,qEAAmE,CAAC;AAGrG,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAuC/B,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAC/E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACnE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -30,7 +30,7 @@ export const createPaymentAttributesSchema = z.object({
|
|
|
30
30
|
amount: z.number().positive(),
|
|
31
31
|
currency: paymentCurrencySchema.default('NGN'),
|
|
32
32
|
paymentMethod: paymentMethodSchema.optional(),
|
|
33
|
-
gateway: paymentGatewaySchema.default('
|
|
33
|
+
gateway: paymentGatewaySchema.default('paystack'), // Default to paystack
|
|
34
34
|
description: z.string().max(500).optional(),
|
|
35
35
|
metadata: z.record(z.unknown()).optional(),
|
|
36
36
|
});
|
|
@@ -45,8 +45,8 @@ export const paymentResourceSchema = createJsonApiResourceSchema('payments', pay
|
|
|
45
45
|
// Payment response schemas
|
|
46
46
|
export const paymentResponseSchema = jsonApiSingleResponseSchema(paymentResourceSchema);
|
|
47
47
|
export const paymentListResponseSchema = jsonApiCollectionResponseSchema(paymentResourceSchema);
|
|
48
|
-
//
|
|
49
|
-
export const
|
|
48
|
+
// Payment initialization request (gateway-agnostic)
|
|
49
|
+
export const initPaymentSchema = z.object({
|
|
50
50
|
amount: z.number().positive(),
|
|
51
51
|
currency: paymentCurrencySchema,
|
|
52
52
|
email: z.string().email(),
|
|
@@ -56,8 +56,8 @@ export const flutterwaveInitPaymentSchema = z.object({
|
|
|
56
56
|
description: z.string().max(500).optional(),
|
|
57
57
|
metadata: z.record(z.unknown()).optional(),
|
|
58
58
|
});
|
|
59
|
-
//
|
|
60
|
-
export const
|
|
59
|
+
// Payment initialization response (gateway-agnostic)
|
|
60
|
+
export const initPaymentResponseSchema = z.object({
|
|
61
61
|
status: z.literal('success'),
|
|
62
62
|
message: z.string(),
|
|
63
63
|
data: z.object({
|
|
@@ -65,19 +65,20 @@ export const flutterwaveInitPaymentResponseSchema = z.object({
|
|
|
65
65
|
tx_ref: z.string(), // Transaction reference
|
|
66
66
|
}),
|
|
67
67
|
});
|
|
68
|
-
//
|
|
69
|
-
export const
|
|
68
|
+
// Webhook payload schema (gateway-agnostic)
|
|
69
|
+
export const webhookPayloadSchema = z.object({
|
|
70
70
|
event: z.string(),
|
|
71
71
|
data: z.object({
|
|
72
72
|
id: z.number(),
|
|
73
|
-
tx_ref: z.string(),
|
|
74
|
-
|
|
73
|
+
tx_ref: z.string().optional(),
|
|
74
|
+
reference: z.string().optional(),
|
|
75
|
+
flw_ref: z.string().optional(),
|
|
75
76
|
device_fingerprint: z.string().optional(),
|
|
76
77
|
amount: z.number(),
|
|
77
78
|
currency: z.string(),
|
|
78
|
-
charged_amount: z.number(),
|
|
79
|
-
app_fee: z.number(),
|
|
80
|
-
merchant_fee: z.number(),
|
|
79
|
+
charged_amount: z.number().optional(),
|
|
80
|
+
app_fee: z.number().optional(),
|
|
81
|
+
merchant_fee: z.number().optional(),
|
|
81
82
|
processor_response: z.string().optional(),
|
|
82
83
|
auth_model: z.string().optional(),
|
|
83
84
|
card: z.object({
|
|
@@ -89,17 +90,19 @@ export const flutterwaveWebhookSchema = z.object({
|
|
|
89
90
|
token: z.string().optional(),
|
|
90
91
|
expiry: z.string().optional(),
|
|
91
92
|
}).optional(),
|
|
92
|
-
account_id: z.number(),
|
|
93
|
+
account_id: z.number().optional(),
|
|
93
94
|
customer: z.object({
|
|
94
95
|
id: z.number(),
|
|
95
96
|
name: z.string(),
|
|
96
97
|
phone_number: z.string().optional(),
|
|
98
|
+
phone: z.string().optional(),
|
|
97
99
|
email: z.string(),
|
|
98
|
-
created_at: z.string(),
|
|
100
|
+
created_at: z.string().optional(),
|
|
99
101
|
}),
|
|
100
102
|
status: z.string(),
|
|
101
|
-
payment_type: z.string(),
|
|
103
|
+
payment_type: z.string().optional(),
|
|
102
104
|
created_at: z.string(),
|
|
105
|
+
paid_at: z.string().optional(),
|
|
103
106
|
amount_settled: z.number().optional(),
|
|
104
107
|
}),
|
|
105
108
|
});
|