Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions assets/css/stripe.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
.StripeElement {
background-color: white;
height: 40px;
padding: 10px 12px;
border-radius: 4px;
border: 1px solid transparent;
box-shadow: 0 1px 3px 0 #e6ebf1;
-webkit-transition: box-shadow 150ms ease;
transition: box-shadow 150ms ease;
}
// .StripeElement {
// background-color: white;
// height: 40px;
// padding: 10px 12px;
// border-radius: 4px;
// border: 1px solid transparent;
// box-shadow: 0 1px 3px 0 #e6ebf1;
// -webkit-transition: box-shadow 150ms ease;
// transition: box-shadow 150ms ease;
// }

.StripeElement--focus {
box-shadow: 0 1px 3px 0 #cfd7df;
}
// .StripeElement--focus {
// box-shadow: 0 1px 3px 0 #cfd7df;
// }

.StripeElement--invalid {
border-color: #fa755a;
}
// .StripeElement--invalid {
// border-color: #fa755a;
// }

.StripeElement--webkit-autofill {
background-color: #fefde5 !important;
}
// .StripeElement--webkit-autofill {
// background-color: #fefde5 !important;
// }
32 changes: 24 additions & 8 deletions js/app/components/Payment/stripe.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-disable */

import React, { useState, useEffect } from 'react'
import axios from 'axios'
import { render, unmountComponentAtNode } from 'react-dom'
import { Elements, CardElement, ElementsConsumer } from '@stripe/react-stripe-js'
import { Elements, CardElement, ElementsConsumer, PaymentElement } from '@stripe/react-stripe-js'
import { useTranslation } from 'react-i18next'
import _ from 'lodash'

Expand Down Expand Up @@ -125,6 +127,8 @@ const StripeForm = ({ onChange, onCardholderNameChange, options, cards, onSaveCr

const { t } = useTranslation()

console.log('OPTIONS', options)

const [addNewCard, setAddNewCard] = useState(false)

const edenred = !!options && _.find(options.payments, p => p.method.code === 'EDENRED')
Expand Down Expand Up @@ -187,16 +191,18 @@ const StripeForm = ({ onChange, onCardholderNameChange, options, cards, onSaveCr
{
(addNewCard || !thereAreCardsToShow || isGuest(formOptions)) ?
<div id="card-form">
<div className="form-group">
{/*<div className="form-group">
<CardholderNameInput onChange={ onCardholderNameChange } />
</div>
<div className="form-group">
</div>*/}
{/*<div className="form-group">
<label className="control-label hidden">
{ t('PAYMENT_FORM_TITLE') }
</label>
<CardElement options={{ style, hidePostalCode: true }} onChange={ onChange } />
</div>
{
<PaymentElement />
</div>*/}
<PaymentElement />
{/*{
!isGuest(formOptions) ?
<div className="form-group">
<div className="checkbox">
Expand All @@ -206,7 +212,7 @@ const StripeForm = ({ onChange, onCardholderNameChange, options, cards, onSaveCr
</label>
</div>
</div> : null
}
}*/}
</div> : null
}
</React.Fragment>
Expand Down Expand Up @@ -234,10 +240,20 @@ export default {
resultCards = await axios.get(this.config.gatewayConfig.customerPaymentMethodsURL)
}

console.log(options, formOptions)

return new Promise((resolve) => {

render(
<Elements stripe={ this.stripe }>
<Elements stripe={ this.stripe } options={{
mode: 'payment',
currency: 'eur',
amount: 1099,
appearance: {
theme: 'stripe'
},
// externalPaymentMethodTypes: ['external_divido']
}}>
<ElementsConsumer>
{({ elements }) => {

Expand Down
2 changes: 1 addition & 1 deletion src/Service/StripeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class StripeManager
{
const STRIPE_API_VERSION = '2019-09-09';
const STRIPE_API_VERSION = '2023-08-16';

public function __construct(
private readonly SettingsManager $settingsManager,
Expand Down
Loading