1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Minor fixes for payments

This commit is contained in:
Hillel Coren 2016-06-22 12:22:38 +03:00
parent c9a19cbd76
commit e2ddabe95d
12 changed files with 102 additions and 113 deletions

View File

@ -137,7 +137,7 @@ class ClientPortalController extends BaseController
$data += [
'transactionToken' => $paymentDriver->createTransactionToken(),
'partialView' => $paymentDriver->partialView(),
'accountGateway' => $paymentDriver->accountGateway,
'accountGateway' => $paymentDriver->accountGateway,
];
}
@ -356,7 +356,7 @@ class ClientPortalController extends BaseController
'clientFontUrl' => $account->getFontsUrl(),
'entityType' => ENTITY_PAYMENT,
'title' => trans('texts.payments'),
'columns' => Utils::trans(['invoice', 'transaction_reference', 'method', 'source', 'payment_amount', 'payment_date', 'status'])
'columns' => Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date', 'status'])
];
return response()->view('public_list', $data);
@ -373,32 +373,6 @@ class ClientPortalController extends BaseController
->addColumn('invoice_number', function ($model) { return $model->invitation_key ? link_to('/view/'.$model->invitation_key, $model->invoice_number)->toHtml() : $model->invoice_number; })
->addColumn('transaction_reference', function ($model) { return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>'; })
->addColumn('payment_type', function ($model) { return ($model->payment_type && !$model->last4) ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : ''); })
->addColumn('payment_source', function ($model) {
$code = str_replace(' ', '', strtolower($model->payment_type));
$card_type = trans("texts.card_" . $code);
if ($model->payment_type_id != PAYMENT_TYPE_ACH) {
if($model->last4) {
$expiration = trans('texts.card_expiration', array('expires' => Utils::fromSqlDate($model->expiration, false)->format('m/y')));
return '<img height="22" src="' . URL::to('/images/credit_cards/' . $code . '.png') . '" alt="' . htmlentities($card_type) . '">&nbsp; &bull;&bull;&bull;' . $model->last4 . ' ' . $expiration;
} elseif ($model->email) {
return $model->email;
}
} elseif ($model->last4) {
if($model->bank_name) {
$bankName = $model->bank_name;
} else {
$bankData = PaymentMethod::lookupBankData($model->routing_number);
if($bankData) {
$bankName = $bankData->name;
}
}
if (!empty($bankName)) {
return $bankName.'&nbsp; &bull;&bull;&bull;' . $model->last4;
} elseif($model->last4) {
return '<img height="22" src="' . URL::to('/images/credit_cards/ach.png') . '" alt="' . htmlentities($card_type) . '">&nbsp; &bull;&bull;&bull;' . $model->last4;
}
}
})
->addColumn('amount', function ($model) { return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id); })
->addColumn('payment_date', function ($model) { return Utils::dateToString($model->payment_date); })
->addColumn('status', function ($model) { return $this->getPaymentStatusLabel($model); })

View File

@ -58,7 +58,7 @@ class OnlinePaymentController extends BaseController
}
return redirect()->to('view/' . $invitation->invitation_key);
} catch (Exception $exception) {
return $this->error($paymentDriver, $exception);
return $this->error($paymentDriver, $exception, true);
}
}
@ -84,7 +84,7 @@ class OnlinePaymentController extends BaseController
}
}
private function error($paymentDriver, $exception)
private function error($paymentDriver, $exception, $showPayment)
{
if (is_string($exception)) {
$displayError = $exception;
@ -100,7 +100,8 @@ class OnlinePaymentController extends BaseController
$message = sprintf('Payment Error [%s]: %s', $paymentDriver->providerName(), $logError);
Utils::logError($message, 'PHP', true);
return redirect()->to('view/' . $paymentDriver->invitation->invitation_key);
$route = $showPayment ? 'payment/' : 'view/';
return redirect()->to($route . $paymentDriver->invitation->invitation_key);
}
public function getBankInfo($routingNumber) {

View File

@ -31,7 +31,7 @@ class PaymentController extends BaseController
return View::make('list', array(
'entityType' => ENTITY_PAYMENT,
'title' => trans('texts.payments'),
'sortCol' => '6',
'sortCol' => '7',
'columns' => Utils::trans([
'checkbox',
'invoice',

View File

@ -59,7 +59,7 @@ class PaymentDatatable extends EntityDatatable
$card_type = trans("texts.card_" . $code);
if ($model->payment_type_id != PAYMENT_TYPE_ACH) {
if($model->last4) {
$expiration = trans('texts.card_expiration', array('expires' => Utils::fromSqlDate($model->expiration, false)->format('m/y')));
$expiration = Utils::fromSqlDate($model->expiration, false)->format('m/y');
return '<img height="22" src="' . URL::to('/images/credit_cards/' . $code . '.png') . '" alt="' . htmlentities($card_type) . '">&nbsp; &bull;&bull;&bull;' . $model->last4 . ' ' . $expiration;
} elseif ($model->email) {
return $model->email;

View File

@ -15,6 +15,7 @@ class WePayPaymentDriver extends BasePaymentDriver
];
}
/*
public function startPurchase($input = false, $sourceId = false)
{
$data = parent::startPurchase($input, $sourceId);
@ -27,6 +28,7 @@ class WePayPaymentDriver extends BasePaymentDriver
return $data;
}
*/
public function tokenize()
{
@ -167,7 +169,7 @@ class WePayPaymentDriver extends BasePaymentDriver
if ($response->state == 'deleted') {
return parent::removePaymentMethod($paymentMethod);
} else {
throw new Exception();
throw new Exception(trans('texts.failed_remove_payment_method'));
}
}

View File

@ -793,7 +793,7 @@ html {
.navbar-header {
padding-top: 4px;
padding-bottom: 4px;
padding-bottom: 4px;
}
.navbar li a {
padding-top: 18px;
@ -806,7 +806,7 @@ html {
.navbar {
x-moz-box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
x-webkit-box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
x-webkit-box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
}
@ -894,7 +894,7 @@ table.table thead .sorting_desc_disabled:after { content: '' !important }
font-weight: 500;
}
@media screen and (min-width: 700px) {
@media screen and (min-width: 700px) {
#footer .top {
padding: 27px 0;
}
@ -935,7 +935,7 @@ th {border-left: 1px solid #FFFFFF; }
table.dataTable.no-footer {
border-bottom: none;
}
.table-striped>tbody>tr:nth-child(odd)>td,
.table-striped>tbody>tr:nth-child(odd)>td,
.table-striped>tbody>tr:nth-child(odd)>th {
background-color: #FDFDFD;
}
@ -969,4 +969,4 @@ table td {
}
/* hide table sorting indicators */
table.data-table thead .sorting { background: url('') no-repeat center right; }
table.data-table thead .sorting { background: url('') no-repeat center right; }

View File

@ -10,7 +10,7 @@ html {
.navbar-header {
padding-top: 4px;
padding-bottom: 4px;
padding-bottom: 4px;
}
.navbar li a {
padding-top: 18px;
@ -23,7 +23,7 @@ html {
.navbar {
x-moz-box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
x-webkit-box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
x-webkit-box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
box-shadow: 0 0 10px 2px rgba(0,0,0,.05);
}
@ -111,7 +111,7 @@ table.table thead .sorting_desc_disabled:after { content: '' !important }
font-weight: 500;
}
@media screen and (min-width: 700px) {
@media screen and (min-width: 700px) {
#footer .top {
padding: 27px 0;
}
@ -152,7 +152,7 @@ th {border-left: 1px solid #FFFFFF; }
table.dataTable.no-footer {
border-bottom: none;
}
.table-striped>tbody>tr:nth-child(odd)>td,
.table-striped>tbody>tr:nth-child(odd)>td,
.table-striped>tbody>tr:nth-child(odd)>th {
background-color: #FDFDFD;
}
@ -186,4 +186,4 @@ table td {
}
/* hide table sorting indicators */
table.data-table thead .sorting { background: url('') no-repeat center right; }
table.data-table thead .sorting { background: url('') no-repeat center right; }

View File

@ -1357,6 +1357,8 @@ $LANG = array(
'use_bank_on_file' => 'Use Bank on File',
'auto_bill_email_message' => 'This invoice will automatically be billed to the payment method on file on the due date.',
'bitcoin' => 'Bitcoin',
'added_on' => 'Added :date',
'failed_remove_payment_method' => 'Failed to remove the payment method',
);

View File

@ -16,13 +16,4 @@
<p>&nbsp;<p>
<p>&nbsp;<p>
<script type="text/javascript">
$(function() {
var height = $(window).height() - ($('.navbar').height() + $('footer').height() + 200);
$('.well').height(Math.max(200, height));
});
</script>
@stop
@stop

View File

@ -1,4 +1,4 @@
<iframe id="theFrame" style="display:none" frameborder="1" width="100%" height="{{ isset($pdfHeight) ? $pdfHeight : 1180 }}px"></iframe>
<iframe id="theFrame" style="display:block" frameborder="1" width="100%" height="{{ isset($pdfHeight) ? $pdfHeight : 1180 }}px"></iframe>
<canvas id="theCanvas" style="display:none;width:100%;border:solid 1px #CCCCCC;"></canvas>
@if (!Utils::isNinja() || !Utils::isPro())
@ -140,6 +140,7 @@
canvas.width = viewport.width;
page.render({canvasContext: context, viewport: viewport});
$('#theFrame').hide();
$('#theCanvas').show();
isRefreshing = false;
if (needsRefresh) {

View File

@ -93,25 +93,30 @@
@else
{{ trans('texts.bank_account') }}
@endif
@if($paymentMethod->status == PAYMENT_METHOD_STATUS_NEW)
@if($gateway->gateway_id == GATEWAY_STRIPE)
<a href="#" onclick="completeVerification('{{$paymentMethod->public_id}}','{{$paymentMethod->currency->symbol}}')">({{trans('texts.complete_verification')}})</a>
@else
({{ trans('texts.verification_pending') }})
@endif
@elseif($paymentMethod->status == PAYMENT_METHOD_STATUS_VERIFICATION_FAILED)
({{trans('texts.verification_failed')}})
@endif
@elseif($paymentMethod->payment_type_id == PAYMENT_TYPE_PAYPAL)
{{ trans('texts.paypal') . ': ' . $paymentMethod->email }}
@else
{{ trans('texts.credit_card') }}
@endif
- {{ trans('texts.added_on', ['date' => Utils::dateToString($paymentMethod->created_at)]) }}
@if($paymentMethod->payment_type_id == PAYMENT_TYPE_ACH)
@if($paymentMethod->status == PAYMENT_METHOD_STATUS_NEW)
@if($gateway->gateway_id == GATEWAY_STRIPE)
<a href="#" onclick="completeVerification('{{$paymentMethod->public_id}}','{{$paymentMethod->currency->symbol}}')">({{trans('texts.complete_verification')}})</a>
@else
[{{ trans('texts.verification_pending') }}]
@endif
@elseif($paymentMethod->status == PAYMENT_METHOD_STATUS_VERIFICATION_FAILED)
[{{trans('texts.verification_failed')}}]
@endif
@endif
@if($paymentMethod->id == $paymentMethod->account_gateway_token->default_payment_method_id)
({{trans('texts.used_for_auto_bill')}})
[{{trans('texts.used_for_auto_bill')}}]
@elseif($paymentMethod->payment_type_id != PAYMENT_TYPE_ACH || $paymentMethod->status == PAYMENT_METHOD_STATUS_VERIFIED)
<a href="#" onclick="setDefault('{{$paymentMethod->public_id}}')">({{trans('texts.use_for_auto_bill')}})</a>
[<a href="#" onclick="setDefault('{{$paymentMethod->public_id}}')">{{trans('texts.use_for_auto_bill')}}</a>]
@endif
<a href="#" title="{{ trans('texts.remove') }}" class="payment_method_remove" onclick="removePaymentMethod('{{$paymentMethod->public_id}}')">&times;</a>

View File

@ -53,56 +53,66 @@
function getStarted() {
$('#startForm').submit();
return false;
}
}
$(function() {
// check that the footer appears at the bottom of the screen
var height = $(window).height() - ($('#header').height() + $('#footer').height());
if ($('#mainContent').height() < height) {
$('#mainContent').height(height);
}
})
</script>
<nav class="navbar navbar-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@if (!isset($account) || !$account->hasFeature(FEATURE_WHITE_LABEL))
{{-- Per our license, please do not remove or modify this link. --}}
<a class="navbar-brand" href="{{ URL::to(NINJA_WEB_URL) }}" target="_blank"><img src="{{ asset('images/invoiceninja-logo.png') }}" style="height:20px"></a>
@endif
<div id="header">
<nav class="navbar navbar-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@if (!isset($account) || !$account->hasFeature(FEATURE_WHITE_LABEL))
{{-- Per our license, please do not remove or modify this link. --}}
<a class="navbar-brand" href="{{ URL::to(NINJA_WEB_URL) }}" target="_blank"><img src="{{ asset('images/invoiceninja-logo.png') }}" style="height:20px"></a>
@endif
</div>
<div id="navbar" class="collapse navbar-collapse">
@if (!isset($account) || $account->isNinjaAccount() || $account->enable_client_portal)
<ul class="nav navbar-nav navbar-right">
@if (!isset($account) || $account->enable_client_portal_dashboard)
<li {{ Request::is('*client/dashboard') ? 'class="active"' : '' }}>
{!! link_to('/client/dashboard', trans('texts.dashboard') ) !!}
</li>
@endif
<li {{ Request::is('*client/quotes') ? 'class="active"' : '' }}>
{!! link_to('/client/quotes', trans('texts.quotes') ) !!}
</li>
<li {{ Request::is('*client/invoices') ? 'class="active"' : '' }}>
{!! link_to('/client/invoices', trans('texts.invoices') ) !!}
</li>
@if (isset($account) && $account->hasFeature(FEATURE_DOCUMENTS))
<li {{ Request::is('*client/documents') ? 'class="active"' : '' }}>
{!! link_to('/client/documents', trans('texts.documents') ) !!}
</li>
@endif
@if (isset($account) && $account->getTokenGatewayId() && !$account->enable_client_portal_dashboard)
<li {{ Request::is('*client/payment_methods') ? 'class="active"' : '' }}>
{!! link_to('/client/payment_methods', trans('texts.payment_methods') ) !!}
</li>
@endif
<li {{ Request::is('*client/payments') ? 'class="active"' : '' }}>
{!! link_to('/client/payments', trans('texts.payments') ) !!}
</li>
</ul>
@endif
</div><!--/.nav-collapse -->
</div>
<div id="navbar" class="collapse navbar-collapse">
@if (!isset($account) || $account->isNinjaAccount() || $account->enable_client_portal)
<ul class="nav navbar-nav navbar-right">
@if (!isset($account) || $account->enable_client_portal_dashboard)
<li {{ Request::is('*client/dashboard') ? 'class="active"' : '' }}>
{!! link_to('/client/dashboard', trans('texts.dashboard') ) !!}
</li>
@endif
<li {{ Request::is('*client/quotes') ? 'class="active"' : '' }}>
{!! link_to('/client/quotes', trans('texts.quotes') ) !!}
</li>
<li {{ Request::is('*client/invoices') ? 'class="active"' : '' }}>
{!! link_to('/client/invoices', trans('texts.invoices') ) !!}
</li>
@if (isset($account) && $account->hasFeature(FEATURE_DOCUMENTS))
<li {{ Request::is('*client/documents') ? 'class="active"' : '' }}>
{!! link_to('/client/documents', trans('texts.documents') ) !!}
</li>
@endif
@if (isset($account) && $account->getTokenGatewayId() && !$account->enable_client_portal_dashboard)
<li {{ Request::is('*client/payment_methods') ? 'class="active"' : '' }}>
{!! link_to('/client/payment_methods', trans('texts.payment_methods') ) !!}
</li>
@endif
<li {{ Request::is('*client/payments') ? 'class="active"' : '' }}>
{!! link_to('/client/payments', trans('texts.payments') ) !!}
</li>
</ul>
@endif
</div><!--/.nav-collapse -->
</div>
</nav>
</nav>
<div class="container">
@ -120,8 +130,11 @@
<div class="alert alert-danger">{!! Session::get('error') !!}</div>
@endif
</div>
</div>
@yield('content')
<div id="mainContent">
@yield('content')
</div>
<footer id="footer" role="contentinfo">
<div class="top">