mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 14:12:44 +01:00
Refactors for einvoicing
This commit is contained in:
parent
cdde25baf7
commit
56ad60afb0
@ -38,7 +38,7 @@ use App\Transformers\ArraySerializer;
|
||||
use App\Transformers\EntityTransformer;
|
||||
use League\Fractal\Resource\Collection;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Invoiceninja\Einvoice\Decoder\Schema;
|
||||
use InvoiceNinja\EInvoice\Decoder\Schema;
|
||||
use League\Fractal\Serializer\JsonApiSerializer;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
|
@ -13,7 +13,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Statics;
|
||||
use Illuminate\Http\Response;
|
||||
use Invoiceninja\Einvoice\Decoder\Schema;
|
||||
use InvoiceNinja\EInvoice\Decoder\Schema;
|
||||
|
||||
class StaticController extends BaseController
|
||||
{
|
||||
|
@ -13,24 +13,24 @@ namespace App\Services\EDocument\Standards;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use App\Services\AbstractService;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\FatturaElettronica;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\IndirizzoType\Sede;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\AnagraficaType\Anagrafica;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\IdFiscaleType\IdFiscaleIVA;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\IdFiscaleType\IdTrasmittente;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DatiGeneraliType\DatiGenerali;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DatiPagamentoType\DatiPagamento;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DatiRiepilogoType\DatiRiepilogo;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DettaglioLineeType\DettaglioLinee;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DatiBeniServiziType\DatiBeniServizi;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DatiTrasmissioneType\DatiTrasmissione;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\CedentePrestatoreType\CedentePrestatore;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DatiAnagraficiCedenteType\DatiAnagrafici;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DettaglioPagamentoType\DettaglioPagamento;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\DatiGeneraliDocumentoType\DatiGeneraliDocumento;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\CessionarioCommittenteType\CessionarioCommittente;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\FatturaElettronicaBodyType\FatturaElettronicaBody;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\FatturaElettronicaHeaderType\FatturaElettronicaHeader;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronica;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\IndirizzoType\Sede;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\AnagraficaType\Anagrafica;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\IdFiscaleType\IdFiscaleIVA;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\IdFiscaleType\IdTrasmittente;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DatiGeneraliType\DatiGenerali;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DatiPagamentoType\DatiPagamento;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DatiRiepilogoType\DatiRiepilogo;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DettaglioLineeType\DettaglioLinee;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DatiBeniServiziType\DatiBeniServizi;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DatiTrasmissioneType\DatiTrasmissione;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\CedentePrestatoreType\CedentePrestatore;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DatiAnagraficiCedenteType\DatiAnagrafici;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DettaglioPagamentoType\DettaglioPagamento;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\DatiGeneraliDocumentoType\DatiGeneraliDocumento;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\CessionarioCommittenteType\CessionarioCommittente;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaBodyType\FatturaElettronicaBody;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaHeaderType\FatturaElettronicaHeader;
|
||||
|
||||
class FatturaPANew extends AbstractService
|
||||
{
|
||||
@ -178,7 +178,7 @@ class FatturaPANew extends AbstractService
|
||||
$this->DatiGeneraliDocumento->Divisa = $this->invoice->client->currency()->code;
|
||||
$this->DatiGeneraliDocumento->Data = new \DateTime($this->invoice->date);
|
||||
$this->DatiGeneraliDocumento->Numero = $this->invoice->number;
|
||||
$this->DatiGeneraliDocumento->Causale[] = substr($this->invoice->public_notes ?? '',0, 200); //unsure..
|
||||
$this->DatiGeneraliDocumento->Causale[] = substr($this->invoice->public_notes ?? ' ', 0, 200); //unsure..
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
11
composer.lock
generated
11
composer.lock
generated
@ -5076,12 +5076,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/invoiceninja/einvoice.git",
|
||||
"reference": "17c57fabb8f065d2782dfc432df9fb801136d82b"
|
||||
"reference": "5ada5e64ee84137dbd5736e4b1c8da7661a8dc97"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/17c57fabb8f065d2782dfc432df9fb801136d82b",
|
||||
"reference": "17c57fabb8f065d2782dfc432df9fb801136d82b",
|
||||
"url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/5ada5e64ee84137dbd5736e4b1c8da7661a8dc97",
|
||||
"reference": "5ada5e64ee84137dbd5736e4b1c8da7661a8dc97",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -5095,6 +5095,7 @@
|
||||
"symfony/validator": "^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.58",
|
||||
"milo/schematron": "^1.0",
|
||||
"nette/php-generator": "^4.1",
|
||||
"phpstan/phpstan": "^1.11",
|
||||
@ -5105,7 +5106,7 @@
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Invoiceninja\\Einvoice\\": "src/"
|
||||
"InvoiceNinja\\EInvoice\\": "src/"
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
@ -5122,7 +5123,7 @@
|
||||
"source": "https://github.com/invoiceninja/einvoice/tree/main",
|
||||
"issues": "https://github.com/invoiceninja/einvoice/issues"
|
||||
},
|
||||
"time": "2024-06-07T00:28:18+00:00"
|
||||
"time": "2024-06-07T01:16:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "invoiceninja/inspector",
|
||||
|
@ -19,13 +19,14 @@ use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\InvoiceItem;
|
||||
use App\Models\Invoice;
|
||||
use Invoiceninja\Einvoice\Symfony\Encode;
|
||||
use InvoiceNinja\EInvoice\Symfony\Encode;
|
||||
use App\Services\EDocument\Standards\FatturaPANew;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\FatturaElettronica;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\FatturaElettronicaBodyType\FatturaElettronicaBody;
|
||||
use Invoiceninja\Einvoice\Models\FatturaPA\FatturaElettronicaHeaderType\FatturaElettronicaHeader;
|
||||
use InvoiceNinja\EInvoice\EInvoice;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronica;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaBodyType\FatturaElettronicaBody;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaHeaderType\FatturaElettronicaHeader;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -126,12 +127,17 @@ class FatturaPATest extends TestCase
|
||||
$this->assertInstanceOf(FatturaElettronicaHeader::class, $fe->FatturaElettronicaHeader);
|
||||
|
||||
|
||||
$e = new EInvoice;
|
||||
$errors = $e->validate($fe);
|
||||
|
||||
if(count($errors) > 0)
|
||||
nlog($errors);
|
||||
|
||||
$this->assertCount(0, $errors);
|
||||
|
||||
$encoder = new Encode($fe);
|
||||
$xml = $encoder->toXml();
|
||||
|
||||
|
||||
nlog($xml);
|
||||
|
||||
$this->assertNotNull($xml);
|
||||
|
||||
|
||||
|
@ -23,51 +23,51 @@ use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\Validator\Validation;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Serializer\Encoder\XmlEncoder;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\ItemType\Item;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
|
||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\PartyType\Party;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\PriceType\Price;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyType\Party;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\PriceType\Price;
|
||||
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\ContactType\Contact;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\CountryType\Country;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxAmount;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\TaxTotalType\TaxTotal;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\ContactType\Contact;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\CountryType\Country;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxAmount;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxTotalType\TaxTotal;
|
||||
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AmountType\PriceAmount;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\PriceAmount;
|
||||
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\TaxSchemeType\TaxScheme;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxSchemeType\TaxScheme;
|
||||
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AddressType\PostalAddress;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AddressType\PostalAddress;
|
||||
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\InvoiceLineType\InvoiceLine;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\TaxScheme as PeppolTaxScheme;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\TaxSubtotalType\TaxSubtotal;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\QuantityType\InvoicedQuantity;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\InvoiceLineType\InvoiceLine;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxScheme as PeppolTaxScheme;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxSubtotalType\TaxSubtotal;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\QuantityType\InvoicedQuantity;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AmountType\LineExtensionAmount;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AmountType\PayableAmount;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxableAmount;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxExclusiveAmount;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxInclusiveAmount;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\LineExtensionAmount;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\PayableAmount;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxableAmount;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxExclusiveAmount;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxInclusiveAmount;
|
||||
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\PartyTaxSchemeType\PartyTaxScheme;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyTaxSchemeType\PartyTaxScheme;
|
||||
use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\MonetaryTotalType\LegalMonetaryTotal;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\PartyLegalEntityType\PartyLegalEntity;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\TaxCategoryType\ClassifiedTaxCategory;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\MonetaryTotalType\LegalMonetaryTotal;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyLegalEntityType\PartyLegalEntity;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxCategoryType\ClassifiedTaxCategory;
|
||||
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\CustomerPartyType\AccountingCustomerParty;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\PartyIdentificationType\PartyIdentification;
|
||||
use Invoiceninja\Einvoice\Models\Peppol\TaxCategoryType\TaxCategory;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\CustomerPartyType\AccountingCustomerParty;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyIdentificationType\PartyIdentification;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxCategoryType\TaxCategory;
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
class PeppolTest extends TestCase
|
||||
class FACT1Test extends TestCase
|
||||
{
|
||||
use MockAccountData;
|
||||
use DatabaseTransactions;
|
||||
@ -140,7 +140,7 @@ class PeppolTest extends TestCase
|
||||
$_invoice->service()->markSent()->save();
|
||||
$calc = $_invoice->calc();
|
||||
|
||||
$invoice = new \Invoiceninja\Einvoice\Models\Peppol\Invoice();
|
||||
$invoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
|
||||
$invoice->UBLVersionID = '2.1';
|
||||
$invoice->CustomizationID = 'urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1';
|
||||
$invoice->ID = $_invoice->number;
|
||||
|
Loading…
Reference in New Issue
Block a user