From 47e3d85e02a0feed87060db8e2cbc6a769db097c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Dec 2024 09:51:57 +1100 Subject: [PATCH] Fixes for blockonomics --- .../Blockonomics/Blockonomics.php | 2 +- .../BlockonomicsPaymentDriver.php | 27 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/PaymentDrivers/Blockonomics/Blockonomics.php b/app/PaymentDrivers/Blockonomics/Blockonomics.php index 35f430da92..87f2aa26c1 100644 --- a/app/PaymentDrivers/Blockonomics/Blockonomics.php +++ b/app/PaymentDrivers/Blockonomics/Blockonomics.php @@ -76,7 +76,7 @@ class Blockonomics implements LivewireMethodInterface } else { return ['success' => false, 'message' => "Could not generate new address (This may be a temporary error. Please try again). \n\n

If this continues, please ask website administrator to check blockonomics registered email address for error messages"]; } - return ['success' => false, 'message' => 'Something went wrong']; + } public function getBTCPrice() diff --git a/app/PaymentDrivers/BlockonomicsPaymentDriver.php b/app/PaymentDrivers/BlockonomicsPaymentDriver.php index dfa717f3f9..8fc5743f32 100644 --- a/app/PaymentDrivers/BlockonomicsPaymentDriver.php +++ b/app/PaymentDrivers/BlockonomicsPaymentDriver.php @@ -12,18 +12,19 @@ namespace App\PaymentDrivers; -use App\Utils\Traits\MakesHash; -use App\Models\PaymentHash; -use App\Models\GatewayType; -use App\PaymentDrivers\Blockonomics\Blockonomics; -use App\Models\SystemLog; -use App\Models\Payment; -use App\Models\Gateway; use App\Models\Client; -use App\Exceptions\PaymentFailed; -use App\Models\PaymentType; -use App\Http\Requests\Payments\PaymentWebhookRequest; +use App\Models\Gateway; use App\Models\Invoice; +use App\Models\Payment; +use App\Models\SystemLog; +use App\Models\GatewayType; +use App\Models\PaymentHash; +use App\Models\PaymentType; +use App\Utils\Traits\MakesHash; +use App\Exceptions\PaymentFailed; +use Illuminate\Support\Facades\Http; +use App\PaymentDrivers\Blockonomics\Blockonomics; +use App\Http\Requests\Payments\PaymentWebhookRequest; class BlockonomicsPaymentDriver extends BaseDriver { @@ -147,8 +148,8 @@ class BlockonomicsPaymentDriver extends BaseDriver public function auth(): bool { try { - // TODO: Add check /api/new_address?reset=1 to see if the API key is valid - $this->company_gateway->getConfigField('apiKey'); + + $api_key = $this->company_gateway->getConfigField('apiKey'); $url = $this->NEW_ADDRESS_URL . '?reset=1'; $response = Http::withToken($api_key) ->post($url, []); @@ -159,6 +160,6 @@ class BlockonomicsPaymentDriver extends BaseDriver } catch (\Exception $e) { return false; } - return false; + } }