mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #4722 from beganovich/v5-1901-authorize-net
(v5) Authorize.net refactor
This commit is contained in:
commit
2757caee7c
@ -27,6 +27,11 @@ class RequiredClientInfo extends Component
|
||||
*/
|
||||
public $contact;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $countries;
|
||||
|
||||
/**
|
||||
* Mappings for updating the database. Left side is mapping from gateway,
|
||||
* right side is column in database.
|
||||
@ -58,16 +63,18 @@ class RequiredClientInfo extends Component
|
||||
'contact_phone' => 'phone',
|
||||
];
|
||||
|
||||
public $show_form = true;
|
||||
public $show_form = false;
|
||||
|
||||
public function handleSubmit(array $data): bool
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
collect($this->fields)->map(function ($field) use (&$rules) {
|
||||
$rules[$field['name']] = array_key_exists('validation_rules', $field)
|
||||
? $field['validation_rules']
|
||||
: 'required';
|
||||
if (!array_key_exists('filled', $field)) {
|
||||
$rules[$field['name']] = array_key_exists('validation_rules', $field)
|
||||
? $field['validation_rules']
|
||||
: 'required';
|
||||
}
|
||||
});
|
||||
|
||||
$validator = Validator::make($data, $rules);
|
||||
@ -120,19 +127,23 @@ class RequiredClientInfo extends Component
|
||||
|
||||
public function checkFields()
|
||||
{
|
||||
foreach ($this->fields as $field) {
|
||||
foreach ($this->fields as $index => $field) {
|
||||
$_field = $this->mappings[$field['name']];
|
||||
|
||||
if (Str::startsWith($field['name'], 'client_')) {
|
||||
(empty($this->contact->client->{$_field}) || is_null($this->contact->client->{$_field}))
|
||||
? $this->show_form = true
|
||||
: $this->show_form = false;
|
||||
if (empty($this->contact->client->{$_field}) || is_null($this->contact->client->{$_field})) {
|
||||
$this->show_form = true;
|
||||
} else {
|
||||
$this->fields[$index]['filled'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::startsWith($field['name'], 'contact_')) {
|
||||
(empty($this->contact->{$_field}) || is_null($this->contact->{$_field}))
|
||||
? $this->show_form = true
|
||||
: $this->show_form = false;
|
||||
if ((empty($this->contact->{$_field}) || is_null($this->contact->{$_field}))) {
|
||||
$this->show_form = true;
|
||||
} else {
|
||||
$this->fields[$index]['filled'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
namespace App\PaymentDrivers\Authorize;
|
||||
|
||||
use App\Events\Payment\PaymentWasCreated;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
@ -21,7 +20,6 @@ use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\AuthorizePaymentDriver;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
/**
|
||||
@ -46,11 +44,11 @@ class AuthorizeCreditCard
|
||||
->get();
|
||||
|
||||
$data['tokens'] = $tokens;
|
||||
$data['gateway'] = $this->authorize->company_gateway;
|
||||
$data['gateway'] = $this->authorize;
|
||||
$data['public_client_id'] = $this->authorize->init()->getPublicClientKey();
|
||||
$data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId');
|
||||
|
||||
return render('gateways.authorize.credit_card_payment', $data);
|
||||
return render('gateways.authorize.credit_card.pay', $data);
|
||||
}
|
||||
|
||||
public function processPaymentResponse($request)
|
||||
@ -97,7 +95,6 @@ class AuthorizeCreditCard
|
||||
|
||||
/*Refactor and push to BaseDriver*/
|
||||
if ($data['response'] != null && $data['response']->getMessages()->getResultCode() == 'Ok') {
|
||||
|
||||
$this->storePayment($payment_hash, $data);
|
||||
|
||||
$vars = [
|
||||
@ -184,7 +181,8 @@ class AuthorizeCreditCard
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||
SystemLog::TYPE_AUTHORIZE,
|
||||
$this->authorize->client);
|
||||
$this->authorize->client
|
||||
);
|
||||
|
||||
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class AuthorizePaymentMethod
|
||||
return $this->authorizeCreditCard();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// case GatewayType::BANK_TRANSFER:
|
||||
// return $this->authorizeBankTransfer();
|
||||
// break;
|
||||
@ -58,7 +58,7 @@ class AuthorizePaymentMethod
|
||||
public function authorizeResponseView($request)
|
||||
{
|
||||
$data = $request->all();
|
||||
|
||||
|
||||
$this->payment_method_id = $data['method'];
|
||||
|
||||
switch ($this->payment_method_id) {
|
||||
@ -81,7 +81,7 @@ class AuthorizePaymentMethod
|
||||
$data['public_client_id'] = $this->authorize->init()->getPublicClientKey();
|
||||
$data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId');
|
||||
|
||||
return render('gateways.authorize.add_credit_card', $data);
|
||||
return render('gateways.authorize.credit_card.authorize', $data);
|
||||
}
|
||||
|
||||
public function authorizeBankTransfer()
|
||||
|
@ -68,6 +68,12 @@ class AuthorizePaymentDriver extends BaseDriver
|
||||
return [
|
||||
['name' => 'client_name', 'label' => ctrans('texts.name'), 'type' => 'text', 'validation' => 'required|min:2'],
|
||||
['name' => 'contact_email', 'label' => ctrans('texts.email'), 'type' => 'text', 'validation' => 'required|email:rfc'],
|
||||
['name' => 'client_address_line_1', 'label' => ctrans('texts.address1'), 'type' => 'text', 'validation' => 'required'],
|
||||
['name' => 'client_address_line_2', 'label' => ctrans('texts.address1'), 'type' => 'text', 'validation' => 'sometimes'],
|
||||
['name' => 'client_city', 'label' => ctrans('texts.city'), 'type' => 'text', 'validation' => 'required'],
|
||||
['name' => 'client_state', 'label' => ctrans('texts.state'), 'type' => 'text', 'validation' => 'required'],
|
||||
['name' => 'client_postal_code', 'label' => ctrans('texts.postal_code'), 'type' => 'text', 'validation' => 'required'],
|
||||
['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'select', 'validation' => 'required'],
|
||||
];
|
||||
}
|
||||
|
||||
|
2
public/css/app.css
vendored
2
public/css/app.css
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"/js/app.js": "/js/app.js?id=a33a5a58bfc6e2174841",
|
||||
"/css/app.css": "/css/app.css?id=7f1ae2f30438771b9dbe",
|
||||
"/css/app.css": "/css/app.css?id=0bc73459b671b24af838",
|
||||
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=a09bb529b8e1826f13b4",
|
||||
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1",
|
||||
"/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=cddcd46c630c71737bda",
|
||||
|
@ -12,13 +12,27 @@
|
||||
|
||||
<form wire:submit.prevent="handleSubmit(Object.fromEntries(new FormData($event.target)))">
|
||||
@foreach($fields as $field)
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => $field['label']])
|
||||
<input class="input w-full" type="{{ $field['type'] }}" name="{{ $field['name'] }}">
|
||||
@if(!array_key_exists('filled', $field))
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => $field['label']])
|
||||
@if($field['name'] == 'client_country_id' || $field['name'] == 'client_shipping_country_id')
|
||||
<select id="country" class="input w-full form-select" name="{{ $field['name'] }}">
|
||||
<option value="none"></option>
|
||||
|
||||
@if(session()->has('validation_errors') && array_key_exists($field['name'], session('validation_errors')))
|
||||
<p class="mt-2 text-gray-900 border-red-300 px-2 py-1 bg-gray-100">{{ session('validation_errors')[$field['name']][0] }}</p>
|
||||
@endif
|
||||
@endcomponent
|
||||
@foreach($countries as $country)
|
||||
<option value="{{ $country->id }}">
|
||||
{{ $country->iso_3166_2 }} ({{ $country->name }})
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<input class="input w-full" type="{{ $field['type'] }}" name="{{ $field['name'] }}">
|
||||
@endif
|
||||
|
||||
@if(session()->has('validation_errors') && array_key_exists($field['name'], session('validation_errors')))
|
||||
<p class="mt-2 text-gray-900 border-red-300 px-2 py-1 bg-gray-100">{{ session('validation_errors')[$field['name']][0] }}</p>
|
||||
@endif
|
||||
@endcomponent
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@component('portal.ninja2020.components.general.card-element-single')
|
||||
|
@ -1,88 +0,0 @@
|
||||
@extends('portal.ninja2020.layout.app')
|
||||
@section('meta_title', ctrans('texts.add_credit_card'))
|
||||
|
||||
@push('head')
|
||||
<meta name="authorize-public-key" content="{{ $public_client_id }}">
|
||||
<meta name="authorize-login-id" content="{{ $api_login_id }}">
|
||||
|
||||
<meta name="year-invalid" content="{{ ctrans('texts.year_invalid') }}">
|
||||
<meta name="month-invalid" content="{{ ctrans('texts.month_invalid') }}">
|
||||
<meta name="credit-card-invalid" content="{{ ctrans('texts.credit_card_invalid') }}">
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||
<script src="{{ asset('js/clients/payments/card-js.min.js') }}"></script>
|
||||
<link href="{{ asset('css/card-js.min.css') }}" rel="stylesheet" type="text/css">
|
||||
|
||||
@endpush
|
||||
|
||||
@section('body')
|
||||
<form action="{{ route('client.payment_methods.store', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}" method="post" id="server_response">
|
||||
|
||||
@csrf
|
||||
<input type="hidden" name="company_gateway_id" value="{{ $gateway->id }}">
|
||||
<input type="hidden" name="payment_method_id" value="1">
|
||||
<input type="hidden" name="gateway_response" id="gateway_response">
|
||||
<input type="hidden" name="is_default" id="is_default">
|
||||
<input type="hidden" name="dataValue" id="dataValue" />
|
||||
<input type="hidden" name="dataDescriptor" id="dataDescriptor" />
|
||||
</form>
|
||||
<div class="container mx-auto">
|
||||
<div class="grid grid-cols-6 gap-4">
|
||||
<div class="col-span-6 md:col-start-2 md:col-span-3">
|
||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||
@if(!Request::isSecure())
|
||||
<p class="alert alert-failure">{{ ctrans('texts.https_required') }}</p>
|
||||
@endif
|
||||
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||
{{ ctrans('texts.add_credit_card') }}
|
||||
</h3>
|
||||
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500" translate>
|
||||
{{ ctrans('texts.authorize_for_future_use') }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<dl>
|
||||
<div class="bg-gray-50 px-4 py-5 sm:px-6">
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 flex justify-center">
|
||||
@include('portal.ninja2020.gateways.authorize.credit_card')
|
||||
</dd>
|
||||
</div>
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.save_as_default') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
<input type="checkbox" class="form-checkbox cursor-pointer" name="proxy_is_default" id="proxy_is_default" />
|
||||
</dd>
|
||||
</div>
|
||||
<div class="bg-gray-50 px-4 py-5 flex justify-end">
|
||||
<div id="errors"></div>
|
||||
<button type="primary" class="button button-primary bg-primary" id="card_button">
|
||||
<svg class="animate-spin h-5 w-5 text-white hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
||||
<span>{{ __('texts.save') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
|
||||
@if($gateway->getConfigField('testMode'))
|
||||
<script src="https://jstest.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@else
|
||||
<script src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@endif
|
||||
|
||||
<script src="{{ asset('js/clients/payment_methods/authorize-authorize-card.js') }}"></script>
|
||||
@endpush
|
@ -1,10 +0,0 @@
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6" style="display: flex!important; justify-content: center!important;">
|
||||
<div class="card-js" id="my-card" data-capture-name="true">
|
||||
<input class="name" id="cardholder_name" name="card-holders-name" placeholder="{{ ctrans('texts.name')}}">
|
||||
<input class="card-number my-custom-class" id="card_number" name="card-number">
|
||||
<input class="expiry-month" name="expiry-month" id="expiration_month">
|
||||
<input class="expiry-year" name="expiry-year" id="expiration_year">
|
||||
<input class="cvc" name="cvc" id="cvv">
|
||||
</div>
|
||||
<div id="errors"></div>
|
||||
</div>
|
@ -0,0 +1,54 @@
|
||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.credit_card'), 'card_title' => ctrans('texts.credit_card')])
|
||||
|
||||
@section('gateway_head')
|
||||
<meta name="authorize-public-key" content="{{ $public_client_id }}">
|
||||
<meta name="authorize-login-id" content="{{ $api_login_id }}">
|
||||
<meta name="year-invalid" content="{{ ctrans('texts.year_invalid') }}">
|
||||
<meta name="month-invalid" content="{{ ctrans('texts.month_invalid') }}">
|
||||
<meta name="credit-card-invalid" content="{{ ctrans('texts.credit_card_invalid') }}">
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||
<script src="{{ asset('js/clients/payments/card-js.min.js') }}"></script>
|
||||
|
||||
<link href="{{ asset('css/card-js.min.css') }}" rel="stylesheet" type="text/css">
|
||||
@endsection
|
||||
|
||||
@section('gateway_content')
|
||||
<form action="{{ route('client.payment_methods.store', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}"
|
||||
method="post" id="server_response">
|
||||
@csrf
|
||||
|
||||
<input type="hidden" name="company_gateway_id" value="{{ $gateway->id }}">
|
||||
<input type="hidden" name="payment_method_id" value="1">
|
||||
<input type="hidden" name="gateway_response" id="gateway_response">
|
||||
<input type="hidden" name="is_default" id="is_default">
|
||||
<input type="hidden" name="dataValue" id="dataValue"/>
|
||||
<input type="hidden" name="dataDescriptor" id="dataDescriptor"/>
|
||||
</form>
|
||||
|
||||
@if(!Request::isSecure())
|
||||
<p class="alert alert-failure">{{ ctrans('texts.https_required') }}</p>
|
||||
@endif
|
||||
|
||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.method')])
|
||||
{{ ctrans('texts.credit_card') }}
|
||||
@endcomponent
|
||||
|
||||
@include('portal.ninja2020.gateways.authorize.includes.credit_card')
|
||||
|
||||
@component('portal.ninja2020.gateways.includes.pay_now', ['id' => 'card_button'])
|
||||
{{ ctrans('texts.add_payment_method') }}
|
||||
@endcomponent
|
||||
@endsection
|
||||
|
||||
@section('gateway_footer')
|
||||
@if($gateway->getConfigField('testMode'))
|
||||
<script src="https://jstest.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@else
|
||||
<script src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@endif
|
||||
|
||||
<script src="{{ asset('js/clients/payment_methods/authorize-authorize-card.js') }}"></script>
|
||||
@endsection
|
@ -0,0 +1,55 @@
|
||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.payment_type_credit_card'), 'card_title' => ctrans('texts.payment_type_credit_card')])
|
||||
|
||||
@section('gateway_head')
|
||||
<meta name="authorize-public-key" content="{{ $public_client_id }}">
|
||||
<meta name="authorize-login-id" content="{{ $api_login_id }}">
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||
<script src="{{ asset('js/clients/payments/card-js.min.js') }}"></script>
|
||||
|
||||
<link href="{{ asset('css/card-js.min.css') }}" rel="stylesheet" type="text/css">
|
||||
@endsection
|
||||
|
||||
@section('gateway_content')
|
||||
<form action="{{ route('client.payments.response') }}" method="post" id="server_response">
|
||||
@csrf
|
||||
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
|
||||
<input type="hidden" name="company_gateway_id" value="{{ $gateway->company_gateway->id }}">
|
||||
<input type="hidden" name="payment_method_id" value="1">
|
||||
<input type="hidden" name="gateway_response" id="gateway_response">
|
||||
<input type="hidden" name="dataValue" id="dataValue"/>
|
||||
<input type="hidden" name="dataDescriptor" id="dataDescriptor"/>
|
||||
<input type="hidden" name="token" id="token"/>
|
||||
<input type="hidden" name="store_card" id="store_card"/>
|
||||
<input type="hidden" name="amount_with_fee" id="amount_with_fee" value="{{ $total['amount_with_fee'] }}"/>
|
||||
</form>
|
||||
|
||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')])
|
||||
{{ ctrans('texts.credit_card') }}
|
||||
@endcomponent
|
||||
|
||||
@include('portal.ninja2020.gateways.includes.payment_details')
|
||||
|
||||
@if($token)
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.credit_card')])
|
||||
{{ strtoupper($token->meta->brand) }} - **** {{ $token->meta->last4 }}
|
||||
@endcomponent
|
||||
|
||||
@include('portal.ninja2020.gateways.includes.pay_now', ['id' => 'card_button', 'class' => 'pay_now_button', 'data' => ['id' => $token->hashed_id]])
|
||||
@else
|
||||
@include('portal.ninja2020.gateways.authorize.includes.credit_card')
|
||||
@include('portal.ninja2020.gateways.includes.pay_now', ['id' => 'card_button'])
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@section('gateway_footer')
|
||||
@if($gateway->company_gateway->getConfigField('testMode'))
|
||||
<script src="https://jstest.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@else
|
||||
<script src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@endif
|
||||
|
||||
<script src="{{ asset('js/clients/payments/authorize-credit-card-payment.js') }}"></script>
|
||||
@endsection
|
@ -1,154 +0,0 @@
|
||||
@extends('portal.ninja2020.layout.app')
|
||||
@section('meta_title', ctrans('texts.payment_type_credit_card'))
|
||||
|
||||
@push('head')
|
||||
<meta name="authorize-public-key" content="{{ $public_client_id }}">
|
||||
<meta name="authorize-login-id" content="{{ $api_login_id }}">
|
||||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||
<script src="{{ asset('js/clients/payments/card-js.min.js') }}"></script>
|
||||
<link href="{{ asset('css/card-js.min.css') }}" rel="stylesheet" type="text/css">
|
||||
|
||||
@endpush
|
||||
|
||||
@section('body')
|
||||
<form action="{{ route('client.payments.response') }}" method="post" id="server_response">
|
||||
@csrf
|
||||
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
|
||||
<input type="hidden" name="company_gateway_id" value="{{ $gateway->id }}">
|
||||
<input type="hidden" name="payment_method_id" value="1">
|
||||
<input type="hidden" name="gateway_response" id="gateway_response">
|
||||
<input type="hidden" name="dataValue" id="dataValue" />
|
||||
<input type="hidden" name="dataDescriptor" id="dataDescriptor" />
|
||||
<input type="hidden" name="token" id="token" />
|
||||
<input type="hidden" name="store_card" id="store_card" />
|
||||
<input type="hidden" name="amount_with_fee" id="amount_with_fee" value="{{ $total['amount_with_fee'] }}" />
|
||||
</form>
|
||||
<div class="container mx-auto">
|
||||
<div class="grid grid-cols-6 gap-4">
|
||||
<div class="col-span-6 md:col-start-2 md:col-span-4">
|
||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||
{{ ctrans('texts.enter_payment') }}
|
||||
</h3>
|
||||
</div>
|
||||
<div>
|
||||
@if($tokens->count() == 0)
|
||||
<dl>
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.subtotal') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['invoice_totals'], $client) }}
|
||||
</dd>
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.gateway_fees') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['fee_total'], $client) }}
|
||||
</dd>
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.total') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['amount_with_fee'], $client) }}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@include('portal.ninja2020.gateways.authorize.credit_card')
|
||||
|
||||
<div class="{{ ($gateway->token_billing == 'optin' || $gateway->token_billing == 'optout') ? 'sm:grid' : 'hidden' }} bg-gray-50 px-4 py-5 sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.token_billing_checkbox') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
<label class="mr-4">
|
||||
<input
|
||||
type="radio"
|
||||
class="form-radio cursor-pointer"
|
||||
name="store_card_checkbox"
|
||||
id="proxy_is_default"
|
||||
value="true"
|
||||
{{ ($gateway->token_billing == 'always' || $gateway->token_billing == 'optout') ? 'checked' : '' }} />
|
||||
<span class="ml-1 cursor-pointer">{{ ctrans('texts.yes') }}</span>
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
class="form-radio cursor-pointer"
|
||||
name="store_card_checkbox"
|
||||
id="proxy_is_default"
|
||||
value="false"
|
||||
{{ ($gateway->token_billing == 'off' || $gateway->token_billing == 'optin') ? 'checked' : '' }} />
|
||||
<span class="ml-1 cursor-pointer">{{ ctrans('texts.no') }}</span>
|
||||
</label>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="bg-white px-4 py-5 flex justify-end">
|
||||
<button class="button button-primary bg-primary" id="card_button">
|
||||
<svg class="animate-spin h-5 w-5 text-white hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
||||
<span>{{ __('texts.pay_now') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</dl>
|
||||
@else
|
||||
|
||||
<div>
|
||||
<dl>
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.totals') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['invoice_totals'], $client) }}
|
||||
</dd>
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.gateway_fees') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['fee_total'], $client) }}
|
||||
</dd>
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.amount') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['amount_with_fee'], $client) }}
|
||||
</dd>
|
||||
</div>
|
||||
@foreach($tokens as $token)
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ $token->meta->brand }} : {{ $token->meta->last4 }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
<button class="button button-primary bg-primary pay_now_button" data-id="{{ $token->hashed_id }}">{{ ctrans('texts.pay_now') }}</button>
|
||||
</dd>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
|
||||
@if($gateway->getConfigField('testMode'))
|
||||
<script src="https://jstest.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@else
|
||||
<script src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script>
|
||||
@endif
|
||||
|
||||
<script src="{{ asset('js/clients/payments/authorize-credit-card-payment.js') }}"></script>
|
||||
@endpush
|
@ -0,0 +1,12 @@
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"
|
||||
style="display: flex!important; justify-content: center!important;">
|
||||
<div class="card-js" id="my-card" data-capture-name="true">
|
||||
<input class="name" id="cardholder_name" name="card-holders-name" placeholder="{{ ctrans('texts.name')}}">
|
||||
<input class="card-number my-custom-class" id="card_number" name="card-number">
|
||||
<input class="expiry-month" name="expiry-month" id="expiration_month">
|
||||
<input class="expiry-year" name="expiry-year" id="expiration_year">
|
||||
<input class="cvc" name="cvc" id="cvv">
|
||||
</div>
|
||||
|
||||
<div id="errors"></div>
|
||||
</div>
|
@ -1,9 +1,10 @@
|
||||
<div class="bg-white px-4 py-5 flex justify-end">
|
||||
<button
|
||||
@isset($form) form="{{ $form }}" @endisset
|
||||
type="{{ $type ?? 'button' }}"
|
||||
id="{{ $id ?? 'pay-now' }}"
|
||||
class="button button-primary bg-primary">
|
||||
<button
|
||||
@isset($form) form="{{ $form }}" @endisset
|
||||
type="{{ $type ?? 'button' }}"
|
||||
id="{{ $id ?? 'pay-now' }}"
|
||||
@isset($data) @foreach($data as $prop => $value) data-{{ $prop }}="{{ $value }}" @endforeach @endisset
|
||||
class="button button-primary bg-primary {{ $class ?? '' }}">
|
||||
<svg class="animate-spin h-5 w-5 text-white hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
|
@ -11,7 +11,7 @@
|
||||
@endpush
|
||||
|
||||
@section('body')
|
||||
@livewire('required-client-info', ['fields' => method_exists($gateway, 'getClientRequiredFields') ? $gateway->getClientRequiredFields() : [], 'contact' => auth('contact')->user()])
|
||||
@livewire('required-client-info', ['fields' => method_exists($gateway, 'getClientRequiredFields') ? $gateway->getClientRequiredFields() : [], 'contact' => auth('contact')->user(), 'countries' => $countries])
|
||||
|
||||
<div class="container mx-auto grid grid-cols-12 opacity-25 pointer-events-none" data-ref="gateway-container">
|
||||
<div class="col-span-12 lg:col-span-6 lg:col-start-4 overflow-hidden bg-white shadow rounded-lg">
|
||||
|
Loading…
x
Reference in New Issue
Block a user