mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:07:32 -05:00 
			
		
		
		
	Working on Peppol
This commit is contained in:
		
							parent
							
								
									c44a3a971b
								
							
						
					
					
						commit
						5bd411b394
					
				@ -262,6 +262,7 @@ class PaymentEmailEngine extends BaseEmailEngine
 | 
				
			|||||||
        $data['$client.email'] = &$data['$email'];
 | 
					        $data['$client.email'] = &$data['$email'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $data['$client.balance'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
 | 
					        $data['$client.balance'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
 | 
				
			||||||
 | 
					        $data['$client.payment_balance'] = ['value' => Number::formatMoney($this->client->payment_balance, $this->client), 'label' => ctrans('texts.payment_balance_on_file')];
 | 
				
			||||||
        $data['$outstanding'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
 | 
					        $data['$outstanding'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
 | 
				
			||||||
        $data['$client_balance'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
 | 
					        $data['$client_balance'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
 | 
				
			||||||
        $data['$paid_to_date'] = ['value' => Number::formatMoney($this->client->paid_to_date, $this->client), 'label' => ctrans('texts.paid_to_date')];
 | 
					        $data['$paid_to_date'] = ['value' => Number::formatMoney($this->client->paid_to_date, $this->client), 'label' => ctrans('texts.paid_to_date')];
 | 
				
			||||||
 | 
				
			|||||||
@ -137,14 +137,14 @@ class Storecove {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function sendDocument(string $document, int $routing_id, array $identifiers = [])
 | 
					    public function sendDocument(string $document, int $routing_id, array $override_payload = [])
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $payload = [
 | 
					        $payload = [
 | 
				
			||||||
            "legalEntityId" => $routing_id,
 | 
					            "legalEntityId" => $routing_id,
 | 
				
			||||||
            "idempotencyGuid"=> \Illuminate\Support\Str::uuid(),
 | 
					            "idempotencyGuid"=> \Illuminate\Support\Str::uuid(),
 | 
				
			||||||
            "routing" => [
 | 
					            "routing" => [
 | 
				
			||||||
                "eIdentifiers" => $identifiers,
 | 
					                "eIdentifiers" => [],
 | 
				
			||||||
                "emails" => ["david@invoiceninja.com"]
 | 
					                "emails" => ["david@invoiceninja.com"]
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "document"=> [
 | 
					            "document"=> [
 | 
				
			||||||
@ -157,6 +157,8 @@ class Storecove {
 | 
				
			|||||||
            ],
 | 
					            ],
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $payload = array_merge($payload, $override_payload);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $uri = "document_submissions";
 | 
					        $uri = "document_submissions";
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        nlog($payload);
 | 
					        nlog($payload);
 | 
				
			||||||
 | 
				
			|||||||
@ -13,22 +13,25 @@ namespace App\Services\EDocument\Standards;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
 | 
					use App\Helpers\Invoice\Taxer;
 | 
				
			||||||
use App\Services\AbstractService;
 | 
					use App\Services\AbstractService;
 | 
				
			||||||
use App\Helpers\Invoice\InvoiceSum;
 | 
					use App\Helpers\Invoice\InvoiceSum;
 | 
				
			||||||
use InvoiceNinja\EInvoice\EInvoice;
 | 
					use InvoiceNinja\EInvoice\EInvoice;
 | 
				
			||||||
 | 
					use App\Utils\Traits\NumberFormatter;
 | 
				
			||||||
use App\Helpers\Invoice\InvoiceSumInclusive;
 | 
					use App\Helpers\Invoice\InvoiceSumInclusive;
 | 
				
			||||||
use App\Helpers\Invoice\Taxer;
 | 
					 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyType\Party;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\PartyType\Party;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\PriceType\Price;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\PriceType\Price;
 | 
				
			||||||
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\IdentifierType\ID;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\AddressType\Address;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\AddressType\Address;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\ContactType\Contact;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\ContactType\Contact;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\CountryType\Country;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\CountryType\Country;
 | 
				
			||||||
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\PartyIdentification;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxAmount;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxAmount;
 | 
				
			||||||
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\Party as PeppolParty;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxTotalType\TaxTotal;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\TaxTotalType\TaxTotal;
 | 
				
			||||||
use App\Services\EDocument\Standards\Settings\PropertyResolver;
 | 
					use App\Services\EDocument\Standards\Settings\PropertyResolver;
 | 
				
			||||||
use App\Utils\Traits\NumberFormatter;
 | 
					 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\PriceAmount;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\AmountType\PriceAmount;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyNameType\PartyName;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\PartyNameType\PartyName;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxSchemeType\TaxScheme;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\TaxSchemeType\TaxScheme;
 | 
				
			||||||
@ -42,14 +45,13 @@ use InvoiceNinja\EInvoice\Models\Peppol\TaxScheme as PeppolTaxScheme;
 | 
				
			|||||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxExclusiveAmount;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxExclusiveAmount;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxInclusiveAmount;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\AmountType\TaxInclusiveAmount;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\AmountType\LineExtensionAmount;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\AmountType\LineExtensionAmount;
 | 
				
			||||||
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\OrderReferenceType\OrderReference;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\MonetaryTotalType\LegalMonetaryTotal;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\MonetaryTotalType\LegalMonetaryTotal;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\TaxCategoryType\ClassifiedTaxCategory;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\TaxCategoryType\ClassifiedTaxCategory;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\CustomerPartyType\AccountingCustomerParty;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\CustomerPartyType\AccountingCustomerParty;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\FinancialAccountType\PayeeFinancialAccount;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\FinancialAccountType\PayeeFinancialAccount;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\IdentifierType\ID;
 | 
					use InvoiceNinja\EInvoice\Models\Peppol\IdentifierType\CustomerAssignedAccountID;
 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\Party as PeppolParty;
 | 
					 | 
				
			||||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyIdentification;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Peppol extends AbstractService
 | 
					class Peppol extends AbstractService
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -103,7 +105,7 @@ class Peppol extends AbstractService
 | 
				
			|||||||
        'DE' => 'VAT', //tested - requires Payment Means to be defined.
 | 
					        'DE' => 'VAT', //tested - requires Payment Means to be defined.
 | 
				
			||||||
        'DK' => 'ERST',
 | 
					        'DK' => 'ERST',
 | 
				
			||||||
        'EE' => 'VAT',
 | 
					        'EE' => 'VAT',
 | 
				
			||||||
        'ES' => 'VAT',
 | 
					        'ES' => 'VAT', //tested - B2G pending
 | 
				
			||||||
        'FI' => 'VAT',
 | 
					        'FI' => 'VAT',
 | 
				
			||||||
        'FR' => 'VAT',
 | 
					        'FR' => 'VAT',
 | 
				
			||||||
        'GR' => 'VAT',
 | 
					        'GR' => 'VAT',
 | 
				
			||||||
@ -165,6 +167,8 @@ class Peppol extends AbstractService
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private EInvoice $e;
 | 
					    private EInvoice $e;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private array $storecove_meta = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
    * @param Invoice $invoice
 | 
					    * @param Invoice $invoice
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
@ -741,6 +745,14 @@ class Peppol extends AbstractService
 | 
				
			|||||||
        return $total;
 | 
					        return $total;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    /////////////////  Helper Methods /////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * setInvoiceDefaults
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Stubs a default einvoice
 | 
				
			||||||
 | 
					     * @return self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public function setInvoiceDefaults(): self
 | 
					    public function setInvoiceDefaults(): self
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $settings = [
 | 
					        $settings = [
 | 
				
			||||||
@ -770,6 +782,14 @@ class Peppol extends AbstractService
 | 
				
			|||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * getSetting
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Attempts to harvest and return a preconfigured prop from company / client / invoice settings
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param  string $property_path
 | 
				
			||||||
 | 
					     * @return mixed
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public function getSetting(string $property_path): mixed
 | 
					    public function getSetting(string $property_path): mixed
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -784,7 +804,13 @@ class Peppol extends AbstractService
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public function countryLevelMutators():self
 | 
					    /**
 | 
				
			||||||
 | 
					     * countryLevelMutators
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Runs country level specific requirements for the e-invoice
 | 
				
			||||||
 | 
					     * @return self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private function countryLevelMutators():self
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(method_exists($this, $this->invoice->company->country()->iso_3166_2))
 | 
					        if(method_exists($this, $this->invoice->company->country()->iso_3166_2))
 | 
				
			||||||
@ -793,6 +819,13 @@ class Peppol extends AbstractService
 | 
				
			|||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * setPaymentMeans
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Sets the payment means - if it exists
 | 
				
			||||||
 | 
					     * @param  bool $required
 | 
				
			||||||
 | 
					     * @return self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private function setPaymentMeans(bool $required = false): self
 | 
					    private function setPaymentMeans(bool $required = false): self
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -803,12 +836,132 @@ class Peppol extends AbstractService
 | 
				
			|||||||
            return $this;
 | 
					            return $this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($required)
 | 
					        return $this->checkRequired($required, "Payment Means");
 | 
				
			||||||
            throw new \Exception('e-invoice generation halted:: Payment Means required');
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * setOrderReference
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * sets the order reference - if it exists (Never rely on settings for this)
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param  bool $required
 | 
				
			||||||
 | 
					     * @return self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private function setOrderReference(bool $required = false): self
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->p_invoice->BuyerReference = $this->invoice->po_number ?? '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(strlen($this->invoice->po_number ?? '') > 1)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            $order_reference = new OrderReference();
 | 
				
			||||||
 | 
					            $id = new ID();
 | 
				
			||||||
 | 
					            $id->value = $this->invoice->po_number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $order_reference->ID = $id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->p_invoice->OrderReference = $order_reference;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->setStorecoveMeta(["document" => [
 | 
				
			||||||
 | 
					                                        "invoice" => [
 | 
				
			||||||
 | 
					                                            "references" => [
 | 
				
			||||||
 | 
					                                                "documentType" => "purchase_order", 
 | 
				
			||||||
 | 
					                                                "documentId" => $this->invoice->po_number,
 | 
				
			||||||
 | 
					                                            ],
 | 
				
			||||||
 | 
					                                        ],
 | 
				
			||||||
 | 
					                                    ]
 | 
				
			||||||
 | 
					                                ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return $this;
 | 
					            return $this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        return $this->checkRequired($required, 'Order Reference');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * setCustomerAssignedAccountId
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Sets the client id_number CAN rely on settings
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param  bool $required
 | 
				
			||||||
 | 
					     * @return self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private function setCustomerAssignedAccountId(bool $required = false): self
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //@phpstan-ignore-next-line
 | 
				
			||||||
 | 
					        if(isset($this->p_invoice->AccountingCustomerParty->CustomerAssignedAccountID)){
 | 
				
			||||||
 | 
					            return $this;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        elseif($customer_assigned_account_id = $this->getSetting('Invoice.AccountingCustomerParty.CustomerAssignedAccountID')){
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					            $this->p_invoice->AccountingCustomerParty->CustomerAssignedAccountID = $customer_assigned_account_id;
 | 
				
			||||||
 | 
					            return $this;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        elseif(strlen($this->invoice->client->id_number ?? '') > 1){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $customer_assigned_account_id = new CustomerAssignedAccountID();
 | 
				
			||||||
 | 
					            $customer_assigned_account_id->value = $this->invoice->client->id_number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->p_invoice->AccountingCustomerParty->CustomerAssignedAccountID = $customer_assigned_account_id;
 | 
				
			||||||
 | 
					            return $this;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //@phpstan-ignore-next-line
 | 
				
			||||||
 | 
					        return $this->checkRequired($required, 'Client ID Number');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Check Required
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Throws if a required field is missing.
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param  bool $required
 | 
				
			||||||
 | 
					     * @param  string $section
 | 
				
			||||||
 | 
					     * @return self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private function checkRequired(bool $required, string $section): self
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $required ? throw new \Exception("e-invoice generation halted:: {$section} required") : $this;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Builds the Routing object for StoreCove
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  string $schemeId
 | 
				
			||||||
 | 
					     * @param  string $id
 | 
				
			||||||
 | 
					     * @return array
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private function buildRouting(string $schemeId, string $id): array
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					        return 
 | 
				
			||||||
 | 
					        [
 | 
				
			||||||
 | 
					            "routing" => [
 | 
				
			||||||
 | 
					                "publicIdentifiers" => [
 | 
				
			||||||
 | 
					                    [
 | 
				
			||||||
 | 
					                        "scheme" => $schemeId,
 | 
				
			||||||
 | 
					                        "id" => $id
 | 
				
			||||||
 | 
					                    ]
 | 
				
			||||||
 | 
					                ]
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ////////////////////////// Country level mutators /////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * DE
 | 
					     * DE
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -825,6 +978,20 @@ class Peppol extends AbstractService
 | 
				
			|||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * setStorecoveMeta
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * updates the storecove payload for sending documents
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param  array $meta
 | 
				
			||||||
 | 
					     * @return self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private function setStorecoveMeta(array $meta): self
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->storecove_meta = array_merge($this->storecove_meta, $meta);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        return $this;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * CH
 | 
					     * CH
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -867,10 +1034,10 @@ class Peppol extends AbstractService
 | 
				
			|||||||
     * ES
 | 
					     * ES
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @Pending 
 | 
					     * @Pending 
 | 
				
			||||||
 | 
					     * B2G configuration
 | 
				
			||||||
 | 
					     * B2G Testing
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * ES:DIRE - routing identifier
 | 
					     * testing. // routing identifier - 293098
 | 
				
			||||||
     * 
 | 
					 | 
				
			||||||
     * testing. //293098
 | 
					 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @return self
 | 
					     * @return self
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@ -923,17 +1090,37 @@ class Peppol extends AbstractService
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function FR(): self
 | 
					    private function FR(): self
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // When sending invoices to the French government (Chorus Pro):
 | 
					        // When sending invoices to the French government (Chorus Pro):
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // All invoices have to be routed to SIRET 0009:11000201100044. There is no test environment for sending to public entities.
 | 
					        // All invoices have to be routed to SIRET 0009:11000201100044. There is no test environment for sending to public entities.
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // The SIRET / 0009 identifier of the final recipient is to be included in the invoice.accountingCustomerParty.publicIdentifiers array.
 | 
					        // The SIRET / 0009 identifier of the final recipient is to be included in the invoice.accountingCustomerParty.publicIdentifiers array.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if($this->invoice->client->classification == 'government'){
 | 
				
			||||||
 | 
					            //route to SIRET 0009:11000201100044
 | 
				
			||||||
 | 
					            $this->setStorecoveMeta($this->buildRouting('FR:SIRET', "0009:11000201100044"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // The SIRET / 0009 identifier of the final recipient is to be included in the invoice.accountingCustomerParty.publicIdentifiers array.
 | 
				
			||||||
 | 
					            $this->setCustomerAssignedAccountId(true);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(strlen($this->invoice->client->id_number ?? '') == 9) {
 | 
				
			||||||
 | 
					            //SIREN
 | 
				
			||||||
 | 
					            $this->setStorecoveMeta($this->buildRouting('FR:SIREN', "0002:{$this->invoice->client->id_number}"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            //SIRET
 | 
				
			||||||
 | 
					            $this->setStorecoveMeta($this->buildRouting('FR:SIRET', "0009:{$this->invoice->client->id_number}"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // ??????????????????????? //@TODO
 | 
				
			||||||
        // The service code must be sent in invoice.buyerReference (deprecated) or the invoice.references array (documentType buyer_reference)
 | 
					        // The service code must be sent in invoice.buyerReference (deprecated) or the invoice.references array (documentType buyer_reference)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // The commitment number must be sent in the invoice.orderReference (deprecated) or the invoice.references array (documentType purchase_order).
 | 
					        if(strlen($this->invoice->po_number ?? '') >1) {
 | 
				
			||||||
 | 
					            $this->setOrderReference(false);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Invoices to companies (SIRET / 0009 or SIRENE / 0002) are routed directly to that identifier.
 | 
					 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -40,6 +40,7 @@
 | 
				
			|||||||
        "asm/php-ansible": "dev-main",
 | 
					        "asm/php-ansible": "dev-main",
 | 
				
			||||||
        "authorizenet/authorizenet": "^2.0",
 | 
					        "authorizenet/authorizenet": "^2.0",
 | 
				
			||||||
        "awobaz/compoships": "^2.1",
 | 
					        "awobaz/compoships": "^2.1",
 | 
				
			||||||
 | 
					        "aws/aws-sdk-php": "^3.319",
 | 
				
			||||||
        "bacon/bacon-qr-code": "^2.0",
 | 
					        "bacon/bacon-qr-code": "^2.0",
 | 
				
			||||||
        "beganovich/snappdf": "dev-master",
 | 
					        "beganovich/snappdf": "dev-master",
 | 
				
			||||||
        "braintree/braintree_php": "^6.0",
 | 
					        "braintree/braintree_php": "^6.0",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										19
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										19
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							@ -4,7 +4,7 @@
 | 
				
			|||||||
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
 | 
					        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
 | 
				
			||||||
        "This file is @generated automatically"
 | 
					        "This file is @generated automatically"
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    "content-hash": "6eda3a2962158b87dab46711e65a8438",
 | 
					    "content-hash": "95e7bd229644d1d8e768ecfbc78582cd",
 | 
				
			||||||
    "packages": [
 | 
					    "packages": [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "adrienrn/php-mimetyper",
 | 
					            "name": "adrienrn/php-mimetyper",
 | 
				
			||||||
@ -535,16 +535,16 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "aws/aws-sdk-php",
 | 
					            "name": "aws/aws-sdk-php",
 | 
				
			||||||
            "version": "3.317.1",
 | 
					            "version": "3.319.0",
 | 
				
			||||||
            "source": {
 | 
					            "source": {
 | 
				
			||||||
                "type": "git",
 | 
					                "type": "git",
 | 
				
			||||||
                "url": "https://github.com/aws/aws-sdk-php.git",
 | 
					                "url": "https://github.com/aws/aws-sdk-php.git",
 | 
				
			||||||
                "reference": "dc1e3031c2721a25beb2e8fbb175b576e3d60ab9"
 | 
					                "reference": "a5c408d4cd1945d5fc817f45e46383634b610497"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "dist": {
 | 
					            "dist": {
 | 
				
			||||||
                "type": "zip",
 | 
					                "type": "zip",
 | 
				
			||||||
                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/dc1e3031c2721a25beb2e8fbb175b576e3d60ab9",
 | 
					                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a5c408d4cd1945d5fc817f45e46383634b610497",
 | 
				
			||||||
                "reference": "dc1e3031c2721a25beb2e8fbb175b576e3d60ab9",
 | 
					                "reference": "a5c408d4cd1945d5fc817f45e46383634b610497",
 | 
				
			||||||
                "shasum": ""
 | 
					                "shasum": ""
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require": {
 | 
					            "require": {
 | 
				
			||||||
@ -597,7 +597,10 @@
 | 
				
			|||||||
                ],
 | 
					                ],
 | 
				
			||||||
                "psr-4": {
 | 
					                "psr-4": {
 | 
				
			||||||
                    "Aws\\": "src/"
 | 
					                    "Aws\\": "src/"
 | 
				
			||||||
                }
 | 
					                },
 | 
				
			||||||
 | 
					                "exclude-from-classmap": [
 | 
				
			||||||
 | 
					                    "src/data/"
 | 
				
			||||||
 | 
					                ]
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "notification-url": "https://packagist.org/downloads/",
 | 
					            "notification-url": "https://packagist.org/downloads/",
 | 
				
			||||||
            "license": [
 | 
					            "license": [
 | 
				
			||||||
@ -624,9 +627,9 @@
 | 
				
			|||||||
            "support": {
 | 
					            "support": {
 | 
				
			||||||
                "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
 | 
					                "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
 | 
				
			||||||
                "issues": "https://github.com/aws/aws-sdk-php/issues",
 | 
					                "issues": "https://github.com/aws/aws-sdk-php/issues",
 | 
				
			||||||
                "source": "https://github.com/aws/aws-sdk-php/tree/3.317.1"
 | 
					                "source": "https://github.com/aws/aws-sdk-php/tree/3.319.0"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "time": "2024-08-02T18:09:42+00:00"
 | 
					            "time": "2024-08-07T18:05:51+00:00"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "bacon/bacon-qr-code",
 | 
					            "name": "bacon/bacon-qr-code",
 | 
				
			||||||
 | 
				
			|||||||
@ -5313,7 +5313,7 @@ $lang = array(
 | 
				
			|||||||
    'forever_free' => 'Forever Free',
 | 
					    'forever_free' => 'Forever Free',
 | 
				
			||||||
    'comments_only' => 'Comments Only',
 | 
					    'comments_only' => 'Comments Only',
 | 
				
			||||||
    'payment_balance_on_file' => 'Payment Balance On File',
 | 
					    'payment_balance_on_file' => 'Payment Balance On File',
 | 
				
			||||||
 | 
					    'ubl_email_attachment_help' => 'For more e-invoice settings please navigate :here',
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
return $lang;
 | 
					return $lang;
 | 
				
			||||||
 | 
				
			|||||||
@ -639,10 +639,14 @@ $x = '<?xml version="1.0" encoding="utf-8"?>
 | 
				
			|||||||
      nlog($xml);
 | 
					      nlog($xml);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      $identifiers = [
 | 
					      $identifiers = [
 | 
				
			||||||
 | 
					        "routing" => [
 | 
				
			||||||
 | 
					          "eIdentifiers" => [
 | 
				
			||||||
              [
 | 
					              [
 | 
				
			||||||
              'scheme' => 'ES:VAT',
 | 
					              'scheme' => 'ES:VAT',
 | 
				
			||||||
              'id' => 'ESB53625999'
 | 
					              'id' => 'ESB53625999'
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
 | 
					      $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
 | 
				
			||||||
@ -673,10 +677,14 @@ $x = '<?xml version="1.0" encoding="utf-8"?>
 | 
				
			|||||||
      nlog($xml);
 | 
					      nlog($xml);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      $identifiers = [
 | 
					      $identifiers = [
 | 
				
			||||||
 | 
					        "routing" => [
 | 
				
			||||||
 | 
					          "eIdentifiers" => [
 | 
				
			||||||
            [
 | 
					            [
 | 
				
			||||||
              'scheme' => 'DE:VAT',
 | 
					              'scheme' => 'DE:VAT',
 | 
				
			||||||
              'id' => 'DE010101010'
 | 
					              'id' => 'DE010101010'
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
 | 
					      $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user