mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 23:54:30 -04:00
Prevent deleted invoice from being paid
This commit is contained in:
parent
7b5cd9e4c1
commit
2a97fc5456
@ -70,7 +70,7 @@ class OnlinePaymentController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! floatval($invitation->invoice->balance)) {
|
if ( ! $invitation->invoice->canBePaid()) {
|
||||||
return redirect()->to('view/' . $invitation->invitation_key);
|
return redirect()->to('view/' . $invitation->invitation_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +103,10 @@ class OnlinePaymentController extends BaseController
|
|||||||
$gatewayTypeId = Session::get($invitation->id . 'gateway_type');
|
$gatewayTypeId = Session::get($invitation->id . 'gateway_type');
|
||||||
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
|
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
|
||||||
|
|
||||||
|
if ( ! $invitation->invoice->canBePaid()) {
|
||||||
|
return redirect()->to('view/' . $invitation->invitation_key);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$paymentDriver->completeOnsitePurchase($request->all());
|
$paymentDriver->completeOnsitePurchase($request->all());
|
||||||
|
|
||||||
|
@ -514,6 +514,11 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return storage_path() . '/pdfcache/cache-' . $this->id . '.pdf';
|
return storage_path() . '/pdfcache/cache-' . $this->id . '.pdf';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canBePaid()
|
||||||
|
{
|
||||||
|
return floatval($this->balance) > 0 && ! $this->is_deleted;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $invoice
|
* @param $invoice
|
||||||
* @return string
|
* @return string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user