1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Fixes for payment failer mailer

This commit is contained in:
David Bomba 2021-01-26 23:09:08 +11:00
parent 88bac69e13
commit bd02d7babd
2 changed files with 12 additions and 1 deletions

View File

@ -12,6 +12,7 @@
namespace App\PaymentDrivers\Authorize; namespace App\PaymentDrivers\Authorize;
use App\Jobs\Mail\PaymentFailureMailer;
use App\Jobs\Util\SystemLogger; use App\Jobs\Util\SystemLogger;
use App\Models\ClientGatewayToken; use App\Models\ClientGatewayToken;
use App\Models\GatewayType; use App\Models\GatewayType;
@ -125,6 +126,8 @@ class AuthorizeCreditCard
'data' => $this->formatGatewayResponse($data, $vars), 'data' => $this->formatGatewayResponse($data, $vars),
]; ];
PaymentFailureMailer::dispatch($this->authorize->client, $response->getTransactionResponse()->getTransId(), $this->authorize->client->company, $amount);
SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
return false; return false;
@ -205,6 +208,10 @@ class AuthorizeCreditCard
private function processFailedResponse($data, $request) private function processFailedResponse($data, $request)
{ {
$response = $data['response'];
PaymentFailureMailer::dispatch($this->authorize->client, $response->getTransactionResponse()->getTransId(), $this->authorize->client->company, $data['amount_with_fee']);
throw new \Exception(ctrans('texts.error_title')); throw new \Exception(ctrans('texts.error_title'));
} }

View File

@ -13,6 +13,7 @@
namespace App\PaymentDrivers\CheckoutCom; namespace App\PaymentDrivers\CheckoutCom;
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
use App\Jobs\Mail\PaymentFailureMailer;
use App\PaymentDrivers\CheckoutComPaymentDriver; use App\PaymentDrivers\CheckoutComPaymentDriver;
use Checkout\Library\Exceptions\CheckoutHttpException; use Checkout\Library\Exceptions\CheckoutHttpException;
use Checkout\Models\Payments\IdSource; use Checkout\Models\Payments\IdSource;
@ -155,11 +156,14 @@ class CreditCard
if ($response->status == 'Declined') { if ($response->status == 'Declined') {
$this->checkout->unWindGatewayFees($this->checkout->payment_hash); $this->checkout->unWindGatewayFees($this->checkout->payment_hash);
PaymentFailureMailer::dispatch($this->checkout->client, $response->response_summary, $this->checkout->client->company, $this->checkout->payment_hash->data->value);
return $this->processUnsuccessfulPayment($response); return $this->processUnsuccessfulPayment($response);
} }
} catch (CheckoutHttpException $e) { } catch (CheckoutHttpException $e) {
$this->checkout->unWindGatewayFees($this->checkout->payment_hash);
$this->checkout->unWindGatewayFees($this->checkout->payment_hash);
return $this->checkout->processInternallyFailedPayment($this->checkout, $e); return $this->checkout->processInternallyFailedPayment($this->checkout, $e);
} }
} }