diff --git a/app/Http/Controllers/EInvoiceTokenController.php b/app/Http/Controllers/EInvoiceTokenController.php index 6f17989186..4b3a0021ef 100644 --- a/app/Http/Controllers/EInvoiceTokenController.php +++ b/app/Http/Controllers/EInvoiceTokenController.php @@ -23,7 +23,7 @@ class EInvoiceTokenController extends BaseController /** @var \App\Models\Company $company */ $company = auth()->user()->company(); - $company->e_invoicing_token = $request->get('token'); + // $company->e_invoicing_token = $request->get('token'); $company->save(); return response()->noContent(); diff --git a/app/Models/Company.php b/app/Models/Company.php index 35b30bd4b8..b498bdacef 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -416,7 +416,7 @@ class Company extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function documents() { diff --git a/app/Models/Credit.php b/app/Models/Credit.php index d6ec4797ef..a3f0122230 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -268,9 +268,9 @@ class Credit extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ - public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany + public function company_ledger() { return $this->morphMany(CompanyLedger::class, 'company_ledgerable'); } @@ -290,17 +290,17 @@ class Credit extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ - public function payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany + public function payments() { return $this->morphToMany(Payment::class, 'paymentable'); } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ - public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany + public function documents() { return $this->morphMany(Document::class, 'documentable'); } diff --git a/app/Models/Expense.php b/app/Models/Expense.php index 88107688fe..9ed0d58dce 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -166,9 +166,6 @@ class Expense extends BaseModel return self::class; } - /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany - */ public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany { return $this->morphMany(Document::class, 'documentable'); diff --git a/app/Models/GroupSetting.php b/app/Models/GroupSetting.php index 88d12d0f27..77af5e61ca 100644 --- a/app/Models/GroupSetting.php +++ b/app/Models/GroupSetting.php @@ -102,7 +102,7 @@ class GroupSetting extends StaticModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany { diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 704fa8158e..2d7b4c86f8 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -292,7 +292,7 @@ class Invoice extends BaseModel // } /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function company() { @@ -345,7 +345,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany { @@ -353,7 +353,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ public function payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany { @@ -361,7 +361,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ public function net_payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany { @@ -369,7 +369,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany { @@ -382,7 +382,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough */ public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough { @@ -400,7 +400,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\HasOne + * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function task(): \Illuminate\Database\Eloquent\Relations\HasOne { @@ -408,7 +408,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\HasOne + * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function quote(): \Illuminate\Database\Eloquent\Relations\HasOne { @@ -421,7 +421,7 @@ class Invoice extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\HasOne + * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function expense(): \Illuminate\Database\Eloquent\Relations\HasOne { diff --git a/app/Models/Payment.php b/app/Models/Payment.php index 42155828e8..a03e27ae14 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -219,7 +219,7 @@ class Payment extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ public function invoices(): \Illuminate\Database\Eloquent\Relations\MorphToMany { @@ -227,7 +227,7 @@ class Payment extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ public function credits(): \Illuminate\Database\Eloquent\Relations\MorphToMany { @@ -235,7 +235,7 @@ class Payment extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany { diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 63574ac168..d1b2ac8898 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -227,7 +227,7 @@ class Quote extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough */ public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough { @@ -270,7 +270,7 @@ class Quote extends BaseModel } /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany { diff --git a/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php b/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php index 5d7f582549..51ab23bb59 100644 --- a/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php +++ b/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php @@ -95,11 +95,13 @@ class StorecoveAdapter //configure identifiers //set additional identifier if required (ie de => FR with FR vat) + return $this; } public function validate(): self { - return $this->valid_document; + // $this->valid_document + return $this; } public function getInvoice(): Invoice diff --git a/app/Services/EDocument/Gateway/Storecove/StorecoveRouter.php b/app/Services/EDocument/Gateway/Storecove/StorecoveRouter.php index 2bf0f35b2d..6623434d5c 100644 --- a/app/Services/EDocument/Gateway/Storecove/StorecoveRouter.php +++ b/app/Services/EDocument/Gateway/Storecove/StorecoveRouter.php @@ -16,7 +16,7 @@ class StorecoveRouter /** * Provides a country matrix for the correct scheme to send via * - * @var mixed $routing_rules + * @var array $routing_rules **/ private array $routing_rules = [ "US" => [ diff --git a/app/Services/EDocument/Gateway/Transformers/StorecoveTransformer.php b/app/Services/EDocument/Gateway/Transformers/StorecoveTransformer.php index f13d7e54db..41c56d5763 100644 --- a/app/Services/EDocument/Gateway/Transformers/StorecoveTransformer.php +++ b/app/Services/EDocument/Gateway/Transformers/StorecoveTransformer.php @@ -34,7 +34,7 @@ class StorecoveTransformer implements TransformerInterface return $this; } - public function getInvoice($s_invoice): StorecoveInvoice + public function getInvoice(): StorecoveInvoice { return $this->s_invoice; } @@ -42,6 +42,7 @@ class StorecoveTransformer implements TransformerInterface public function createNewStorecoveInvoice(): self { $this->s_invoice = (new \ReflectionClass(StorecoveInvoice::class))->newInstanceWithoutConstructor(); + return $this; } //$invoice = inbound peppol @@ -166,11 +167,6 @@ class StorecoveTransformer implements TransformerInterface return $doc; } - public function getInvoice(): StorecoveInvoice - { - return $this->s_invoice; - } - public function toJson(): string { return json_encode($this->s_invoice, JSON_PRETTY_PRINT); diff --git a/app/Services/EDocument/Jobs/SendEDocument.php b/app/Services/EDocument/Jobs/SendEDocument.php index eb7cbe2c1b..b1143b007c 100644 --- a/app/Services/EDocument/Jobs/SendEDocument.php +++ b/app/Services/EDocument/Jobs/SendEDocument.php @@ -60,16 +60,19 @@ class SendEDocument implements ShouldQueue $result = $storecove->build($model); - // $xml = $p->toXml(); + /**************************** Legacy */ + $xml = $p->toXml(); - // $payload = [ - // 'legal_entity_id' => $model->company->legal_entity_id, - // 'document' => base64_encode($xml), - // 'tenant_id' => $model->company->company_key, - // 'identifiers' => $identifiers, - // // 'e_invoicing_token' => $model->company->e_invoicing_token, - // // include whitelabel key. - // ]; + $payload = [ + 'legal_entity_id' => $model->company->legal_entity_id, + 'document' => base64_encode($xml), + 'tenant_id' => $model->company->company_key, + 'identifiers' => $identifiers, + // 'e_invoicing_token' => $model->company->e_invoicing_token, + // include whitelabel key. + ]; + + /**************************** Legacy */ $r = Http::withHeaders($this->getHeaders()) ->post(config('ninja.hosted_ninja_url')."/api/einvoice/submission", $payload);