1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

CLient payment failure mailer

This commit is contained in:
David Bomba 2021-10-13 20:24:15 +11:00
parent fc276970a0
commit d0cb751d03
2 changed files with 23 additions and 13 deletions

View File

@ -378,12 +378,30 @@ class BaseDriver extends AbstractPaymentDriver
$this->payment_hash
);
SystemLogger::dispatch(
$gateway->payment_hash,
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_ERROR,
$gateway::SYSTEM_LOG_TYPE,
$gateway->client,
$gateway->client->company,
);
throw new PaymentFailed($error, $e->getCode());
}
public function clientPaymentFailureMailer($error)
{
nlog("outside");
if ($this->payment_hash && is_array($this->payment_hash->invoices())) {
nlog("inside");
$nmo = new NinjaMailerObject;
$nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($gateway->client, $error, $gateway->client->company, $this->payment_hash))->build());
$nmo->company = $gateway->client->company;
$nmo->settings = $gateway->client->company->settings;
$nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($this->client, $error, $this->client->company, $this->payment_hash))->build());
$nmo->company = $this->client->company;
$nmo->settings = $this->client->company->settings;
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
@ -405,16 +423,6 @@ class BaseDriver extends AbstractPaymentDriver
}
SystemLogger::dispatch(
$gateway->payment_hash,
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_ERROR,
$gateway::SYSTEM_LOG_TYPE,
$gateway->client,
$gateway->client->company,
);
throw new PaymentFailed($error, $e->getCode());
}
/**

View File

@ -176,6 +176,8 @@ class CreditCard
PaymentFailureMailer::dispatch($this->checkout->client, $response->response_summary, $this->checkout->client->company, $this->checkout->payment_hash->data->value);
$this->checkout->clientPaymentFailureMailer($response->status);
return $this->processUnsuccessfulPayment($response);
}
} catch (CheckoutHttpException $e) {