fixes for checkout payment gateway

This commit is contained in:
David Bomba 2020-09-10 14:41:56 +10:00
parent d071ed0d3b
commit f061fd49f9
2 changed files with 8 additions and 4 deletions

View File

@ -295,17 +295,19 @@ class CheckoutComPaymentDriver extends BaseDriver
public function processInternallyFailedPayment($e, $state) 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 = [ $message = [
'server_response' => $state['server_response'], '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); 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); throw new \Exception('Failed to process the payment.', 1);
} }

View File

@ -75,7 +75,9 @@ class UpdateInvoicePayment
->updateBalance($paid_amount * -1) ->updateBalance($paid_amount * -1)
->save(); ->save();
info("firing invoice was updated event");
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars())); event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
info("fired invoice was updated event");
}); });
return $this->payment; return $this->payment;