// tslint:disable:no-magic-numbers import { Button, Grid, Paper } from '@material-ui/core'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { CardCVCElement, CardExpiryElement, CardNumberElement, injectStripe, } from 'react-stripe-elements'; import StripeElementWrapper from '../../atoms/StripeElementWrapper'; import useStyles from './styles'; // reference: https://github.com/mui-org/material-ui/issues/16037 // https://gist.github.com/lfalke/1c5e7168424c8b2a65dcfba425fcc310 const PaymentForm = (props: any) => { const classes = useStyles(); const [paying, setPaying] = useState(false); const [name, setName] = useState(''); const { t } = useTranslation(); const handleSubmit = async (ev: any) => { ev.preventDefault(); if (props.stripe) { setPaying(true); props.stripe .createToken({type: 'card', name: 'Jenny Rosen'}) // tslint:disable-next-line:no-console .then((payload: any) => console.log('[token]', payload)) .finally(() => { setPaying(false); }); } else { // tslint:disable-next-line:no-console console.log("Stripe.js hasn't loaded yet."); } }; return (
); }; // tslint:disable-next-line:max-file-line-count export default injectStripe(PaymentForm);