diff --git a/app/Http/Controllers/Gateways/BlockonomicsController.php b/app/Http/Controllers/Gateways/BlockonomicsController.php new file mode 100644 index 000000000000..5f451a49c0fb --- /dev/null +++ b/app/Http/Controllers/Gateways/BlockonomicsController.php @@ -0,0 +1,32 @@ +query('currency'); + $response = Http::get("https://www.blockonomics.co/api/price?currency={$currency}"); + + if ($response->successful()) { + return response()->json(['price' => $response->json('price')]); + } + + return response()->json(['error' => 'Unable to fetch BTC price'], 500); + } +} \ No newline at end of file diff --git a/app/PaymentDrivers/Blockonomics/Blockonomics.php b/app/PaymentDrivers/Blockonomics/Blockonomics.php index 3da7a37815a9..13c40fbd12d4 100644 --- a/app/PaymentDrivers/Blockonomics/Blockonomics.php +++ b/app/PaymentDrivers/Blockonomics/Blockonomics.php @@ -111,10 +111,12 @@ class Blockonomics implements MethodInterface $data['gateway'] = $this->blockonomics; $data['amount'] = $data['total']['amount_with_fee']; $data['currency'] = $this->blockonomics->client->getCurrencyCode(); - $btc_amount = $data['amount'] / $this->getBTCPrice(); + $btc_price = $this->getBTCPrice(); + $btc_amount = $data['amount'] / $btc_price; $data['btc_amount'] = number_format($btc_amount, 10, '.', ''); $btc_address = $this->getBTCAddress(); $data['btc_address'] = $btc_address; + $data['btc_price'] = $btc_price; $data['invoice_id'] = $_invoice->invoice_id; $data['invoice_number'] = $_invoice->invoice_number; $data['end_time'] = $this->getTenMinutesCountDownEndTime(); diff --git a/resources/views/portal/ninja2020/gateways/blockonomics/pay.blade.php b/resources/views/portal/ninja2020/gateways/blockonomics/pay.blade.php index e708d8dc9d0d..029f12c681e2 100644 --- a/resources/views/portal/ninja2020/gateways/blockonomics/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/blockonomics/pay.blade.php @@ -10,21 +10,24 @@ The invoice will be marked as paid automatically once the payment is confirmed. -->
-
Invoice #{{$invoice_number}}
-
To pay, send bitcoin to this address:
+
+
Invoice #{{$invoice_number}}
+
{{$amount}} {{$currency}}
+
+ To pay, send bitcoin to this address: - - ') }}" class="icon" alt="Copy Icon"> + + ') }}" class="icon" alt="Copy Icon"> -
Amount of bitcoin (BTC) to send:
+ Amount of bitcoin (BTC) to send: -
+
{{$btc_amount}}
') }}" class="icon" alt="Copy Icon"> - + - 1 BTC = {{$amount}} {{$currency}}, updates in +
1 BTC = {{$btc_price}} {{$currency}}, updates in
@@ -41,19 +44,22 @@ + +