mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 17:54:30 -04:00
Merge pull request #5656 from beganovich/v5-1005-stripe-hiding-cvv
(v5) Prefill the postal code with Stripe Elements
This commit is contained in:
commit
3fb202be2c
@ -88,7 +88,9 @@ class RequiredClientInfo extends Component
|
||||
}
|
||||
|
||||
if ($this->updateClientDetails($data)) {
|
||||
$this->emit('passed-required-fields-check');
|
||||
$this->emit('passed-required-fields-check', [
|
||||
'client_postal_code' => $this->contact->client->postal_code,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -10,7 +10,7 @@
|
||||
"/js/clients/payments/checkout-credit-card.js": "/js/clients/payments/checkout-credit-card.js?id=98e406fa8e4db0e93427",
|
||||
"/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=76d8ba6a814b3015e359",
|
||||
"/js/clients/payments/stripe-alipay.js": "/js/clients/payments/stripe-alipay.js?id=7a4ce306366be98be5f7",
|
||||
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=2c828298b04fe30a4fe7",
|
||||
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=5c762e4a21bdbce9c0c0",
|
||||
"/js/clients/payments/stripe-sofort.js": "/js/clients/payments/stripe-sofort.js?id=282f5d57f1c1efe8f896",
|
||||
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=1b8f9325aa6e8595e7fa",
|
||||
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=85bcae0a646882e56b12",
|
||||
|
@ -19,7 +19,7 @@ class StripeCreditCard {
|
||||
setupStripe() {
|
||||
this.stripe = Stripe(this.key);
|
||||
|
||||
if(this.stripeConnect)
|
||||
if (this.stripeConnect)
|
||||
this.stripe.stripeAccount = this.stripeConnect;
|
||||
|
||||
this.elements = this.stripe.elements();
|
||||
@ -28,7 +28,11 @@ class StripeCreditCard {
|
||||
}
|
||||
|
||||
createElement() {
|
||||
this.cardElement = this.elements.create('card');
|
||||
this.cardElement = this.elements.create('card', {
|
||||
value: {
|
||||
postalCode: document.querySelector('meta[name=client-postal-code]').content,
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -206,7 +210,11 @@ const secret =
|
||||
const onlyAuthorization =
|
||||
document.querySelector('meta[name="only-authorization"]').content ?? '';
|
||||
|
||||
const stripeConnect =
|
||||
const stripeConnect =
|
||||
document.querySelector('meta[name="stripe-account-id"]').content;
|
||||
|
||||
new StripeCreditCard(publishableKey, secret, onlyAuthorization, stripeConnect).handle();
|
||||
let s = new StripeCreditCard(publishableKey, secret, onlyAuthorization, stripeConnect);
|
||||
|
||||
s.handle();
|
||||
|
||||
Livewire.on('passed-required-fields-check', () => s.handle());
|
||||
|
@ -5,6 +5,8 @@
|
||||
<meta name="stripe-account-id" content="{{ $gateway->company_gateway->getConfigField('account_id') }}">
|
||||
<meta name="stripe-secret" content="{{ $intent->client_secret }}">
|
||||
<meta name="only-authorization" content="">
|
||||
|
||||
<meta name="client-postal-code" content="{{ $client->postal_code ?? '' }}">
|
||||
@endsection
|
||||
|
||||
@section('gateway_content')
|
||||
@ -58,6 +60,14 @@
|
||||
@endsection
|
||||
|
||||
@section('gateway_footer')
|
||||
<script>
|
||||
Livewire.on('passed-required-fields-check', (event) => {
|
||||
if (event.hasOwnProperty('client_postal_code')) {
|
||||
document.querySelector('meta[name=client-postal-code]').content = event.client_postal_code;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
<script src="{{ asset('js/clients/payments/stripe-credit-card.js') }}"></script>
|
||||
@endsection
|
||||
|
Loading…
x
Reference in New Issue
Block a user