diff --git a/app/Http/Controllers/PublicClientController.php b/app/Http/Controllers/PublicClientController.php index 7cfb675c28d4..4cf6a346db45 100644 --- a/app/Http/Controllers/PublicClientController.php +++ b/app/Http/Controllers/PublicClientController.php @@ -267,6 +267,8 @@ class PublicClientController extends BaseController 'account' => $account, 'client' => $client, 'clientFontUrl' => $account->getFontsUrl(), + 'gateway' => $account->getTokenGateway(), + 'paymentMethods' => $this->paymentService->getClientPaymentMethods($client), ]; return response()->view('invited.dashboard', $data); @@ -711,7 +713,7 @@ class PublicClientController extends BaseController Session::flash('message', trans('texts.payment_method_verified')); } - return redirect()->to('/client/paymentmethods/'); + return redirect()->to($client->account->enable_client_portal?'/client/dashboard':'/client/paymentmethods/'); } public function removePaymentMethod($sourceId) @@ -729,7 +731,7 @@ class PublicClientController extends BaseController Session::flash('message', trans('texts.payment_method_removed')); } - return redirect()->to('/client/paymentmethods/'); + return redirect()->to($client->account->enable_client_portal?'/client/dashboard':'/client/paymentmethods/'); } public function addPaymentMethod($paymentType) @@ -813,10 +815,10 @@ class PublicClientController extends BaseController } else if ($paymentType == PAYMENT_TYPE_STRIPE_ACH && empty($usingPlaid) ) { // The user needs to complete verification Session::flash('message', trans('texts.bank_account_verification_next_steps')); - return Redirect::to('client/paymentmethods/'); + return Redirect::to($account->enable_client_portal?'/client/dashboard':'/client/paymentmethods/'); } else { Session::flash('message', trans('texts.payment_method_added')); - return redirect()->to('/client/paymentmethods/'); + return redirect()->to($account->enable_client_portal?'/client/dashboard':'/client/paymentmethods/'); } } @@ -826,11 +828,11 @@ class PublicClientController extends BaseController } $validator = Validator::make(Input::all(), array('source' => 'required')); + $client = $invitation->invoice->client; if ($validator->fails()) { - return Redirect::to('client/paymentmethods'); + return Redirect::to($client->account->enable_client_portal?'/client/dashboard':'/client/paymentmethods/'); } - $client = $invitation->invoice->client; $result = $this->paymentService->setClientDefaultPaymentMethod($client, Input::get('source')); if (is_string($result)) { @@ -839,7 +841,7 @@ class PublicClientController extends BaseController Session::flash('message', trans('texts.payment_method_set_as_default')); } - return redirect()->to('/client/paymentmethods/'); + return redirect()->to($client->account->enable_client_portal?'/client/dashboard':'/client/paymentmethods/'); } private function paymentMethodError($type, $error, $accountGateway = false, $exception = false) diff --git a/resources/views/invited/dashboard.blade.php b/resources/views/invited/dashboard.blade.php index 4af2cc53c9d3..c7c67b6489d9 100644 --- a/resources/views/invited/dashboard.blade.php +++ b/resources/views/invited/dashboard.blade.php @@ -126,7 +126,6 @@ @endif -
@@ -162,7 +161,14 @@
- + @if (!empty($paymentMethods)) +
+
+

{{ trans('texts.payment_methods') }}

+ @include('payments.paymentmethods_list') +
+
+ @endif
{!! Datatable::table() ->addColumn( diff --git a/resources/views/payments/paymentmethods.blade.php b/resources/views/payments/paymentmethods.blade.php index 1a368ebc8412..e7b1593922a0 100644 --- a/resources/views/payments/paymentmethods.blade.php +++ b/resources/views/payments/paymentmethods.blade.php @@ -1,149 +1,9 @@ @extends('public.header') @section('content') - -
-

{{ $title }}

- - @foreach ($paymentMethods as $paymentMethod) -
- - {{trans(name)))}}"> - - •••••{{$paymentMethod['last4']}} - - @if($paymentMethod['type']->id == PAYMENT_TYPE_ACH) - {{ $paymentMethod['bank_name'] }} - @if($paymentMethod['status'] == 'new') - ({{trans('texts.complete_verification')}}) - @elseif($paymentMethod['status'] == 'verification_failed') - ({{trans('texts.verification_failed')}}) - @endif - @else - {!! trans('texts.card_expiration', array('expires'=>Utils::fromSqlDate($paymentMethod['expiration'], false)->format('m/y'))) !!} - @endif - @if($paymentMethod['default']) - ({{trans('texts.used_for_auto_bill')}}) - @elseif($paymentMethod['type']->id != PAYMENT_TYPE_ACH || $paymentMethod['status'] == 'verified') - ({{trans('texts.use_for_auto_bill')}}) - @endif - × -
- @endforeach - -
- {!! Button::success(strtoupper(trans('texts.add_credit_card'))) - ->asLinkTo(URL::to('/client/paymentmethods/add/'.($gateway->getPaymentType() == PAYMENT_TYPE_STRIPE ? 'stripe_credit_card' : 'credit_card'))) !!} - @if($gateway->getACHEnabled()) -   - {!! Button::success(strtoupper(trans('texts.add_bank_account'))) - ->asLinkTo(URL::to('/client/paymentmethods/add/stripe_ach')) !!} - @endif -
+ @include('payments.paymentmethods_list')

- - - - - {!! Former::open(URL::to('/client/paymentmethods/default'))->id('defaultSourceForm') !!} - - {!! Former::close() !!} - - @stop \ No newline at end of file diff --git a/resources/views/payments/paymentmethods_list.blade.php b/resources/views/payments/paymentmethods_list.blade.php new file mode 100644 index 000000000000..4d88b907339e --- /dev/null +++ b/resources/views/payments/paymentmethods_list.blade.php @@ -0,0 +1,138 @@ + +@foreach ($paymentMethods as $paymentMethod) +
+ + {{trans(name)))}}"> + + •••••{{$paymentMethod['last4']}} + + @if($paymentMethod['type']->id == PAYMENT_TYPE_ACH) + {{ $paymentMethod['bank_name'] }} + @if($paymentMethod['status'] == 'new') + ({{trans('texts.complete_verification')}}) + @elseif($paymentMethod['status'] == 'verification_failed') + ({{trans('texts.verification_failed')}}) + @endif + @else + {!! trans('texts.card_expiration', array('expires'=>Utils::fromSqlDate($paymentMethod['expiration'], false)->format('m/y'))) !!} + @endif + @if($paymentMethod['default']) + ({{trans('texts.used_for_auto_bill')}}) + @elseif($paymentMethod['type']->id != PAYMENT_TYPE_ACH || $paymentMethod['status'] == 'verified') + ({{trans('texts.use_for_auto_bill')}}) + @endif + × +
+@endforeach + +
+ {!! Button::success(strtoupper(trans('texts.add_credit_card'))) + ->asLinkTo(URL::to('/client/paymentmethods/add/'.($gateway->getPaymentType() == PAYMENT_TYPE_STRIPE ? 'stripe_credit_card' : 'credit_card'))) !!} + @if($gateway->getACHEnabled()) +   + {!! Button::success(strtoupper(trans('texts.add_bank_account'))) + ->asLinkTo(URL::to('/client/paymentmethods/add/stripe_ach')) !!} + @endif +
+ + + + +{!! Former::open(URL::to('/client/paymentmethods/default'))->id('defaultSourceForm') !!} + +{!! Former::close() !!} + + \ No newline at end of file diff --git a/resources/views/public/header.blade.php b/resources/views/public/header.blade.php index dd2c5d6412d2..7ccc64f603f8 100644 --- a/resources/views/public/header.blade.php +++ b/resources/views/public/header.blade.php @@ -90,11 +90,11 @@ {!! link_to('/client/documents', trans('texts.documents') ) !!} @endif - @if (isset($account) && $account->getTokenGatewayId()) + @if (isset($account) && $account->getTokenGatewayId() && !$account->enable_client_portal_dashboard)
  • {!! link_to('/client/paymentmethods', trans('texts.payment_methods') ) !!}
  • - @endif + @endif
  • {!! link_to('/client/payments', trans('texts.payments') ) !!}