diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 70fff30a46ad..191d42e98877 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -237,7 +237,7 @@ class Gateway extends StaticModel ], GatewayType::ACSS => ['refund' => false, 'token_billing' => true, 'webhooks' => []] ]; // Rotessa - case 64: + case 65: return [ GatewayType::CRYPTO => ['refund' => true, 'token_billing' => false, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']], ]; //Blockonomics diff --git a/app/PaymentDrivers/Blockonomics/Blockonomics.php b/app/PaymentDrivers/Blockonomics/Blockonomics.php index f9e588e70f18..6e3d00c851c4 100644 --- a/app/PaymentDrivers/Blockonomics/Blockonomics.php +++ b/app/PaymentDrivers/Blockonomics/Blockonomics.php @@ -109,10 +109,11 @@ class Blockonomics implements MethodInterface $data['payment_method_id'] = $request->payment_method_id; $data['payment_type'] = PaymentType::CRYPTO; $data['gateway_type_id'] = GatewayType::CRYPTO; - $data['transaction_reference'] = "payment hash: " . $request->payment_hash . " txid: " . $request->txid . " BTC amount: " . $request->btc_amount; + $data['transaction_reference'] = $request->txid; $statusId = Payment::STATUS_PENDING; $payment = $this->blockonomics->createPayment($data, $statusId); + SystemLogger::dispatch( ['response' => $payment, 'data' => $data], SystemLog::CATEGORY_GATEWAY_RESPONSE, diff --git a/app/PaymentDrivers/BlockonomicsPaymentDriver.php b/app/PaymentDrivers/BlockonomicsPaymentDriver.php index 485ae6d39e18..a702d353ab8a 100644 --- a/app/PaymentDrivers/BlockonomicsPaymentDriver.php +++ b/app/PaymentDrivers/BlockonomicsPaymentDriver.php @@ -115,10 +115,11 @@ class BlockonomicsPaymentDriver extends BaseDriver return $this->payment_method->paymentResponse($request); } - public function processWebhookRequest() + public function processWebhookRequest(PaymentWebhookRequest $request) { - - $url_callback_secret = $_GET['secret']; + nlog($request->all()); + + $url_callback_secret = $request->secret; $db_callback_secret = $this->getCallbackSecret(); if ($url_callback_secret != $db_callback_secret) { @@ -150,13 +151,16 @@ class BlockonomicsPaymentDriver extends BaseDriver } if($payment->status_id == $statusId) { - header('HTTP/1.1 200 OK'); - echo "No change in payment status"; + return response()->json([], 200); + // header('HTTP/1.1 200 OK'); + // echo "No change in payment status"; } else { $payment->status_id = $statusId; $payment->save(); - header('HTTP/1.1 200 OK'); - echo "Payment status updated successfully"; + + return response()->json([], 200); + // header('HTTP/1.1 200 OK'); + // echo "Payment status updated successfully"; } } diff --git a/database/migrations/2024_08_27_230111_blockonomics_gateway.php b/database/migrations/2024_08_27_230111_blockonomics_gateway.php index b70147ec65d5..f33ee3656e78 100644 --- a/database/migrations/2024_08_27_230111_blockonomics_gateway.php +++ b/database/migrations/2024_08_27_230111_blockonomics_gateway.php @@ -12,20 +12,19 @@ return new class extends Migration */ public function up(): void { - if(!Gateway::find(64)) + if(!Gateway::find(65)) { $fields = new \stdClass; $fields->apiKey = ""; - $fields->callbackUrl = ""; $fields->callbackSecret = ""; $gateway = new Gateway; - $gateway->id = 64; + $gateway->id = 65; $gateway->name = 'Blockonomics'; $gateway->key = 'wbhf02us6owgo7p4nfjd0ymssdshks4d'; $gateway->provider = 'Blockonomics'; - $gateway->is_offsite = true; + $gateway->is_offsite = false; $gateway->fields = \json_encode($fields); diff --git a/database/seeders/PaymentLibrariesSeeder.php b/database/seeders/PaymentLibrariesSeeder.php index 4530ae9a3595..a96177624975 100644 --- a/database/seeders/PaymentLibrariesSeeder.php +++ b/database/seeders/PaymentLibrariesSeeder.php @@ -98,7 +98,7 @@ class PaymentLibrariesSeeder extends Seeder ['id' => 61, 'name' => 'PayPal Platform', 'provider' => 'PayPal_PPCP', 'key' => '80af24a6a691230bbec33e930ab40666', 'fields' => '{"testMode":false}'], ['id' => 62, 'name' => 'BTCPay', 'provider' => 'BTCPay', 'key' => 'vpyfbmdrkqcicpkjqdusgjfluebftuva', 'fields' => '{"btcpayUrl":"", "apiKey":"", "storeId":"", "webhookSecret":""}'], ['id' => 63, 'name' => 'Rotessa', 'is_offsite' => false, 'sort_order' => 22, 'provider' => 'Rotessa', 'key' => '91be24c7b792230bced33e930ac61676', 'fields' => '{"apiKey":"", "testMode":""}'], - ['id' => 64, 'name' => 'Blockonomics', 'provider' => 'Blockonomics', 'key' => 'wbhf02us6owgo7p4nfjd0ymssdshks4d', 'fields' => "$blockonomics_fields"], + ['id' => 65, 'name' => 'Blockonomics', 'provider' => 'Blockonomics', 'key' => 'wbhf02us6owgo7p4nfjd0ymssdshks4d', 'fields' => "$blockonomics_fields"], ]; foreach ($gateways as $gateway) { @@ -115,7 +115,7 @@ class PaymentLibrariesSeeder extends Seeder Gateway::query()->update(['visible' => 0]); - Gateway::whereIn('id', [1, 3, 7, 11, 15, 20, 39, 46, 55, 50, 57, 52, 58, 59, 60, 62, 63, 64])->update(['visible' => 1]); + Gateway::whereIn('id', [1, 3, 7, 11, 15, 20, 39, 46, 55, 50, 57, 52, 58, 59, 60, 62, 63, 64,65])->update(['visible' => 1]); if (Ninja::isHosted()) { Gateway::whereIn('id', [20, 49])->update(['visible' => 0]);