diff --git a/src/api/resources/SinglePayment.ts b/src/api/resources/SinglePayment.ts index f99a6ff..a0cc4ea 100644 --- a/src/api/resources/SinglePayment.ts +++ b/src/api/resources/SinglePayment.ts @@ -32,10 +32,18 @@ export interface PayloadPost extends Payload { } export interface ResponseGet { - key: string; - productId: string; - amount: number; - currency: string; + _id: string, + key: string, + name: string, + type: string, + description: string, + discountPrice: null | unknown, + isDiscount: boolean, + isFreeTrial: boolean, + isTrial: boolean, + price: number, + trialDuration: number, + trialPrice: number } interface ResponsePostNewPaymentData { diff --git a/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx b/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx index b194f3e..68a3fe4 100644 --- a/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx +++ b/src/components/pages/AdditionalPurchases/pages/AddConsultation/index.tsx @@ -47,9 +47,9 @@ function AddConsultationPage() { const handleClick = async () => { if (!userFromStore || !currentProduct) return; setIsLoading(true); - const { productId, key } = currentProduct; + const { _id, key } = currentProduct; const paymentInfo = { - productId, + productId: _id, key, }; const paymentIntent = await createSinglePayment( @@ -86,7 +86,7 @@ function AddConsultationPage() { onClose={() => setPaymentIntent(null)} > - {getPriceCentsToDollars(currentProduct?.amount || 0)}$ + {getPriceCentsToDollars(currentProduct?.price || 0)}$ { if (!userFromStore || !currentProduct) return; setIsLoading(true); - const { productId, key } = currentProduct; + const { _id, key } = currentProduct; const paymentInfo = { - productId, + productId: _id, key, }; const paymentIntent = await createSinglePayment( @@ -102,7 +102,7 @@ function UnlimitedReadingsPage() { onClose={() => setPaymentIntent(null)} > - {getPriceCentsToDollars(currentProduct?.amount || 0)}$ + {getPriceCentsToDollars(currentProduct?.price || 0)}$ - {getPriceCentsToDollars(product?.amount || 0)}$ + {getPriceCentsToDollars(product?.price || 0)}$ - {getPriceCentsToDollars(product?.amount || 0)}$ + {getPriceCentsToDollars(product?.price || 0)}$ { if (!user?.id || !product) return; - const { productId, key } = product; + const { _id, key } = product; const paymentInfo = { - productId, + productId: _id, key, }; diff --git a/src/components/palmistry/premium-bundle-screen/premium-bundle-screen.tsx b/src/components/palmistry/premium-bundle-screen/premium-bundle-screen.tsx index 0d34d81..49589c3 100644 --- a/src/components/palmistry/premium-bundle-screen/premium-bundle-screen.tsx +++ b/src/components/palmistry/premium-bundle-screen/premium-bundle-screen.tsx @@ -52,7 +52,7 @@ export default function PremiumBundleScreen() { const buy = async () => { if (!user?.id || !product) return; - const { productId, key } = product; + const { _id, key } = product; const response = await api.createSinglePayment({ token: token, @@ -69,7 +69,7 @@ export default function PremiumBundleScreen() { age: 0, }, paymentInfo: { - productId, + productId: _id, key, }, return_url: returnUrl, diff --git a/src/hooks/payment/useSinglePayment.ts b/src/hooks/payment/useSinglePayment.ts index df40126..83a3807 100644 --- a/src/hooks/payment/useSinglePayment.ts +++ b/src/hooks/payment/useSinglePayment.ts @@ -130,7 +130,7 @@ export const useSinglePayment = () => { age: null, }, paymentInfo: { - productId: product?.productId || "", + productId: product?._id || "", key: product?.key || "", }, return_url: returnUrl,