mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Clean up Webhook Handler
This commit is contained in:
parent
fb5b27323e
commit
c581c183ac
@ -13,6 +13,7 @@ namespace App\Jobs\Util;
|
||||
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client as ClientModel;
|
||||
use App\Models\SystemLog;
|
||||
use App\Models\Webhook;
|
||||
use App\Transformers\ArraySerializer;
|
||||
@ -147,11 +148,12 @@ class WebhookHandler implements ShouldQueue
|
||||
|
||||
private function resolveClient()
|
||||
{
|
||||
if($this->entity->client()->exists()){
|
||||
//make sure it isn't an instance of the Client Model
|
||||
if((!$this->entity instanceof ClientModel) && $this->entity->client()->exists()){
|
||||
return $this->entity->client;
|
||||
}
|
||||
|
||||
return $this->company->clients->first();
|
||||
return $this->company->clients()->first();
|
||||
}
|
||||
|
||||
public function failed($exception)
|
||||
|
@ -287,7 +287,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoices->each(function ($invoice) use ($fee_total) {
|
||||
if (collect($invoice->line_items)->contains('type_id', '3')) {
|
||||
$invoice->service()->toggleFeesPaid()->deletePdf()->save();
|
||||
$invoice->service()->toggleFeesPaid()->save();
|
||||
$invoice->client->service()->updateBalance($fee_total)->save();
|
||||
$invoice->ledger()->updateInvoiceBalance($fee_total, "Gateway fee adjustment for invoice {$invoice->number}");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user