mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Show or hide post code in Stripe elements based on company settings
This commit is contained in:
parent
dd2d490db3
commit
4e6477d441
@ -195,8 +195,9 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
$fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required'];
|
$fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->company_gateway->require_postal_code)
|
if($this->company_gateway->require_postal_code) {
|
||||||
$fields[] = ['name' => 'client_postal_code', 'label' => ctrans('texts.postal_code'), 'type' => 'text', 'validation' => 'required'];
|
$fields[] = ['name' => 'client_postal_code', 'label' => ctrans('texts.postal_code'), 'type' => 'text', 'validation' => 'required'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->company_gateway->require_shipping_address) {
|
if ($this->company_gateway->require_shipping_address) {
|
||||||
$fields[] = ['name' => 'client_shipping_address_line_1', 'label' => ctrans('texts.shipping_address1'), 'type' => 'text', 'validation' => 'required'];
|
$fields[] = ['name' => 'client_shipping_address_line_1', 'label' => ctrans('texts.shipping_address1'), 'type' => 'text', 'validation' => 'required'];
|
||||||
|
@ -37,6 +37,7 @@ class StripeCreditCard {
|
|||||||
|
|
||||||
createElement() {
|
createElement() {
|
||||||
this.cardElement = this.elements.create('card', {
|
this.cardElement = this.elements.create('card', {
|
||||||
|
hidePostalCode: document.querySelector('meta[name=stripe-require-postal-code]')?.content === "0",
|
||||||
value: {
|
value: {
|
||||||
postalCode: document.querySelector('meta[name=client-postal-code]').content,
|
postalCode: document.querySelector('meta[name=client-postal-code]').content,
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
@else
|
@else
|
||||||
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
|
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<meta name="stripe-secret" content="{{ $intent->client_secret }}">
|
<meta name="stripe-secret" content="{{ $intent->client_secret }}">
|
||||||
<meta name="only-authorization" content="">
|
<meta name="only-authorization" content="">
|
||||||
<meta name="client-postal-code" content="{{ $client->postal_code ?? '' }}">
|
<meta name="client-postal-code" content="{{ $client->postal_code ?? '' }}">
|
||||||
|
<meta name="stripe-require-postal-code" content="{{ $gateway->company_gateway->require_postal_code }}">
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('gateway_content')
|
@section('gateway_content')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user