From 6444ed02ae013c96c72f4a7dcbd40926f9d0e0d8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 16 Jun 2022 11:51:42 +1000 Subject: [PATCH] Version bump for checkout refactor + dependency update --- VERSION.txt | 2 +- .../Checkout3ds/Checkout3dsRequest.php | 3 ++ .../CheckoutComPaymentDriver.php | 45 +++++++------------ config/ninja.php | 4 +- 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 4b336d6ed820..1e20ec35c642 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.100 \ No newline at end of file +5.4.0 \ No newline at end of file diff --git a/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php b/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php index 7b497e22cfaa..3588d8ca953a 100644 --- a/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php +++ b/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php @@ -39,6 +39,7 @@ class Checkout3dsRequest extends FormRequest public function getCompany() { MultiDB::findAndSetDbByCompanyKey($this->company_key); + return Company::where('company_key', $this->company_key)->first(); } @@ -58,6 +59,8 @@ class Checkout3dsRequest extends FormRequest public function getClient() { + MultiDB::findAndSetDbByCompanyKey($this->company_key); + return Client::withTrashed()->find($this->getPaymentHash()->data->client_id); } } diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 5ee6f6889c06..552123dbbc75 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -255,44 +255,31 @@ class CheckoutComPaymentDriver extends BaseDriver } catch (CheckoutApiException $e) { // API error - nlog($e); $request_id = $e->request_id; $http_status_code = $e->http_status_code; $error_details = $e->error_details; } catch (CheckoutArgumentException $e) { // Bad arguments - nlog($e); + + return [ + 'transaction_reference' => null, + 'transaction_response' => json_encode($e->getMessage()), + 'success' => false, + 'description' => $e->getMessage(), + 'code' => $e->getCode(), + ]; } catch (CheckoutAuthorizationException $e) { // Bad Invalid authorization - nlog($e); + + return [ + 'transaction_reference' => null, + 'transaction_response' => json_encode($e->getMessage()), + 'success' => false, + 'description' => $e->getMessage(), + 'code' => $e->getCode(), + ]; } - - - // $checkout_payment = new Refund($payment->transaction_reference); - - // // try { - // // $refund = $this->gateway->payments()->refund($checkout_payment); - // // $checkout_payment = $this->gateway->payments()->details($refund->id); - - // // $response = ['refund_response' => $refund, 'checkout_payment_fetch' => $checkout_payment]; - - // // return [ - // // 'transaction_reference' => $refund->action_id, - // // 'transaction_response' => json_encode($response), - // // 'success' => $checkout_payment->status == 'Refunded', - // // 'description' => $checkout_payment->status, - // // 'code' => $checkout_payment->http_code, - // // ]; - // // } catch (CheckoutApiException $e) { - // // return [ - // // 'transaction_reference' => null, - // // 'transaction_response' => json_encode($e->getMessage()), - // // 'success' => false, - // // 'description' => $e->getMessage(), - // // 'code' => $e->getCode(), - // // ]; - // // } } public function getCustomer() diff --git a/config/ninja.php b/config/ninja.php index c07e03da7a42..19bbfb180258 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.3.100', - 'app_tag' => '5.3.100', + 'app_version' => '5.4.0', + 'app_tag' => '5.4.0', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),