From 902b37fd382f0677599149aa21f5fd7c1a130196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 25 Oct 2021 16:37:43 +0200 Subject: [PATCH] Fix for accesing `response_summary` on payment object --- app/PaymentDrivers/CheckoutCom/Utilities.php | 5 ++--- app/PaymentDrivers/CheckoutComPaymentDriver.php | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/PaymentDrivers/CheckoutCom/Utilities.php b/app/PaymentDrivers/CheckoutCom/Utilities.php index 9790a5ca8d2d..ca4c544d75b4 100644 --- a/app/PaymentDrivers/CheckoutCom/Utilities.php +++ b/app/PaymentDrivers/CheckoutCom/Utilities.php @@ -84,8 +84,7 @@ trait Utilities public function processUnsuccessfulPayment(Payment $_payment, $throw_exception = true) { - - $this->getParent()->sendFailureMail($_payment->status . " " . $_payment->response_summary); + $this->getParent()->sendFailureMail($_payment->status . " " . optional($_payment)->response_summary); $message = [ 'server_response' => $_payment, @@ -102,7 +101,7 @@ trait Utilities ); if ($throw_exception) { - throw new PaymentFailed($_payment->status . " " . $_payment->response_summary, $_payment->http_code); + throw new PaymentFailed($_payment->status . " " . optional($_payment)->response_summary, $_payment->http_code); } } diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 1cb3443c014f..d7937fac43ff 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -338,7 +338,9 @@ class CheckoutComPaymentDriver extends BaseDriver $this->setPaymentHash($request->getPaymentHash()); try { - $payment = $this->gateway->payments()->details($request->query('cko-session-id')); + $payment = $this->gateway->payments()->details( + $request->query('cko-session-id') + ); if ($payment->approved) { return $this->processSuccessfulPayment($payment);