mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #8118 from paulwer/v5-develop
adding update_payment webhook
This commit is contained in:
commit
5dfd3206c5
@ -78,6 +78,8 @@ class Webhook extends BaseModel
|
||||
|
||||
const EVENT_PROJECT_DELETE = 30;
|
||||
|
||||
const EVENT_UPDATE_PAYMENT = 31;
|
||||
|
||||
|
||||
public static $valid_events = [
|
||||
self::EVENT_CREATE_CLIENT,
|
||||
@ -109,7 +111,8 @@ class Webhook extends BaseModel
|
||||
self::EVENT_CREATE_CREDIT,
|
||||
self::EVENT_UPDATE_CREDIT,
|
||||
self::EVENT_DELETE_CREDIT,
|
||||
self::EVENT_PROJECT_DELETE
|
||||
self::EVENT_PROJECT_DELETE,
|
||||
self::EVENT_UPDATE_PAYMENT
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
@ -42,6 +42,13 @@ class PaymentObserver
|
||||
*/
|
||||
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…
Reference in New Issue
Block a user