From fb92f8fe9dd6fc92fa46c61ed71624faeca01612 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 20 Feb 2024 17:29:38 +1100 Subject: [PATCH] Stubs for form submissions --- app/Livewire/BillingPortal/Submit.php | 32 +++++++++++--------- app/Services/ClientPortal/InstantPayment.php | 3 ++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/Livewire/BillingPortal/Submit.php b/app/Livewire/BillingPortal/Submit.php index cc9d03520a9f..629c434f085c 100644 --- a/app/Livewire/BillingPortal/Submit.php +++ b/app/Livewire/BillingPortal/Submit.php @@ -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. - // - // - // - // - // - // - //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'
HTML; diff --git a/app/Services/ClientPortal/InstantPayment.php b/app/Services/ClientPortal/InstantPayment.php index 3b5451cb54aa..990a95635417 100644 --- a/app/Services/ClientPortal/InstantPayment.php +++ b/app/Services/ClientPortal/InstantPayment.php @@ -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) {