1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +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

@ -356,7 +356,7 @@ class ClientPortalController extends BaseController
'clientFontUrl' => $account->getFontsUrl(), 'clientFontUrl' => $account->getFontsUrl(),
'entityType' => ENTITY_PAYMENT, 'entityType' => ENTITY_PAYMENT,
'title' => trans('texts.payments'), '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); 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('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('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_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('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('payment_date', function ($model) { return Utils::dateToString($model->payment_date); })
->addColumn('status', function ($model) { return $this->getPaymentStatusLabel($model); }) ->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); return redirect()->to('view/' . $invitation->invitation_key);
} catch (Exception $exception) { } 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)) { if (is_string($exception)) {
$displayError = $exception; $displayError = $exception;
@ -100,7 +100,8 @@ class OnlinePaymentController extends BaseController
$message = sprintf('Payment Error [%s]: %s', $paymentDriver->providerName(), $logError); $message = sprintf('Payment Error [%s]: %s', $paymentDriver->providerName(), $logError);
Utils::logError($message, 'PHP', true); 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) { public function getBankInfo($routingNumber) {

View File

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

View File

@ -59,7 +59,7 @@ class PaymentDatatable extends EntityDatatable
$card_type = trans("texts.card_" . $code); $card_type = trans("texts.card_" . $code);
if ($model->payment_type_id != PAYMENT_TYPE_ACH) { if ($model->payment_type_id != PAYMENT_TYPE_ACH) {
if($model->last4) { 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; 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) { } elseif ($model->email) {
return $model->email; return $model->email;

View File

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

View File

@ -1357,6 +1357,8 @@ $LANG = array(
'use_bank_on_file' => 'Use Bank on File', '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.', 'auto_bill_email_message' => 'This invoice will automatically be billed to the payment method on file on the due date.',
'bitcoin' => 'Bitcoin', '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>
<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> <canvas id="theCanvas" style="display:none;width:100%;border:solid 1px #CCCCCC;"></canvas>
@if (!Utils::isNinja() || !Utils::isPro()) @if (!Utils::isNinja() || !Utils::isPro())
@ -140,6 +140,7 @@
canvas.width = viewport.width; canvas.width = viewport.width;
page.render({canvasContext: context, viewport: viewport}); page.render({canvasContext: context, viewport: viewport});
$('#theFrame').hide();
$('#theCanvas').show(); $('#theCanvas').show();
isRefreshing = false; isRefreshing = false;
if (needsRefresh) { if (needsRefresh) {

View File

@ -93,25 +93,30 @@
@else @else
{{ trans('texts.bank_account') }} {{ trans('texts.bank_account') }}
@endif @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) @elseif($paymentMethod->payment_type_id == PAYMENT_TYPE_PAYPAL)
{{ trans('texts.paypal') . ': ' . $paymentMethod->email }} {{ trans('texts.paypal') . ': ' . $paymentMethod->email }}
@else @else
{{ trans('texts.credit_card') }} {{ trans('texts.credit_card') }}
@endif @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) @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) @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 @endif
<a href="#" title="{{ trans('texts.remove') }}" class="payment_method_remove" onclick="removePaymentMethod('{{$paymentMethod->public_id}}')">&times;</a> <a href="#" title="{{ trans('texts.remove') }}" class="payment_method_remove" onclick="removePaymentMethod('{{$paymentMethod->public_id}}')">&times;</a>

View File

@ -53,11 +53,21 @@
function getStarted() { function getStarted() {
$('#startForm').submit(); $('#startForm').submit();
return false; 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> </script>
<nav class="navbar navbar-top navbar-inverse"> <div id="header">
<nav class="navbar navbar-top navbar-inverse">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
@ -102,7 +112,7 @@
@endif @endif
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>
</nav> </nav>
<div class="container"> <div class="container">
@ -120,8 +130,11 @@
<div class="alert alert-danger">{!! Session::get('error') !!}</div> <div class="alert alert-danger">{!! Session::get('error') !!}</div>
@endif @endif
</div> </div>
</div>
@yield('content') <div id="mainContent">
@yield('content')
</div>
<footer id="footer" role="contentinfo"> <footer id="footer" role="contentinfo">
<div class="top"> <div class="top">