Make stripe postal code optional

This commit is contained in:
David Bomba 2022-08-12 10:04:08 +10:00
parent 86043a2f9b
commit b8f76691fa
6 changed files with 6 additions and 3 deletions

View File

@ -68,6 +68,7 @@ class CreditCard implements MethodInterface
$data['amount'] = $this->square_driver->payment_hash->data->amount_with_fee;
$data['currencyCode'] = $this->square_driver->client->getCurrencyCode();
$data['square_contact'] = $this->buildClientObject();
$data['postal_code_required'] = in_array($data['currencyCode'], ['USD', 'GBP', 'CAD']) || $this->square_driver->company_gateway->getConfigField('testMode');
return render('gateways.square.credit_card.pay', $data);
}

View File

@ -195,7 +195,6 @@ class SquarePaymentDriver extends BaseDriver
{
$fields = [];
$fields[] = ['name' => 'client_postal_code', 'label' => ctrans('texts.postal_code'), 'type' => 'text', 'validation' => 'required'];
if ($this->company_gateway->require_client_name) {
$fields[] = ['name' => 'client_name', 'label' => ctrans('texts.client_name'), 'type' => 'text', 'validation' => 'required'];
@ -217,6 +216,7 @@ class SquarePaymentDriver extends BaseDriver
if ($this->company_gateway->require_billing_address) {
$fields[] = ['name' => 'client_address_line_1', 'label' => ctrans('texts.address1'), 'type' => 'text', 'validation' => 'required'];
// $fields[] = ['name' => 'client_address_line_2', 'label' => ctrans('texts.address2'), 'type' => 'text', 'validation' => 'nullable'];
$fields[] = ['name' => 'client_postal_code', 'label' => ctrans('texts.postal_code'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_city', 'label' => ctrans('texts.city'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_state', 'label' => ctrans('texts.state'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required'];

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,7 @@
"/js/clients/payments/mollie-credit-card.js": "/js/clients/payments/mollie-credit-card.js?id=bbab588ed009a93345bec520cbe66869",
"/js/clients/payments/eway-credit-card.js": "/js/clients/payments/eway-credit-card.js?id=31d068e55757636f34834bc2494250df",
"/js/clients/payment_methods/braintree-ach.js": "/js/clients/payment_methods/braintree-ach.js?id=6d8c7fd66d911b20cdc4248e33db1b3a",
"/js/clients/payments/square-credit-card.js": "/js/clients/payments/square-credit-card.js?id=b180fd6378d3723d3e9133e0b1943ac6",
"/js/clients/payments/square-credit-card.js": "/js/clients/payments/square-credit-card.js?id=a1b483c277ea0827d875fde333e9b715",
"/js/clients/statements/view.js": "/js/clients/statements/view.js?id=7971b212e8a849fe36bfe915f81023bd",
"/js/clients/payments/razorpay-aio.js": "/js/clients/payments/razorpay-aio.js?id=c36ab5621413ef1de7c864bc8eb7439e",
"/js/clients/payments/stripe-sepa.js": "/js/clients/payments/stripe-sepa.js?id=b258636d8bae366e9d8f54274f437181",

View File

@ -61,6 +61,7 @@ class SquareCreditCard {
currencyCode: document.querySelector('meta[name=currencyCode]')
.content,
intent: 'CHARGE',
postalCode: document.querySelector('meta[name=postal_code_required]')
};
const verificationResults = await this.payments.verifyBuyer(

View File

@ -7,6 +7,7 @@
<meta name="square_contact" content="{{ json_encode($square_contact) }}">
<meta name="amount" content="{{ $amount }}">
<meta name="currencyCode" content="{{ $currencyCode }}">
<meta name="postal_code_required" content="{{ $postal_code_required }}"?
@endsection