Remove carte bancaire payment method
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import {useState} from 'react'
|
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import Tabs from '@mui/material/Tabs'
|
import Tabs from '@mui/material/Tabs'
|
||||||
import Tab from '@mui/material/Tab'
|
import Tab from '@mui/material/Tab'
|
||||||
@@ -6,16 +5,9 @@ import Box from '@mui/material/Box'
|
|||||||
import Button from '@mui/material/Button'
|
import Button from '@mui/material/Button'
|
||||||
|
|
||||||
import {Paypal, Liberapay} from '@icons-pack/react-simple-icons'
|
import {Paypal, Liberapay} from '@icons-pack/react-simple-icons'
|
||||||
import {Elements} from '@stripe/react-stripe-js'
|
|
||||||
import {loadStripe} from '@stripe/stripe-js'
|
|
||||||
|
|
||||||
import {Grid} from '@mui/material'
|
import Grid from '@mui/material/Unstable_Grid2'
|
||||||
import {appearance} from '../../lib/utils/stripe-style'
|
|
||||||
|
|
||||||
import CheckoutForm from './checkout-form'
|
|
||||||
import StripeDialog from './stripe-dialog'
|
|
||||||
|
|
||||||
const STRIPE_PUBLIC_KEY = process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY
|
|
||||||
const PAYPAL_ID = process.env.NEXT_PUBLIC_PAYPAL_DONATE_ID
|
const PAYPAL_ID = process.env.NEXT_PUBLIC_PAYPAL_DONATE_ID
|
||||||
const LIBERAPAY_DONATE = process.env.NEXT_PUBLIC_LIBERAPAY_DONATE
|
const LIBERAPAY_DONATE = process.env.NEXT_PUBLIC_LIBERAPAY_DONATE
|
||||||
|
|
||||||
@@ -52,48 +44,27 @@ function a11yProps(index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PaymentMethod({isLoading, paymentMethod, setPaymentMethod, selectedMontant, setSelectedMontant, validMontant, setValidMontant, paymentIntent, setClientSecret, setPaymentIntent, setIsLoading, setClientEmail, clientEmail, error, setError, clientSecret}) {
|
export default function PaymentMethod({paymentMethod, setPaymentMethod}) {
|
||||||
const [open, setOpen] = useState(false)
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
clientSecret,
|
|
||||||
appearance,
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleChange = (event, newValue) => {
|
const handleChange = (event, newValue) => {
|
||||||
setPaymentMethod(newValue)
|
setPaymentMethod(newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClickOpen = () => {
|
|
||||||
setOpen(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleClose = () => {
|
|
||||||
if (selectedMontant) {
|
|
||||||
setSelectedMontant(null)
|
|
||||||
setValidMontant(null)
|
|
||||||
}
|
|
||||||
|
|
||||||
setOpen(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<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 wrapped label='Liberapay / PayPal' {...a11yProps(0)} />
|
<Tab wrapped label='Liberapay / PayPal' {...a11yProps(0)} />
|
||||||
<Tab wrapped label='Adhésion' {...a11yProps(1)} />
|
<Tab wrapped label='Adhésion' {...a11yProps(1)} />
|
||||||
<Tab wrapped label='Carte bancaire' {...a11yProps(2)} />
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
<TabPanel value={paymentMethod} index={0}>
|
<TabPanel value={paymentMethod} index={0}>
|
||||||
<Grid container rowSpacing={1}>
|
<Grid container rowSpacing={1}>
|
||||||
<Grid item md={6} xs={12}>
|
<Grid md={6} xs={12}>
|
||||||
<Button variant='outlined' size='large' endIcon={<Liberapay />} onClick={() => window.open(`https://liberapay.com/${LIBERAPAY_DONATE}/donate`, '_blank')}>
|
<Button variant='outlined' size='large' endIcon={<Liberapay />} onClick={() => window.open(`https://liberapay.com/${LIBERAPAY_DONATE}/donate`, '_blank')}>
|
||||||
Faire un don via Liberapay
|
Faire un don via Liberapay
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item md={6} xs={12}>
|
<Grid md={6} xs={12}>
|
||||||
<Button variant='outlined' size='large' endIcon={<Paypal />} onClick={() => window.open(`https://www.paypal.com/donate/?hosted_button_id=${PAYPAL_ID}`, '_blank')}>
|
<Button variant='outlined' size='large' endIcon={<Paypal />} onClick={() => window.open(`https://www.paypal.com/donate/?hosted_button_id=${PAYPAL_ID}`, '_blank')}>
|
||||||
Faire un don via PayPal
|
Faire un don via PayPal
|
||||||
</Button>
|
</Button>
|
||||||
@@ -105,67 +76,11 @@ export default function PaymentMethod({isLoading, paymentMethod, setPaymentMetho
|
|||||||
Cliquez ici pour adhérer à l’association OKi
|
Cliquez ici pour adhérer à l’association OKi
|
||||||
</Button>
|
</Button>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={paymentMethod} index={2}>
|
|
||||||
<Button size='large' variant='outlined' onClick={handleClickOpen}>
|
|
||||||
Faire un don par carte bancaire
|
|
||||||
</Button>
|
|
||||||
<StripeDialog
|
|
||||||
open={open}
|
|
||||||
handleClose={handleClose}
|
|
||||||
selectedMontant={selectedMontant}
|
|
||||||
setSelectedMontant={setSelectedMontant}
|
|
||||||
validMontant={validMontant}
|
|
||||||
setValidMontant={setValidMontant}
|
|
||||||
paymentIntent={paymentIntent}
|
|
||||||
setClientSecret={setClientSecret}
|
|
||||||
setPaymentIntent={setPaymentIntent}
|
|
||||||
setIsLoading={setIsLoading}
|
|
||||||
setClientEmail={setClientEmail}
|
|
||||||
clientEmail={clientEmail}
|
|
||||||
error={error}
|
|
||||||
setError={setError}
|
|
||||||
isLoading={isLoading}
|
|
||||||
>
|
|
||||||
{clientSecret && validMontant && paymentMethod === 2 && (
|
|
||||||
<Elements options={options} stripe={loadStripe(STRIPE_PUBLIC_KEY)}>
|
|
||||||
<CheckoutForm
|
|
||||||
validMontant={validMontant}
|
|
||||||
setError={setError}
|
|
||||||
isLoading={isLoading}
|
|
||||||
setIsLoading={setIsLoading}
|
|
||||||
/>
|
|
||||||
</Elements>
|
|
||||||
)}
|
|
||||||
</StripeDialog>
|
|
||||||
</TabPanel>
|
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
PaymentMethod.defaultProps = {
|
|
||||||
selectedMontant: null,
|
|
||||||
validMontant: null,
|
|
||||||
paymentIntent: null,
|
|
||||||
clientEmail: null,
|
|
||||||
error: null,
|
|
||||||
clientSecret: null
|
|
||||||
}
|
|
||||||
|
|
||||||
PaymentMethod.propTypes = {
|
PaymentMethod.propTypes = {
|
||||||
isLoading: PropTypes.bool.isRequired,
|
|
||||||
paymentMethod: PropTypes.number.isRequired,
|
paymentMethod: PropTypes.number.isRequired,
|
||||||
setPaymentMethod: PropTypes.func.isRequired,
|
setPaymentMethod: PropTypes.func.isRequired
|
||||||
selectedMontant: PropTypes.string,
|
|
||||||
setSelectedMontant: PropTypes.func.isRequired,
|
|
||||||
validMontant: PropTypes.string,
|
|
||||||
setValidMontant: PropTypes.func.isRequired,
|
|
||||||
paymentIntent: PropTypes.string,
|
|
||||||
setClientSecret: PropTypes.func.isRequired,
|
|
||||||
setPaymentIntent: PropTypes.func.isRequired,
|
|
||||||
setIsLoading: PropTypes.func.isRequired,
|
|
||||||
setClientEmail: PropTypes.func.isRequired,
|
|
||||||
clientEmail: PropTypes.string,
|
|
||||||
error: PropTypes.string,
|
|
||||||
setError: PropTypes.func.isRequired,
|
|
||||||
clientSecret: PropTypes.string
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function Presantasyon() {
|
|||||||
<strong>Toute contribution, aussi modeste soit-elle, nous permet d’augmenter nos capacités</strong>.
|
<strong>Toute contribution, aussi modeste soit-elle, nous permet d’augmenter nos capacités</strong>.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography paragraph variant='subtitle1' component='div'>
|
<Typography paragraph variant='subtitle1' component='div'>
|
||||||
Concernant les dons, ils peuvent s'effectuer via <Link underline='hover' href='https://liberapay.com/OKi/donate' target='_blank' rel='noreferrer'><strong>Liberapay</strong></Link>, <Link underline='hover' href='https://www.paypal.com/donate/?hosted_button_id=5Q3KPR79CAZVW' target='_blank' rel='noreferrer'><strong>PayPal</strong></Link> ou directement sur notre site par carte bancaire. Pour ce dernier, nous utilisons <Link underline='hover' href='https://stripe.com/fr/about' target='_blank' rel='noreferrer'><strong>Stripe</strong></Link> (une plateforme de paiement 100% sécurisée).
|
Concernant les dons, ils peuvent s'effectuer via <Link underline='hover' href='https://liberapay.com/OKi/donate' target='_blank' rel='noreferrer'><strong>Liberapay</strong></Link>, <Link underline='hover' href='https://www.paypal.com/donate/?hosted_button_id=5Q3KPR79CAZVW' target='_blank' rel='noreferrer'><strong>PayPal</strong></Link>.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography paragraph variant='subtitle1' component='div'>
|
<Typography paragraph variant='subtitle1' component='div'>
|
||||||
Vous pouvez adhérer à notre association en vous rendant sur <Link underline='hover' href='https://asso.oki.re/public/members/new.php' target='_blank' rel='noreferrer'><strong>asso.oki.re</strong></Link>.
|
Vous pouvez adhérer à notre association en vous rendant sur <Link underline='hover' href='https://asso.oki.re/public/members/new.php' target='_blank' rel='noreferrer'><strong>asso.oki.re</strong></Link>.
|
||||||
|
|||||||
Reference in New Issue
Block a user