Merge branch 'AW-82-singlePaymentProductsBugDev' into 'develop'

AW-82-singlePaymentProductsBugDev

See merge request witapp/aura-webapp!145
This commit is contained in:
Daniil Chemerkin 2024-05-27 20:43:52 +00:00
commit f06bb85bae
9 changed files with 27 additions and 19 deletions

View File

@ -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 {

View File

@ -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)}
>
<Title variant="h1" className={styles["modal-title"]}>
{getPriceCentsToDollars(currentProduct?.amount || 0)}$
{getPriceCentsToDollars(currentProduct?.price || 0)}$
</Title>
<PaymentForm
stripePublicKey={paymentIntent.paymentIntent.data.public_key}

View File

@ -52,9 +52,9 @@ function AddReportPage() {
const currentProduct = getCurrentProduct(activeOffer?.productKey);
if (!currentProduct) return;
setIsLoading(true);
const { productId, key } = currentProduct;
const { _id, key } = currentProduct;
const paymentInfo = {
productId,
productId: _id,
key,
};
const paymentIntent = await createSinglePayment(

View File

@ -62,9 +62,9 @@ function UnlimitedReadingsPage() {
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(
@ -102,7 +102,7 @@ function UnlimitedReadingsPage() {
onClose={() => setPaymentIntent(null)}
>
<Title variant="h1" className={styles["modal-title"]}>
{getPriceCentsToDollars(currentProduct?.amount || 0)}$
{getPriceCentsToDollars(currentProduct?.price || 0)}$
</Title>
<PaymentForm
stripePublicKey={paymentIntent.paymentIntent.data.public_key}

View File

@ -179,7 +179,7 @@ function PaymentWithEmailPage() {
!!tokenFromStore.length && (
<>
<Title variant="h1" className={styles.title}>
{getPriceCentsToDollars(product?.amount || 0)}$
{getPriceCentsToDollars(product?.price || 0)}$
</Title>
<PaymentForm
stripePublicKey={paymentIntent.paymentIntent.data.public_key}

View File

@ -59,7 +59,7 @@ function SinglePaymentPage({ productId, isForce = false }: ISinglePaymentPage) {
!!tokenFromStore.length && (
<>
<Title variant="h1" className={styles.title}>
{getPriceCentsToDollars(product?.amount || 0)}$
{getPriceCentsToDollars(product?.price || 0)}$
</Title>
<PaymentForm
stripePublicKey={paymentIntent.paymentIntent.data.public_key}

View File

@ -72,9 +72,9 @@ export default function DiscountScreen() {
const buy = async () => {
if (!user?.id || !product) return;
const { productId, key } = product;
const { _id, key } = product;
const paymentInfo = {
productId,
productId: _id,
key,
};

View File

@ -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,

View File

@ -130,7 +130,7 @@ export const useSinglePayment = () => {
age: null,
},
paymentInfo: {
productId: product?.productId || "",
productId: product?._id || "",
key: product?.key || "",
},
return_url: returnUrl,