mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 07:34:37 -04:00
adding update_payment webhook
This commit is contained in:
parent
dacb811422
commit
205a0669d8
@ -78,6 +78,8 @@ class Webhook extends BaseModel
|
|||||||
|
|
||||||
const EVENT_PROJECT_DELETE = 30;
|
const EVENT_PROJECT_DELETE = 30;
|
||||||
|
|
||||||
|
const EVENT_UPDATE_PAYMENT = 31;
|
||||||
|
|
||||||
|
|
||||||
public static $valid_events = [
|
public static $valid_events = [
|
||||||
self::EVENT_CREATE_CLIENT,
|
self::EVENT_CREATE_CLIENT,
|
||||||
@ -109,7 +111,8 @@ class Webhook extends BaseModel
|
|||||||
self::EVENT_CREATE_CREDIT,
|
self::EVENT_CREATE_CREDIT,
|
||||||
self::EVENT_UPDATE_CREDIT,
|
self::EVENT_UPDATE_CREDIT,
|
||||||
self::EVENT_DELETE_CREDIT,
|
self::EVENT_DELETE_CREDIT,
|
||||||
self::EVENT_PROJECT_DELETE
|
self::EVENT_PROJECT_DELETE,
|
||||||
|
self::EVENT_UPDATE_PAYMENT
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
@ -42,6 +42,13 @@ class PaymentObserver
|
|||||||
*/
|
*/
|
||||||
public function updated(Payment $payment)
|
public function updated(Payment $payment)
|
||||||
{
|
{
|
||||||
|
$subscriptions = Webhook::where('company_id', $payment->company->id)
|
||||||
|
->where('event_id', Webhook::EVENT_UPDATE_PAYMENT)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($subscriptions) {
|
||||||
|
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(now()->addSeconds(20));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user