Resolve client correctly in webhooks

This commit is contained in:
David Bomba 2021-09-21 07:52:21 +10:00
parent 6b9b12d723
commit b2baadc429
2 changed files with 12 additions and 2 deletions

View File

@ -120,7 +120,7 @@ class WebhookHandler implements ShouldQueue
SystemLog::CATEGORY_WEBHOOK, SystemLog::CATEGORY_WEBHOOK,
SystemLog::EVENT_WEBHOOK_SUCCESS, SystemLog::EVENT_WEBHOOK_SUCCESS,
SystemLog::TYPE_WEBHOOK_RESPONSE, SystemLog::TYPE_WEBHOOK_RESPONSE,
$this->company->clients->first(), $this->resolveClient(),
$this->company $this->company
); );
@ -137,7 +137,7 @@ class WebhookHandler implements ShouldQueue
SystemLog::CATEGORY_WEBHOOK, SystemLog::CATEGORY_WEBHOOK,
SystemLog::EVENT_WEBHOOK_RESPONSE, SystemLog::EVENT_WEBHOOK_RESPONSE,
SystemLog::TYPE_WEBHOOK_RESPONSE, SystemLog::TYPE_WEBHOOK_RESPONSE,
$this->company->clients->first(), $this->resolveClient(),
$this->company, $this->company,
); );
@ -145,6 +145,15 @@ class WebhookHandler implements ShouldQueue
} }
private function resolveClient()
{
if($this->entity->client()->exists()){
return $this->entity->client;
}
return $this->company->clients->first();
}
public function failed($exception) public function failed($exception)
{ {
nlog(print_r($exception->getMessage(), 1)); nlog(print_r($exception->getMessage(), 1));

View File

@ -135,6 +135,7 @@ class PaymentEmailEngine extends BaseEmailEngine
{ {
$data = []; $data = [];
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];
$data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')];
$data['$number'] = ['value' => $this->payment->number ?: ' ', 'label' => ctrans('texts.payment_number')]; $data['$number'] = ['value' => $this->payment->number ?: ' ', 'label' => ctrans('texts.payment_number')];