1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Stubs for form submissions

This commit is contained in:
David Bomba 2024-02-20 17:29:38 +11:00
parent c8f7e9e250
commit fb92f8fe9d
2 changed files with 21 additions and 14 deletions

View File

@ -13,43 +13,47 @@
namespace App\Livewire\BillingPortal;
use Livewire\Component;
use Livewire\Attributes\Lazy;
use App\Services\ClientPortal\InstantPayment;
#[Lazy]
class Submit extends Component
{
public array $context;
public function mount()
{
// This is right place to check if everything is set up correctly.
// <input type="hidden" name="action" value="payment">
// <input type="hidden" name="invoices[]" value="{{ $context['form']['invoice_hashed_id'] ?? '' }}">
// <input type="hidden" name="payable_invoices[0][amount]" value="{{ $context['form']['payable_amount'] ?? '' }}">
// <input type="hidden" name="payable_invoices[0][invoice_id]" value="{{ $context['form']['invoice_hashed_id'] ?? '' }}">
// <input type="hidden" name="company_gateway_id" value="{{ $context['form']['company_gateway_id'] ?? '' }}"/>
// <input type="hidden" name="payment_method_id" value="{{ $context['form']['payment_method_id'] ?? '' }}"/>
//hash
//sidebar = h
// $request = new \Illuminate\Http\Request([
// 'sidebar' => 'hidden',
// 'hash' => $this->context['hash'],
// 'action' => 'payment',
// 'invoices[]' => $this->context['form']['invoice_hashed_id'],
// 'payable_invoices[0][amount]' => $this->context['form']['payable_amount'],
// 'payable_invoices[0][invoice_id]' => $this->context['form']['invoice_hashed_id'],
// 'invoices' => [
// $this->context['form']['invoice_hashed_id'],
// ],
// 'payable_invoices' => [
// [
// 'amount' => $this->context['form']['payable_amount'],
// 'invoice_id' => $this->context['form']['invoice_hashed_id'],
// ],
// ],
// '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'],
// ]);
// return (new InstantPayment($request))->run();
// return redirect((new InstantPayment($request))->run());
$this->dispatch('purchase.submit');
}
public function render()
{
return <<<'HTML'
<div></div>
HTML;

View File

@ -71,6 +71,9 @@ class InstantPayment
* ['invoice_id' => xxx, 'amount' => 22.00]
*/
$payable_invoices = collect($this->request->payable_invoices);
nlog($payable_invoices);
$invoices = Invoice::query()->whereIn('id', $this->transformKeys($payable_invoices->pluck('invoice_id')->toArray()))->withTrashed()->get();
$invoices->each(function ($invoice) {