1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Refactor 'update' to 'capture'

This commit is contained in:
Hillel Coren 2018-03-09 15:24:24 +02:00
parent 61d70b09e8
commit 1b364bde4e
8 changed files with 13 additions and 13 deletions

View File

@ -75,14 +75,14 @@ class OnlinePaymentController extends BaseController
]);
}
if (! $invitation->invoice->canBePaid() && ! request()->update) {
if (! request()->capture && ! $invitation->invoice->canBePaid()) {
return redirect()->to('view/' . $invitation->invitation_key);
}
$invitation = $invitation->load('invoice.client.account.account_gateways.gateway');
$account = $invitation->account;
if ($account->requiresAuthorization($invitation->invoice) && ! session('authorized:' . $invitation->invitation_key)) {
if (! request()->capture && $account->requiresAuthorization($invitation->invoice) && ! session('authorized:' . $invitation->invitation_key)) {
return redirect()->to('view/' . $invitation->invitation_key);
}
@ -126,14 +126,14 @@ class OnlinePaymentController extends BaseController
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
if (! $invitation->invoice->canBePaid() && ! request()->update) {
if (! $invitation->invoice->canBePaid() && ! request()->capture) {
return redirect()->to('view/' . $invitation->invitation_key);
}
try {
$paymentDriver->completeOnsitePurchase($request->all());
if (request()->update) {
if (request()->capture) {
return redirect('/client/dashboard')->withMessage(trans('texts.updated_payment_details'));
} elseif ($paymentDriver->isTwoStep()) {
Session::flash('warning', trans('texts.bank_account_verification_next_steps'));

View File

@ -164,8 +164,8 @@ class BasePaymentDriver
}
$url = 'payment/' . $this->invitation->invitation_key;
if (request()->update) {
$url .= '?update=true';
if (request()->capture) {
$url .= '?capture=true';
}
$data = [
@ -303,7 +303,7 @@ class BasePaymentDriver
}
}
if ($this->isTwoStep() || request()->update) {
if ($this->isTwoStep() || request()->capture) {
return;
}

View File

@ -29,7 +29,7 @@
<center>
@if(isset($amount))
{!! Button::success(request()->update ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
{!! Button::success(request()->capture ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
->submit()
->large() !!}
@else

View File

@ -450,7 +450,7 @@
@endif
@if (isset($amount))
{!! Button::success(request()->update ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
{!! Button::success(request()->capture ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
->submit()
->large() !!}
@else

View File

@ -15,7 +15,7 @@
<header>
@if ($client && isset($invoiceNumber))
<h2>{{ $client->getDisplayName() }}</h2>
@if (request()->update)
@if (request()->capture)
<h3>{{ trans('texts.update_payment_details') }}</h3>
@else
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>|&nbsp; {{ trans('texts.amount_due') }}: <em>{{ $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) }}</em></span></h3>

View File

@ -86,7 +86,7 @@
&& $account->getGatewayByType(GATEWAY_TYPE_TOKEN)
&& $account->token_billing_type_id != TOKEN_BILLING_DISABLED)
&nbsp;&nbsp;
{!! Button::success(strtoupper(trans(!empty($paymentMethods) && count($paymentMethods) ? 'texts.update_credit_card' : 'texts.add_credit_card')))->asLinkTo(URL::to("/payment/$invitationKey/credit_card?update=true")) !!}
{!! Button::success(strtoupper(trans(!empty($paymentMethods) && count($paymentMethods) ? 'texts.update_credit_card' : 'texts.add_credit_card')))->asLinkTo(URL::to("/payment/$invitationKey/credit_card?capture=true")) !!}
@endif
</h3>

View File

@ -249,7 +249,7 @@
->large() !!}
@if ($accountGateway->getPlaidEnabled() && !empty($amount))
{!! Button::success(request()->update ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
{!! Button::success(request()->capture ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
->submit()
->withAttributes(['style'=>'display:none', 'id'=>'pay_now_button'])
->large() !!}

View File

@ -33,7 +33,7 @@
{!! Button::normal(strtoupper(trans('texts.cancel')))->large()->asLinkTo($invitation->getLink()) !!}
&nbsp;&nbsp;
@if (isset($amount))
{!! Button::success(request()->update ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
{!! Button::success(request()->capture ? strtoupper(trans('texts.submit')) : strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) ))
->submit()
->large() !!}
@else