diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index b2da639512e1..45ecfd8bd3e0 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -295,17 +295,19 @@ class CheckoutComPaymentDriver extends BaseDriver public function processInternallyFailedPayment($e, $state) { - $message = json_decode($e->getBody()); + $error_message = json_decode($e->getBody()); - PaymentFailureMailer::dispatch($this->client, $message->error_type, $this->client->company, $state['value']); + PaymentFailureMailer::dispatch($this->client, $error_message->message, $this->client->company, $state['value']); $message = [ 'server_response' => $state['server_response'], - 'data' => $message, + 'data' => $e->getBody(), ]; SystemLogger::dispatch($message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_CHECKOUT, $this->client); - + + //todo push to a error page with the exception message. + throw new \Exception('Failed to process the payment.', 1); } diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index ca7ef1119b6a..60eaeb686c8c 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -75,7 +75,9 @@ class UpdateInvoicePayment ->updateBalance($paid_amount * -1) ->save(); + info("firing invoice was updated event"); event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars())); + info("fired invoice was updated event"); }); return $this->payment;