|
|
|
|
@ -35,6 +35,7 @@ export const useBrazilPayment = ({ |
|
|
|
|
const { close } = useBuyMatchPopupStore() |
|
|
|
|
|
|
|
|
|
const [src, setSrc] = useState('') |
|
|
|
|
const [error, setError] = useState('') |
|
|
|
|
const { translate } = useLexicsStore() |
|
|
|
|
|
|
|
|
|
const { id, sportType } = match |
|
|
|
|
@ -58,6 +59,7 @@ export const useBrazilPayment = ({ |
|
|
|
|
const closePopup = async (e?: MouseEvent) => { |
|
|
|
|
e?.stopPropagation() |
|
|
|
|
setIsOpenBrasilian(false) |
|
|
|
|
setError('') |
|
|
|
|
|
|
|
|
|
const accessMatch = await getMatchInfo(sportType, id) |
|
|
|
|
if (accessMatch?.access) { |
|
|
|
|
@ -69,8 +71,12 @@ export const useBrazilPayment = ({ |
|
|
|
|
useEffect(() => { |
|
|
|
|
if (open) { |
|
|
|
|
(async () => { |
|
|
|
|
try { |
|
|
|
|
const json: ResponsePaymentArray = await getBrazilPaymentUrl({ item: originalObject, product_name: `${pack} ${teams}` }) |
|
|
|
|
setSrc(json?.url || '') |
|
|
|
|
} catch (err) { |
|
|
|
|
setError('error_payment_unsuccessful') |
|
|
|
|
} |
|
|
|
|
})() |
|
|
|
|
} |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
@ -78,6 +84,7 @@ export const useBrazilPayment = ({ |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
closePopup, |
|
|
|
|
error, |
|
|
|
|
matchLink, |
|
|
|
|
src, |
|
|
|
|
} |
|
|
|
|
|