mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:27:29 -05:00 
			
		
		
		
	Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop
This commit is contained in:
		
						commit
						934a30f661
					
				@ -1 +1 @@
 | 
			
		||||
5.5.105
 | 
			
		||||
5.5.106
 | 
			
		||||
@ -162,6 +162,9 @@ class SelfUpdateController extends BaseController
 | 
			
		||||
                $this->deleteDirectory(base_path('vendor/beganovich/snappdf/versions/'.$file->getFileName()));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $iterator = null;
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function deleteDirectory($dir)
 | 
			
		||||
@ -206,6 +209,8 @@ class SelfUpdateController extends BaseController
 | 
			
		||||
        foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
 | 
			
		||||
            unlink(base_path('bootstrap/cache/').$file->getFileName());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $directoryIterator = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function testWritable()
 | 
			
		||||
@ -225,6 +230,8 @@ class SelfUpdateController extends BaseController
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $directoryIterator = null;
 | 
			
		||||
        
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										140
									
								
								app/Services/Invoice/EInvoice/FatturaPA.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										140
									
								
								app/Services/Invoice/EInvoice/FatturaPA.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,140 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://www.elastic.co/licensing/elastic-license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace App\Services\Invoice\EInvoice;
 | 
			
		||||
 | 
			
		||||
use SimpleXMLElement;
 | 
			
		||||
use App\Models\Invoice;
 | 
			
		||||
use App\Services\AbstractService;
 | 
			
		||||
/*
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<FatturaElettronica versione="FPR12" xmlns="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2">
 | 
			
		||||
    <FatturaElettronicaHeader>
 | 
			
		||||
        <DatiTrasmissione>
 | 
			
		||||
            <IdTrasmittente>
 | 
			
		||||
                <IdPaese>IT</IdPaese>
 | 
			
		||||
                <IdCodice>01234567890</IdCodice>
 | 
			
		||||
            </IdTrasmittente>
 | 
			
		||||
            <ProgressivoInvio>00001</ProgressivoInvio>
 | 
			
		||||
            <FormatoTrasmissione>FPR12</FormatoTrasmissione>
 | 
			
		||||
            <CodiceDestinatario>ABCDE1</CodiceDestinatario>
 | 
			
		||||
        </DatiTrasmissione>
 | 
			
		||||
        <CedentePrestatore>
 | 
			
		||||
            <!-- Company information of the sender (seller/provider) -->
 | 
			
		||||
        </CedentePrestatore>
 | 
			
		||||
        <CessionarioCommittente>
 | 
			
		||||
            <!-- Company information of the receiver (buyer) -->
 | 
			
		||||
        </CessionarioCommittente>
 | 
			
		||||
    </FatturaElettronicaHeader>
 | 
			
		||||
    <FatturaElettronicaBody>
 | 
			
		||||
        <DatiGenerali>
 | 
			
		||||
            <DatiGeneraliDocumento>
 | 
			
		||||
                <TipoDocumento>TD01</TipoDocumento>
 | 
			
		||||
                <Divisa>EUR</Divisa>
 | 
			
		||||
                <Data>2023-04-21</Data>
 | 
			
		||||
                <Numero>1</Numero>
 | 
			
		||||
                <!-- Add other information as needed -->
 | 
			
		||||
            </DatiGeneraliDocumento>
 | 
			
		||||
            <!-- Add other general data as needed -->
 | 
			
		||||
        </DatiGenerali>
 | 
			
		||||
        <DatiBeniServizi>
 | 
			
		||||
            <!-- List of items or services -->
 | 
			
		||||
        </DatiBeniServizi>
 | 
			
		||||
        <DatiPagamento>
 | 
			
		||||
            <!-- Payment details -->
 | 
			
		||||
        </DatiPagamento>
 | 
			
		||||
    </FatturaElettronicaBody>
 | 
			
		||||
</FatturaElettronica>
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
class FatturaPA extends AbstractService
 | 
			
		||||
{
 | 
			
		||||
    private $xml;
 | 
			
		||||
 | 
			
		||||
    public function __construct(public Invoice $invoice)
 | 
			
		||||
    {
 | 
			
		||||
        $this->xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><FatturaElettronica></FatturaElettronica>');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function run()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->addHeader()->getXml();
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
   public function addHeader() {
 | 
			
		||||
        $this->xml->addChild('FatturaElettronicaHeader');
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addTrasmissioneData($idPaese, $idCodice, $progressivoInvio, $formatoTrasmissione, $codiceDestinatario) {
 | 
			
		||||
        $datiTrasmissione = $this->xml->FatturaElettronicaHeader->addChild('DatiTrasmissione');
 | 
			
		||||
        $idTrasmittente = $datiTrasmissione->addChild('IdTrasmittente');
 | 
			
		||||
        $idTrasmittente->addChild('IdPaese', $idPaese);
 | 
			
		||||
        $idTrasmittente->addChild('IdCodice', $idCodice);
 | 
			
		||||
        $datiTrasmissione->addChild('ProgressivoInvio', $progressivoInvio);
 | 
			
		||||
        $datiTrasmissione->addChild('FormatoTrasmissione', $formatoTrasmissione);
 | 
			
		||||
        $datiTrasmissione->addChild('CodiceDestinatario', $codiceDestinatario);
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addCedentePrestatore($data) {
 | 
			
		||||
        // Add CedentePrestatore data
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addCessionarioCommittente($data) {
 | 
			
		||||
        // Add CessionarioCommittente data
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addBody() {
 | 
			
		||||
        $this->xml->addChild('FatturaElettronicaBody');
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addDatiGenerali($data) {
 | 
			
		||||
        // Add DatiGenerali data
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addLineItem($data) {
 | 
			
		||||
        if (!isset($this->xml->FatturaElettronicaBody->DatiBeniServizi)) {
 | 
			
		||||
            $this->xml->FatturaElettronicaBody->addChild('DatiBeniServizi');
 | 
			
		||||
        }
 | 
			
		||||
        $lineItem = $this->xml->FatturaElettronicaBody->DatiBeniServizi->addChild('DettaglioLinee');
 | 
			
		||||
        $lineItem->addChild('NumeroLinea', $data['NumeroLinea']);
 | 
			
		||||
        $lineItem->addChild('Descrizione', $data['notes']);
 | 
			
		||||
        $lineItem->addChild('Quantita', $data['quantity']);
 | 
			
		||||
        $lineItem->addChild('PrezzoUnitario', $data['cost']);
 | 
			
		||||
        $lineItem->addChild('PrezzoTotale', $data['line_total']);
 | 
			
		||||
        $lineItem->addChild('AliquotaIVA', $data['tax_rate1']);
 | 
			
		||||
 | 
			
		||||
        if (isset($data['UnitaMisura'])) {
 | 
			
		||||
            $lineItem->addChild('UnitaMisura', $data['UnitaMisura']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addDatiPagamento($data) {
 | 
			
		||||
        // Add DatiPagamento data
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function getXml()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->xml->asXML();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// $fattura = new FatturaPA();
 | 
			
		||||
// $fattura
 | 
			
		||||
//     ->addHeader()
 | 
			
		||||
//     ->addTrasmissioneData('IT', '01234567890', '00001', 'FPR12', 'ABCDE1');
 | 
			
		||||
 | 
			
		||||
// echo $fattura->getXml();
 | 
			
		||||
@ -14,8 +14,8 @@ return [
 | 
			
		||||
    'require_https' => env('REQUIRE_HTTPS', true),
 | 
			
		||||
    'app_url' => rtrim(env('APP_URL', ''), '/'),
 | 
			
		||||
    'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
 | 
			
		||||
    'app_version' => '5.5.105',
 | 
			
		||||
    'app_tag' => '5.5.105',
 | 
			
		||||
    'app_version' => '5.5.106',
 | 
			
		||||
    'app_tag' => '5.5.106',
 | 
			
		||||
    'minimum_client_version' => '5.0.16',
 | 
			
		||||
    'terms_version' => '1.0.1',
 | 
			
		||||
    'api_secret' => env('API_SECRET', ''),
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								public/flutter_service_worker.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								public/flutter_service_worker.js
									
									
									
									
										vendored
									
									
								
							@ -8,8 +8,8 @@ const RESOURCES = {
 | 
			
		||||
"canvaskit/profiling/canvaskit.js": "c21852696bc1cc82e8894d851c01921a",
 | 
			
		||||
"canvaskit/profiling/canvaskit.wasm": "371bc4e204443b0d5e774d64a046eb99",
 | 
			
		||||
"canvaskit/canvaskit.wasm": "3de12d898ec208a5f31362cc00f09b9e",
 | 
			
		||||
"/": "ce916b859a7b6e9b399d0ea53e3943aa",
 | 
			
		||||
"main.dart.js": "9795e7408f5fd9d163f59f046dea3a30",
 | 
			
		||||
"/": "4dc42582b23586f0a87f05a055704c19",
 | 
			
		||||
"main.dart.js": "31eae793fd4596a8c839ab497b11df22",
 | 
			
		||||
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
 | 
			
		||||
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
 | 
			
		||||
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										61116
									
								
								public/main.dart.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										61116
									
								
								public/main.dart.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										60892
									
								
								public/main.foss.dart.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										60892
									
								
								public/main.foss.dart.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										329
									
								
								public/main.profile.dart.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										329
									
								
								public/main.profile.dart.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										48
									
								
								tests/Feature/EInvoice/FatturaPATest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								tests/Feature/EInvoice/FatturaPATest.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://www.elastic.co/licensing/elastic-license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Tests\Feature;
 | 
			
		||||
 | 
			
		||||
use App\Services\Invoice\EInvoice\FatturaPA;
 | 
			
		||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
 | 
			
		||||
use Illuminate\Routing\Middleware\ThrottleRequests;
 | 
			
		||||
use Tests\MockAccountData;
 | 
			
		||||
use Tests\TestCase;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @test
 | 
			
		||||
 */
 | 
			
		||||
class FatturaPATest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    use DatabaseTransactions;
 | 
			
		||||
    use MockAccountData;
 | 
			
		||||
 | 
			
		||||
    protected function setUp(): void
 | 
			
		||||
    {
 | 
			
		||||
        parent::setUp();
 | 
			
		||||
 | 
			
		||||
        $this->makeTestData();
 | 
			
		||||
 | 
			
		||||
        $this->withoutMiddleware(
 | 
			
		||||
            ThrottleRequests::class
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testInvoiceBoot()
 | 
			
		||||
    {
 | 
			
		||||
        $fat = new FatturaPA($this->invoice);
 | 
			
		||||
        $xml = $fat->run();
 | 
			
		||||
 | 
			
		||||
        // nlog($xml);
 | 
			
		||||
        
 | 
			
		||||
        $this->assertnotNull($xml);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user