Fixes for blockonomics

This commit is contained in:
David Bomba 2024-12-04 09:51:57 +11:00
parent e5a5c108bd
commit 47e3d85e02
2 changed files with 15 additions and 14 deletions

View File

@ -76,7 +76,7 @@ class Blockonomics implements LivewireMethodInterface
} else { } else {
return ['success' => false, 'message' => "Could not generate new address (This may be a temporary error. Please try again). \n\n<br><br> If this continues, please ask website administrator to check blockonomics registered email address for error messages"]; return ['success' => false, 'message' => "Could not generate new address (This may be a temporary error. Please try again). \n\n<br><br> 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() public function getBTCPrice()

View File

@ -12,18 +12,19 @@
namespace App\PaymentDrivers; 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\Models\Client;
use App\Exceptions\PaymentFailed; use App\Models\Gateway;
use App\Models\PaymentType;
use App\Http\Requests\Payments\PaymentWebhookRequest;
use App\Models\Invoice; 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 class BlockonomicsPaymentDriver extends BaseDriver
{ {
@ -147,8 +148,8 @@ class BlockonomicsPaymentDriver extends BaseDriver
public function auth(): bool public function auth(): bool
{ {
try { 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'; $url = $this->NEW_ADDRESS_URL . '?reset=1';
$response = Http::withToken($api_key) $response = Http::withToken($api_key)
->post($url, []); ->post($url, []);
@ -159,6 +160,6 @@ class BlockonomicsPaymentDriver extends BaseDriver
} catch (\Exception $e) { } catch (\Exception $e) {
return false; return false;
} }
return false;
} }
} }