getContext()['db']); $invitation = InvoiceInvitation::find($this->getContext()['invitation_id']); $data = [ 'company_gateway_id' => $this->getContext()['company_gateway_id'], 'payment_method_id' => $this->getContext()['gateway_type_id'], 'payable_invoices' => $this->getContext()['payable_invoices'], 'signature' => isset($this->getContext()['signature']) ? $this->getContext()['signature'] : false, 'signature_ip' => isset($this->getContext()['signature_ip']) ? $this->getContext()['signature_ip'] : false, 'pre_payment' => false, 'frequency_id' => false, 'remaining_cycles' => false, 'is_recurring' => false, // 'hash' => false, ]; $responder_data = (new LivewireInstantPayment($data))->run(); $company_gateway = CompanyGateway::find($this->getContext()['company_gateway_id']); if (!$responder_data['success']) { throw new PaymentFailed($responder_data['error'], 400); } $driver = $company_gateway ->driver($invitation->contact->client) // @phpstan-ignore-line ->setPaymentMethod($data['payment_method_id']) ->setPaymentHash($responder_data['payload']['ph']); $this->payment_data_payload = $driver->processPaymentViewData($responder_data['payload']); $this->payment_view = $driver->livewirePaymentView( $this->payment_data_payload, ); $this->isLoading = false; } public function render(): \Illuminate\Contracts\View\Factory|string|\Illuminate\View\View { if ($this->isLoading) { return <<<'HTML' HTML; } return render($this->payment_view, $this->payment_data_payload); } public function exception($e, $stopPropagation) { $errors = session()->get('errors', new \Illuminate\Support\ViewErrorBag()); $bag = new \Illuminate\Support\MessageBag(); $bag->add('gateway_error', $e->getMessage()); session()->put('errors', $errors->put('default', $bag)); $invoice_id = $this->getContext()['payable_invoices'][0]['invoice_id']; $this->redirectRoute('client.invoice.show', ['invoice' => $invoice_id]); $stopPropagation(); } }