diff --git a/app/PaymentDrivers/Square/CreditCard.php b/app/PaymentDrivers/Square/CreditCard.php index b2f2a72391..75848bec07 100644 --- a/app/PaymentDrivers/Square/CreditCard.php +++ b/app/PaymentDrivers/Square/CreditCard.php @@ -130,9 +130,9 @@ class CreditCard { $data['gateway'] = $this->square_driver; - $data['client_token'] = $this->braintree->gateway->clientToken()->generate(); - return render('gateways.braintree.credit_card.pay', $data); + + return render('gateways.square.credit_card.pay', $data); } diff --git a/app/PaymentDrivers/SquarePaymentDriver.php b/app/PaymentDrivers/SquarePaymentDriver.php index d3c5ab2471..818c1e501a 100644 --- a/app/PaymentDrivers/SquarePaymentDriver.php +++ b/app/PaymentDrivers/SquarePaymentDriver.php @@ -102,4 +102,49 @@ class SquarePaymentDriver extends BaseDriver public function processWebhookRequest(PaymentWebhookRequest $request, Payment $payment = null) { } + + + public function getClientRequiredFields(): array + { + $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']; + } + + if ($this->company_gateway->require_contact_name) { + $fields[] = ['name' => 'contact_first_name', 'label' => ctrans('texts.first_name'), 'type' => 'text', 'validation' => 'required']; + $fields[] = ['name' => 'contact_last_name', 'label' => ctrans('texts.last_name'), 'type' => 'text', 'validation' => 'required']; + } + + if ($this->company_gateway->require_contact_email) { + $fields[] = ['name' => 'contact_email', 'label' => ctrans('texts.email'), 'type' => 'text', 'validation' => 'required,email:rfc']; + } + + if ($this->company_gateway->require_client_phone) { + $fields[] = ['name' => 'client_phone', 'label' => ctrans('texts.client_phone'), 'type' => 'tel', 'validation' => 'required']; + } + + 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_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']; + } + + 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_2', 'label' => ctrans('texts.shipping_address2'), 'type' => 'text', 'validation' => 'sometimes']; + $fields[] = ['name' => 'client_shipping_city', 'label' => ctrans('texts.shipping_city'), 'type' => 'text', 'validation' => 'required']; + $fields[] = ['name' => 'client_shipping_state', 'label' => ctrans('texts.shipping_state'), 'type' => 'text', 'validation' => 'required']; + $fields[] = ['name' => 'client_shipping_postal_code', 'label' => ctrans('texts.shipping_postal_code'), 'type' => 'text', 'validation' => 'required']; + $fields[] = ['name' => 'client_shipping_country_id', 'label' => ctrans('texts.shipping_country'), 'type' => 'text', 'validation' => 'required']; + } + + + return $fields; + } } \ No newline at end of file diff --git a/resources/views/portal/ninja2020/gateways/square/credit_card/authorize.blade.php b/resources/views/portal/ninja2020/gateways/square/credit_card/authorize.blade.php index 7bd9f85d4f..0c5eaf2a28 100644 --- a/resources/views/portal/ninja2020/gateways/square/credit_card/authorize.blade.php +++ b/resources/views/portal/ninja2020/gateways/square/credit_card/authorize.blade.php @@ -10,14 +10,14 @@ @csrf - + @component('portal.ninja2020.components.general.card-element-single') -
+
-
+
- + @endcomponent @component('portal.ninja2020.gateways.includes.pay_now') @@ -27,141 +27,143 @@ @section('gateway_footer') - - + @else + + @endif - const darkModeCardStyle = { - '.input-container': { - borderColor: '#2D2D2D', - borderRadius: '6px', - }, - '.input-container.is-focus': { - borderColor: '#006AFF', - }, - '.input-container.is-error': { - borderColor: '#ff1600', - }, - '.message-text': { - color: '#999999', - }, - '.message-icon': { - color: '#999999', - }, - '.message-text.is-error': { - color: '#ff1600', - }, - '.message-icon.is-error': { - color: '#ff1600', - }, - input: { - backgroundColor: '#2D2D2D', - color: '#FFFFFF', - fontFamily: 'helvetica neue, sans-serif', - }, - 'input::placeholder': { - color: '#999999', - }, - 'input.is-error': { - color: '#ff1600', - }, - }; + + }); + @endsection \ No newline at end of file diff --git a/resources/views/portal/ninja2020/gateways/square/credit_card/pay.blade.php b/resources/views/portal/ninja2020/gateways/square/credit_card/pay.blade.php new file mode 100644 index 0000000000..e29ed33863 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/square/credit_card/pay.blade.php @@ -0,0 +1,171 @@ +@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.payment_type_credit_card'), 'card_title' +=> ctrans('texts.payment_type_credit_card')]) + +@section('gateway_head') +@endsection + +@section('gateway_content') + +
+ @csrf + + +
+ + + + @component('portal.ninja2020.components.general.card-element-single') +
+ +
+ + + @endcomponent + + @component('portal.ninja2020.gateways.includes.pay_now') + {{ ctrans('texts.pay_now') }} + @endcomponent +@endsection + +@section('gateway_footer') + + @if($gateway->company_gateway->getConfigField('testMode')) + + @else + + @endif + + + +@endsection \ No newline at end of file