mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 05:34:35 -04:00
Fixes for webhook bug
This commit is contained in:
parent
46852794aa
commit
48c5c56a4a
@ -111,12 +111,9 @@ class WebhookHandler implements ShouldQueue
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$response = $client->post($subscription->target_url, [
|
$response = $client->post($subscription->target_url, [
|
||||||
RequestOptions::JSON => $data, // or 'json' => [...]
|
RequestOptions::JSON => $data, // or 'json' => [...]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($response->getStatusCode() == 410 || $response->getStatusCode() == 200)
|
|
||||||
$subscription->delete();
|
|
||||||
|
|
||||||
SystemLogger::dispatch(
|
SystemLogger::dispatch(
|
||||||
$response,
|
$response,
|
||||||
@ -127,10 +124,13 @@ class WebhookHandler implements ShouldQueue
|
|||||||
$this->company
|
$this->company
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// if ($response->getStatusCode() == 410 || $response->getStatusCode() == 200)
|
||||||
|
// return true;// $subscription->delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(\Exception $e){
|
catch(\Exception $e){
|
||||||
|
|
||||||
// nlog($e->getMessage());
|
nlog($e->getMessage());
|
||||||
|
|
||||||
SystemLogger::dispatch(
|
SystemLogger::dispatch(
|
||||||
$e->getMessage(),
|
$e->getMessage(),
|
||||||
@ -143,8 +143,6 @@ class WebhookHandler implements ShouldQueue
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function failed($exception)
|
public function failed($exception)
|
||||||
|
@ -19,6 +19,8 @@ use App\Models\Webhook;
|
|||||||
|
|
||||||
class InvoiceObserver
|
class InvoiceObserver
|
||||||
{
|
{
|
||||||
|
public $afterCommit = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the client "created" event.
|
* Handle the client "created" event.
|
||||||
*
|
*
|
||||||
@ -27,6 +29,7 @@ class InvoiceObserver
|
|||||||
*/
|
*/
|
||||||
public function created(Invoice $invoice)
|
public function created(Invoice $invoice)
|
||||||
{
|
{
|
||||||
|
|
||||||
$subscriptions = Webhook::where('company_id', $invoice->company->id)
|
$subscriptions = Webhook::where('company_id', $invoice->company->id)
|
||||||
->where('event_id', Webhook::EVENT_CREATE_INVOICE)
|
->where('event_id', Webhook::EVENT_CREATE_INVOICE)
|
||||||
->exists();
|
->exists();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user