diff --git a/src/hooks/usePayments.jsx b/src/hooks/usePayments.jsx new file mode 100644 index 00000000..42ce6558 --- /dev/null +++ b/src/hooks/usePayments.jsx @@ -0,0 +1,37 @@ +import { useMutation, useQueryClient } from "@tanstack/react-query"; +import { PaymentRepository } from "../repositories/PaymentRepository"; + +export const useMakePayment = (onSuccessCallBack) => { + const client = useQueryClient(); + return useMutation({ + mutationFn: (payload) => PaymentRepository.makePayment(payload), + onSuccess: (_, varibales) => { + if (onSuccessCallBack) onSuccessCallBack(); + }, + onError: (error) => { + showToast( + error.message || + error.response.message || + "Something went wrong.Please try again later.", + "error" + ); + }, + }); +}; +export const useVerifyPayment = () => { + const client = useQueryClient(); + return useMutation({ + mutationFn: (payload) => PaymentRepository.verifyPayment(payload), + onSuccess: (_, varibales) => { + if (onSuccessCallBack) onSuccessCallBack(); + }, + onError: (error) => { + showToast( + error.message || + error.response.message || + "Something went wrong.Please try again later.", + "error" + ); + }, + }); +}; diff --git a/src/pages/Home/SubscriptionSummary.jsx b/src/pages/Home/SubscriptionSummary.jsx new file mode 100644 index 00000000..733ec81a --- /dev/null +++ b/src/pages/Home/SubscriptionSummary.jsx @@ -0,0 +1,117 @@ +import React from "react"; + +const SubscriptionSummary = () => { + const options = [ + { + id: 1, + title: "Design", + description: "Cake sugar plum fruitcake I love sweet roll jelly-o.", + svg: ( + + + + ), + }, + { + id: 2, + title: "Development", + description: "Cake sugar plum fruitcake I love sweet roll jelly-o.", + svg: ( + + + + ), + }, + { + id: 3, + title: "Native App", + description: "Cake sugar plum fruitcake I love sweet roll jelly-o.", + svg: ( + + + + ), + }, + ]; + + return ( +
+ {/* Section title aligned at start */} +
+

Summary

+
+ +
+
+
+ {options.map((opt) => ( +
+
+ +
+
+ ))} +
+
+ +
+ {/* Add your right-side content here */} +
+
+
+ + ); +}; + +export default SubscriptionSummary; diff --git a/src/repositories/PaymentRepository.jsx b/src/repositories/PaymentRepository.jsx new file mode 100644 index 00000000..f3e7b5c5 --- /dev/null +++ b/src/repositories/PaymentRepository.jsx @@ -0,0 +1,7 @@ +import { api } from "../utils/axiosClient"; + + +export const PaymentRepository = { + makePayment: () => api.post(`/api/Payment/create-order`), + verifyPayment: () => api.post(`/api/Payment/verify-payment`), +}; diff --git a/src/router/AppRoutes.jsx b/src/router/AppRoutes.jsx index ac736d7b..f97be55f 100644 --- a/src/router/AppRoutes.jsx +++ b/src/router/AppRoutes.jsx @@ -54,6 +54,7 @@ import ProjectPage from "../pages/project/ProjectPage"; import { ComingSoonPage } from "../pages/Misc/ComingSoonPage"; import ImageGalleryPage from "../pages/Gallary/ImageGallaryPage"; import CollectionPage from "../pages/collections/CollectionPage"; +import SubscriptionSummary from "../pages/Home/SubscriptionSummary"; const router = createBrowserRouter( [ { @@ -70,9 +71,11 @@ const router = createBrowserRouter( { path: "/reset-password", element: }, { path: "/legal-info", element: }, { path: "/auth/changepassword", element: }, + ], }, { path: "/auth/switch/org", element: }, + { path: "/request", element: }, { element: , errorElement: ,