Change PaymentMethod order

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-03-11 18:15:00 +04:00
parent ccaebdb557
commit d41cae9865
2 changed files with 16 additions and 16 deletions
+13 -13
View File
@@ -66,22 +66,12 @@ export default function PaymentMethod({isLoading, paymentMethod, setPaymentMetho
<Box sx={{width: '100%'}}> <Box sx={{width: '100%'}}>
<Box sx={{borderBottom: 1, borderColor: 'divider'}}> <Box sx={{borderBottom: 1, borderColor: 'divider'}}>
<Tabs scrollButtons allowScrollButtonsMobile value={paymentMethod} aria-label='basic tabs example' variant='fullWidth' onChange={handleChange}> <Tabs scrollButtons allowScrollButtonsMobile value={paymentMethod} aria-label='basic tabs example' variant='fullWidth' onChange={handleChange}>
<Tab label='Adhésion' {...a11yProps(0)} /> <Tab label='Don Carte bancaire' {...a11yProps(0)} />
<Tab label='Don PayPal' {...a11yProps(1)} /> <Tab label='Don PayPal' {...a11yProps(1)} />
<Tab label='Don Carte bancaire' {...a11yProps(2)} /> <Tab label='Adhésion' {...a11yProps(2)} />
</Tabs> </Tabs>
</Box> </Box>
<TabPanel value={paymentMethod} index={0}> <TabPanel value={paymentMethod} index={0}>
<Button size='large' variant='outlined' onClick={() => window.open('https://www.helloasso.com/associations/organisation-ka-internationale/adhesions/adhesion-oki', '_blank')}>
Cliquez ici pour adhérer à #OKi via HelloAsso
</Button>
</TabPanel>
<TabPanel value={paymentMethod} index={1}>
<Button variant='outlined' size='large' endIcon={<Paypal />} onClick={() => window.open(`https://www.paypal.com/donate/?hosted_button_id=${PAYPAL_ID}`, '_blank')}>
Cliquez ici pour faire un don via PayPal
</Button>
</TabPanel>
<TabPanel value={paymentMethod} index={2}>
<StripePayment <StripePayment
selectedMontant={selectedMontant} selectedMontant={selectedMontant}
setSelectedMontant={setSelectedMontant} setSelectedMontant={setSelectedMontant}
@@ -100,7 +90,7 @@ export default function PaymentMethod({isLoading, paymentMethod, setPaymentMetho
isLoading={isLoading} isLoading={isLoading}
/> />
{clientSecret && validMontant && paymentMethod === 2 && ( {clientSecret && validMontant && paymentMethod === 0 && (
<Elements options={options} stripe={stripePromise}> <Elements options={options} stripe={stripePromise}>
<CheckoutForm <CheckoutForm
setPaymentIsReady={setPaymentIsReady} setPaymentIsReady={setPaymentIsReady}
@@ -111,6 +101,16 @@ export default function PaymentMethod({isLoading, paymentMethod, setPaymentMetho
</Elements> </Elements>
)} )}
</TabPanel> </TabPanel>
<TabPanel value={paymentMethod} index={1}>
<Button variant='outlined' size='large' endIcon={<Paypal />} onClick={() => window.open(`https://www.paypal.com/donate/?hosted_button_id=${PAYPAL_ID}`, '_blank')}>
Cliquez ici pour faire un don via PayPal
</Button>
</TabPanel>
<TabPanel value={paymentMethod} index={2}>
<Button size='large' variant='outlined' onClick={() => window.open('https://www.helloasso.com/associations/organisation-ka-internationale/adhesions/adhesion-oki', '_blank')}>
Cliquez ici pour adhérer à #OKi via HelloAsso
</Button>
</TabPanel>
</Box> </Box>
) )
} }
+3 -3
View File
@@ -65,7 +65,7 @@ export default function Soutyen({prices, paymentStatus}) {
} }
useEffect(() => { useEffect(() => {
if (paymentMethod !== 2) { if (paymentMethod !== 0) {
setClientEmail('') setClientEmail('')
setClientSecret(null) setClientSecret(null)
setSelectedMontant(null) setSelectedMontant(null)
@@ -119,10 +119,10 @@ export default function Soutyen({prices, paymentStatus}) {
useEffect(() => {}, [router.query.payment_intent]) useEffect(() => {}, [router.query.payment_intent])
useEffect(() => { useEffect(() => {
if (paymentMethod === 2 || validMontant) { if (validMontant) {
scrollToBottom() scrollToBottom()
} }
}, [paymentMethod, validMontant]) }, [validMontant])
useEffect(() => { useEffect(() => {
if (payementIsReady) { if (payementIsReady) {