mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for postmark reporting
This commit is contained in:
parent
b12190e554
commit
acaf554031
@ -121,18 +121,29 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
|
|
||||||
$message = $e->getMessage();
|
$message = $e->getMessage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post mark buries the proper message in a a guzzle response
|
||||||
|
* this merges a text string with a json object
|
||||||
|
* need to harvest the ->Message property using the following
|
||||||
|
*/
|
||||||
if($e instanceof ClientException) { //postmark specific failure
|
if($e instanceof ClientException) { //postmark specific failure
|
||||||
|
|
||||||
$response = $e->getResponse();
|
$response = $e->getResponse();
|
||||||
|
$message_body = json_decode($response->getBody()->getContents());
|
||||||
|
|
||||||
|
if(property_exists($message_body, 'Message')){
|
||||||
|
$message = $message_body->Message;
|
||||||
|
nlog($message);
|
||||||
|
}
|
||||||
|
|
||||||
nlog($response);
|
|
||||||
// $message = $response->Message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the is an entity attached to the message send a failure mailer */
|
||||||
if($this->nmo->entity)
|
if($this->nmo->entity)
|
||||||
$this->entityEmailFailed($message);
|
$this->entityEmailFailed($message);
|
||||||
|
|
||||||
if(Ninja::isHosted() && (!$e instanceof ClientException)) // Don't send postmark failures to Sentry
|
/* Don't send postmark failures to Sentry */
|
||||||
|
if(Ninja::isHosted() && (!$e instanceof ClientException))
|
||||||
app('sentry')->captureException($e);
|
app('sentry')->captureException($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ use App\Utils\Traits\MakesHash;
|
|||||||
use App\Utils\Traits\SubscriptionHooker;
|
use App\Utils\Traits\SubscriptionHooker;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use GuzzleHttp\RequestOptions;
|
use GuzzleHttp\RequestOptions;
|
||||||
|
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||||
|
|
||||||
class SubscriptionService
|
class SubscriptionService
|
||||||
{
|
{
|
||||||
@ -950,7 +951,12 @@ class SubscriptionService
|
|||||||
return redirect($default_redirect);
|
return redirect($default_redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function planPaid($invoice)
|
/**
|
||||||
|
* @param Invoice $invoice
|
||||||
|
* @return true
|
||||||
|
* @throws BindingResolutionException
|
||||||
|
*/
|
||||||
|
public function planPaid(Invoice $invoice)
|
||||||
{
|
{
|
||||||
$recurring_invoice_hashed_id = $invoice->recurring_invoice()->exists() ? $invoice->recurring_invoice->hashed_id : null;
|
$recurring_invoice_hashed_id = $invoice->recurring_invoice()->exists() ? $invoice->recurring_invoice->hashed_id : null;
|
||||||
|
|
||||||
@ -959,12 +965,14 @@ class SubscriptionService
|
|||||||
'subscription' => $this->subscription->hashed_id,
|
'subscription' => $this->subscription->hashed_id,
|
||||||
'recurring_invoice' => $recurring_invoice_hashed_id,
|
'recurring_invoice' => $recurring_invoice_hashed_id,
|
||||||
'client' => $invoice->client->hashed_id,
|
'client' => $invoice->client->hashed_id,
|
||||||
'contact' => $invoice->client->primary_contact()->first() ? $invoice->client->contacts->first() : false,
|
'contact' => $invoice->client->primary_contact()->first() ? $invoice->client->primary_contact()->first(): $invoice->client->contacts->first(),
|
||||||
'invoice' => $invoice->hashed_id,
|
'invoice' => $invoice->hashed_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->triggerWebhook($context);
|
$response = $this->triggerWebhook($context);
|
||||||
|
|
||||||
|
nlog($response);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user