mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-08-11 15:34:21 -04:00
Refactor 'update' to 'capture'
This commit is contained in:
parent
61d70b09e8
commit
1b364bde4e
@ -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);
|
return redirect()->to('view/' . $invitation->invitation_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$invitation = $invitation->load('invoice.client.account.account_gateways.gateway');
|
$invitation = $invitation->load('invoice.client.account.account_gateways.gateway');
|
||||||
$account = $invitation->account;
|
$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);
|
return redirect()->to('view/' . $invitation->invitation_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,14 +126,14 @@ class OnlinePaymentController extends BaseController
|
|||||||
|
|
||||||
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
|
$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);
|
return redirect()->to('view/' . $invitation->invitation_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$paymentDriver->completeOnsitePurchase($request->all());
|
$paymentDriver->completeOnsitePurchase($request->all());
|
||||||
|
|
||||||
if (request()->update) {
|
if (request()->capture) {
|
||||||
return redirect('/client/dashboard')->withMessage(trans('texts.updated_payment_details'));
|
return redirect('/client/dashboard')->withMessage(trans('texts.updated_payment_details'));
|
||||||
} elseif ($paymentDriver->isTwoStep()) {
|
} elseif ($paymentDriver->isTwoStep()) {
|
||||||
Session::flash('warning', trans('texts.bank_account_verification_next_steps'));
|
Session::flash('warning', trans('texts.bank_account_verification_next_steps'));
|
||||||
|
@ -164,8 +164,8 @@ class BasePaymentDriver
|
|||||||
}
|
}
|
||||||
|
|
||||||
$url = 'payment/' . $this->invitation->invitation_key;
|
$url = 'payment/' . $this->invitation->invitation_key;
|
||||||
if (request()->update) {
|
if (request()->capture) {
|
||||||
$url .= '?update=true';
|
$url .= '?capture=true';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -303,7 +303,7 @@ class BasePaymentDriver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isTwoStep() || request()->update) {
|
if ($this->isTwoStep() || request()->capture) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<center>
|
<center>
|
||||||
@if(isset($amount))
|
@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()
|
->submit()
|
||||||
->large() !!}
|
->large() !!}
|
||||||
@else
|
@else
|
||||||
|
@ -450,7 +450,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (isset($amount))
|
@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()
|
->submit()
|
||||||
->large() !!}
|
->large() !!}
|
||||||
@else
|
@else
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<header>
|
<header>
|
||||||
@if ($client && isset($invoiceNumber))
|
@if ($client && isset($invoiceNumber))
|
||||||
<h2>{{ $client->getDisplayName() }}</h2>
|
<h2>{{ $client->getDisplayName() }}</h2>
|
||||||
@if (request()->update)
|
@if (request()->capture)
|
||||||
<h3>{{ trans('texts.update_payment_details') }}</h3>
|
<h3>{{ trans('texts.update_payment_details') }}</h3>
|
||||||
@else
|
@else
|
||||||
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>| {{ trans('texts.amount_due') }}: <em>{{ $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) }}</em></span></h3>
|
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>| {{ trans('texts.amount_due') }}: <em>{{ $account->formatMoney($amount, $client, CURRENCY_DECORATOR_CODE) }}</em></span></h3>
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
&& $account->getGatewayByType(GATEWAY_TYPE_TOKEN)
|
&& $account->getGatewayByType(GATEWAY_TYPE_TOKEN)
|
||||||
&& $account->token_billing_type_id != TOKEN_BILLING_DISABLED)
|
&& $account->token_billing_type_id != TOKEN_BILLING_DISABLED)
|
||||||
|
|
||||||
{!! 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
|
@endif
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@
|
|||||||
->large() !!}
|
->large() !!}
|
||||||
|
|
||||||
@if ($accountGateway->getPlaidEnabled() && !empty($amount))
|
@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()
|
->submit()
|
||||||
->withAttributes(['style'=>'display:none', 'id'=>'pay_now_button'])
|
->withAttributes(['style'=>'display:none', 'id'=>'pay_now_button'])
|
||||||
->large() !!}
|
->large() !!}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
{!! Button::normal(strtoupper(trans('texts.cancel')))->large()->asLinkTo($invitation->getLink()) !!}
|
{!! Button::normal(strtoupper(trans('texts.cancel')))->large()->asLinkTo($invitation->getLink()) !!}
|
||||||
|
|
||||||
@if (isset($amount))
|
@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()
|
->submit()
|
||||||
->large() !!}
|
->large() !!}
|
||||||
@else
|
@else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user