Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
currency="NOK"
allowRememberMe
locale="no"
token={onToken}
stripeKey={config.stripeKey}
amount={event.price}
email={currentUser.email}
>
<button style="{{">Betal nå</button>
)}
);
}
}
const InjectedForm = injectStripe(PaymentRequestForm);
// TODO Move this to a "global" thing
const WithProvider = (props: Props) => (
);
export default WithProvider;
useEffect( () => {
debug( 'loading stripe configuration' );
let isSubscribed = true;
getStripeConfiguration( requestArgs || {} ).then(
configuration => isSubscribed && setStripeConfiguration( configuration )
);
return () => ( isSubscribed = false );
}, [ requestArgs, stripeError ] );
return { stripeConfiguration, setStripeError };
}
function StripeHookProviderInnerWrapper( { stripe, stripeData, children } ) {
const updatedStripeData = { ...stripeData, stripe };
return { children };
}
const StripeInjectedWrapper = injectStripe( StripeHookProviderInnerWrapper );
export function StripeHookProvider( { children, configurationArgs } ) {
debug( 'rendering StripeHookProvider' );
const { stripeConfiguration, setStripeError } = useStripeConfiguration( configurationArgs );
const { stripeJs, isStripeLoading, stripeLoadingError } = useStripeJs( stripeConfiguration );
const stripeData = {
stripe: null, // This must be set inside the injected component
stripeConfiguration,
isStripeLoading,
stripeLoadingError,
setStripeError,
};
return (
type="submit"
fullWidth
variant="contained"
color="secondary"
size="large"
>
{t('checkout.buyNow')}
);
};
// tslint:disable-next-line:max-file-line-count
export default injectStripe(PaymentForm);
import addData from 'data/addData'
import WalletStatus from 'queries/WalletStatus'
import MakeOffer from 'mutations/MakeOffer'
import AllowToken from 'mutations/AllowToken'
import Price from 'components/Price'
import Link from 'components/Link'
import WithPrices from 'components/WithPrices'
import CryptoWallet from './CryptoWallet'
import WaitForTransaction from '../../components/WaitForTransaction'
const MarketplaceContract = process.env.MARKETPLACE_CONTRACT
const CreditCardForm = injectStripe(({ stripe }) => {
// const [paymentMethod, setPaymentMethod] = useState()
// const [applePay, setApplePay] = useState(false)
const { config } = useConfig()
const [token, setToken] = useState('token-ETH')
const [tokenStatus, setTokenStatus] = useState({})
const [formData, setFormData] = useState({})
const [loading, setLoading] = useState(false)
const [paymentReq, setPaymentReq] = useState()
const [{ cart }, dispatch] = useStateValue()
const [approveOfferTx, setApproveOfferTx] = useState()
const [auth, setAuth] = useState()
const [offerTx, setOfferTx] = useState()
const history = useHistory()
const paymentMethod = get(cart, 'paymentMethod.id')
type="submit"
disabled={!this.state.complete || this.state.errorRequired}
value={payPlan ? "Subscribe" : "Add Method"} />
{this.state.error &&
<div>{this.state.error}</div>
}
{this.state.errorRequired &&
<div>All fields are required to fill!</div>
}
);
}
}
export const PayCardElement = injectStripe(_PayCardElement);
@CSSModules(styles, {allowMultiple: true})
class PaymentMethods extends Component {
state = {
method: null,
pending: false,
defaultMethod: true
};
methods = [];
payPlan = null;
isYearly = false;
constructor(props) {
{hasSaveCheckBox && (
)}
);
}
}
const NewCreditCardFormWithStripe = injectStripe(NewCreditCardFormWithoutStripe);
const NewCreditCardForm = props => (
);
NewCreditCardForm.propTypes = {
intl: PropTypes.object,
};
export default injectIntl(NewCreditCardForm);
const [ currentAttempt, setAttempt ] = useState( 1 );
const stripeConfiguration = useSelect( select => select( 'stripe' ).getStripeConfiguration() );
const { getConfiguration } = useDispatch( 'stripe' );
const getConfigurationMemo = useCallback( getConfiguration, [ currentAttempt, requestArgs ] );
useEffect( () => {
getConfigurationMemo( requestArgs );
}, [ requestArgs, currentAttempt, getConfigurationMemo ] );
const forceReload = () => setAttempt( currentAttempt + 1 );
return { stripeConfiguration, forceReload };
}
function StripeHookProviderInnerWrapper( { stripe, stripeData, children } ) {
const updatedStripeData = { ...stripeData, stripe };
return { children };
}
const StripeInjectedWrapper = injectStripe( StripeHookProviderInnerWrapper );
/**
* Custom Provider to access Stripe.js
*
* First you must wrap a parent component in this Provider. Then you can call
* `useStripe()` in any sub-component to get access to the stripe variables and
* functions. See `useStripe` for more details.
*
* This has one optional prop, `configurationArgs`, which is an object that
* will be used when fetching the stripe configuration.
*
* @returns {object} React element
*/
export function StripeHookProvider( { children, configurationArgs } ) {
const { stripeConfiguration, forceReload } = useStripeConfiguration( configurationArgs );
const { stripeJs, isStripeLoading, stripeLoadingError } = useStripeJs( stripeConfiguration );
Expiry Date
<div>
CVC Number
</div>
{this.submitButton()}
)
}
}
const InjectedForm = injectStripe(PaymentForm)
const mapDispatchToProps = (dispatch: any) => ({
signPaymentData: (stripeTokenId: string) =>
dispatch(signPaymentData(stripeTokenId)),
close: (e: WarningError) => {
dispatch(resetError(e))
},
})
interface ReduxState {
account?: Account
errors: UnlockError[]
}
const mapStateToProps = ({ account, errors }: ReduxState) => {
const storageWarnings = errors.filter(
updater: (store, data) => this.onCreditCardAdded(me, store, data),
}
)
}
private onMutationError(errors, errorModalMessage?) {
logger.error(errors)
this.setState({
isCommittingMutation: false,
isErrorModalOpen: true,
errorModalMessage,
})
}
}
export default injectStripe(PaymentForm)