1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

initial BTCPay commit

Signed-off-by: Nisaba <34550856+Nisaba@users.noreply.github.com>
This commit is contained in:
Nisaba 2024-05-13 16:33:15 +00:00 committed by GitHub
parent d6193f261a
commit d11766c1bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 1319 additions and 1112 deletions

View File

@ -1,10 +1,11 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
@ -75,14 +76,14 @@ class Gateway extends StaticModel
return $this->getMethods();
}
// /**
// * Test if gateway is custom.
// * @return bool TRUE|FALSE
// */
// public function isCustom(): bool
// {
// return in_array($this->id, [62, 67, 68]); //static table ids of the custom gateways
// }
/**
* Test if gateway is custom.
* @return bool TRUE|FALSE
*/
public function isCustom(): bool
{
return in_array($this->id, [62, 67, 68]); //static table ids of the custom gateways
}
public function getHelp()
{
@ -90,7 +91,7 @@ class Gateway extends StaticModel
if ($this->id == 1) {
$link = 'http://reseller.authorize.net/application/?id=5560364';
} elseif (in_array($this->id, [15,60,61])) {
} elseif (in_array($this->id, [15, 60, 61])) {
$link = 'https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run';
} elseif ($this->id == 24) {
$link = 'https://www.2checkout.com/referral?r=2c37ac2298';
@ -102,6 +103,8 @@ class Gateway extends StaticModel
$link = 'https://dashboard.stripe.com/account/apikeys';
} elseif ($this->id == 59) {
$link = 'https://www.forte.net/';
} elseif ($this->id == 62) {
$link = 'https://docs.btcpayserver.org';
}
return $link;
@ -137,22 +140,22 @@ class Gateway extends StaticModel
case 56:
return [
GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true, 'webhooks' => ['payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'customer.source.updated','payment_intent.processing', 'payment_intent.payment_failed', 'charge.failed']],
GatewayType::DIRECT_DEBIT => ['refund' => false, 'token_billing' => false, 'webhooks' => ['payment_intent.processing','payment_intent.succeeded','payment_intent.partially_funded', 'payment_intent.payment_failed']],
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'customer.source.updated', 'payment_intent.processing', 'payment_intent.payment_failed']],
GatewayType::DIRECT_DEBIT => ['refund' => false, 'token_billing' => false, 'webhooks' => ['payment_intent.processing', 'payment_intent.succeeded', 'payment_intent.partially_funded', 'payment_intent.payment_failed']],
GatewayType::ALIPAY => ['refund' => false, 'token_billing' => false],
GatewayType::APPLE_PAY => ['refund' => false, 'token_billing' => false],
GatewayType::BACS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.processing', 'payment_intent.succeeded', 'mandate.updated', 'payment_intent.payment_failed']],
GatewayType::SOFORT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::KLARNA => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::SEPA => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::PRZELEWY24 => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::GIROPAY => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::EPS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::BANCONTACT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::BECS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::IDEAL => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::ACSS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::FPX => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'charge.failed', ]],
GatewayType::BACS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.processing', 'payment_intent.succeeded', 'mandate.updated', 'payment_intent.payment_failed']],
GatewayType::SOFORT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::KLARNA => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::SEPA => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::PRZELEWY24 => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::GIROPAY => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::EPS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::BANCONTACT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::BECS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::IDEAL => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::ACSS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded', 'payment_intent.payment_failed']],
GatewayType::FPX => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']],
];
case 39:
return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true, 'webhooks' => [' ']]]; //Checkout
@ -175,10 +178,10 @@ class Gateway extends StaticModel
];
case 52:
return [
GatewayType::BANK_TRANSFER => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed','paid_out','failed','fulfilled']], // GoCardless
GatewayType::DIRECT_DEBIT => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed','paid_out','failed','fulfilled']],
GatewayType::SEPA => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed','paid_out','failed','fulfilled']],
GatewayType::INSTANT_BANK_PAY => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed','paid_out','failed','fulfilled']],
GatewayType::BANK_TRANSFER => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']], // GoCardless
GatewayType::DIRECT_DEBIT => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']],
GatewayType::SEPA => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']],
GatewayType::INSTANT_BANK_PAY => ['refund' => false, 'token_billing' => true, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']],
];
case 58:
return [
@ -194,7 +197,6 @@ class Gateway extends StaticModel
GatewayType::PAYPAL => ['refund' => false, 'token_billing' => false],
GatewayType::CREDIT_CARD => ['refund' => false, 'token_billing' => false],
GatewayType::VENMO => ['refund' => false, 'token_billing' => false],
GatewayType::PAYPAL_ADVANCED_CARDS => ['refund' => false, 'token_billing' => true],
// GatewayType::SEPA => ['refund' => false, 'token_billing' => false],
// GatewayType::BANCONTACT => ['refund' => false, 'token_billing' => false],
// GatewayType::EPS => ['refund' => false, 'token_billing' => false],
@ -208,7 +210,6 @@ class Gateway extends StaticModel
GatewayType::PAYPAL => ['refund' => false, 'token_billing' => false],
GatewayType::CREDIT_CARD => ['refund' => false, 'token_billing' => false],
GatewayType::VENMO => ['refund' => false, 'token_billing' => false],
GatewayType::PAYPAL_ADVANCED_CARDS => ['refund' => false, 'token_billing' => true],
// GatewayType::SEPA => ['refund' => false, 'token_billing' => false],
// GatewayType::BANCONTACT => ['refund' => false, 'token_billing' => false],
// GatewayType::EPS => ['refund' => false, 'token_billing' => false],
@ -217,6 +218,10 @@ class Gateway extends StaticModel
// GatewayType::PRZELEWY24 => ['refund' => false, 'token_billing' => false],
// GatewayType::SOFORT => ['refund' => false, 'token_billing' => false],
]; //Paypal PPCP
case 62:
return [
GatewayType::CRYPTO => ['refund' => true, 'token_billing' => false, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']],
]; //BTCPay
default:
return [];
}

View File

@ -0,0 +1,147 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\PaymentDrivers\BTCPay;
use App\Models\GatewayType;
use App\Models\Payment;
use App\Models\PaymentType;
use App\PaymentDrivers\BTCPayPaymentDriver;
use App\Utils\Traits\MakesHash;
use App\PaymentDrivers\Common\MethodInterface;
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
use App\Exceptions\PaymentFailed;
class BTCPay implements MethodInterface
{
use MakesHash;
public $driver_class;
public function __construct(BTCPayPaymentDriver $driver_class)
{
$this->driver_class = $driver_class;
$this->driver_class->init();
}
public function authorizeView($data)
{
}
public function authorizeRequest($request)
{
}
public function authorizeResponse($request)
{
}
public function paymentView($data)
{
$data['gateway'] = $this->driver_class;
$data['amount'] = $data['total']['amount_with_fee'];
$data['currency'] = $this->driver_class->client->getCurrencyCode();
return render('gateways.btcpay.pay', $data);
}
public function paymentResponse(PaymentResponseRequest $request)
{
$request->validate([
'payment_hash' => ['required'],
'amount' => ['required'],
'currency' => ['required'],
]);
$drv = $this->driver_class;
if (
strlen($drv->btcpay_url) < 1
|| strlen($drv->api_key) < 1
|| strlen($drv->store_id) < 1
|| strlen($drv->webhook_secret) < 1
) {
throw new PaymentFailed('BTCPay is not well configured');
}
if (!filter_var($this->driver_class->btcpay_url, FILTER_VALIDATE_URL)) {
throw new PaymentFailed('Wrong format for BTCPay Url');
}
try {
$_invoice = collect($drv->payment_hash->data->invoices)->first();
$cli = $drv->client;
$dataPayment = [
'payment_method' => $drv->payment_method,
'payment_type' => PaymentType::CRYPTO,
'amount' => $request->amount,
'gateway_type_id' => GatewayType::CRYPTO,
'transaction_reference' => 'xxx'
];
$payment = $drv->createPayment($dataPayment, \App\Models\Payment::STATUS_PENDING);
$metaData = [
'buyerName' => $cli->name,
'buyerAddress1' => $cli->address1,
'buyerAddress2' => $cli->address2,
'buyerCity' => $cli->city,
'buyerState' => $cli->state,
'buyerZip' => $cli->postal_code,
'buyerCountry' => $cli->country_id,
'buyerPhone' => $cli->phone,
'itemDesc' => "From InvoiceNinja",
'paymentID' => $payment->id
];
$urlRedirect = redirect()->route('client.payments.show', ['payment' => $payment->hashed_id])->getTargetUrl();
$checkoutOptions = new \BTCPayServer\Client\InvoiceCheckoutOptions();
$checkoutOptions->setRedirectURL($urlRedirect);
$client = new \BTCPayServer\Client\Invoice($drv->btcpay_url, $drv->api_key);
$rep = $client->createInvoice(
$drv->store_id,
$request->currency,
\BTCPayServer\Util\PreciseNumber::parseString($request->amount),
$_invoice->invoice_number,
$cli->present()->email(),
$metaData,
$checkoutOptions
);
$payment->transaction_reference = $rep->getId();
$payment->save();
return redirect($rep->getCheckoutLink());
} catch (\Throwable $e) {
throw new PaymentFailed('Error during BTCPay payment : ' . $e->getMessage());
}
}
public function refund(Payment $payment, $amount)
{
try {
$invoice = $payment->invoices()->first();
$isPartialRefund = ($amount < $payment->amount);
$client = new \BTCPayServer\Client\Invoice($this->driver_class->btcpay_url, $this->driver_class->api_key);
$refund = $client->refundInvoice($this->driver_class->store_id, $payment->transaction_reference);
/* $data = [];
$data['InvoiceNumber'] = $invoice->number;
$data['isPartialRefund'] = $isPartialRefund;
$data['BTCPayLink'] = $refund->getViewLink();*/
return $refund->getViewLink();
} catch (\Throwable $e) {
throw new PaymentFailed('Error during BTCPay refund : ' . $e->getMessage());
}
}
}

View File

@ -0,0 +1,138 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\PaymentDrivers;
use App\Utils\Traits\MakesHash;
use App\Models\GatewayType;
use App\PaymentDrivers\BTCPay\BTCPay;
use App\Models\SystemLog;
use App\Models\Payment;
use App\Exceptions\PaymentFailed;
use BTCPayServer\Client\Webhook;
class BTCPayPaymentDriver extends BaseDriver
{
use MakesHash;
public $refundable = true; //does this gateway support refunds?
public $token_billing = false; //does this gateway support token billing?
public $can_authorise_credit_card = false; //does this gateway support authorizations?
public $gateway; //initialized gateway
public $payment_method; //initialized payment method
public static $methods = [
GatewayType::CRYPTO => BTCPay::class, //maps GatewayType => Implementation class
];
const SYSTEM_LOG_TYPE = SystemLog::TYPE_CHECKOUT; //define a constant for your gateway ie TYPE_YOUR_CUSTOM_GATEWAY - set the const in the SystemLog model
public $btcpay_url = "";
public $api_key = "";
public $store_id = "";
public $webhook_secret = "";
public $btcpay;
public function init()
{
$this->btcpay_url = $this->company_gateway->getConfigField('btcpayUrl');
$this->api_key = $this->company_gateway->getConfigField('apiKey');
$this->store_id = $this->company_gateway->getConfigField('storeId');
$this->webhook_secret = $this->company_gateway->getConfigField('webhookSecret');
return $this; /* This is where you boot the gateway with your auth credentials*/
}
/* Returns an array of gateway types for the payment gateway */
public function gatewayTypes(): array
{
$types = [];
$types[] = GatewayType::CRYPTO;
return $types;
}
public function setPaymentMethod($payment_method_id)
{
$class = self::$methods[$payment_method_id];
$this->payment_method = new $class($this);
return $this;
}
public function processPaymentView(array $data)
{
return $this->payment_method->paymentView($data); //this is your custom implementation from here
}
public function processWebhookRequest()
{
$webhook_payload = file_get_contents('php://input');
//file_put_contents("/home/claude/invoiceninja/storage/my.log", $webhook_payload);
$btcpayRep = json_decode($webhook_payload);
if ($btcpayRep == null) {
throw new PaymentFailed('Empty data');
}
if (true === empty($btcpayRep->invoiceId)) {
throw new PaymentFailed(
'Invalid BTCPayServer payment notification- did not receive invoice ID.'
);
}
if (str_starts_with($btcpayRep->invoiceId, "__test__") || $btcpayRep->type == "InvoiceCreated") {
return;
}
$headers = getallheaders();
foreach ($headers as $key => $value) {
if (strtolower($key) === 'btcpay-sig') {
$sig = $value;
}
}
$this->init();
$webhookClient = new Webhook($this->btcpay_url, $this->api_key);
if (!$webhookClient->isIncomingWebhookRequestValid($webhook_payload, $sig, $this->webhook_secret)) {
throw new \RuntimeException(
'Invalid BTCPayServer payment notification message received - signature did not match.'
);
}
/** @var \App\Models\Payment $payment **/
$payment = Payment::find($btcpayRep->metafata->paymentID);
switch ($btcpayRep->type) {
case "InvoiceExpired":
$payment->status_id = Payment::STATUS_CANCELLED;
break;
case "InvoiceInvalid":
$payment->status_id = Payment::STATUS_FAILED;
break;
case "InvoiceSettled":
$payment->status_id = Payment::STATUS_COMPLETED;
break;
}
$payment->save();
}
public function refund(Payment $payment, $amount, $return_client_response = false)
{
$this->setPaymentMethod(GatewayType::CRYPTO);
return $this->payment_method->refund($payment, $amount); //this is your custom implementation from here
}
}

View File

@ -42,12 +42,11 @@
"bacon/bacon-qr-code": "^2.0",
"beganovich/snappdf": "^4",
"braintree/braintree_php": "^6.0",
"btcpayserver/btcpayserver-greenfield-php": "^2.6",
"checkout/checkout-sdk-php": "^3.0",
"invoiceninja/ubl_invoice": "^2",
"doctrine/dbal": "^3.0",
"eway/eway-rapid-php": "^1.3",
"fakerphp/faker": "^1.14",
"getbrevo/brevo-php": "^1.0",
"gocardless/gocardless-pro": "^4.12",
"google/apiclient": "^2.7",
"guzzlehttp/guzzle": "^7.2",
@ -55,10 +54,11 @@
"hashids/hashids": "^4.0",
"hedii/laravel-gelf-logger": "^8",
"horstoeko/zugferd": "^1",
"horstoeko/orderx": "^1",
"hyvor/php-json-exporter": "^0.0.3",
"imdhemy/laravel-purchases": "^1.7",
"intervention/image": "^2.5",
"invoiceninja/inspector": "^2.0",
"invoiceninja/ubl_invoice": "^2",
"josemmo/facturae-php": "^1.7",
"laracasts/presenter": "^0.2.1",
"laravel/framework": "^10",
@ -70,13 +70,14 @@
"league/flysystem-aws-s3-v3": "^3.0",
"league/fractal": "^0.20.0",
"league/omnipay": "^3.1",
"livewire/livewire": "^3",
"livewire/livewire": "^3.0",
"microsoft/microsoft-graph": "^1.69",
"mollie/mollie-api-php": "^2.36",
"nelexa/zip": "^4.0",
"nordigen/nordigen-php": "^1.1",
"nwidart/laravel-modules": "^10.0",
"omnipay/paypal": "^3.0",
"payfast/payfast-php-sdk": "^1.1",
"phpoffice/phpspreadsheet": "^1.29",
"pragmarx/google2fa": "^8.0",
"predis/predis": "^2",
@ -93,7 +94,6 @@
"sprain/swiss-qr-bill": "^4.3",
"square/square": "30.0.0.*",
"stripe/stripe-php": "^12",
"symfony/brevo-mailer": "6.4",
"symfony/http-client": "^6.0",
"symfony/mailgun-mailer": "^6.1",
"symfony/postmark-mailer": "^6.1",
@ -103,8 +103,7 @@
"twilio/sdk": "^6.40",
"webpatser/laravel-countries": "dev-master#75992ad",
"wepay/php-sdk": "^0.3",
"wildbit/postmark-php": "^4.0",
"hyvor/php-json-exporter": "^0.0.3"
"wildbit/postmark-php": "^4.0"
},
"require-dev": {
"php": "^8.1|^8.2",
@ -112,6 +111,7 @@
"barryvdh/laravel-ide-helper": "^2.13",
"beyondcode/laravel-query-detector": "^1.8",
"brianium/paratest": "^7",
"fakerphp/faker": "^1.14",
"filp/whoops": "^2.7",
"friendsofphp/php-cs-fixer": "^3.14",
"laracasts/cypress": "^3.0",

1997
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Models\Gateway;
use App\Models\GatewayType;
use Illuminate\Support\Str;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$gateway = new Gateway;
$gateway->name = 'BTCPay';
$gateway->key = 'vpyfbmdrkqcicpkjqdusgjfluebftuva';
$gateway->provider = 'BTCPay';
$gateway->is_offsite = true;
$btcpayFieds = new \stdClass;
$btcpayFieds->btcpayUrl = "";
$btcpayFieds->apiKey = "";
$btcpayFieds->storeId = "";
$btcpayFieds->webhookSecret = "";
$gateway->fields = \json_encode($btcpayFieds);
$gateway->visible = true;
$gateway->site_url = 'https://btcpayserver.org';
$gateway->default_gateway_type_id = GatewayType::CRYPTO;
$gateway->save();
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@ -0,0 +1,28 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.payment_type_Crypto'), 'card_title' => ctrans('texts.payment_type_Crypto')])
@section('gateway_content')
<div class="alert alert-failure mb-4" hidden id="errors"></div>
@include('portal.ninja2020.gateways.includes.payment_details')
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
@csrf
<input type="hidden" name="gateway_response">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}">
<input type="hidden" name="token">
<input type="hidden" name="amount" value="{{ $amount }}">
<input type="hidden" name="currency" value="{{ $currency }}">
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
</form>
@include('portal.ninja2020.gateways.includes.pay_now')
@endsection
@push('footer')
<script>
document.getElementById('pay-now').addEventListener('click', function() {
document.getElementById('server-response').submit();
});
</script>
@endpush