1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Livewire/BillingPortal/Submit.php

75 lines
2.7 KiB
PHP
Raw Normal View History

2024-02-19 18:16:40 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Livewire\BillingPortal;
use Livewire\Component;
2024-02-20 07:29:38 +01:00
use Livewire\Attributes\Lazy;
2024-02-20 06:05:00 +01:00
use App\Services\ClientPortal\InstantPayment;
2024-02-19 18:16:40 +01:00
2024-02-20 07:29:38 +01:00
#[Lazy]
2024-02-19 18:16:40 +01:00
class Submit extends Component
{
public array $context;
public function mount()
{
2024-02-20 06:05:00 +01:00
// $request = new \Illuminate\Http\Request([
// 'sidebar' => 'hidden',
// 'hash' => $this->context['hash'],
// 'action' => 'payment',
2024-02-20 07:29:38 +01:00
// 'invoices' => [
// $this->context['form']['invoice_hashed_id'],
// ],
// 'payable_invoices' => [
// [
// 'amount' => $this->context['form']['payable_amount'],
// 'invoice_id' => $this->context['form']['invoice_hashed_id'],
// ],
// ],
2024-02-20 06:05:00 +01:00
// 'company_gateway_id' => $this->context['form']['company_gateway_id'],
// 'payment_method_id' => $this->context['form']['payment_method_id'],
2024-02-20 07:29:38 +01:00
// 'contact_first_name' => $this->context['contact']['first_name'],
// 'contact_last_name' => $this->context['contact']['last_name'],
// 'contact_email' => $this->context['contact']['email'],
2024-02-20 06:05:00 +01:00
// ]);
2024-02-20 07:29:38 +01:00
// return redirect((new InstantPayment($request))->run());
2024-02-19 18:16:40 +01:00
$this->dispatch(
'purchase.submit',
invoice_hashed_id: $this->context['form']['invoice_hashed_id'],
payable_amount: $this->context['form']['payable_amount'],
company_gateway_id: $this->context['form']['company_gateway_id'],
payment_method_id: $this->context['form']['payment_method_id'],
contact_first_name: $this->context['contact']['first_name'],
contact_last_name: $this->context['contact']['last_name'],
contact_email: $this->context['contact']['email'],
);
2024-02-19 18:16:40 +01:00
}
public function render()
{
2024-02-19 18:16:40 +01:00
return <<<'HTML'
<svg class="animate-spin h-8 w-8 text-primary" xmlns="http://www.w3.org/2000/svg"
fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
2024-02-19 18:16:40 +01:00
HTML;
}
}