fix(#686): annual access

Rakov 3 years ago
parent 443d768dc1
commit 7c7fd742b2
  1. 12
      src/features/BuyMatchPopup/components/IframePayment/hooks.tsx

@ -2,6 +2,7 @@ import {
MouseEvent,
useCallback,
useEffect,
useMemo,
useState,
} from 'react'
@ -14,6 +15,7 @@ import isNumber from 'lodash/isNumber'
import { useLexicsStore } from 'features/LexicsStore'
import { useBuyMatchPopupStore } from 'features/BuyMatchPopup/store'
import { getProfileUrl } from 'features/ProfileLink/helpers'
import { SubscriptionType } from 'features/BuyMatchPopup/types'
import { getMatchInfo } from 'requests/getMatchInfo'
import { getPaymentUrl } from 'requests/getPaymentUrl'
@ -49,6 +51,7 @@ export const useIframePayment = ({
nameLexic,
originalObject,
pass,
type,
} = selectedPackage
const teams = isNumber(nameLexic) ? translate(String(nameLexic)) : name
@ -60,6 +63,13 @@ export const useIframePayment = ({
sportType,
})
const defaultPass = useMemo(() => {
if (type === SubscriptionType.Month) {
return 'create_subscription'
}
return 'one_payment'
}, [type])
const closePopup = useCallback(async (e?: MouseEvent) => {
e?.stopPropagation()
@ -92,7 +102,7 @@ export const useIframePayment = ({
break
default:
url_return = `${window.location.origin}${PAGES.thanksForSubscribe}`
action = pass === 'pass_match_access' ? 'one_payment' : 'create_subscription'
action = defaultPass
break
}

Loading…
Cancel
Save