From 5f43c5e2a2064f4334c2c85e9c9f978cba633083 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 28 Aug 2024 11:02:57 +1000 Subject: [PATCH] Fixes for tests --- app/Livewire/EInvoice/Portal.php | 10 ++++++++++ app/Services/EDocument/Standards/Peppol.php | 2 +- app/Services/Report/ClientBalanceReport.php | 2 ++ resources/views/livewire/e-invoice/portal.blade.php | 8 +++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/Livewire/EInvoice/Portal.php b/app/Livewire/EInvoice/Portal.php index aa3f4be43564..de93a2ca5f60 100644 --- a/app/Livewire/EInvoice/Portal.php +++ b/app/Livewire/EInvoice/Portal.php @@ -106,7 +106,17 @@ class Portal extends Component if($r->successful()) { $response = $r->json(); + + $_company = auth()->guard('user')->user()->account->companies()->where('company_id', $company_key)->first(); + $_company->legal_entity_id = $response['id']; + $_company->save(); + return; } + + $error = json_decode($r->getBody()->getContents(),true); + + session()->flash('error', $error['message']); + } private function getHeaders() diff --git a/app/Services/EDocument/Standards/Peppol.php b/app/Services/EDocument/Standards/Peppol.php index 64bfba964585..3044f0749a19 100644 --- a/app/Services/EDocument/Standards/Peppol.php +++ b/app/Services/EDocument/Standards/Peppol.php @@ -783,7 +783,7 @@ class Peppol extends AbstractService */ private function resolveTaxScheme(): string { - return (new StorecoveRouter())->resolveTaxScheme($this->invoice->client->country->iso_3166_2, $this->invoice->client->classification) + return (new StorecoveRouter())->resolveTaxScheme($this->invoice->client->country->iso_3166_2, $this->invoice->client->classification); // $rules = isset($this->routing_rules[$this->invoice->client->country->iso_3166_2]) ? $this->routing_rules[$this->invoice->client->country->iso_3166_2] : [false, false, false, false,]; diff --git a/app/Services/Report/ClientBalanceReport.php b/app/Services/Report/ClientBalanceReport.php index a4a6b9f7eb1b..bf9cbf5c9d15 100644 --- a/app/Services/Report/ClientBalanceReport.php +++ b/app/Services/Report/ClientBalanceReport.php @@ -39,6 +39,7 @@ class ClientBalanceReport extends BaseExport 'invoices', 'invoice_balance', 'credit_balance', + 'payment_balance', ]; /** @@ -119,6 +120,7 @@ class ClientBalanceReport extends BaseExport $query->count(), $query->sum('balance'), $client->credit_balance, + $client->payment_balance, ]; } } diff --git a/resources/views/livewire/e-invoice/portal.blade.php b/resources/views/livewire/e-invoice/portal.blade.php index 58d0af7764ce..aeea856f8fbd 100644 --- a/resources/views/livewire/e-invoice/portal.blade.php +++ b/resources/views/livewire/e-invoice/portal.blade.php @@ -24,8 +24,14 @@ - +
+ + @if (session()->has('error')) +
+ {{ session('error') }} +
+ @endif