feat(735): added subscription confirmation and resulting steps (#315)
parent
3ecbd9020f
commit
3da64ed59a
@ -0,0 +1,48 @@ |
||||
import { currencySymbols } from 'config' |
||||
|
||||
import { T9n } from 'features/T9n' |
||||
import { |
||||
CloseButton, |
||||
Header, |
||||
HeaderActions, |
||||
HeaderTitle, |
||||
} from 'features/PopupComponents' |
||||
|
||||
import { useBuyMatchPopupStore } from '../../store' |
||||
import { SubscriptionsList } from '../SubscriptionsList' |
||||
import { |
||||
Wrapper, |
||||
Footer, |
||||
Button, |
||||
Body, |
||||
} from '../../styled' |
||||
|
||||
export const ConfirmationStep = () => { |
||||
const { |
||||
close, |
||||
selectedSubscriptions, |
||||
subscribeToMatches, |
||||
totalPrice, |
||||
} = useBuyMatchPopupStore() |
||||
|
||||
return ( |
||||
<Wrapper> |
||||
<Header height={50}> |
||||
<HeaderTitle> |
||||
<T9n t='payment_confirmation' /> |
||||
</HeaderTitle> |
||||
<HeaderActions position='right'> |
||||
<CloseButton onClick={close} /> |
||||
</HeaderActions> |
||||
</Header> |
||||
<Body marginTop={25}> |
||||
<SubscriptionsList subscriptions={selectedSubscriptions} /> |
||||
</Body> |
||||
<Footer marginTop={35}> |
||||
<Button onClick={subscribeToMatches}> |
||||
<T9n t='buy_for' /> {totalPrice} {currencySymbols.ruble} |
||||
</Button> |
||||
</Footer> |
||||
</Wrapper> |
||||
) |
||||
} |
||||
@ -0,0 +1,34 @@ |
||||
import { T9n } from 'features/T9n' |
||||
import { |
||||
Header, |
||||
HeaderTitle, |
||||
HeaderActions, |
||||
CloseButton, |
||||
} from 'features/PopupComponents' |
||||
|
||||
import { useBuyMatchPopupStore } from '../../store' |
||||
import { |
||||
Wrapper, |
||||
Body, |
||||
ResultText, |
||||
} from '../../styled' |
||||
|
||||
export const ErrorStep = () => { |
||||
const { close } = useBuyMatchPopupStore() |
||||
|
||||
return ( |
||||
<Wrapper width={517}> |
||||
<Header height={50}> |
||||
<HeaderTitle> |
||||
<T9n t='payment' /> |
||||
</HeaderTitle> |
||||
<HeaderActions position='right'> |
||||
<CloseButton onClick={close} /> |
||||
</HeaderActions> |
||||
</Header> |
||||
<Body marginTop={30} marginBottom={35}> |
||||
<ResultText t='error_not_enough_balance' /> |
||||
</Body> |
||||
</Wrapper> |
||||
) |
||||
} |
||||
@ -0,0 +1,36 @@ |
||||
import { T9n } from 'features/T9n' |
||||
import { |
||||
Header, |
||||
HeaderTitle, |
||||
} from 'features/PopupComponents' |
||||
|
||||
import { useBuyMatchPopupStore } from '../../store' |
||||
import { |
||||
Wrapper, |
||||
Body, |
||||
Footer, |
||||
Button, |
||||
ResultText, |
||||
} from '../../styled' |
||||
|
||||
export const SuccessStep = () => { |
||||
const { close } = useBuyMatchPopupStore() |
||||
|
||||
return ( |
||||
<Wrapper width={517}> |
||||
<Header height={50}> |
||||
<HeaderTitle> |
||||
<T9n t='payment' /> |
||||
</HeaderTitle> |
||||
</Header> |
||||
<Body marginTop={30} marginBottom={40}> |
||||
<ResultText t='success_subscription' /> |
||||
</Body> |
||||
<Footer> |
||||
<Button onClick={close}> |
||||
<T9n t='subscription_done' /> |
||||
</Button> |
||||
</Footer> |
||||
</Wrapper> |
||||
) |
||||
} |
||||
@ -0,0 +1,18 @@ |
||||
import { API_ROOT } from 'config' |
||||
import { callApi } from 'helpers' |
||||
|
||||
export const buyMatchSubscriptions = () => { |
||||
const config = { |
||||
body: { |
||||
_p_c_subscription_plan: 1, |
||||
_p_is_scheduled: 0, |
||||
}, |
||||
} |
||||
|
||||
callApi({ |
||||
config, |
||||
url: `${API_ROOT}/account/purchase`, |
||||
}) |
||||
|
||||
return Promise.resolve() |
||||
} |
||||
Loading…
Reference in new issue