diff --git a/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx b/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx new file mode 100644 index 00000000..fb4a509d --- /dev/null +++ b/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx @@ -0,0 +1,43 @@ +import { useEffect, useState } from 'react' + +import { Loader } from 'features/Loader' + +import { getBrazilPaymentUrl } from 'requests/getBrazilPaymentUrl' +import type { SubscriptionResponse } from 'requests/getSubscriptions' + +import { ScModal, LoaderWrapper } from './styled' + +type Props = { + item: SubscriptionResponse, + open: boolean, + product_name: string, +} + +export const BrazilPayment = ({ + item, + open, + product_name, +}: Props) => { + const [src, setSrc] = useState('') + + useEffect(() => { + if (open) { + (async () => { + const json: any = await getBrazilPaymentUrl({ item, product_name }) + setSrc(json[0]?.url) + })() + } + }, [item, open, product_name]) + + return ( + + {src && open ? ( +