mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 00:04:29 -04:00
Move payment methods to dashboard when enabled
This commit is contained in:
parent
77bd6f7bc5
commit
37f4430e62
@ -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)
|
||||
|
@ -126,7 +126,6 @@
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-md-4-left">
|
||||
<div class="well">
|
||||
@ -162,7 +161,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!empty($paymentMethods))
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<h3>{{ trans('texts.payment_methods') }}</h3>
|
||||
@include('payments.paymentmethods_list')
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div style="min-height: 550px">
|
||||
{!! Datatable::table()
|
||||
->addColumn(
|
||||
|
@ -1,149 +1,9 @@
|
||||
@extends('public.header')
|
||||
|
||||
@section('content')
|
||||
<style type="text/css">
|
||||
.payment_method_img_container{
|
||||
width:37px;
|
||||
text-align: center;
|
||||
display:inline-block;
|
||||
margin-right:10px;
|
||||
}
|
||||
|
||||
.payment_method{
|
||||
margin:20px 0;
|
||||
}
|
||||
|
||||
.payment_method_number{
|
||||
margin-right:10px;
|
||||
width:65px;
|
||||
display:inline-block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container main-container">
|
||||
|
||||
<h3>{{ $title }}</h3>
|
||||
|
||||
@foreach ($paymentMethods as $paymentMethod)
|
||||
<div class="payment_method">
|
||||
<span class="payment_method_img_container">
|
||||
<img height="22" src="{{URL::to('/images/credit_cards/'.str_replace(' ', '', strtolower($paymentMethod['type']->name).'.png'))}}" alt="{{trans("texts.card_" . str_replace(' ', '', strtolower($paymentMethod['type']->name)))}}">
|
||||
</span>
|
||||
<span class="payment_method_number">•••••{{$paymentMethod['last4']}}</span>
|
||||
|
||||
@if($paymentMethod['type']->id == PAYMENT_TYPE_ACH)
|
||||
{{ $paymentMethod['bank_name'] }}
|
||||
@if($paymentMethod['status'] == 'new')
|
||||
<a href="javasript::void" onclick="completeVerification('{{$paymentMethod['id']}}','{{$paymentMethod['currency']->symbol}}')">({{trans('texts.complete_verification')}})</a>
|
||||
@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')
|
||||
<a href="#" onclick="setDefault('{{$paymentMethod['id']}}')">({{trans('texts.use_for_auto_bill')}})</a>
|
||||
@endif
|
||||
<a href="javasript::void" class="payment_method_remove" onclick="removePaymentMethod('{{$paymentMethod['id']}}')">×</a>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<center>
|
||||
{!! 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
|
||||
</center>
|
||||
@include('payments.paymentmethods_list')
|
||||
<p></p>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="completeVerificationModal" tabindex="-1" role="dialog" aria-labelledby="completeVerificationModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" style="min-width:150px">
|
||||
<div class="modal-content">
|
||||
{!! Former::open('/client/paymentmethods/verify') !!}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="completeVerificationModalLabel">{{ trans('texts.complete_verification') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div style="display:none">
|
||||
{!! Former::text('source_id') !!}
|
||||
</div>
|
||||
<p>{{ trans('texts.bank_account_verification_help') }}</p>
|
||||
<div class="form-group">
|
||||
<label for="verification1" class="control-label col-sm-5">{{ trans('texts.verification_amount1') }}</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="payment_method_currenct_symbol"></span>0.</span>
|
||||
<input type="number" min="0" max="99" required class="form-control" id="verification1" name="verification1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="verification2" class="control-label col-sm-5">{{ trans('texts.verification_amount2') }}</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="payment_method_currenct_symbol"></span>0.</span>
|
||||
<input type="number" min="0" max="99" required class="form-control" id="verification2" name="verification2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 0px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ trans('texts.complete_verification') }}</button>
|
||||
</div>
|
||||
{!! Former::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="removePaymentMethodModal" tabindex="-1" role="dialog" aria-labelledby="removePaymentMethodModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" style="min-width:150px">
|
||||
<div class="modal-content">
|
||||
{!! Former::open()->id('removeForm') !!}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="removePaymentMethodModalLabel">{{ trans('texts.remove_payment_method') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{{ trans('texts.confirm_remove_payment_method') }}</p>
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 0px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ trans('texts.remove') }}</button>
|
||||
</div>
|
||||
{!! Former::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{!! Former::open(URL::to('/client/paymentmethods/default'))->id('defaultSourceForm') !!}
|
||||
<input type="hidden" name="source" id="default_id">
|
||||
{!! Former::close() !!}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function completeVerification(sourceId, currencySymbol) {
|
||||
$('#source_id').val(sourceId);
|
||||
$('.payment_method_currenct_symbol').text(currencySymbol);
|
||||
$('#completeVerificationModal').modal('show');
|
||||
}
|
||||
|
||||
function removePaymentMethod(sourceId) {
|
||||
$('#removeForm').attr('action', '{{ URL::to('/client/paymentmethods/%s/remove') }}'.replace('%s', sourceId))
|
||||
$('#removePaymentMethodModal').modal('show');
|
||||
}
|
||||
|
||||
function setDefault(sourceId) {
|
||||
$('#default_id').val(sourceId);
|
||||
$('#defaultSourceForm').submit()
|
||||
}
|
||||
</script>
|
||||
@stop
|
138
resources/views/payments/paymentmethods_list.blade.php
Normal file
138
resources/views/payments/paymentmethods_list.blade.php
Normal file
@ -0,0 +1,138 @@
|
||||
<style type="text/css">
|
||||
.payment_method_img_container{
|
||||
width:37px;
|
||||
text-align: center;
|
||||
display:inline-block;
|
||||
margin-right:10px;
|
||||
}
|
||||
|
||||
.payment_method{
|
||||
margin:20px 0;
|
||||
}
|
||||
|
||||
.payment_method_number{
|
||||
margin-right:10px;
|
||||
width:65px;
|
||||
display:inline-block;
|
||||
}
|
||||
</style>
|
||||
@foreach ($paymentMethods as $paymentMethod)
|
||||
<div class="payment_method">
|
||||
<span class="payment_method_img_container">
|
||||
<img height="22" src="{{URL::to('/images/credit_cards/'.str_replace(' ', '', strtolower($paymentMethod['type']->name).'.png'))}}" alt="{{trans("texts.card_" . str_replace(' ', '', strtolower($paymentMethod['type']->name)))}}">
|
||||
</span>
|
||||
<span class="payment_method_number">•••••{{$paymentMethod['last4']}}</span>
|
||||
|
||||
@if($paymentMethod['type']->id == PAYMENT_TYPE_ACH)
|
||||
{{ $paymentMethod['bank_name'] }}
|
||||
@if($paymentMethod['status'] == 'new')
|
||||
<a href="javasript::void" onclick="completeVerification('{{$paymentMethod['id']}}','{{$paymentMethod['currency']->symbol}}')">({{trans('texts.complete_verification')}})</a>
|
||||
@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')
|
||||
<a href="#" onclick="setDefault('{{$paymentMethod['id']}}')">({{trans('texts.use_for_auto_bill')}})</a>
|
||||
@endif
|
||||
<a href="javasript::void" class="payment_method_remove" onclick="removePaymentMethod('{{$paymentMethod['id']}}')">×</a>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<center>
|
||||
{!! 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
|
||||
</center>
|
||||
|
||||
<div class="modal fade" id="completeVerificationModal" tabindex="-1" role="dialog" aria-labelledby="completeVerificationModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" style="min-width:150px">
|
||||
<div class="modal-content">
|
||||
{!! Former::open('/client/paymentmethods/verify') !!}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="completeVerificationModalLabel">{{ trans('texts.complete_verification') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div style="display:none">
|
||||
{!! Former::text('source_id') !!}
|
||||
</div>
|
||||
<p>{{ trans('texts.bank_account_verification_help') }}</p>
|
||||
<div class="form-group">
|
||||
<label for="verification1" class="control-label col-sm-5">{{ trans('texts.verification_amount1') }}</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="payment_method_currenct_symbol"></span>0.</span>
|
||||
<input type="number" min="0" max="99" required class="form-control" id="verification1" name="verification1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="verification2" class="control-label col-sm-5">{{ trans('texts.verification_amount2') }}</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="payment_method_currenct_symbol"></span>0.</span>
|
||||
<input type="number" min="0" max="99" required class="form-control" id="verification2" name="verification2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 0px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ trans('texts.complete_verification') }}</button>
|
||||
</div>
|
||||
{!! Former::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="removePaymentMethodModal" tabindex="-1" role="dialog" aria-labelledby="removePaymentMethodModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" style="min-width:150px">
|
||||
<div class="modal-content">
|
||||
{!! Former::open()->id('removeForm') !!}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="removePaymentMethodModalLabel">{{ trans('texts.remove_payment_method') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{{ trans('texts.confirm_remove_payment_method') }}</p>
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 0px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ trans('texts.remove') }}</button>
|
||||
</div>
|
||||
{!! Former::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{!! Former::open(URL::to('/client/paymentmethods/default'))->id('defaultSourceForm') !!}
|
||||
<input type="hidden" name="source" id="default_id">
|
||||
{!! Former::close() !!}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function completeVerification(sourceId, currencySymbol) {
|
||||
$('#source_id').val(sourceId);
|
||||
$('.payment_method_currenct_symbol').text(currencySymbol);
|
||||
$('#completeVerificationModal').modal('show');
|
||||
}
|
||||
|
||||
function removePaymentMethod(sourceId) {
|
||||
$('#removeForm').attr('action', '{{ URL::to('/client/paymentmethods/%s/remove') }}'.replace('%s', sourceId))
|
||||
$('#removePaymentMethodModal').modal('show');
|
||||
}
|
||||
|
||||
function setDefault(sourceId) {
|
||||
$('#default_id').val(sourceId);
|
||||
$('#defaultSourceForm').submit()
|
||||
}
|
||||
</script>
|
@ -90,7 +90,7 @@
|
||||
{!! link_to('/client/documents', trans('texts.documents') ) !!}
|
||||
</li>
|
||||
@endif
|
||||
@if (isset($account) && $account->getTokenGatewayId())
|
||||
@if (isset($account) && $account->getTokenGatewayId() && !$account->enable_client_portal_dashboard)
|
||||
<li {{ Request::is('*client/paymentmethods') ? 'class="active"' : '' }}>
|
||||
{!! link_to('/client/paymentmethods', trans('texts.payment_methods') ) !!}
|
||||
</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user