diff --git a/public/videos/background-video-1.mp4 b/public/videos/background-video-1.mp4 new file mode 100644 index 0000000..6a735ef Binary files /dev/null and b/public/videos/background-video-1.mp4 differ diff --git a/src/api/api.ts b/src/api/api.ts index 929a879..547ea56 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -67,6 +67,7 @@ const api = { runThread: createMethod(OpenAI.createRequest), getStatusRunThread: createMethod(OpenAI.createRequest), getListRuns: createMethod(OpenAI.createRequest), + // Single payment getSinglePaymentProducts: createMethod(SinglePayment.createRequestGet), createSinglePayment: createMethod(SinglePayment.createRequestPost), } diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index 7cc558b..7103ae9 100755 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -109,6 +109,7 @@ import AdvisorChatPage from "../pages/AdvisorChat"; import PaymentWithEmailPage from "../pages/PaymentWithEmailPage"; import SuccessPaymentPage from "../pages/PaymentWithEmailPage/ResultPayment/SuccessPaymentPage"; import FailPaymentPage from "../pages/PaymentWithEmailPage/ResultPayment/FailPaymentPage"; +import GetInformationPartnerPage from "../pages/GetInformationPartner"; const isProduction = import.meta.env.MODE === "production"; @@ -233,9 +234,18 @@ function App(): JSX.Element { {/* Email - Pay - Email */} } /> } /> - } /> - } /> - } /> + } + /> + } + /> + } + /> {/* Email - Pay - Email */} {/* Test Routes Start */} @@ -351,19 +361,29 @@ function App(): JSX.Element { {/* Email Letters End */} {/* Additional Purchases */} - }> - } /> - } - /> - } - /> + }> + }> + } + /> + } + /> + } + /> + {/* Additional Purchases End */} + } + /> + } diff --git a/src/components/PaymentPage/results/SuccessPage/index.tsx b/src/components/PaymentPage/results/SuccessPage/index.tsx index 5c4a5c4..59966ed 100644 --- a/src/components/PaymentPage/results/SuccessPage/index.tsx +++ b/src/components/PaymentPage/results/SuccessPage/index.tsx @@ -27,7 +27,11 @@ function PaymentSuccessPage(): JSX.Element { {t("auweb.pay_good.title")}

{t("auweb.pay_good.text1")}

- + {t("auweb.pay_good.button")} diff --git a/src/components/pages/AdditionalPurchases/components/FooterButton/index.tsx b/src/components/pages/AdditionalPurchases/components/FooterButton/index.tsx index de0eae2..32a498f 100644 --- a/src/components/pages/AdditionalPurchases/components/FooterButton/index.tsx +++ b/src/components/pages/AdditionalPurchases/components/FooterButton/index.tsx @@ -6,6 +6,7 @@ interface IFooterButtonProps { classNameButton?: string; classNameSkip?: string; children?: React.ReactNode; + disabled?: boolean; onClick: () => void; onClickSkip: () => void; } @@ -17,11 +18,13 @@ function FooterButton({ classNameContainer = "", classNameButton = "", classNameSkip = "", + disabled = false, }: IFooterButtonProps) { return (
{children} diff --git a/src/components/pages/AdditionalPurchases/components/SignUpOffer/index.tsx b/src/components/pages/AdditionalPurchases/components/SignUpOffer/index.tsx index 9c015b5..948a34c 100644 --- a/src/components/pages/AdditionalPurchases/components/SignUpOffer/index.tsx +++ b/src/components/pages/AdditionalPurchases/components/SignUpOffer/index.tsx @@ -1,6 +1,7 @@ import { ISignUpOffer } from "@/data/additionalPurchases"; import styles from "./styles.module.css"; import CheckMark from "./check-mark-1.svg"; +import { getPriceCentsToDollars } from "@/services/price"; interface ISignUpOfferProps extends ISignUpOffer { isActive: boolean; @@ -31,9 +32,14 @@ function SignUpOffer(props: ISignUpOfferProps) { )}
- ${current} ({" "} - {id === "ultra-pack" ? "regular price" : "was"}{" "} - ${old} ) + + ${getPriceCentsToDollars(current || 0)} + {" "} + ( {id === "ultra-pack" ? "regular price" : "was"}{" "} + + ${getPriceCentsToDollars(old || 0)} + {" "} + ) {id !== "ultra-pack" && (
diff --git a/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx b/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx index 7e98855..9887303 100644 --- a/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx +++ b/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx @@ -5,14 +5,93 @@ import PaymentAddress from "../../components/PaymentAddress"; import FooterButton from "../../components/FooterButton"; import { useNavigate } from "react-router-dom"; import routes from "@/routes"; +import { useAuth } from "@/auth"; +import { SinglePayment, useApi, useApiCall } from "@/api"; +import { useSelector } from "react-redux"; +import { selectors } from "@/store"; +import { useCallback, useState } from "react"; +import { + ResponsePost, + ResponsePostExistPaymentData, +} from "@/api/resources/SinglePayment"; +import { createSinglePayment } from "@/services/singlePayment"; +import Modal from "@/components/Modal"; +import PaymentForm from "@/components/pages/PaymentWithEmailPage/PaymentForm"; +import { getPriceCentsToDollars } from "@/services/price"; +import Loader, { LoaderColor } from "@/components/Loader"; function AddConsultationPage() { const navigate = useNavigate(); - const handleNext = () => { - navigate(routes.client.home()); + const { user: userFromStore } = useAuth(); + const api = useApi(); + const tokenFromStore = useSelector(selectors.selectToken); + const [isLoading, setIsLoading] = useState(false); + const [paymentIntent, setPaymentIntent] = useState< + ResponsePost | ResponsePostExistPaymentData | null + >(null); + const [isError, setIsError] = useState(false); + const returnUrl = `${window.location.protocol}//${ + window.location.host + }${routes.client.getInformationPartner()}`; + + const loadData = useCallback(async () => { + return await api.getSinglePaymentProducts({ token: tokenFromStore }); + }, [api, tokenFromStore]); + + const { data: products, isPending: isPendingProducts } = + useApiCall(loadData); + + const currentProduct = products?.find( + (product) => product.key === "main.unique.individual.consultation" + ); + + const handleClick = async () => { + if (!userFromStore || !currentProduct) return; + setIsLoading(true); + const paymentIntent = await createSinglePayment( + userFromStore, + currentProduct.productId, + tokenFromStore, + userFromStore.email, + userFromStore.profile.full_name, + userFromStore.profile.birthday, + returnUrl, + api + ); + setPaymentIntent(paymentIntent); + setIsLoading(false); + if ("payment" in paymentIntent) { + if (paymentIntent.payment.status === "paid") + return navigate(routes.client.getInformationPartner()); + return setIsError(true); + } + }; + + const handleClickSkip = () => { + navigate(routes.client.getInformationPartner()); }; return (
+ {!isLoading && + paymentIntent && + "paymentIntent" in paymentIntent && + !!tokenFromStore.length && ( + <> + setPaymentIntent(null)} + > + + {getPriceCentsToDollars(currentProduct?.amount || 0)}$ + + + + + )} More for you @@ -27,11 +106,22 @@ function AddConsultationPage() { This is a non-recuring payment.

+ {isError && ( +

+ Something went wrong. Please try again later. +

+ )} + onClick={handleClick} + onClickSkip={handleClickSkip} + disabled={isPendingProducts || isLoading} + > + {isPendingProducts || isLoading ? ( + + ) : ( + "Get my consultation" + )} +
); } diff --git a/src/components/pages/AdditionalPurchases/pages/AddConsultation/styles.module.css b/src/components/pages/AdditionalPurchases/pages/AddConsultation/styles.module.css index 345f5a5..3e6dc95 100644 --- a/src/components/pages/AdditionalPurchases/pages/AddConsultation/styles.module.css +++ b/src/components/pages/AdditionalPurchases/pages/AddConsultation/styles.module.css @@ -36,3 +36,12 @@ line-height: 140%; color: rgb(79, 79, 79); } + +.error { + max-width: 526px; + margin-left: auto; + margin-right: auto; + text-align: center; + font-size: 14px; + color: red; +} diff --git a/src/components/pages/AdditionalPurchases/pages/AddReport/index.tsx b/src/components/pages/AdditionalPurchases/pages/AddReport/index.tsx index 51b7fd5..a12d5f6 100644 --- a/src/components/pages/AdditionalPurchases/pages/AddReport/index.tsx +++ b/src/components/pages/AdditionalPurchases/pages/AddReport/index.tsx @@ -3,22 +3,102 @@ import ThankYouBanner from "../../components/ThankYouBanner"; import styles from "./styles.module.css"; import { signUpOffers } from "@/data/additionalPurchases"; import SignUpOffer from "../../components/SignUpOffer"; -import { useState } from "react"; +import { useCallback, useState } from "react"; import { useNavigate } from "react-router-dom"; import FooterButton from "../../components/FooterButton"; import routes from "@/routes"; import PaymentAddress from "../../components/PaymentAddress"; +import { createSinglePayment } from "@/services/singlePayment"; +import { + ResponsePost, + ResponsePostExistPaymentData, +} from "@/api/resources/SinglePayment"; +import { useAuth } from "@/auth"; +import { useSelector } from "react-redux"; +import { selectors } from "@/store"; +import { SinglePayment, useApi, useApiCall } from "@/api"; +import Loader, { LoaderColor } from "@/components/Loader"; +import { getPriceCentsToDollars } from "@/services/price"; +import Modal from "@/components/Modal"; +import PaymentForm from "@/components/pages/PaymentWithEmailPage/PaymentForm"; function AddReportPage() { const navigate = useNavigate(); - const [activeOffer, setActiveOffer] = useState(signUpOffers[0].id); + const { user: userFromStore } = useAuth(); + const api = useApi(); + const tokenFromStore = useSelector(selectors.selectToken); + const [paymentIntent, setPaymentIntent] = useState< + ResponsePost | ResponsePostExistPaymentData | null + >(null); + const [isLoading, setIsLoading] = useState(false); + const [isError, setIsError] = useState(false); + const [activeOffer, setActiveOffer] = useState(signUpOffers[0]); + const returnUrl = `${window.location.protocol}//${ + window.location.host + }${routes.client.unlimitedReadings()}`; - const handleClick = () => { + const loadData = useCallback(async () => { + return await api.getSinglePaymentProducts({ token: tokenFromStore }); + }, [api, tokenFromStore]); + + const { data: products, isPending: isPendingProducts } = + useApiCall(loadData); + + const getCurrentProduct = (id: string) => { + return products?.find((product) => product.key === id) || null; + }; + + const handleClick = async () => { + if (!userFromStore || !activeOffer) return; + const currentProduct = getCurrentProduct(activeOffer?.productKey); + if (!currentProduct) return; + setIsLoading(true); + const paymentIntent = await createSinglePayment( + userFromStore, + currentProduct.productId, + tokenFromStore, + userFromStore.email, + userFromStore.profile.full_name, + userFromStore.profile.birthday, + returnUrl, + api + ); + setPaymentIntent(paymentIntent); + setIsLoading(false); + if ("payment" in paymentIntent) { + if (paymentIntent.payment.status === "paid") + return navigate(routes.client.unlimitedReadings()); + return setIsError(true); + } + }; + + const handleClickSkip = () => { navigate(routes.client.unlimitedReadings()); }; return (
+ {!isLoading && + paymentIntent && + "paymentIntent" in paymentIntent && + !!tokenFromStore.length && ( + <> + setPaymentIntent(null)} + > + + {getPriceCentsToDollars(activeOffer.price.current || 0)}$ + + + + + )} + Choose your sign-up offer 🔥 @@ -27,26 +107,33 @@ function AddReportPage() { Available only now
- {signUpOffers.map((offer, index) => ( - setActiveOffer(offer.id)} - /> - ))} + {!isPendingProducts && + signUpOffers.map((offer, index) => ( + setActiveOffer(offer)} + {...offer} + /> + ))} + {isPendingProducts && }

*You will be charged for the add-on services or offers selected at the time of purchase. This is a non-recuring payment.

+ {isError && ( +

+ Something went wrong. Please try again later. +

+ )} - - Get my copy + + {isLoading ? : "Get my copy"}
); diff --git a/src/components/pages/AdditionalPurchases/pages/AddReport/styles.module.css b/src/components/pages/AdditionalPurchases/pages/AddReport/styles.module.css index 4aa5861..74189f1 100644 --- a/src/components/pages/AdditionalPurchases/pages/AddReport/styles.module.css +++ b/src/components/pages/AdditionalPurchases/pages/AddReport/styles.module.css @@ -34,6 +34,10 @@ margin-bottom: 0; } +.modal-title { + margin-bottom: 16px; +} + .subtitle { font-size: 18px; text-align: center; @@ -56,3 +60,7 @@ margin-bottom: 20px; color: rgb(79, 79, 79); } + +.error { + color: red; +} diff --git a/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/index.tsx b/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/index.tsx index 50e8db8..0f1c22a 100644 --- a/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/index.tsx +++ b/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/index.tsx @@ -9,26 +9,105 @@ import SliderNextArrow from "../../components/SliderNextArrow"; import SliderPrevArrow from "../../components/SliderPrevArrow"; import routes from "@/routes"; import PaymentAddress from "../../components/PaymentAddress"; +import { useAuth } from "@/auth"; +import { SinglePayment, useApi, useApiCall } from "@/api"; +import { useSelector } from "react-redux"; +import { selectors } from "@/store"; +import { useCallback, useState } from "react"; +import { createSinglePayment } from "@/services/singlePayment"; +import Loader, { LoaderColor } from "@/components/Loader"; +import { + ResponsePost, + ResponsePostExistPaymentData, +} from "@/api/resources/SinglePayment"; +import Modal from "@/components/Modal"; +import { getPriceCentsToDollars } from "@/services/price"; +import PaymentForm from "@/components/pages/PaymentWithEmailPage/PaymentForm"; + +const sliderSettings = { + dots: false, + infinite: false, + speed: 500, + slidesToShow: 1, + slidesToScroll: 1, + className: styles["slider-container"], + nextArrow: , + prevArrow: , +}; function UnlimitedReadingsPage() { const navigate = useNavigate(); - const handleClick = () => { - navigate(routes.client.addConsultation()); + const { user: userFromStore } = useAuth(); + const api = useApi(); + const tokenFromStore = useSelector(selectors.selectToken); + const [isLoading, setIsLoading] = useState(false); + const [paymentIntent, setPaymentIntent] = useState< + ResponsePost | ResponsePostExistPaymentData | null + >(null); + const [isError, setIsError] = useState(false); + const returnUrl = `${window.location.protocol}//${ + window.location.host + }${routes.client.addConsultation()}`; + + const loadData = useCallback(async () => { + return await api.getSinglePaymentProducts({ token: tokenFromStore }); + }, [api, tokenFromStore]); + + const { data: products, isPending: isPendingProducts } = + useApiCall(loadData); + + const currentProduct = products?.find( + (product) => product.key === "main.unlimited.readings" + ); + + const handleClick = async () => { + if (!userFromStore || !currentProduct) return; + setIsLoading(true); + const paymentIntent = await createSinglePayment( + userFromStore, + currentProduct.productId, + tokenFromStore, + userFromStore.email, + userFromStore.profile.full_name, + userFromStore.profile.birthday, + returnUrl, + api + ); + setPaymentIntent(paymentIntent); + setIsLoading(false); + if ("payment" in paymentIntent) { + if (paymentIntent.payment.status === "paid") + return navigate(routes.client.addConsultation()); + return setIsError(true); + } }; - const sliderSettings = { - dots: false, - infinite: false, - speed: 500, - slidesToShow: 1, - slidesToScroll: 1, - className: styles["slider-container"], - nextArrow: , - prevArrow: , + const handleClickSkip = () => { + navigate(routes.client.addConsultation()); }; return (
+ {!isLoading && + paymentIntent && + "paymentIntent" in paymentIntent && + !!tokenFromStore.length && ( + <> + setPaymentIntent(null)} + > + + {getPriceCentsToDollars(currentProduct?.amount || 0)}$ + + + + + )}
@@ -54,14 +133,24 @@ function UnlimitedReadingsPage() { ))} + {isError && ( +

+ Something went wrong. Please try again later. +

+ )} - Add unlimited readings + {isPendingProducts || isLoading ? ( + + ) : ( + "Add unlimited readings" + )}

Please note: In addition to your subscription, your account will be diff --git a/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/styles.module.css b/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/styles.module.css index 271d6e7..af671a5 100644 --- a/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/styles.module.css +++ b/src/components/pages/AdditionalPurchases/pages/UnlimitedReadings/styles.module.css @@ -82,3 +82,12 @@ height: 189px; object-fit: contain; } + +.error { + max-width: 526px; + margin-left: auto; + margin-right: auto; + text-align: center; + font-size: 14px; + color: red; +} diff --git a/src/components/pages/GetInformationPartner/index.tsx b/src/components/pages/GetInformationPartner/index.tsx new file mode 100644 index 0000000..53e8454 --- /dev/null +++ b/src/components/pages/GetInformationPartner/index.tsx @@ -0,0 +1,56 @@ +import Title from "@/components/Title"; +import styles from "./styles.module.css"; +import MainButton from "@/components/MainButton"; +import { useNavigate } from "react-router-dom"; +import routes from "@/routes"; + +function GetInformationPartnerPage() { + const navigate = useNavigate(); + + const handleBack = () => { + navigate(routes.client.addConsultation()); + }; + + const handleNext = () => { + navigate(routes.client.home()); + }; + + return ( +

+ + + AURA + +
+ + Wonderful! Let's find out what's working (and what isn't) and go from + there. + +

+ Now we need some information about Your Partner's Profile to create + the astrological synastry blueprint between you and your partner. +

+
+ + Back + + + Next + +
+
+
+ ); +} + +export default GetInformationPartnerPage; diff --git a/src/components/pages/GetInformationPartner/styles.module.css b/src/components/pages/GetInformationPartner/styles.module.css new file mode 100644 index 0000000..c934d6d --- /dev/null +++ b/src/components/pages/GetInformationPartner/styles.module.css @@ -0,0 +1,64 @@ +.page { + background-color: #171717; + height: fit-content; + min-height: 100dvh; + color: #fff; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; +} + +.title { + margin-top: 58px; + z-index: 1; +} + +.buttons-container { + display: flex; + flex-direction: row; + align-items: center; + gap: 8px; + margin-top: 32px; +} + +.button { + min-width: 0; + min-height: 0; + width: 160px; + border-radius: 8px; +} + +.back-button { + background-color: transparent; + border: 2px solid #fff; +} + +.next-button { + background-color: #fff; + color: #000; +} + +.bottom-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + margin-bottom: 170px; + z-index: 1; +} + +.description { + line-height: 140%; +} + +.background-video { + position: fixed; + height: 100%; + width: 100%; + float: left; + top: 0; + padding: 0; + object-fit: cover; +} diff --git a/src/components/pages/PaymentWithEmailPage/index.tsx b/src/components/pages/PaymentWithEmailPage/index.tsx index 2266769..897db43 100644 --- a/src/components/pages/PaymentWithEmailPage/index.tsx +++ b/src/components/pages/PaymentWithEmailPage/index.tsx @@ -12,7 +12,6 @@ import { getClientTimezone } from "@/locales"; import ErrorText from "@/components/ErrorText"; import Title from "@/components/Title"; import NameInput from "@/components/EmailEnterPage/NameInput"; -import { getZodiacSignByDate } from "@/services/zodiac-sign"; import { ResponseGet, ResponsePost, @@ -22,7 +21,7 @@ import { useNavigate } from "react-router-dom"; import routes from "@/routes"; import PaymentForm from "./PaymentForm"; import { getPriceCentsToDollars } from "@/services/price"; -import { User } from "@/api/resources/User"; +import { createSinglePayment } from "@/services/singlePayment"; function PaymentWithEmailPage() { const { t, i18n } = useTranslation(); @@ -125,36 +124,6 @@ function PaymentWithEmailPage() { return currentProduct; }; - const createSinglePayment = async ( - user: User, - productId: string, - token: string, - email: string, - name: string | null - ) => { - return await api.createSinglePayment({ - token, - data: { - user: { - id: `${user?.id}`, - email, - name: name || "", - sign: user?.profile?.sign?.sign || getZodiacSignByDate(birthday), - age: user?.profile?.age?.years || 1, - gender: gender, - }, - partner: { - sign: "partner_cancer", - age: 26, - }, - paymentInfo: { - productId, - }, - return_url: returnUrl, - }, - }); - }; - const handleClick = async () => { const authData = await authorization(); if (!authData) { @@ -175,7 +144,11 @@ function PaymentWithEmailPage() { productId, token, email, - name + name, + birthday, + returnUrl, + api, + gender ); setPaymentIntent(paymentIntent); setIsLoading(false); @@ -204,7 +177,11 @@ function PaymentWithEmailPage() { productId, tokenFromStore, userFromStore.email, - userFromStore.profile.full_name + userFromStore.profile.full_name, + userFromStore.profile.birthday, + returnUrl, + api, + gender ); setPaymentIntent(paymentIntent); setIsLoadingPage(false); diff --git a/src/data/additionalPurchases.ts b/src/data/additionalPurchases.ts index c21cc51..730b6c1 100644 --- a/src/data/additionalPurchases.ts +++ b/src/data/additionalPurchases.ts @@ -37,6 +37,7 @@ export interface ISignUpOffer { id: string; title: string; subtitle?: string; + productKey: string; price: ISignUpOfferPrice; emoji: string; } @@ -47,40 +48,44 @@ export const signUpOffers: ISignUpOffer[] = [ title: "ULTRA PACK", subtitle: "(3 in 1 + 2 secret bonus reading)", price: { - current: 49.99, - old: 99.99, + current: 4999, + old: 9999, discount: 50, }, + productKey: "main.ultra.pack", emoji: "star_struck.png", }, { id: "numerology-analyses", title: "NUMEROLOGY ANALYSIS", price: { - current: 14.99, - old: 29.99, + current: 1499, + old: 2999, discount: 50, }, + productKey: "main.numerology.analysis", emoji: "input_numbers.png", }, { id: "tarot-reading", title: "TAROT READING", price: { - current: 19.99, - old: 34.99, + current: 1999, + old: 3499, discount: 45, }, + productKey: "main.tarot.reading", emoji: "sunset.png", }, { id: "palmistry-guide", title: "PALMISTRY GUIDE", price: { - current: 19.99, - old: 29.99, + current: 1999, + old: 2999, discount: 30, }, + productKey: "main.palmistry.guide", emoji: "rised_hand.png", }, ]; diff --git a/src/routes.ts b/src/routes.ts index efb882f..d94e926 100755 --- a/src/routes.ts +++ b/src/routes.ts @@ -4,7 +4,10 @@ const isProduction = import.meta.env.MODE === "production"; const host = ""; export const apiHost = "https://api-web.aura.wit.life"; -const dApiHost = isProduction ? "https://d.api.witapps.us" : "https://dev.api.witapps.us" +const dApiHost = isProduction + ? "https://d.api.witapps.us" + : "https://dev.api.witapps.us"; +// const dApiHost = "https://d.api.witapps.us"; const siteHost = "https://aura.wit.life"; const prefix = "api/v1"; const openAIHost = " https://api.openai.com"; @@ -38,7 +41,8 @@ const routes = { palmistryPaywall: () => [host, "palmistry", "paywall"].join("/"), palmistryPayment: () => [host, "palmistry", "payment"].join("/"), palmistryDiscount: () => [host, "palmistry", "discount"].join("/"), - palmistryPremiumBundle: () => [host, "palmistry", "premium-bundle"].join("/"), + palmistryPremiumBundle: () => + [host, "palmistry", "premium-bundle"].join("/"), birthday: () => [host, "birthday"].join("/"), didYouKnow: () => [host, "did-you-know"].join("/"), freePeriodInfo: () => [host, "free-period"].join("/"), @@ -128,6 +132,8 @@ const routes = { epeSuccessPayment: () => [host, "epe", "success-payment"].join("/"), epeFailPayment: () => [host, "epe", "fail-payment"].join("/"), + getInformationPartner: () => [host, "get-information-partner"].join("/"), + notFound: () => [host, "404"].join("/"), }, server: { @@ -311,6 +317,7 @@ export const withoutFooterRoutes = [ routes.client.addConsultation(), routes.client.advisors(), routes.client.epeSuccessPayment(), + routes.client.getInformationPartner(), ]; export const withoutFooterPartOfRoutes = [ @@ -385,6 +392,7 @@ export const withoutHeaderRoutes = [ routes.client.tryApp(), routes.client.advisors(), routes.client.epeSuccessPayment(), + routes.client.getInformationPartner(), ]; export const hasNoHeader = (path: string) => { let result = true; diff --git a/src/services/singlePayment/index.ts b/src/services/singlePayment/index.ts new file mode 100644 index 0000000..74876b5 --- /dev/null +++ b/src/services/singlePayment/index.ts @@ -0,0 +1,37 @@ +import { User } from "@/api/resources/User"; +import { getZodiacSignByDate } from "../zodiac-sign"; +import { ApiContextValue } from "@/api"; + +export const createSinglePayment = async ( + user: User, + productId: string, + token: string, + email: string, + name: string | null, + birthday: string | null, + returnUrl: string, + api: ApiContextValue, + gender?: string +) => { + return await api.createSinglePayment({ + token, + data: { + user: { + id: `${user?.id}`, + email, + name: name || "", + sign: user?.profile?.sign?.sign || getZodiacSignByDate(birthday || ""), + age: user?.profile?.age?.years || 1, + gender: gender || "", + }, + partner: { + sign: "partner_cancer", + age: 26, + }, + paymentInfo: { + productId, + }, + return_url: returnUrl, + }, + }); +};