mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:07:32 -05:00 
			
		
		
		
	
						commit
						d98f7c3902
					
				@ -1 +1 @@
 | 
			
		||||
5.10.10
 | 
			
		||||
5.10.11
 | 
			
		||||
@ -94,7 +94,7 @@ class SendEmailRequest extends Request
 | 
			
		||||
 | 
			
		||||
        $this->entity_plural = Str::plural($input['entity']) ?? '';
 | 
			
		||||
 | 
			
		||||
        if (isset($input['entity'])) {
 | 
			
		||||
        if (isset($input['entity']) && in_array($input['entity'], ['invoice','quote','credit','recurring_invoice','purchase_order','payment'])) {
 | 
			
		||||
            $input['entity'] = "App\Models\\".ucfirst(Str::camel($input['entity']));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -104,23 +104,23 @@ class Storecove {
 | 
			
		||||
            "legalEntityId"=> 290868,
 | 
			
		||||
            "idempotencyGuid"=> \Illuminate\Support\Str::uuid(),
 | 
			
		||||
            "routing" => [
 | 
			
		||||
                "eIdentifiers" => [
 | 
			
		||||
                    [
 | 
			
		||||
                        "scheme" => "DE:VAT",
 | 
			
		||||
                        "id"=> "DE:VAT"
 | 
			
		||||
                    ],
 | 
			
		||||
                ]
 | 
			
		||||
                "eIdentifiers" => [],
 | 
			
		||||
                "emails" => ["david@invoiceninja.com"]
 | 
			
		||||
            ],
 | 
			
		||||
            "document"=> [
 | 
			
		||||
                'documentType' => 'invoice',
 | 
			
		||||
                'rawDocumentData' => ['document' => base64_encode($document), 'parse' => true, 'parseStrategy', 'ubl'],
 | 
			
		||||
                // 
 | 
			
		||||
                // '
 | 
			
		||||
                "rawDocumentData"=> [
 | 
			
		||||
                    "document" => base64_encode($document), 
 | 
			
		||||
                    "parse" => true,
 | 
			
		||||
                    "parseStrategy"=> "ubl",
 | 
			
		||||
                ],
 | 
			
		||||
            ],
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $uri = "document_submissions";
 | 
			
		||||
        
 | 
			
		||||
        nlog($payload);
 | 
			
		||||
        
 | 
			
		||||
        $r = $this->httpClient($uri, (HttpVerb::POST)->value, $payload, $this->getHeaders());
 | 
			
		||||
 | 
			
		||||
        nlog($r->body());
 | 
			
		||||
 | 
			
		||||
@ -11,11 +11,14 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Services\EDocument\Standards;
 | 
			
		||||
 | 
			
		||||
use App\Models\Company;
 | 
			
		||||
use App\Models\Invoice;
 | 
			
		||||
use App\Services\AbstractService;
 | 
			
		||||
use App\Helpers\Invoice\InvoiceSum;
 | 
			
		||||
use App\Helpers\Invoice\InvoiceSumInclusive;
 | 
			
		||||
use InvoiceNinja\EInvoice\EInvoice;
 | 
			
		||||
use App\Helpers\Invoice\InvoiceSumInclusive;
 | 
			
		||||
use App\Helpers\Invoice\Taxer;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyType\Party;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\PriceType\Price;
 | 
			
		||||
@ -24,9 +27,14 @@ 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 App\Services\EDocument\Standards\Settings\PropertyResolver;
 | 
			
		||||
use App\Utils\Traits\NumberFormatter;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\PriceAmount;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyNameType\PartyName;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxSchemeType\TaxScheme;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\PayableAmount;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxableAmount;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxTotal as PeppolTaxTotal;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\InvoiceLineType\InvoiceLine;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxCategoryType\TaxCategory;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxSubtotalType\TaxSubtotal;
 | 
			
		||||
@ -34,16 +42,17 @@ use InvoiceNinja\EInvoice\Models\Peppol\TaxScheme as PeppolTaxScheme;
 | 
			
		||||
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\PriceAmount;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxableAmount;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\MonetaryTotalType\LegalMonetaryTotal;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxCategoryType\ClassifiedTaxCategory;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\CustomerPartyType\AccountingCustomerParty;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxTotal as PeppolTaxTotal;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\FinancialAccountType\PayeeFinancialAccount;
 | 
			
		||||
 | 
			
		||||
class Peppol extends AbstractService
 | 
			
		||||
{
 | 
			
		||||
    use Taxer;
 | 
			
		||||
    use NumberFormatter;
 | 
			
		||||
    
 | 
			
		||||
    private array $InvoiceTypeCodes = [
 | 
			
		||||
        "380" => "Commercial invoice",
 | 
			
		||||
        "381" => "Credit note",
 | 
			
		||||
@ -59,16 +68,17 @@ class Peppol extends AbstractService
 | 
			
		||||
        "896" => "Debit note related to self-billed invoice"
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    private \InvoiceNinja\EInvoice\Models\Peppol\Invoice $p_invoice;
 | 
			
		||||
    private Company $company;
 | 
			
		||||
 | 
			
		||||
    private InvoiceSum | InvoiceSumInclusive $calc;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Invoice $invoice
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct(public Invoice $invoice)
 | 
			
		||||
    public function __construct(public Invoice $invoice, public ?\InvoiceNinja\EInvoice\Models\Peppol\Invoice $p_invoice = null)
 | 
			
		||||
    {
 | 
			
		||||
        $this->p_invoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
 | 
			
		||||
        $this->p_invoice = $p_invoice ?? new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
 | 
			
		||||
        $this->company = $invoice->company;
 | 
			
		||||
        $this->calc = $this->invoice->calc();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -95,6 +105,7 @@ class Peppol extends AbstractService
 | 
			
		||||
        $this->p_invoice->InvoiceLine = $this->getInvoiceLines();
 | 
			
		||||
        $this->p_invoice->TaxTotal = $this->getTotalTaxes();
 | 
			
		||||
        $this->p_invoice->LegalMonetaryTotal = $this->getLegalMonetaryTotal();
 | 
			
		||||
        // $this->p_invoice->PaymentMeans = $this->getPaymentMeans();
 | 
			
		||||
 | 
			
		||||
        // $payeeFinancialAccount = (new PayeeFinancialAccount())
 | 
			
		||||
        //     ->setBankId($company->settings->custom_value1)
 | 
			
		||||
@ -107,6 +118,17 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getPaymentMeans(): PaymentMeans
 | 
			
		||||
    {
 | 
			
		||||
        // $payeeFinancialAccount = new PayeeFinancialAccount()
 | 
			
		||||
        // $payeeFinancialAccount->
 | 
			
		||||
 | 
			
		||||
        // $ppm = new PaymentMeans();
 | 
			
		||||
        // $ppm->PayeeFinancialAccount = $payeeFinancialAccount;
 | 
			
		||||
 | 
			
		||||
        // return $ppm;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getLegalMonetaryTotal(): LegalMonetaryTotal
 | 
			
		||||
    {
 | 
			
		||||
        $taxable = $this->getTaxable();
 | 
			
		||||
@ -115,12 +137,12 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
        $lea = new LineExtensionAmount();
 | 
			
		||||
        $lea->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
        $lea->amount = $taxable;
 | 
			
		||||
        $lea->amount = $this->invoice->uses_inclusive_taxes ? round($this->invoice->amount - $this->invoice->total_taxes, 2) : $taxable;
 | 
			
		||||
        $lmt->LineExtensionAmount = $lea;
 | 
			
		||||
 | 
			
		||||
        $tea = new TaxExclusiveAmount();
 | 
			
		||||
        $tea->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
        $tea->amount = $taxable;
 | 
			
		||||
        $tea->amount = $this->invoice->uses_inclusive_taxes ? round($this->invoice->amount - $this->invoice->total_taxes,2) : $taxable;
 | 
			
		||||
        $lmt->TaxExclusiveAmount = $tea;
 | 
			
		||||
 | 
			
		||||
        $tia = new TaxInclusiveAmount();
 | 
			
		||||
@ -142,23 +164,21 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
        $type_id = $this->invoice->line_items[0]->type_id;
 | 
			
		||||
 | 
			
		||||
        if(strlen($this->invoice->tax_name1 ?? '') > 1) {
 | 
			
		||||
        // if(strlen($this->invoice->tax_name1 ?? '') > 1) {
 | 
			
		||||
 | 
			
		||||
            $tax_amount = new TaxAmount();
 | 
			
		||||
            $tax_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $tax_amount->amount = round($this->invoice->amount * (1 / $this->invoice->tax_rate1), 2);
 | 
			
		||||
            // $tax_amount->amount = $this->invoice->uses_inclusive_taxes ?  $this->calcInclusiveLineTax($this->invoice->tax_rate1, $this->invoice->amount) : $this->calcAmountLineTax($this->invoice->tax_rate1, $this->invoice->amount);
 | 
			
		||||
            $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->invoice->total_taxes : $this->calcAmountLineTax($this->invoice->tax_rate1, $this->invoice->amount);
 | 
			
		||||
 | 
			
		||||
            $tax_subtotal = new TaxSubtotal();
 | 
			
		||||
            $tax_subtotal->TaxAmount = $tax_amount;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            $taxable_amount = new TaxableAmount();
 | 
			
		||||
            $taxable_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $taxable_amount->amount = $this->invoice->amount;
 | 
			
		||||
            $taxable_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->invoice->amount - $this->invoice->total_taxes : $this->invoice->amount;
 | 
			
		||||
            $tax_subtotal->TaxableAmount = $taxable_amount;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            $tc = new TaxCategory();
 | 
			
		||||
            $tc->ID = $type_id == '2' ? 'HUR' : 'C62';
 | 
			
		||||
            $tc->Percent = $this->invoice->tax_rate1;
 | 
			
		||||
@ -169,24 +189,25 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
            $tax_total = new TaxTotal();
 | 
			
		||||
            $tax_total->TaxAmount = $tax_amount;
 | 
			
		||||
            $tax_total->TaxSubtotal = $tax_subtotal;
 | 
			
		||||
            $tax_total->TaxSubtotal[] = $tax_subtotal;
 | 
			
		||||
 | 
			
		||||
            $taxes[] = $tax_total;
 | 
			
		||||
        }
 | 
			
		||||
        // }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        if(strlen($this->invoice->tax_name2 ?? '') > 1) {
 | 
			
		||||
 | 
			
		||||
            $tax_amount = new TaxAmount();
 | 
			
		||||
            $tax_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $tax_amount->amount = round($this->invoice->amount * (1 / $this->invoice->tax_rate2), 2);
 | 
			
		||||
 | 
			
		||||
            $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiveLineTax($this->invoice->tax_rate2, $this->invoice->amount) : $this->calcAmountLineTax($this->invoice->tax_rate2, $this->invoice->amount);
 | 
			
		||||
 | 
			
		||||
            $tax_subtotal = new TaxSubtotal();
 | 
			
		||||
            $tax_subtotal->TaxAmount = $tax_amount;
 | 
			
		||||
 | 
			
		||||
            $taxable_amount = new TaxableAmount();
 | 
			
		||||
            $taxable_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $taxable_amount->amount = $this->invoice->amount;
 | 
			
		||||
            $taxable_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->invoice->amount- $this->invoice->total_taxes : $this->invoice->amount;
 | 
			
		||||
            $tax_subtotal->TaxableAmount = $taxable_amount;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -211,14 +232,14 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
            $tax_amount = new TaxAmount();
 | 
			
		||||
            $tax_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $tax_amount->amount = round($this->invoice->amount * (1 / $this->invoice->tax_rate1), 2);
 | 
			
		||||
            $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiveLineTax($this->invoice->tax_rate3, $this->invoice->amount) : $this->calcAmountLineTax($this->invoice->tax_rate3, $this->invoice->amount);
 | 
			
		||||
 | 
			
		||||
            $tax_subtotal = new TaxSubtotal();
 | 
			
		||||
            $tax_subtotal->TaxAmount = $tax_amount;
 | 
			
		||||
 | 
			
		||||
            $taxable_amount = new TaxableAmount();
 | 
			
		||||
            $taxable_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $taxable_amount->amount = $this->invoice->amount;
 | 
			
		||||
            $taxable_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->invoice->amount - $this->invoice->total_taxes : $this->invoice->amount;
 | 
			
		||||
            $tax_subtotal->TaxableAmount = $taxable_amount;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -259,14 +280,11 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
            $lea = new LineExtensionAmount();
 | 
			
		||||
            $lea->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $lea->amount = $item->line_total;
 | 
			
		||||
            // $lea->amount = $item->line_total;
 | 
			
		||||
            $lea->amount = $this->invoice->uses_inclusive_taxes ? $item->line_total - $this->calcInclusiveLineTax($item->tax_rate1, $item->line_total) : $item->line_total;
 | 
			
		||||
            $line->LineExtensionAmount = $lea;
 | 
			
		||||
            $line->Item = $_item;
 | 
			
		||||
 | 
			
		||||
            // $ta = new TaxAmount;
 | 
			
		||||
            // $ta->amount = $this->getItemTaxes($item);
 | 
			
		||||
            // $ta->currencyID = $this->invoice->client->currency()->Code;
 | 
			
		||||
            // $tt->TaxAmount = $ta;
 | 
			
		||||
            $item_taxes = $this->getItemTaxes($item);
 | 
			
		||||
 | 
			
		||||
            if(count($item_taxes) > 0) {
 | 
			
		||||
@ -276,7 +294,7 @@ class Peppol extends AbstractService
 | 
			
		||||
            $price = new Price();
 | 
			
		||||
            $pa = new PriceAmount();
 | 
			
		||||
            $pa->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $pa->amount = $this->costWithDiscount($item);
 | 
			
		||||
            $pa->amount = $this->costWithDiscount($item) - ( $this->invoice->uses_inclusive_taxes ? ($this->calcInclusiveLineTax($item->tax_rate1, $item->line_total)/$item->quantity) : 0);
 | 
			
		||||
            $price->PriceAmount = $pa;
 | 
			
		||||
 | 
			
		||||
            $line->Price = $price;
 | 
			
		||||
@ -310,13 +328,13 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
            $tax_amount = new TaxAmount();
 | 
			
		||||
            $tax_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $tax_amount->amount = round(($item->line_total * (1 / $item->tax_rate1)), 2);
 | 
			
		||||
            $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiveLineTax($item->tax_rate1, $item->line_total) : $this->calcAmountLineTax($item->tax_rate1, $item->line_total);
 | 
			
		||||
            $tax_subtotal = new TaxSubtotal();
 | 
			
		||||
            $tax_subtotal->TaxAmount = $tax_amount;
 | 
			
		||||
 | 
			
		||||
            $taxable_amount = new TaxableAmount();
 | 
			
		||||
            $taxable_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $taxable_amount->amount = $item->line_total;
 | 
			
		||||
            $taxable_amount->amount = $this->invoice->uses_inclusive_taxes ? $item->line_total - $tax_amount->amount : $item->line_total;
 | 
			
		||||
            $tax_subtotal->TaxableAmount = $taxable_amount;
 | 
			
		||||
            $tc = new TaxCategory();
 | 
			
		||||
            $tc->ID = $item->type_id == '2' ? 'HUR' : 'C62';
 | 
			
		||||
@ -339,7 +357,8 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
            $tax_amount = new TaxAmount();
 | 
			
		||||
            $tax_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $tax_amount->amount = round(($item->line_total * (1 / $item->tax_rate2)), 2);
 | 
			
		||||
            
 | 
			
		||||
$tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiveLineTax($item->tax_rate2, $item->line_total) : $this->calcAmountLineTax($item->tax_rate2, $item->line_total);
 | 
			
		||||
 | 
			
		||||
            $tax_subtotal = new TaxSubtotal();
 | 
			
		||||
            $tax_subtotal->TaxAmount = $tax_amount;
 | 
			
		||||
@ -372,7 +391,8 @@ class Peppol extends AbstractService
 | 
			
		||||
 | 
			
		||||
            $tax_amount = new TaxAmount();
 | 
			
		||||
            $tax_amount->currencyID = $this->invoice->client->currency()->code;
 | 
			
		||||
            $tax_amount->amount = round(($item->line_total * (1 / $item->tax_rate3)), 2);
 | 
			
		||||
 | 
			
		||||
$tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiveLineTax($item->tax_rate3, $item->line_total) : $this->calcAmountLineTax($item->tax_rate3, $item->line_total);
 | 
			
		||||
 | 
			
		||||
            $tax_subtotal = new TaxSubtotal();
 | 
			
		||||
            $tax_subtotal->TaxAmount = $tax_amount;
 | 
			
		||||
@ -520,4 +540,34 @@ class Peppol extends AbstractService
 | 
			
		||||
        return $total;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setInvoiceDefaults(): self
 | 
			
		||||
    {
 | 
			
		||||
        $settings = [
 | 
			
		||||
            'AccountingCostCode' => 7,
 | 
			
		||||
            'AccountingCost' => 7,
 | 
			
		||||
            'BuyerReference' => 6,
 | 
			
		||||
            'AccountingSupplierParty' => 1,
 | 
			
		||||
            'AccountingCustomerParty' => 2,
 | 
			
		||||
            'PayeeParty' => 1,
 | 
			
		||||
            'BuyerCustomerParty' => 2,
 | 
			
		||||
            'SellerSupplierParty' => 1,
 | 
			
		||||
            'TaxRepresentativeParty' => 1,
 | 
			
		||||
            'Delivery' => 1,
 | 
			
		||||
            'DeliveryTerms' => 7,
 | 
			
		||||
            'PaymentMeans' => 7,
 | 
			
		||||
            'PaymentTerms' => 7,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        foreach($settings as $prop => $visibility){
 | 
			
		||||
 | 
			
		||||
            if($prop_value = PropertyResolver::resolve($this->invoice->client->e_invoice, $prop))
 | 
			
		||||
                $this->p_invoice->{$prop} = $prop_value;
 | 
			
		||||
            elseif($prop_value = PropertyResolver::resolve($this->invoice->company->e_invoice, $prop)) {
 | 
			
		||||
                $this->p_invoice->{$prop} = $prop_value;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,44 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://www.elastic.co/licensing/elastic-license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace App\Services\EDocument\Standards\Settings;
 | 
			
		||||
 | 
			
		||||
class PropertyResolver
 | 
			
		||||
{
 | 
			
		||||
    public static function resolve($object, string $propertyPath)
 | 
			
		||||
    {
 | 
			
		||||
        $pathSegments = explode('.', $propertyPath);
 | 
			
		||||
 | 
			
		||||
        return self::traverse($object, $pathSegments);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function traverse($object, array $pathSegments) {
 | 
			
		||||
        if (empty($pathSegments)) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $currentProperty = array_shift($pathSegments);
 | 
			
		||||
 | 
			
		||||
        if (is_object($object) && isset($object->{$currentProperty})) {
 | 
			
		||||
            $nextObject = $object->{$currentProperty};
 | 
			
		||||
        } elseif (is_array($object) && array_key_exists($currentProperty, $object)) {
 | 
			
		||||
            $nextObject = $object[$currentProperty];
 | 
			
		||||
        } else {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty($pathSegments)) {
 | 
			
		||||
            return $nextObject;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return self::traverse($nextObject, $pathSegments);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -17,8 +17,8 @@ return [
 | 
			
		||||
    'require_https' => env('REQUIRE_HTTPS', true),
 | 
			
		||||
    'app_url' => rtrim(env('APP_URL', ''), '/'),
 | 
			
		||||
    'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
 | 
			
		||||
    'app_version' => env('APP_VERSION', '5.10.10'),
 | 
			
		||||
    'app_tag' => env('APP_TAG', '5.10.10'),
 | 
			
		||||
    'app_version' => env('APP_VERSION', '5.10.11'),
 | 
			
		||||
    'app_tag' => env('APP_TAG', '5.10.11'),
 | 
			
		||||
    'minimum_client_version' => '5.0.16',
 | 
			
		||||
    'terms_version' => '1.0.1',
 | 
			
		||||
    'api_secret' => env('API_SECRET', false),
 | 
			
		||||
 | 
			
		||||
@ -144,20 +144,20 @@ Route::group(['middleware' => ['invite_db'], 'prefix' => 'client', 'as' => 'clie
 | 
			
		||||
    Route::get('unsubscribe/{entity}/{invitation_key}', [App\Http\Controllers\ClientPortal\InvitationController::class, 'unsubscribe'])->name('unsubscribe');
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
Route::get('route/{hash}', function ($hash) {
 | 
			
		||||
// Route::get('route/{hash}', function ($hash) {
 | 
			
		||||
 | 
			
		||||
    $route = '/';
 | 
			
		||||
//     $route = '/';
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
        $route = decrypt($hash); 
 | 
			
		||||
    }
 | 
			
		||||
    catch (\Exception $e) { 
 | 
			
		||||
        abort(404);
 | 
			
		||||
    }
 | 
			
		||||
//     try {
 | 
			
		||||
//         $route = decrypt($hash); 
 | 
			
		||||
//     }
 | 
			
		||||
//     catch (\Exception $e) { 
 | 
			
		||||
//         abort(404);
 | 
			
		||||
//     }
 | 
			
		||||
 | 
			
		||||
    return redirect($route);
 | 
			
		||||
//     return redirect($route);
 | 
			
		||||
 | 
			
		||||
})->middleware('throttle:404');
 | 
			
		||||
// })->middleware('throttle:404');
 | 
			
		||||
 | 
			
		||||
Route::get('phantom/{entity}/{invitation_key}', [Phantom::class, 'displayInvitation'])->middleware(['invite_db', 'phantom_secret'])->name('phantom_view');
 | 
			
		||||
Route::get('blade/', [Phantom::class, 'blade'])->name('blade');
 | 
			
		||||
 | 
			
		||||
@ -14,20 +14,23 @@ namespace Tests\Feature\EInvoice;
 | 
			
		||||
use Tests\TestCase;
 | 
			
		||||
use App\Models\Client;
 | 
			
		||||
use App\Models\Company;
 | 
			
		||||
use App\Models\Invoice;
 | 
			
		||||
use Tests\MockAccountData;
 | 
			
		||||
use App\DataMapper\InvoiceItem;
 | 
			
		||||
use App\DataMapper\ClientSettings;
 | 
			
		||||
use App\DataMapper\CompanySettings;
 | 
			
		||||
use App\DataMapper\InvoiceItem;
 | 
			
		||||
use App\Models\Invoice;
 | 
			
		||||
use InvoiceNinja\EInvoice\EInvoice;
 | 
			
		||||
use InvoiceNinja\EInvoice\Symfony\Encode;
 | 
			
		||||
use App\Services\EDocument\Standards\FatturaPANew;
 | 
			
		||||
use App\Services\EDocument\Standards\Peppol;
 | 
			
		||||
use App\Services\EDocument\Standards\FatturaPANew;
 | 
			
		||||
use Illuminate\Routing\Middleware\ThrottleRequests;
 | 
			
		||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
 | 
			
		||||
use InvoiceNinja\EInvoice\EInvoice;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronica;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\BranchType\FinancialInstitutionBranch;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\FinancialAccountType\PayeeFinancialAccount;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaBodyType\FatturaElettronicaBody;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaHeaderType\FatturaElettronicaHeader;
 | 
			
		||||
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @test
 | 
			
		||||
@ -51,6 +54,233 @@ class PeppolTest extends TestCase
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testDeInvoice()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $settings = CompanySettings::defaults();
 | 
			
		||||
        $settings->address1 = 'Dudweilerstr. 34b';
 | 
			
		||||
        $settings->city = 'Ost Alessa'; 
 | 
			
		||||
        $settings->state = 'Bayern';
 | 
			
		||||
        $settings->postal_code = '98060';
 | 
			
		||||
        $settings->vat_number = 'DE923356489';
 | 
			
		||||
        $settings->country_id = '276';
 | 
			
		||||
        $settings->currency_id = '3';
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        $einvoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
        $fib = new FinancialInstitutionBranch();
 | 
			
		||||
        $fib->ID = "DEUTDEMMXXX"; //BIC
 | 
			
		||||
        $fib->Name = 'Deutsche Bank';
 | 
			
		||||
        
 | 
			
		||||
        $pfa = new PayeeFinancialAccount();
 | 
			
		||||
        $pfa->ID = 'DE89370400440532013000';
 | 
			
		||||
        $pfa->Name = 'PFA-NAME';
 | 
			
		||||
        $pfa->AliasName = 'PFA-Alias';
 | 
			
		||||
        $pfa->AccountTypeCode = 'CHECKING';
 | 
			
		||||
        $pfa->AccountFormatCode = 'IBAN';
 | 
			
		||||
        $pfa->CurrencyCode = 'EUR';
 | 
			
		||||
        $pfa->FinancialInstitutionBranch = $fib;
 | 
			
		||||
 | 
			
		||||
        $pm = new PaymentMeans();
 | 
			
		||||
        $pm->PayeeFinancialAccount = $pfa;        
 | 
			
		||||
        $einvoice->PaymentMeans[] = $pm;
 | 
			
		||||
 | 
			
		||||
        $company = Company::factory()->create([
 | 
			
		||||
            'account_id' => $this->account->id,
 | 
			
		||||
            'settings' => $settings,
 | 
			
		||||
            'e_invoice' => $einvoice,
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $client_settings = ClientSettings::defaults();
 | 
			
		||||
        $client_settings->currency_id = '3';
 | 
			
		||||
 | 
			
		||||
        $client = Client::factory()->create([
 | 
			
		||||
            'company_id' => $company->id,
 | 
			
		||||
            'user_id' => $this->user->id,
 | 
			
		||||
            'name' => 'German Client Name',
 | 
			
		||||
            'address1' => 'Kinderhausen 96b',
 | 
			
		||||
            'address2' => 'Apt. 842',
 | 
			
		||||
            'city' => 'Süd Jessestadt',
 | 
			
		||||
            'state' => 'Bayern',
 | 
			
		||||
            'postal_code' => '33323',
 | 
			
		||||
            'country_id' => 276,
 | 
			
		||||
            'routing_id' => 'ABC1234',
 | 
			
		||||
            'settings' => $client_settings,
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
        $item = new InvoiceItem();
 | 
			
		||||
        $item->product_key = "Product Key";
 | 
			
		||||
        $item->notes = "Product Description";
 | 
			
		||||
        $item->cost = 10;
 | 
			
		||||
        $item->quantity = 10;
 | 
			
		||||
        $item->tax_rate1 = 19;
 | 
			
		||||
        $item->tax_name1 = 'mwst';
 | 
			
		||||
 | 
			
		||||
        $invoice = Invoice::factory()->create([
 | 
			
		||||
            'company_id' => $company->id,
 | 
			
		||||
            'user_id' => $this->user->id,
 | 
			
		||||
            'client_id' => $client->id,
 | 
			
		||||
            'discount' => 0,
 | 
			
		||||
            'uses_inclusive_taxes' => false,
 | 
			
		||||
            'status_id' => 1,
 | 
			
		||||
            'tax_rate1' => 0,
 | 
			
		||||
            'tax_name1' => '',
 | 
			
		||||
            'tax_rate2' => 0,
 | 
			
		||||
            'tax_rate3' => 0,
 | 
			
		||||
            'tax_name2' => '',
 | 
			
		||||
            'tax_name3' => '',
 | 
			
		||||
            'line_items' => [$item],
 | 
			
		||||
            'number' => 'DE-'.rand(1000, 100000),
 | 
			
		||||
            'date' => now()->format('Y-m-d')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $invoice = $invoice->calc()->getInvoice();
 | 
			
		||||
        $invoice->service()->markSent()->save();
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(119, $invoice->amount);
 | 
			
		||||
 | 
			
		||||
       
 | 
			
		||||
        $peppol = new Peppol($invoice);
 | 
			
		||||
        $peppol->setInvoiceDefaults();
 | 
			
		||||
        $peppol->run();
 | 
			
		||||
 | 
			
		||||
        $de_invoice = $peppol->getInvoice();
 | 
			
		||||
 | 
			
		||||
        $this->assertNotNull($de_invoice);
 | 
			
		||||
 | 
			
		||||
        $e = new EInvoice();
 | 
			
		||||
        $xml = $e->encode($de_invoice, 'xml');
 | 
			
		||||
        $this->assertNotNull($xml);
 | 
			
		||||
 | 
			
		||||
        nlog($xml);
 | 
			
		||||
 | 
			
		||||
        $errors = $e->validate($de_invoice);
 | 
			
		||||
 | 
			
		||||
        if(count($errors) > 0) {
 | 
			
		||||
            nlog($errors);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->assertCount(0, $errors);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function testDeInvoiceInclusiveTaxes()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $settings = CompanySettings::defaults();
 | 
			
		||||
        $settings->address1 = 'Dudweilerstr. 34b';
 | 
			
		||||
        $settings->city = 'Ost Alessa'; 
 | 
			
		||||
        $settings->state = 'Bayern';
 | 
			
		||||
        $settings->postal_code = '98060';
 | 
			
		||||
        $settings->vat_number = 'DE923356489';
 | 
			
		||||
        $settings->country_id = '276';
 | 
			
		||||
        $settings->currency_id = '3';
 | 
			
		||||
 | 
			
		||||
        $einvoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
 | 
			
		||||
        
 | 
			
		||||
        $fib = new FinancialInstitutionBranch();
 | 
			
		||||
        $fib->ID = "DEUTDEMMXXX"; //BIC
 | 
			
		||||
        $fib->Name = 'Deutsche Bank';
 | 
			
		||||
        
 | 
			
		||||
        $pfa = new PayeeFinancialAccount();
 | 
			
		||||
        $pfa->ID = 'DE89370400440532013000';
 | 
			
		||||
        $pfa->Name = 'PFA-NAME';
 | 
			
		||||
        $pfa->AliasName = 'PFA-Alias';
 | 
			
		||||
        $pfa->AccountTypeCode = 'CHECKING';
 | 
			
		||||
        $pfa->AccountFormatCode = 'IBAN';
 | 
			
		||||
        $pfa->CurrencyCode = 'EUR';
 | 
			
		||||
        $pfa->FinancialInstitutionBranch = $fib;
 | 
			
		||||
 | 
			
		||||
        $pm = new PaymentMeans();
 | 
			
		||||
        $pm->PayeeFinancialAccount = $pfa;        
 | 
			
		||||
        $einvoice->PaymentMeans[] = $pm;
 | 
			
		||||
 | 
			
		||||
        $company = Company::factory()->create([
 | 
			
		||||
            'account_id' => $this->account->id,
 | 
			
		||||
            'settings' => $settings,
 | 
			
		||||
            'e_invoice' => $einvoice,
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $client_settings = ClientSettings::defaults();
 | 
			
		||||
        $client_settings->currency_id = '3';
 | 
			
		||||
 | 
			
		||||
        $client = Client::factory()->create([
 | 
			
		||||
            'company_id' => $company->id,
 | 
			
		||||
            'user_id' => $this->user->id,
 | 
			
		||||
            'name' => 'German Client Name',
 | 
			
		||||
            'address1' => 'Kinderhausen 96b',
 | 
			
		||||
            'address2' => 'Apt. 842',
 | 
			
		||||
            'city' => 'Süd Jessestadt',
 | 
			
		||||
            'state' => 'Bayern',
 | 
			
		||||
            'postal_code' => '33323',
 | 
			
		||||
            'country_id' => 276,
 | 
			
		||||
            'routing_id' => 'ABC1234',
 | 
			
		||||
            'settings' => $client_settings,
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
        $item = new InvoiceItem();
 | 
			
		||||
        $item->product_key = "Product Key";
 | 
			
		||||
        $item->notes = "Product Description";
 | 
			
		||||
        $item->cost = 10;
 | 
			
		||||
        $item->quantity = 10;
 | 
			
		||||
        $item->tax_rate1 = 19;
 | 
			
		||||
        $item->tax_name1 = 'mwst';
 | 
			
		||||
 | 
			
		||||
        $invoice = Invoice::factory()->create([
 | 
			
		||||
            'company_id' => $company->id,
 | 
			
		||||
            'user_id' => $this->user->id,
 | 
			
		||||
            'client_id' => $client->id,
 | 
			
		||||
            'discount' => 0,
 | 
			
		||||
            'uses_inclusive_taxes' => true,
 | 
			
		||||
            'status_id' => 1,
 | 
			
		||||
            'tax_rate1' => 0,
 | 
			
		||||
            'tax_name1' => '',
 | 
			
		||||
            'tax_rate2' => 0,
 | 
			
		||||
            'tax_rate3' => 0,
 | 
			
		||||
            'tax_name2' => '',
 | 
			
		||||
            'tax_name3' => '',
 | 
			
		||||
            'line_items' => [$item],
 | 
			
		||||
            'number' => 'DE-'.rand(1000, 100000),
 | 
			
		||||
            'date' => now()->format('Y-m-d')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $invoice = $invoice->calc()->getInvoice();
 | 
			
		||||
        $invoice->service()->markSent()->save();
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(100, $invoice->amount);
 | 
			
		||||
 | 
			
		||||
        $peppol = new Peppol($invoice);
 | 
			
		||||
        $peppol->setInvoiceDefaults();
 | 
			
		||||
        $peppol->run();
 | 
			
		||||
 | 
			
		||||
        $de_invoice = $peppol->getInvoice();
 | 
			
		||||
 | 
			
		||||
        $this->assertNotNull($de_invoice);
 | 
			
		||||
 | 
			
		||||
        $e = new EInvoice();
 | 
			
		||||
        $xml = $e->encode($de_invoice, 'xml');
 | 
			
		||||
        $this->assertNotNull($xml);
 | 
			
		||||
 | 
			
		||||
        nlog("inclusive");
 | 
			
		||||
        nlog($xml);
 | 
			
		||||
 | 
			
		||||
        $errors = $e->validate($de_invoice);
 | 
			
		||||
 | 
			
		||||
        if(count($errors) > 0) {
 | 
			
		||||
            nlog($errors);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->assertCount(0, $errors);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function testInvoiceBoot()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -103,123 +103,246 @@ class StorecoveTest extends TestCase
 | 
			
		||||
    public function testSendDocument()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $x = '<?xml version="1.0"?>
 | 
			
		||||
            <cbc:ID>0061</cbc:ID>
 | 
			
		||||
            <cbc:IssueDate>2024-07-15</cbc:IssueDate>
 | 
			
		||||
        $x = '
 | 
			
		||||
        <?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
        <Invoice
 | 
			
		||||
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 | 
			
		||||
            xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
 | 
			
		||||
  <cbc:ID>DE-77323</cbc:ID>
 | 
			
		||||
  <cbc:IssueDate>2024-07-18</cbc:IssueDate>
 | 
			
		||||
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
 | 
			
		||||
  <cac:AccountingSupplierParty>
 | 
			
		||||
    <cac:Party>
 | 
			
		||||
      <cac:PartyName>
 | 
			
		||||
                <cbc:Name>Eladio Ullrich I</cbc:Name>
 | 
			
		||||
        <cbc:Name>Untitled Company</cbc:Name>
 | 
			
		||||
      </cac:PartyName>
 | 
			
		||||
      <cac:PostalAddress>
 | 
			
		||||
                <cbc:StreetName>Jasper Brook</cbc:StreetName>
 | 
			
		||||
                <cbc:CityName>Kodychester</cbc:CityName>
 | 
			
		||||
                <cbc:PostalZone>73445-5131</cbc:PostalZone>
 | 
			
		||||
                <cbc:CountrySubentity>South Dakota</cbc:CountrySubentity>
 | 
			
		||||
        <cbc:StreetName>Dudweilerstr. 34b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Ost Alessa</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>98060</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
                    <cbc:IdentificationCode>AT</cbc:IdentificationCode>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PostalAddress>
 | 
			
		||||
      <cac:PhysicalLocation>
 | 
			
		||||
                <cbc:StreetName>Jasper Brook</cbc:StreetName>
 | 
			
		||||
                <cbc:CityName>Kodychester</cbc:CityName>
 | 
			
		||||
                <cbc:PostalZone>73445-5131</cbc:PostalZone>
 | 
			
		||||
                <cbc:CountrySubentity>South Dakota</cbc:CountrySubentity>
 | 
			
		||||
        <cbc:StreetName>Dudweilerstr. 34b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Ost Alessa</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>98060</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
                    <cbc:IdentificationCode>AT</cbc:IdentificationCode>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PhysicalLocation>
 | 
			
		||||
      <cac:Contact>
 | 
			
		||||
                <cbc:ElectronicMail>small@example.com</cbc:ElectronicMail>
 | 
			
		||||
        <cbc:ElectronicMail>owner@gmail.com</cbc:ElectronicMail>
 | 
			
		||||
      </cac:Contact>
 | 
			
		||||
    </cac:Party>
 | 
			
		||||
  </cac:AccountingSupplierParty>
 | 
			
		||||
  <cac:AccountingCustomerParty>
 | 
			
		||||
    <cac:Party>
 | 
			
		||||
      <cac:PartyName>
 | 
			
		||||
                <cbc:Name>Beispiel GmbH</cbc:Name>
 | 
			
		||||
        <cbc:Name>German Client Name</cbc:Name>
 | 
			
		||||
      </cac:PartyName>
 | 
			
		||||
      <cac:PostalAddress>
 | 
			
		||||
                <cbc:StreetName>45 Hauptstraße</cbc:StreetName>
 | 
			
		||||
                <cbc:CityName>Berlin</cbc:CityName>
 | 
			
		||||
                <cbc:PostalZone>10115</cbc:PostalZone>
 | 
			
		||||
                <cbc:CountrySubentity>Berlin</cbc:CountrySubentity>
 | 
			
		||||
        <cbc:StreetName>Kinderhausen 96b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Süd Jessestadt</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>33323</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PostalAddress>
 | 
			
		||||
      <cac:PhysicalLocation>
 | 
			
		||||
                <cbc:StreetName>45 Hauptstraße</cbc:StreetName>
 | 
			
		||||
                <cbc:CityName>Berlin</cbc:CityName>
 | 
			
		||||
                <cbc:PostalZone>10115</cbc:PostalZone>
 | 
			
		||||
                <cbc:CountrySubentity>Berlin</cbc:CountrySubentity>
 | 
			
		||||
        <cbc:StreetName>Kinderhausen 96b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Süd Jessestadt</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>33323</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PhysicalLocation>
 | 
			
		||||
      <cac:Contact>
 | 
			
		||||
                <cbc:ElectronicMail>TTKGjKW9Rv00LEr@example.com</cbc:ElectronicMail>
 | 
			
		||||
        <cbc:ElectronicMail>No Email Set</cbc:ElectronicMail>
 | 
			
		||||
      </cac:Contact>
 | 
			
		||||
    </cac:Party>
 | 
			
		||||
  </cac:AccountingCustomerParty>
 | 
			
		||||
  <cac:PaymentMeans>
 | 
			
		||||
    <PayeeFinancialAccount>
 | 
			
		||||
      <ID>DE89370400440532013000</ID>
 | 
			
		||||
      <Name>PFA-NAME</Name>
 | 
			
		||||
      <AliasName>PFA-Alias</AliasName>
 | 
			
		||||
      <AccountTypeCode>CHECKING</AccountTypeCode>
 | 
			
		||||
      <AccountFormatCode>IBAN</AccountFormatCode>
 | 
			
		||||
      <CurrencyCode>EUR</CurrencyCode>
 | 
			
		||||
      <FinancialInstitutionBranch>
 | 
			
		||||
        <ID>DEUTDEMMXXX</ID>
 | 
			
		||||
        <Name>Deutsche Bank</Name>
 | 
			
		||||
      </FinancialInstitutionBranch>
 | 
			
		||||
    </PayeeFinancialAccount>
 | 
			
		||||
  </cac:PaymentMeans>
 | 
			
		||||
  <cac:TaxTotal/>
 | 
			
		||||
  <cac:LegalMonetaryTotal>
 | 
			
		||||
            <cbc:LineExtensionAmount currencyID="EUR">215</cbc:LineExtensionAmount>
 | 
			
		||||
            <cbc:TaxExclusiveAmount currencyID="EUR">215</cbc:TaxExclusiveAmount>
 | 
			
		||||
            <cbc:TaxInclusiveAmount currencyID="EUR">215.00</cbc:TaxInclusiveAmount>
 | 
			
		||||
            <cbc:PayableAmount currencyID="EUR">215.00</cbc:PayableAmount>
 | 
			
		||||
    <cbc:LineExtensionAmount currencyID="EUR">100</cbc:LineExtensionAmount>
 | 
			
		||||
    <cbc:TaxExclusiveAmount currencyID="EUR">100</cbc:TaxExclusiveAmount>
 | 
			
		||||
    <cbc:TaxInclusiveAmount currencyID="EUR">119.00</cbc:TaxInclusiveAmount>
 | 
			
		||||
    <cbc:PayableAmount currencyID="EUR">119.00</cbc:PayableAmount>
 | 
			
		||||
  </cac:LegalMonetaryTotal>
 | 
			
		||||
  <cac:InvoiceLine>
 | 
			
		||||
    <cbc:ID>1</cbc:ID>
 | 
			
		||||
            <cbc:InvoicedQuantity>1</cbc:InvoicedQuantity>
 | 
			
		||||
            <cbc:LineExtensionAmount currencyID="EUR">10</cbc:LineExtensionAmount>
 | 
			
		||||
    <cbc:InvoicedQuantity>10</cbc:InvoicedQuantity>
 | 
			
		||||
    <cbc:LineExtensionAmount currencyID="EUR">100</cbc:LineExtensionAmount>
 | 
			
		||||
    <cac:TaxTotal>
 | 
			
		||||
                <cbc:TaxAmount currencyID="EUR">0.5</cbc:TaxAmount>
 | 
			
		||||
      <cbc:TaxAmount currencyID="EUR">19</cbc:TaxAmount>
 | 
			
		||||
      <cac:TaxSubtotal>
 | 
			
		||||
                <cbc:TaxableAmount currencyID="EUR">10</cbc:TaxableAmount>
 | 
			
		||||
                <cbc:TaxAmount currencyID="EUR">0.5</cbc:TaxAmount>
 | 
			
		||||
        <cbc:TaxableAmount currencyID="EUR">100</cbc:TaxableAmount>
 | 
			
		||||
        <cbc:TaxAmount currencyID="EUR">19</cbc:TaxAmount>
 | 
			
		||||
        <cac:TaxCategory>
 | 
			
		||||
          <cbc:ID>C62</cbc:ID>
 | 
			
		||||
                    <cbc:Percent>20</cbc:Percent>
 | 
			
		||||
          <cbc:Percent>19</cbc:Percent>
 | 
			
		||||
          <cac:TaxScheme>
 | 
			
		||||
                    <cbc:ID>USt</cbc:ID>
 | 
			
		||||
            <cbc:ID>mwst</cbc:ID>
 | 
			
		||||
          </cac:TaxScheme>
 | 
			
		||||
        </cac:TaxCategory>
 | 
			
		||||
      </cac:TaxSubtotal>
 | 
			
		||||
    </cac:TaxTotal>
 | 
			
		||||
    <cac:Item>
 | 
			
		||||
                <cbc:Description>The Pro Plan NO MORE</cbc:Description>
 | 
			
		||||
                <cbc:Name>ee</cbc:Name>
 | 
			
		||||
      <cbc:Description>Product Description</cbc:Description>
 | 
			
		||||
      <cbc:Name>Product Key</cbc:Name>
 | 
			
		||||
    </cac:Item>
 | 
			
		||||
    <cac:Price>
 | 
			
		||||
      <cbc:PriceAmount currencyID="EUR">10</cbc:PriceAmount>
 | 
			
		||||
    </cac:Price>
 | 
			
		||||
  </cac:InvoiceLine>
 | 
			
		||||
  ';
 | 
			
		||||
 | 
			
		||||
//inclusive
 | 
			
		||||
$x = '<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<Invoice
 | 
			
		||||
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 | 
			
		||||
    xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
 | 
			
		||||
<cbc:ID>DE-93090</cbc:ID>
 | 
			
		||||
  <cbc:IssueDate>2024-07-18</cbc:IssueDate>
 | 
			
		||||
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
 | 
			
		||||
  <cac:AccountingSupplierParty>
 | 
			
		||||
    <cac:Party>
 | 
			
		||||
      <cac:PartyName>
 | 
			
		||||
        <cbc:Name>Untitled Company</cbc:Name>
 | 
			
		||||
      </cac:PartyName>
 | 
			
		||||
      <cac:PostalAddress>
 | 
			
		||||
        <cbc:StreetName>Dudweilerstr. 34b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Ost Alessa</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>98060</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PostalAddress>
 | 
			
		||||
      <cac:PhysicalLocation>
 | 
			
		||||
        <cbc:StreetName>Dudweilerstr. 34b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Ost Alessa</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>98060</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PhysicalLocation>
 | 
			
		||||
      <cac:Contact>
 | 
			
		||||
        <cbc:ElectronicMail>owner@gmail.com</cbc:ElectronicMail>
 | 
			
		||||
      </cac:Contact>
 | 
			
		||||
    </cac:Party>
 | 
			
		||||
  </cac:AccountingSupplierParty>
 | 
			
		||||
  <cac:AccountingCustomerParty>
 | 
			
		||||
    <cac:Party>
 | 
			
		||||
      <cac:PartyName>
 | 
			
		||||
        <cbc:Name>German Client Name</cbc:Name>
 | 
			
		||||
      </cac:PartyName>
 | 
			
		||||
      <cac:PostalAddress>
 | 
			
		||||
        <cbc:StreetName>Kinderhausen 96b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Süd Jessestadt</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>33323</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PostalAddress>
 | 
			
		||||
      <cac:PhysicalLocation>
 | 
			
		||||
        <cbc:StreetName>Kinderhausen 96b</cbc:StreetName>
 | 
			
		||||
        <cbc:CityName>Süd Jessestadt</cbc:CityName>
 | 
			
		||||
        <cbc:PostalZone>33323</cbc:PostalZone>
 | 
			
		||||
        <cbc:CountrySubentity>Bayern</cbc:CountrySubentity>
 | 
			
		||||
        <cac:Country>
 | 
			
		||||
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
 | 
			
		||||
        </cac:Country>
 | 
			
		||||
      </cac:PhysicalLocation>
 | 
			
		||||
      <cac:Contact>
 | 
			
		||||
        <cbc:ElectronicMail>No Email Set</cbc:ElectronicMail>
 | 
			
		||||
      </cac:Contact>
 | 
			
		||||
    </cac:Party>
 | 
			
		||||
  </cac:AccountingCustomerParty>
 | 
			
		||||
  <cac:PaymentMeans>
 | 
			
		||||
    <PayeeFinancialAccount>
 | 
			
		||||
      <ID>DE89370400440532013000</ID>
 | 
			
		||||
      <Name>PFA-NAME</Name>
 | 
			
		||||
      <AliasName>PFA-Alias</AliasName>
 | 
			
		||||
      <AccountTypeCode>CHECKING</AccountTypeCode>
 | 
			
		||||
      <AccountFormatCode>IBAN</AccountFormatCode>
 | 
			
		||||
      <CurrencyCode>EUR</CurrencyCode>
 | 
			
		||||
      <FinancialInstitutionBranch>
 | 
			
		||||
        <ID>DEUTDEMMXXX</ID>
 | 
			
		||||
        <Name>Deutsche Bank</Name>
 | 
			
		||||
      </FinancialInstitutionBranch>
 | 
			
		||||
    </PayeeFinancialAccount>
 | 
			
		||||
  </cac:PaymentMeans>
 | 
			
		||||
  <cac:TaxTotal>
 | 
			
		||||
    <cbc:TaxAmount currencyID="EUR">15.97</cbc:TaxAmount>
 | 
			
		||||
    <cac:TaxSubtotal>
 | 
			
		||||
      <cbc:TaxableAmount currencyID="EUR">84.03</cbc:TaxableAmount>
 | 
			
		||||
      <cbc:TaxAmount currencyID="EUR">15.97</cbc:TaxAmount>
 | 
			
		||||
      <cac:TaxCategory>
 | 
			
		||||
        <cbc:ID>C62</cbc:ID>
 | 
			
		||||
        <cbc:Percent>0</cbc:Percent>
 | 
			
		||||
        <cac:TaxScheme>
 | 
			
		||||
          <cbc:ID></cbc:ID>
 | 
			
		||||
        </cac:TaxScheme>
 | 
			
		||||
      </cac:TaxCategory>
 | 
			
		||||
    </cac:TaxSubtotal>
 | 
			
		||||
  </cac:TaxTotal>
 | 
			
		||||
  <cac:LegalMonetaryTotal>
 | 
			
		||||
    <cbc:LineExtensionAmount currencyID="EUR">84.03</cbc:LineExtensionAmount>
 | 
			
		||||
    <cbc:TaxExclusiveAmount currencyID="EUR">84.03</cbc:TaxExclusiveAmount>
 | 
			
		||||
    <cbc:TaxInclusiveAmount currencyID="EUR">100.00</cbc:TaxInclusiveAmount>
 | 
			
		||||
    <cbc:PayableAmount currencyID="EUR">100.00</cbc:PayableAmount>
 | 
			
		||||
  </cac:LegalMonetaryTotal>
 | 
			
		||||
  <cac:InvoiceLine>
 | 
			
		||||
            <cbc:ID>2</cbc:ID>
 | 
			
		||||
            <cbc:InvoicedQuantity>1</cbc:InvoicedQuantity>
 | 
			
		||||
            <cbc:LineExtensionAmount currencyID="EUR">14</cbc:LineExtensionAmount>
 | 
			
		||||
    <cbc:ID>1</cbc:ID>
 | 
			
		||||
    <cbc:InvoicedQuantity>10</cbc:InvoicedQuantity>
 | 
			
		||||
    <cbc:LineExtensionAmount currencyID="EUR">84.03</cbc:LineExtensionAmount>
 | 
			
		||||
    <cac:TaxTotal>
 | 
			
		||||
      <cbc:TaxAmount currencyID="EUR">15.97</cbc:TaxAmount>
 | 
			
		||||
      <cac:TaxSubtotal>
 | 
			
		||||
        <cbc:TaxableAmount currencyID="EUR">84.03</cbc:TaxableAmount>
 | 
			
		||||
        <cbc:TaxAmount currencyID="EUR">15.97</cbc:TaxAmount>
 | 
			
		||||
        <cac:TaxCategory>
 | 
			
		||||
          <cbc:ID>C62</cbc:ID>
 | 
			
		||||
          <cbc:Percent>19</cbc:Percent>
 | 
			
		||||
          <cac:TaxScheme>
 | 
			
		||||
            <cbc:ID>mwst</cbc:ID>
 | 
			
		||||
          </cac:TaxScheme>
 | 
			
		||||
        </cac:TaxCategory>
 | 
			
		||||
      </cac:TaxSubtotal>
 | 
			
		||||
    </cac:TaxTotal>
 | 
			
		||||
    <cac:Item>
 | 
			
		||||
                <cbc:Description>The Enterprise Plan</cbc:Description>
 | 
			
		||||
                <cbc:Name>eee</cbc:Name>
 | 
			
		||||
      <cbc:Description>Product Description</cbc:Description>
 | 
			
		||||
      <cbc:Name>Product Key</cbc:Name>
 | 
			
		||||
    </cac:Item>
 | 
			
		||||
    <cac:Price>
 | 
			
		||||
                <cbc:PriceAmount currencyID="EUR">14</cbc:PriceAmount>
 | 
			
		||||
      <cbc:PriceAmount currencyID="EUR">8.403</cbc:PriceAmount>
 | 
			
		||||
    </cac:Price>
 | 
			
		||||
  </cac:InvoiceLine>
 | 
			
		||||
            <cac:InvoiceLine>
 | 
			
		||||
            <cbc:ID>3</cbc:ID>
 | 
			
		||||
            <cbc:InvoicedQuantity>1</cbc:InvoicedQuantity>
 | 
			
		||||
            <cbc:LineExtensionAmount currencyID="EUR">191</cbc:LineExtensionAmount>
 | 
			
		||||
            <cac:Item>
 | 
			
		||||
                <cbc:Description>Soluta provident.</cbc:Description>
 | 
			
		||||
                <cbc:Name>k</cbc:Name>
 | 
			
		||||
            </cac:Item>
 | 
			
		||||
            <cac:Price>
 | 
			
		||||
                <cbc:PriceAmount currencyID="EUR">191</cbc:PriceAmount>
 | 
			
		||||
            </cac:Price>
 | 
			
		||||
            </cac:InvoiceLine>';
 | 
			
		||||
';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user