mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
add invoice number
This commit is contained in:
parent
e2a23af0b1
commit
f77303c4d1
@ -15,11 +15,13 @@ namespace App\PaymentDrivers\Blockonomics;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
|
use App\Models\SystemLog;
|
||||||
use App\PaymentDrivers\BlockonomicsPaymentDriver;
|
use App\PaymentDrivers\BlockonomicsPaymentDriver;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\PaymentDrivers\Common\MethodInterface;
|
use App\PaymentDrivers\Common\MethodInterface;
|
||||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||||
use App\Exceptions\PaymentFailed;
|
use App\Exceptions\PaymentFailed;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Jobs\Mail\PaymentFailureMailer;
|
use App\Jobs\Mail\PaymentFailureMailer;
|
||||||
use Illuminate\Mail\Mailables\Address;
|
use Illuminate\Mail\Mailables\Address;
|
||||||
use App\Services\Email\EmailObject;
|
use App\Services\Email\EmailObject;
|
||||||
@ -147,6 +149,7 @@ class Blockonomics implements MethodInterface
|
|||||||
|
|
||||||
public function paymentView($data)
|
public function paymentView($data)
|
||||||
{
|
{
|
||||||
|
$_invoice = collect($this->blockonomics->payment_hash->data->invoices)->first();
|
||||||
$data['gateway'] = $this->blockonomics;
|
$data['gateway'] = $this->blockonomics;
|
||||||
$data['amount'] = $data['total']['amount_with_fee'];
|
$data['amount'] = $data['total']['amount_with_fee'];
|
||||||
$data['currency'] = $this->blockonomics->client->getCurrencyCode();
|
$data['currency'] = $this->blockonomics->client->getCurrencyCode();
|
||||||
@ -154,8 +157,8 @@ class Blockonomics implements MethodInterface
|
|||||||
$data['btc_amount'] = number_format($btc_amount, 10, '.', '');
|
$data['btc_amount'] = number_format($btc_amount, 10, '.', '');
|
||||||
$btc_address = $this->getBTCAddress();
|
$btc_address = $this->getBTCAddress();
|
||||||
$data['btc_address'] = $btc_address;
|
$data['btc_address'] = $btc_address;
|
||||||
//TODO: set invoice_id
|
$data['invoice_id'] = $_invoice->invoice_id;
|
||||||
$data['invoice_id'] = "123";
|
$data['invoice_number'] = $_invoice->invoice_number;
|
||||||
$data['end_time'] = $this->getTenMinutesCountDownEndTime();
|
$data['end_time'] = $this->getTenMinutesCountDownEndTime();
|
||||||
$data['callback_url'] = $this->setCallbackUrl();
|
$data['callback_url'] = $this->setCallbackUrl();
|
||||||
|
|
||||||
@ -173,16 +176,23 @@ class Blockonomics implements MethodInterface
|
|||||||
'txid' => ['required'],
|
'txid' => ['required'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$data = [
|
$data = [];
|
||||||
'payment_method' => $request->payment_method_id,
|
$data['amount'] = $request->amount;
|
||||||
'payment_type' => PaymentType::CRYPTO,
|
$data['payment_method_id'] = $request->payment_method_id;
|
||||||
'amount' => $request->amount,
|
$data['payment_type'] = PaymentType::CRYPTO;
|
||||||
'gateway_type_id' => GatewayType::CRYPTO,
|
$data['gateway_type_id'] = GatewayType::CRYPTO;
|
||||||
'transaction_reference' => $request->txid,
|
$data['transaction_reference'] = $request->txid;
|
||||||
];
|
$payment = $this->blockonomics->createPayment($data);
|
||||||
$payment = $this->blockonomics->createPayment($data, Payment::STATUS_COMPLETED);
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
['response' => $payment, 'data' => $data],
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||||
|
SystemLog::TYPE_BLOCKONOMICS,
|
||||||
|
$this->blockonomics->client,
|
||||||
|
$this->blockonomics->client->company,
|
||||||
|
);
|
||||||
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<!-- @include('portal.ninja2020.gateways.includes.payment_details') -->
|
<!-- @include('portal.ninja2020.gateways.includes.payment_details') -->
|
||||||
<div class="blockonomics-payment-wrapper">
|
<div class="blockonomics-payment-wrapper">
|
||||||
<div>Invoice #{{$invoice_id}}</div>
|
<div>Invoice #{{$invoice_number}}</div>
|
||||||
<div>To pay, send exactly this BTC amount</div>
|
<div>To pay, send exactly this BTC amount</div>
|
||||||
<input class="full-width-input" name="btcAmount" value="BTC {{$btc_amount}} ≈ {{$amount}} {{$currency}}" readonly>
|
<input class="full-width-input" name="btcAmount" value="BTC {{$btc_amount}} ≈ {{$amount}} {{$currency}}" readonly>
|
||||||
<div>To this bitcoin address</div>
|
<div>To this bitcoin address</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user