diff --git a/app/PaymentDrivers/Blockonomics/Blockonomics.php b/app/PaymentDrivers/Blockonomics/Blockonomics.php index b721df142f..45ec6f1954 100644 --- a/app/PaymentDrivers/Blockonomics/Blockonomics.php +++ b/app/PaymentDrivers/Blockonomics/Blockonomics.php @@ -29,7 +29,7 @@ use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; class Blockonomics implements LivewireMethodInterface { use MakesHash; - private const TEST_TXID = 'WarningThisIsAGeneratedTestPaymentAndNotARealBitcoinTransaction'; + private string $test_txid = 'WarningThisIsAGeneratedTestPaymentAndNotARealBitcoinTransaction'; public function __construct(public BlockonomicsPaymentDriver $blockonomics) { @@ -47,12 +47,6 @@ class Blockonomics implements LivewireMethodInterface { } - public static function getTestTxid() - { - return self::TEST_TXID; - } - - public function getBTCAddress(): array { @@ -160,7 +154,7 @@ class Blockonomics implements LivewireMethodInterface // Append a random value to the transaction reference for test payments // to prevent duplicate entries in the database. // This ensures the payment hashed_id remains unique. - $testTxid = $this->getTestTxid(); + $testTxid = $this->test_txid; $data['transaction_reference'] = ($request->txid === $testTxid) ? $request->txid . bin2hex(random_bytes(16)) : $request->txid; @@ -182,9 +176,7 @@ class Blockonomics implements LivewireMethodInterface } $payment = $this->blockonomics->createPayment($data, $statusId); - $payment->custom_value1 = $request->txid; - $payment->custom_value2 = $request->btc_address; - $payment->custom_value3 = $request->btc_amount; + $payment->private_notes = "{$request->btc_address} - {$request->btc_amount}"; $payment->save(); SystemLogger::dispatch( diff --git a/app/PaymentDrivers/BlockonomicsPaymentDriver.php b/app/PaymentDrivers/BlockonomicsPaymentDriver.php index 59ba772bc7..cafe8b3cf2 100644 --- a/app/PaymentDrivers/BlockonomicsPaymentDriver.php +++ b/app/PaymentDrivers/BlockonomicsPaymentDriver.php @@ -50,6 +50,7 @@ class BlockonomicsPaymentDriver extends BaseDriver public $NEW_ADDRESS_URL = 'https://www.blockonomics.co/api/new_address'; public $PRICE_URL = 'https://www.blockonomics.co/api/price'; public $STORES_URL = 'https://www.blockonomics.co/api/v2/stores'; + private string $test_txid = 'WarningThisIsAGeneratedTestPaymentAndNotARealBitcoinTransaction'; public function init() { @@ -106,13 +107,10 @@ class BlockonomicsPaymentDriver extends BaseDriver $status = $request->status; $addr = $request->addr; - $test_txid = Blockonomics::getTestTxid(); - - if ($txid === $test_txid) { + if ($txid === $this->test_txid) { $payment = Payment::query() ->where('company_id', $company->id) - ->where('custom_value1', $txid) - ->where('custom_value2', $addr) + ->where('private_notes', "$addr - $value") ->firstOrFail(); } else { $payment = Payment::query()