1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Merge pull request #10188 from turbo124/v5-develop

v5.10.43
This commit is contained in:
David Bomba 2024-10-25 17:54:03 +11:00 committed by GitHub
commit 96372e558b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 1574 additions and 17 deletions

View File

@ -1 +1 @@
5.10.42
5.10.43

View File

@ -172,7 +172,7 @@ class EInvoicePeppolController extends BaseController
$r = $storecove->updateLegalEntity($company->legal_entity_id, $request->validated());
if ($r) {
if ($r->successful()) {
$tax_data = $company->tax_data;
$tax_data->acts_as_sender = $request->acts_as_sender;

View File

@ -63,6 +63,9 @@ class SelfUpdateController extends BaseController
$file_headers = @get_headers($this->getDownloadUrl());
nlog("Download URL");
nlog($this->getDownloadUrl());
if(!is_array($file_headers)) {
nlog($file_headers);
return response()->json(['message' => 'There was a problem reaching the update server, please try again in a little while.'], 410);

View File

@ -307,7 +307,7 @@ class CompanyExport implements ShouldQueue
$invoice = $this->transformArrayOfKeys($invoice, ['recurring_id','client_id', 'vendor_id', 'project_id', 'design_id', 'subscription_id']);
$invoice->tax_data = '';
return $invoice->makeVisible(['id',
return $invoice->makeHidden(['gateway_fee'])->makeVisible(['id',
'private_notes',
'user_id',
'client_id',

View File

@ -0,0 +1,29 @@
<?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\Gateway\Storecove\Models;
class AccountingCustomerParty
{
/** @var PublicIdentifiers[] */
public array $publicIdentifiers;
public Party $party;
/**
* @param PublicIdentifiers[] $publicIdentifiers
*/
public function __construct(array $publicIdentifiers, Party $party)
{
$this->publicIdentifiers = $publicIdentifiers;
$this->party = $party;
}
}

View File

@ -0,0 +1,22 @@
<?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\Gateway\Storecove\Models;
class AccountingSupplierParty
{
public Party $party;
public function __construct(Party $party)
{
$this->party = $party;
}
}

View File

@ -0,0 +1,25 @@
<?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\Gateway\Storecove\Models;
class AdditionalItemProperties
{
public string $name;
public string $value;
public function __construct(string $name, string $value)
{
$this->name = $name;
$this->value = $value;
}
}

View File

@ -0,0 +1,39 @@
<?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\Gateway\Storecove\Models;
class Address
{
public string $street1;
public null $street2;
public string $city;
public string $zip;
public null $county;
public string $country;
public function __construct(
string $street1,
null $street2,
string $city,
string $zip,
null $county,
string $country
) {
$this->street1 = $street1;
$this->street2 = $street2;
$this->city = $city;
$this->zip = $zip;
$this->county = $county;
$this->country = $country;
}
}

View File

@ -0,0 +1,29 @@
<?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\Gateway\Storecove\Models;
class AllowanceCharges
{
public string $reason;
public float $amountExcludingTax;
public Tax $tax;
public function __construct(
string $reason,
float $amountExcludingTax,
Tax $tax
) {
$this->reason = $reason;
$this->amountExcludingTax = $amountExcludingTax;
$this->tax = $tax;
}
}

View File

@ -0,0 +1,39 @@
<?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\Gateway\Storecove\Models;
class Attachments
{
public string $filename;
public string $document;
public string $mimeType;
public bool $primaryImage;
public string $documentId;
public string $description;
public function __construct(
string $filename,
string $document,
string $mimeType,
bool $primaryImage,
string $documentId,
string $description
) {
$this->filename = $filename;
$this->document = $document;
$this->mimeType = $mimeType;
$this->primaryImage = $primaryImage;
$this->documentId = $documentId;
$this->description = $description;
}
}

View File

@ -0,0 +1,33 @@
<?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\Gateway\Storecove\Models;
class Contact
{
public string $email;
public string $firstName;
public string $lastName;
public string $phone;
public function __construct(
string $email,
string $firstName,
string $lastName,
string $phone
) {
$this->email = $email;
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->phone = $phone;
}
}

View File

@ -0,0 +1,30 @@
<?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\Gateway\Storecove\Models;
class Delivery
{
public string $deliveryPartyName;
public string $actualDeliveryDate;
public DeliveryLocation $deliveryLocation;
public function __construct(
string $deliveryPartyName,
string $actualDeliveryDate,
DeliveryLocation $deliveryLocation
) {
$this->deliveryPartyName = $deliveryPartyName;
$this->actualDeliveryDate = $actualDeliveryDate;
$this->deliveryLocation = $deliveryLocation;
}
}

View File

@ -0,0 +1,28 @@
<?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\Gateway\Storecove\Models;
class DeliveryLocation
{
public string $id;
public string $schemeId;
public Address $address;
public function __construct(
string $id,
string $schemeId,
Address $address
) {
$this->id = $id;
$this->schemeId = $schemeId;
$this->address = $address;
}
}

View File

@ -0,0 +1,25 @@
<?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\Gateway\Storecove\Models;
class Document
{
public string $documentType;
public Invoice $invoice;
public function __construct(string $documentType, Invoice $invoice)
{
$this->documentType = $documentType;
$this->invoice = $invoice;
}
}

View File

@ -0,0 +1,25 @@
<?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\Gateway\Storecove\Models;
class EIdentifiers
{
public string $scheme;
public string $id;
public function __construct(string $scheme, string $id)
{
$this->scheme = $scheme;
$this->id = $id;
}
}

View File

@ -0,0 +1,171 @@
<?php
namespace App\Services\EDocument\Gateway\Storecove\Models;
use JsonSerializable;
use Symfony\Component\Serializer\Annotation\SerializedName;
use DateTime;
class Invoice implements JsonSerializable
{
#[SerializedName('taxSystem')]
private string $taxSystem = 'tax_line_percentages';
#[SerializedName('documentCurrency')]
private string $documentCurrency = '';
#[SerializedName('invoiceNumber')]
private string $invoiceNumber = '';
#[SerializedName('issueDate')]
private DateTime $issueDate;
#[SerializedName('taxPointDate')]
private ?DateTime $taxPointDate = null;
#[SerializedName('dueDate')]
private DateTime $dueDate;
#[SerializedName('invoicePeriod')]
private array $invoicePeriod = [];
#[SerializedName('references')]
private array $references = [];
#[SerializedName('accountingCost')]
private ?string $accountingCost = null;
#[SerializedName('note')]
private string $note = '';
#[SerializedName('amountIncludingVat')]
private float $amountIncludingVat = 0.0;
#[SerializedName('prepaidAmount')]
private ?float $prepaidAmount = null;
#[SerializedName('accountingSupplierParty')]
private array $accountingSupplierParty = [];
#[SerializedName('accountingCustomerParty')]
private array $accountingCustomerParty = [];
#[SerializedName('paymentMeans')]
private array $paymentMeans = [];
#[SerializedName('taxTotal')]
private array $taxTotal = [];
/**
* @var InvoiceLines[]
*/
private array $invoiceLines = [];
// Getters and setters for all properties
public function setDocumentCurrency(string $documentCurrency): void
{
$this->documentCurrency = $documentCurrency;
}
public function setInvoiceNumber(string $invoiceNumber): void
{
$this->invoiceNumber = $invoiceNumber;
}
public function setIssueDate(DateTime $issueDate): void
{
$this->issueDate = $issueDate;
}
public function setTaxPointDate(?DateTime $taxPointDate): void
{
$this->taxPointDate = $taxPointDate;
}
public function setDueDate(DateTime $dueDate): void
{
$this->dueDate = $dueDate;
}
public function setInvoicePeriod(array $invoicePeriod): void
{
$this->invoicePeriod = $invoicePeriod;
}
public function setReferences(array $references): void
{
$this->references = $references;
}
public function setAccountingCost(?string $accountingCost): void
{
$this->accountingCost = $accountingCost;
}
public function setNote(string $note): void
{
$this->note = $note;
}
public function setAmountIncludingVat(float $amountIncludingVat): void
{
$this->amountIncludingVat = $amountIncludingVat;
}
public function setPrepaidAmount(?float $prepaidAmount): void
{
$this->prepaidAmount = $prepaidAmount;
}
public function setAccountingSupplierParty(array $accountingSupplierParty): void
{
$this->accountingSupplierParty = $accountingSupplierParty;
}
public function setAccountingCustomerParty(array $accountingCustomerParty): void
{
$this->accountingCustomerParty = $accountingCustomerParty;
}
public function setPaymentMeans(array $paymentMeans): void
{
$this->paymentMeans = $paymentMeans;
}
public function setTaxTotal(array $taxTotal): void
{
$this->taxTotal = $taxTotal;
}
/**
* @param InvoiceLines[] $invoiceLines
*/
public function setInvoiceLines(array $invoiceLines): void
{
$this->invoiceLines = $invoiceLines;
}
public function jsonSerialize(): mixed
{
return [
'taxSystem' => $this->taxSystem,
'documentCurrency' => $this->documentCurrency,
'invoiceNumber' => $this->invoiceNumber,
'issueDate' => $this->issueDate->format('Y-m-d'),
'taxPointDate' => $this->taxPointDate ? $this->taxPointDate->format('Y-m-d') : null,
'dueDate' => $this->dueDate->format('Y-m-d'),
'invoicePeriod' => $this->invoicePeriod,
'references' => $this->references,
'accountingCost' => $this->accountingCost,
'note' => $this->note,
'amountIncludingVat' => $this->amountIncludingVat,
'prepaidAmount' => $this->prepaidAmount,
'accountingSupplierParty' => $this->accountingSupplierParty,
'accountingCustomerParty' => $this->accountingCustomerParty,
'paymentMeans' => $this->paymentMeans,
'taxTotal' => $this->taxTotal,
'invoiceLines' => $this->invoiceLines,
];
}
}

View File

@ -0,0 +1,119 @@
<?php
namespace App\Services\EDocument\Gateway\Storecove\Models;
use App\Services\EDocument\Gateway\Storecove\Models\Tax;
use Symfony\Component\Serializer\Annotation\SerializedName;
class InvoiceLines
{
#[SerializedName('ID.value')]
public string $lineId = '';
#[SerializedName('LineExtensionAmount.amount')]
public float $amountExcludingVat = 0.0;
#[SerializedName('Price.PriceAmount.amount')]
public float $itemPrice = 0.0;
#[SerializedName('InvoicedQuantity')]
public int $quantity = 0;
#[SerializedName('InvoicedQuantity.unitCode')]
public string $quantityUnitCode = '';
#[SerializedName('Item.Name')]
public string $name = '';
#[SerializedName('Item.Description')]
public string $description = '';
public Tax $tax;
public function __construct()
{
$this->tax = new Tax();
}
// Getters and setters
public function getLineId(): string
{
return $this->lineId;
}
public function setLineId(string $lineId): void
{
$this->lineId = $lineId;
}
public function getAmountExcludingVat(): float
{
return $this->amountExcludingVat;
}
public function setAmountExcludingVat(float $amountExcludingVat): void
{
$this->amountExcludingVat = $amountExcludingVat;
}
public function getItemPrice(): float
{
return $this->itemPrice;
}
public function setItemPrice(float $itemPrice): void
{
$this->itemPrice = $itemPrice;
}
public function getQuantity(): int
{
return $this->quantity;
}
public function setQuantity(int $quantity): void
{
$this->quantity = $quantity;
}
public function getQuantityUnitCode(): string
{
return $this->quantityUnitCode;
}
public function setQuantityUnitCode(string $quantityUnitCode): void
{
$this->quantityUnitCode = $quantityUnitCode;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
public function getDescription(): string
{
return $this->description;
}
public function setDescription(string $description): void
{
$this->description = $description;
}
public function getTax(): Tax
{
return $this->tax;
}
public function setTax(Tax $tax): void
{
$this->tax = $tax;
}
}

View File

@ -0,0 +1,29 @@
<?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\Gateway\Storecove\Models;
class Party
{
public string $companyName;
public Address $address;
public Contact $contact;
public function __construct(
string $companyName,
Address $address,
Contact $contact
) {
$this->companyName = $companyName;
$this->address = $address;
$this->contact = $contact;
}
}

View File

@ -0,0 +1,23 @@
<?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\Gateway\Storecove\Models;
class PaymentTerms
{
public string $note;
public function __construct(string $note)
{
$this->note = $note;
}
}

View File

@ -0,0 +1,24 @@
<?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\Gateway\Storecove\Models;
class PublicIdentifiers
{
public string $scheme;
public string $id;
public function __construct(string $scheme, string $id)
{
$this->scheme = $scheme;
$this->id = $id;
}
}

View File

@ -0,0 +1,33 @@
<?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\Gateway\Storecove\Models;
class References
{
public string $documentType;
public string $documentId;
public ?string $lineId;
public ?string $issueDate;
public function __construct(
string $documentType,
string $documentId,
?string $lineId,
?string $issueDate
) {
$this->documentType = $documentType;
$this->documentId = $documentId;
$this->lineId = $lineId;
$this->issueDate = $issueDate;
}
}

View File

@ -0,0 +1,30 @@
<?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\Gateway\Storecove\Models;
class Routing
{
/** @var EIdentifiers[] */
public array $eIdentifiers;
/** @var string[] */
public array $emails;
/**
* @param EIdentifiers[] $eIdentifiers
* @param string[] $emails
*/
public function __construct(array $eIdentifiers, array $emails)
{
$this->eIdentifiers = $eIdentifiers;
$this->emails = $emails;
}
}

View File

@ -0,0 +1,40 @@
<?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\Gateway\Storecove\Models;
class StorecoveModel
{
public int $legalEntityId;
public string $idempotencyGuid;
public Routing $routing;
/** @var Attachments[] */
public array $attachments;
public Document $document;
/**
* @param Attachments[] $attachments
*/
public function __construct(
int $legalEntityId,
string $idempotencyGuid,
Routing $routing,
array $attachments,
Document $document
) {
$this->legalEntityId = $legalEntityId;
$this->idempotencyGuid = $idempotencyGuid;
$this->routing = $routing;
$this->attachments = $attachments;
$this->document = $document;
}
}

View File

@ -0,0 +1,71 @@
<?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\Gateway\Storecove\Models;
use Symfony\Component\Serializer\Annotation\SerializedName;
class Tax
{
#[SerializedName('Item.ClassifiedTaxCategory.0.Percent')]
public float $taxPercentage = 0.0;
#[SerializedName('LineExtensionAmount.amount')]
public float $taxableAmount = 0.0;
#[SerializedName('TaxTotal.0.TaxAmount.amount')]
public float $taxAmount = 0.0;
#[SerializedName('Item.ClassifiedTaxCategory.0.ID.value')]
public string $taxCategory = '';
// Getters and setters
public function getTaxPercentage(): float
{
return $this->taxPercentage;
}
public function setTaxPercentage(float $taxPercentage): void
{
$this->taxPercentage = $taxPercentage;
}
public function getTaxableAmount(): float
{
return $this->taxableAmount;
}
public function setTaxableAmount(float $taxableAmount): void
{
$this->taxableAmount = $taxableAmount;
}
public function getTaxAmount(): float
{
return $this->taxAmount;
}
public function setTaxAmount(float $taxAmount): void
{
$this->taxAmount = $taxAmount;
}
public function getTaxCategory(): string
{
return $this->taxCategory;
}
public function setTaxCategory(string $taxCategory): void
{
$this->taxCategory = $taxCategory;
}
}

View File

@ -0,0 +1,32 @@
<?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\Gateway\Storecove\Models;
class TaxSubtotals
{
public float $taxableAmount;
public float $taxAmount;
public int $percentage;
public string $country;
public function __construct(
float $taxableAmount,
float $taxAmount,
int $percentage,
string $country
) {
$this->taxableAmount = $taxableAmount;
$this->taxAmount = $taxAmount;
$this->percentage = $percentage;
$this->country = $country;
}
}

View File

@ -0,0 +1,244 @@
<?php
namespace App\Services\EDocument\Gateway\Storecove;
use App\Services\EDocument\Gateway\Storecove\Models\Tax;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
use App\Services\EDocument\Gateway\Storecove\Models\InvoiceLines;
use InvoiceNinja\EInvoice\Models\Peppol\Invoice as PeppolInvoice;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter;
use App\Services\EDocument\Gateway\Storecove\Models\Invoice as StorecoveInvoice;
use Symfony\Component\Serializer\SerializerInterface;
class PeppolToStorecoveNormalizer implements DenormalizerInterface
{
private SerializerInterface $serializer;
private ObjectNormalizer $objectNormalizer;
public function __construct(SerializerInterface $serializer)
{
$this->serializer = $serializer;
$classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());
$metadataAwareNameConverter = new MetadataAwareNameConverter($classMetadataFactory);
$this->objectNormalizer = new ObjectNormalizer($classMetadataFactory, $metadataAwareNameConverter);
}
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
{
$peppolInvoice = $data;
$storecoveInvoice = new StorecoveInvoice();
$storecoveInvoice->setDocumentCurrency($peppolInvoice->DocumentCurrencyCode ?? '');
$storecoveInvoice->setInvoiceNumber($peppolInvoice->ID ?? '');
$storecoveInvoice->setIssueDate($peppolInvoice->IssueDate);
$storecoveInvoice->setDueDate($peppolInvoice->DueDate);
$storecoveInvoice->setNote($peppolInvoice->Note ?? '');
$storecoveInvoice->setAmountIncludingVat((float)($peppolInvoice->LegalMonetaryTotal->TaxInclusiveAmount->amount ?? 0));
if (isset($peppolInvoice->InvoicePeriod[0])) {
$storecoveInvoice->setInvoicePeriod([
'startDate' => $peppolInvoice->InvoicePeriod[0]->StartDate,
'endDate' => $peppolInvoice->InvoicePeriod[0]->EndDate,
]);
}
$storecoveInvoice->setReferences([
'buyerReference' => $peppolInvoice->BuyerReference ?? '',
'orderReference' => $peppolInvoice->OrderReference->ID->value ?? '',
]);
if (isset($peppolInvoice->AccountingSupplierParty->Party)) {
$supplier = $peppolInvoice->AccountingSupplierParty->Party;
$storecoveInvoice->setAccountingSupplierParty([
'name' => $supplier->PartyName[0]->Name ?? '',
'vatNumber' => $supplier->PartyIdentification[0]->ID->value ?? '',
'streetName' => $supplier->PostalAddress->StreetName ?? '',
'cityName' => $supplier->PostalAddress->CityName ?? '',
'postalZone' => $supplier->PostalAddress->PostalZone ?? '',
'countryCode' => $supplier->PostalAddress->Country->IdentificationCode->value ?? '',
]);
}
if (isset($peppolInvoice->AccountingCustomerParty->Party)) {
$customer = $peppolInvoice->AccountingCustomerParty->Party;
$storecoveInvoice->setAccountingCustomerParty([
'name' => $customer->PartyName[0]->Name ?? '',
'vatNumber' => $customer->PartyIdentification[0]->ID->value ?? '',
'streetName' => $customer->PostalAddress->StreetName ?? '',
'cityName' => $customer->PostalAddress->CityName ?? '',
'postalZone' => $customer->PostalAddress->PostalZone ?? '',
'countryCode' => $customer->PostalAddress->Country->IdentificationCode->value ?? '',
]);
}
if (isset($peppolInvoice->PaymentMeans[0])) {
$storecoveInvoice->setPaymentMeans([
'paymentID' => $peppolInvoice->PaymentMeans[0]->PayeeFinancialAccount->ID->value ?? '',
]);
}
// Map tax total at invoice level
$taxTotal = [];
if (isset($peppolInvoice->InvoiceLine[0]->TaxTotal[0])) {
$taxTotal[] = [
'taxAmount' => (float)($peppolInvoice->InvoiceLine[0]->TaxTotal[0]->TaxAmount->amount ?? 0),
'taxCurrency' => $peppolInvoice->DocumentCurrencyCode ?? '',
];
}
$storecoveInvoice->setTaxTotal($taxTotal);
if (isset($peppolInvoice->InvoiceLine)) {
$invoiceLines = [];
foreach ($peppolInvoice->InvoiceLine as $line) {
$invoiceLine = new InvoiceLines();
$invoiceLine->setLineId($line->ID->value ?? '');
$invoiceLine->setAmountExcludingVat((float)($line->LineExtensionAmount->amount ?? 0));
$invoiceLine->setQuantity((float)($line->InvoicedQuantity ?? 0));
$invoiceLine->setQuantityUnitCode(''); // Not present in the provided JSON
$invoiceLine->setItemPrice((float)($line->Price->PriceAmount->amount ?? 0));
$invoiceLine->setName($line->Item->Name ?? '');
$invoiceLine->setDescription($line->Item->Description ?? '');
$tax = new Tax();
if (isset($line->TaxTotal[0])) {
$taxTotal = $line->TaxTotal[0];
$tax->setTaxAmount((float)($taxTotal->TaxAmount->amount ?? 0));
if (isset($line->Item->ClassifiedTaxCategory[0])) {
$taxCategory = $line->Item->ClassifiedTaxCategory[0];
$tax->setTaxPercentage((float)($taxCategory->Percent ?? 0));
$tax->setTaxCategory($taxCategory->ID->value ?? '');
}
$tax->setTaxableAmount((float)($line->LineExtensionAmount->amount ?? 0));
}
$invoiceLine->setTax($tax);
$invoiceLines[] = $invoiceLine;
}
$storecoveInvoice->setInvoiceLines($invoiceLines);
}
return $storecoveInvoice;
}
private function validateStorecoveInvoice(StorecoveInvoice $invoice): void
{
$requiredFields = ['documentCurrency', 'invoiceNumber', 'issueDate', 'dueDate'];
foreach ($requiredFields as $field) {
if (empty($invoice->$field)) {
throw new \InvalidArgumentException("Required field '$field' is missing or empty");
}
}
if (empty($invoice->invoiceLines)) {
throw new \InvalidArgumentException("Invoice must have at least one line item");
}
// Add more validations as needed
}
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
{
return $type === StorecoveInvoice::class && $data instanceof PeppolInvoice;
}
public function getSupportedTypes(?string $format): array
{
return [
StorecoveInvoice::class => true,
];
}
private function mapNestedProperties($object, array $nestedPaths): array
{
$result = [];
foreach ($nestedPaths as $key => $path) {
if (is_array($path)) {
// Try multiple paths
foreach ($path as $possiblePath) {
$value = $this->getValueFromPath($object, $possiblePath);
if ($value !== null) {
$result[$key] = $value;
nlog("Mapped nested property: $key", ['path' => $possiblePath, 'value' => $value]);
break;
}
}
if (!isset($result[$key])) {
nlog("Failed to map nested property: $key", ['paths' => $path]);
}
} else {
$value = $this->getValueFromPath($object, $path);
if ($value !== null) {
$result[$key] = $value;
nlog("Mapped nested property: $key", ['path' => $path, 'value' => $value]);
} else {
nlog("Failed to map nested property: $key", ['path' => $path]);
}
}
}
return $result;
}
private function getValueFromPath($object, string $path)
{
$parts = explode('.', $path);
$value = $object;
foreach ($parts as $part) {
if (preg_match('/(.+)\[(\d+)\]/', $part, $matches)) {
$property = $matches[1];
$index = $matches[2];
$value = $value->$property[$index] ?? null;
} else {
$value = $value->$part ?? null;
}
if ($value === null) {
nlog("Null value encountered in path: $path at part: $part");
return null;
}
}
return $value instanceof \DateTime ? $value->format('Y-m-d') : $value;
}
private function castValue(string $property, $value)
{
try {
$reflectionProperty = new \ReflectionProperty(StorecoveInvoice::class, $property);
$type = $reflectionProperty->getType();
if ($type instanceof \ReflectionNamedType) {
switch ($type->getName()) {
case 'float':
return (float) $value;
case 'int':
return (int) $value;
case 'string':
return (string) $value;
case 'bool':
return (bool) $value;
case 'array':
return (array) $value;
default:
return $value;
}
}
} catch (\ReflectionException $e) {
nlog("Error casting value for property: $property", ['error' => $e->getMessage()]);
}
return $value;
}
}

View File

@ -896,6 +896,26 @@ class Peppol extends AbstractService
$party_name->Name = $this->invoice->company->present()->name();
$party->PartyName[] = $party_name;
if (strlen($this->company->settings->vat_number ?? '') > 1) {
$pi = new PartyIdentification();
$vatID = new ID();
if ($scheme = $this->resolveTaxScheme()) {
$vatID->schemeID = $scheme;
}
$vatID->value = $this->company->settings->vat_number; //todo if we are cross border - switch to the supplier local vat number
$pi->ID = $vatID;
$party->PartyIdentification[] = $pi;
}
$address = new Address();
$address->CityName = $this->invoice->company->settings->city;
$address->StreetName = $this->invoice->company->settings->address1;

View File

@ -88,7 +88,6 @@ class PdfService
*/
public function getPdf()
{
try {
$pdf = $this->resolvePdfEngine($this->getHtml());

View File

@ -283,7 +283,6 @@ class TemplateService
*/
public function processData($data): self
{
$this->data = $this->preProcessDataBlocks($data);
return $this;
@ -494,6 +493,7 @@ class TemplateService
*/
private function preProcessDataBlocks($data): array
{
return collect($data)->map(function ($value, $key) {
$processed = [];
@ -962,7 +962,8 @@ class TemplateService
'created_at' => $this->translateDate($task->created_at, $task->client ? $task->client->date_format() : $task->company->date_format(), $task->client ? $task->client->locale() : $task->company->locale()),
'updated_at' => $this->translateDate($task->updated_at, $task->client ? $task->client->date_format() : $task->company->date_format(), $task->client ? $task->client->locale() : $task->company->locale()),
'date' => $task->calculated_start_date ? $this->translateDate($task->calculated_start_date, $task->client ? $task->client->date_format() : $task->company->date_format(), $task->client ? $task->client->locale() : $task->company->locale()) : '',
'project' => $task->project ? $this->transformProject($task->project, true) : [],
// 'project' => $task->project ? $this->transformProject($task->project, true) : [],
'project' => $task->project ? $task->project->name : '',
'time_log' => $task->processLogsExpandedNotation(),
'custom_value1' => $task->custom_value1 ?: '',
'custom_value2' => $task->custom_value2 ?: '',
@ -1021,7 +1022,7 @@ class TemplateService
*/
public function processProjects($projects): array
{
return
collect($projects)->map(function ($project) {
@ -1042,7 +1043,7 @@ class TemplateService
private function transformProject(Project $project, bool $nested = false): array
{
return [
'name' => $project->name ?: '',
'number' => $project->number ?: '',

View File

@ -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.42'),
'app_tag' => env('APP_TAG', '5.10.42'),
'app_version' => env('APP_VERSION', '5.10.43'),
'app_tag' => env('APP_TAG', '5.10.43'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -2345,7 +2345,7 @@ $lang = array(
'currency_gold_troy_ounce' => 'أونصة تروي ذهبية',
'currency_nicaraguan_córdoba' => 'قرطبة نيكاراغوا',
'currency_malagasy_ariary' => 'أرياري مدغشقر',
"currency_tongan_paanga" => "بانغا تونغا",
"currency_tongan_pa_anga" => "بانغا تونغا",
'review_app_help' => 'نأمل أن تستمتع باستخدام التطبيق.<br/> إذا كنت تفكر في :link فإننا نقدر ذلك كثيرًا!',
'writing_a_review' => 'كتابة مراجعة',
@ -5319,6 +5319,73 @@ $lang = array(
'no_unread_notifications' => 'لقد تم اللحاق بكل شيء! لا توجد إشعارات جديدة.',
'how_to_import_data' => 'كيفية استيراد البيانات',
'download_example_file' => 'تنزيل ملف المثال',
'expense_mailbox' => 'عنوان البريد الإلكتروني الوارد',
'expense_mailbox_help' => 'عنوان البريد الإلكتروني الوارد الذي يقبل مستندات النفقات. على سبيل المثال، expenses@invoiceninja.com',
'expense_mailbox_active' => 'صندوق بريد النفقات',
'expense_mailbox_active_help' => 'يتيح معالجة المستندات مثل الإيصالات لإعداد تقارير النفقات',
'inbound_mailbox_allow_company_users' => 'السماح لمرسلي الشركة',
'inbound_mailbox_allow_company_users_help' => 'يسمح للمستخدمين داخل الشركة بإرسال مستندات النفقات.',
'inbound_mailbox_allow_vendors' => 'السماح لمرسلي البائعين',
'inbound_mailbox_allow_vendors_help' => 'يسمح لبائعي الشركة بإرسال مستندات النفقات',
'inbound_mailbox_allow_clients' => 'السماح لمرسلي العميل',
'inbound_mailbox_allow_clients_help' => 'يسمح للعملاء بإرسال مستندات النفقات',
'inbound_mailbox_whitelist' => 'قائمة السماح للمرسلين الواردين',
'inbound_mailbox_whitelist_help' => 'قائمة منفصلة بفواصل للرسائل الإلكترونية التي ينبغي السماح لها بإرسال رسائل إلكترونية للمعالجة',
'inbound_mailbox_blacklist' => 'قائمة المرسلين المحظورين',
'inbound_mailbox_blacklist_help' => 'قائمة منفصلة بفواصل للرسائل الإلكترونية التي لا يُسمح بإرسال رسائل إلكترونية إليها للمعالجة',
'inbound_mailbox_allow_unknown' => 'السماح لجميع المرسلين',
'inbound_mailbox_allow_unknown_help' => 'السماح لأي شخص بإرسال بريد إلكتروني للنفقات للمعالجة',
'quick_actions' => 'الإجراءات السريعة',
'end_all_sessions_help' => 'يقوم بتسجيل خروج جميع المستخدمين ويطلب من جميع المستخدمين النشطين إعادة المصادقة.',
'updated_records' => 'السجلات المحدثة',
'vat_not_registered' => 'البائع غير مسجل في ضريبة القيمة المضافة',
'small_company_info' => 'عدم الإفصاح عن ضريبة المبيعات وفقًا للمادة 19 من قانون الضرائب الأمريكي',
'peppol_onboarding' => 'يبدو أن هذه هي المرة الأولى التي تستخدم فيها PEPPOL',
'get_started' => 'البدء',
'configure_peppol' => 'Configure PEPPOL',
'step' => 'خطوة',
'peppol_whitelabel_warning' => 'White-label license required in order to use einvoicing over the PEPPOL network.',
'peppol_plan_warning' => 'Enterprise plan required in order to use einvoicing over the PEPPOL network.',
'peppol_credits_info' => 'Ecredits are required to send and receive einvoices. These are charged on a per document basis.',
'buy_credits' => 'Buy E Credits',
'peppol_successfully_configured' => 'PEPPOL successsfully configured.',
'peppol_not_paid_message' => 'Enterprise plan required for PEPPOL. Please upgrade your plan.',
'peppol_country_not_supported' => 'PEPPOL network not yet available for this country.',
'peppol_disconnect' => 'Disconnect from the PEPPOL network',
'peppol_disconnect_short' => 'Disconnect from PEPPOL.',
'peppol_disconnect_long' => 'Your VAT number will be withdrawn from the PEPPOL network after disconnecting. You will be unable to send or receive edocuments.',
'log_duration_words' => 'مدة تسجيل الوقت بالكلمات',
'log_duration' => 'مدة سجل الوقت',
'merged_vendors' => 'تم دمج البائعين بنجاح',
'hidden_taxes_warning' => 'بعض الضرائب مخفية بسبب إعدادات الضرائب الحالية. :link',
'tax3' => 'الضريبة الثالثة',
'negative_payment_warning' => 'هل أنت متأكد من أنك تريد إنشاء دفعة سلبية؟ لا يمكن استخدام هذه الدفعة كرصيد أو دفعة.',
'currency_Bermudian_Dollar' => 'الدولار البرمودي',
'currency_Central_African_CFA_Franc' => 'الفرنك الوسط أفريقي',
'currency_Congolese_Franc' => 'الفرنك الكونغولي',
'currency_Djiboutian_Franc' => 'فرنك جيبوتي',
'currency_Eritrean_Nakfa' => 'الناكفا الإريترية',
'currency_Falkland_Islands_Pound' => 'Falklan Islands Pound',
'currency_Guinean_Franc' => 'فرنك غيني',
'currency_Iraqi_Dinar' => 'الدينار العراقي',
'currency_Lesotho_Loti' => 'ليسوتو لوتي',
'currency_Mongolian_Tugrik' => 'التوغريك المنغولي',
'currency_Seychellois_Rupee' => 'الروبية السيشيلية',
'currency_Solomon_Islands_Dollar' => 'دولار جزر سليمان',
'currency_Somali_Shilling' => 'شلن صومالي',
'currency_South_Sudanese_Pound' => 'الجنيه الجنوب سوداني',
'currency_Sudanese_Pound' => 'الجنيه السوداني',
'currency_Tajikistani_Somoni' => 'السوموني الطاجيكستاني',
'currency_Turkmenistani_Manat' => 'المانات التركمانستانية',
'currency_Uzbekistani_Som' => 'السوم الأوزباكستاني',
'payment_status_changed' => 'يرجى ملاحظة أن حالة الدفع الخاصة بك قد تم تحديثها. نوصي بتحديث الصفحة لعرض الإصدار الأحدث.',
'credit_status_changed' => 'يرجى ملاحظة أن حالة الائتمان الخاصة بك قد تم تحديثها. نوصي بتحديث الصفحة لعرض الإصدار الأحدث.',
'credit_updated' => 'تم تحديث الائتمان',
'payment_updated' => 'تم تحديث الدفع',
'search_placeholder' => 'ابحث عن الفواتير والعملاء والمزيد',
'invalid_vat_number' => "رقم ضريبة القيمة المضافة غير صالح للبلد المحدد. يجب أن يكون التنسيق عبارة عن رمز البلد متبوعًا برقم فقط، على سبيل المثال، DE123456789",
'acts_as_sender' => 'Acts as Sender',
'acts_as_receiver' => 'Acts as Receiver',
);
return $lang;

View File

@ -5384,7 +5384,7 @@ $lang = array(
'currency_Congolese_Franc' => 'Congolese Franc',
'currency_Djiboutian_Franc' => 'Djiboutian Franc',
'currency_Eritrean_Nakfa' => 'Eritrean Nakfa',
'currency_Falkland_Islands_Pound' => 'Falklan Islands Pound',
'currency_Falkland_Islands_Pound' => 'Falkland Islands Pound',
'currency_Guinean_Franc' => 'Guinean Franc',
'currency_Iraqi_Dinar' => 'Iraqi Dinar',
'currency_Lesotho_Loti' => 'Lesotho Loti',

View File

@ -1167,7 +1167,7 @@ $lang = array(
'page_size' => 'Taille de page',
'live_preview_disabled' => 'La prévisualisation en direct a été désactivée pour cette police',
'invoice_number_padding' => 'Remplissage (padding)',
'preview' => 'Prévisualitsation',
'preview' => 'Prévisualisation',
'list_vendors' => 'Liste des fournisseurs',
'add_users_not_supported' => 'Mettre à niveau vers le plan Enterprise plan pour ajouter des utilisateurs à votre compte.',
'enterprise_plan_features' => 'Le Plan entreprise offre le support pour de multiple utilisateurs ainsi que l\'ajout de pièces jointes, :link pour voir la liste complète des fonctionnalités.',
@ -5357,8 +5357,52 @@ Développe automatiquement la section des notes dans le tableau de produits pour
'updated_records' => 'Enregistrements mis à jour',
'vat_not_registered' => 'Vendeur non enregistré aux taxes',
'small_company_info' => 'Aucune déclaration de taxe de vente conformément à l\'article 19 UStG',
'peppol_onboarding' => 'Il semble que ce soit votre première avec PEPPOL.',
'get_started' => 'Commencer',
'configure_peppol' => 'Configurer PEPPOL',
'step' => 'Étape',
'peppol_whitelabel_warning' => 'Une licence de marque blanche est nécessaire pour utiliser la facturation électronique sur le réseau PEPPOL.',
'peppol_plan_warning' => 'Un plan Entreprise est requis pour utiliser la facturation électronique sur le réseau PEPPOL.',
'peppol_credits_info' => 'Des crédits électroniques (Ecredits) sont nécessaires pour envoyer et recevoir des factures électroniques. Ils sont facturés par document.',
'buy_credits' => 'Acheter des Ecredits',
'peppol_successfully_configured' => 'PEPPOL a été configuré correctement',
'peppol_not_paid_message' => 'Un plan Entreprise est requis pour PEPPOL. Veuillez mettre à niveau votre plan.',
'peppol_country_not_supported' => 'Le réseau PEPPOL n\'est pas encore disponible pour ce pays.',
'peppol_disconnect' => 'Se déconnecter du réseau PEPPOL',
'peppol_disconnect_short' => 'Déconnexion de PEPPOL',
'peppol_disconnect_long' => 'Votre numéro de TVA sera retiré du réseau PEPPOL après la déconnexion. Vous ne pourrez plus envoyer ni recevoir de documents électroniques.',
'log_duration_words' => 'Durée du journal de temps exprimée en mots',
'log_duration' => 'Durée du journal de temps'
'log_duration' => 'Durée du journal de temps',
'merged_vendors' => 'Les fournisseurs ont été fusionnés',
'hidden_taxes_warning' => 'Certaines taxes sont masquées en raison des paramètres de taxes actuels.',
'tax3' => 'Troisième taxe',
'negative_payment_warning' => 'Êtes-vous sûr de vouloir créer un paiement négatif? Cela ne peut pas être utilisé comme crédit ou paiement.',
'currency_Bermudian_Dollar' => 'Dollar bermudien',
'currency_Central_African_CFA_Franc' => 'Franc CFA de l\'Afrique centrale',
'currency_Congolese_Franc' => 'Franc congolais',
'currency_Djiboutian_Franc' => 'Franc Djiboutien',
'currency_Eritrean_Nakfa' => 'Nakfa érythréen',
'currency_Falkland_Islands_Pound' => 'Livre des Îles Malouines',
'currency_Guinean_Franc' => 'Franc guinéen',
'currency_Iraqi_Dinar' => 'Dinar irakien',
'currency_Lesotho_Loti' => 'Loti lésothien',
'currency_Mongolian_Tugrik' => 'Tugrik mongolien',
'currency_Seychellois_Rupee' => 'Roupie seychelloise',
'currency_Solomon_Islands_Dollar' => 'Dollar des Salomon',
'currency_Somali_Shilling' => 'Shilling somalien',
'currency_South_Sudanese_Pound' => 'Livre sud-soudanaise',
'currency_Sudanese_Pound' => 'Livre soudanaise',
'currency_Tajikistani_Somoni' => 'Somoni Tadjik',
'currency_Turkmenistani_Manat' => 'Manat turkmène',
'currency_Uzbekistani_Som' => 'Sum Ouzbek',
'payment_status_changed' => 'Veuillez noter que le statut de votre paiement a été mis à jour. Nous vous recommandons de rafraîchir la page pour voir la version la plus récente.',
'credit_status_changed' => 'Veuillez noter que le statut de votre crédit a été mis à jour. Nous vous recommandons de rafraîchir la page pour voir la version la plus récente.',
'credit_updated' => 'Crédit mis à jour',
'payment_updated' => 'Paiement mis à jour',
'search_placeholder' => 'Recherchez des factures, des clients et plus',
'invalid_vat_number' => "Le numéro de TVA n'est pas valide pour le pays sélectionné. Le format doit être le code du pays suivi uniquement du numéro, par exemple DE123456789.",
'acts_as_sender' => 'Agit en tant qu\'expéditeur',
'acts_as_receiver' => 'Agit en tant que destinataire',
);
return $lang;

View File

@ -5359,8 +5359,52 @@ E-mail: :email<b><br><b>',
'updated_records' => 'Items bijgewerkt',
'vat_not_registered' => 'Verkoper is niet btw-plichtig',
'small_company_info' => 'Geen openbaarmaking van omzetbelasting in overeenstemming met § 19 UStG',
'peppol_onboarding' => 'Het lijkt erop dat dit de eerste keer is dat u PEPPOL gebruikt.',
'get_started' => 'Aan de slag',
'configure_peppol' => 'PEPPOL configureren',
'step' => 'Stap',
'peppol_whitelabel_warning' => 'White-label license required in order to use einvoicing over the PEPPOL network.',
'peppol_plan_warning' => 'Enterprise plan required in order to use einvoicing over the PEPPOL network.',
'peppol_credits_info' => 'Ecredits are required to send and receive einvoices. These are charged on a per document basis.',
'buy_credits' => 'Buy E Credits',
'peppol_successfully_configured' => 'PEPPOL successsfully configured.',
'peppol_not_paid_message' => 'Enterprise plan required for PEPPOL. Please upgrade your plan.',
'peppol_country_not_supported' => 'PEPPOL network not yet available for this country.',
'peppol_disconnect' => 'Disconnect from the PEPPOL network',
'peppol_disconnect_short' => 'Disconnect from PEPPOL.',
'peppol_disconnect_long' => 'Your VAT number will be withdrawn from the PEPPOL network after disconnecting. You will be unable to send or receive edocuments.',
'log_duration_words' => 'Maximale lengte logboek in woorden',
'log_duration' => 'Maximale lengte logboek'
'log_duration' => 'Maximale lengte logboek',
'merged_vendors' => 'Succesvol samengevoegde leveranciers',
'hidden_taxes_warning' => 'Sommige belastingen zijn verborgen vanwege de huidige belastinginstellingen. :link',
'tax3' => 'Derde belasting',
'negative_payment_warning' => 'Weet u zeker dat u een negatieve betaling wilt maken? Dit kan niet worden gebruikt als een tegoed of betaling.',
'currency_Bermudian_Dollar' => 'Bermudaanse dollar',
'currency_Central_African_CFA_Franc' => 'Centraal-Afrikaanse CFA-frank',
'currency_Congolese_Franc' => 'Congolese Frank',
'currency_Djiboutian_Franc' => 'Djiboutiaanse Frank',
'currency_Eritrean_Nakfa' => 'Eritrese Nakfa',
'currency_Falkland_Islands_Pound' => 'Falklan Islands Pound',
'currency_Guinean_Franc' => 'Guinean Franc',
'currency_Iraqi_Dinar' => 'Iraqi Dinar',
'currency_Lesotho_Loti' => 'Lesotho Loti',
'currency_Mongolian_Tugrik' => 'Mongolian Tugrik',
'currency_Seychellois_Rupee' => 'Seychellois Rupee',
'currency_Solomon_Islands_Dollar' => 'Solomon Islands Dollar',
'currency_Somali_Shilling' => 'Somali Shilling',
'currency_South_Sudanese_Pound' => 'South Sudanese Pound',
'currency_Sudanese_Pound' => 'Sudanese Pound',
'currency_Tajikistani_Somoni' => 'Tajikistani Somoni',
'currency_Turkmenistani_Manat' => 'Turkmenistani Manat',
'currency_Uzbekistani_Som' => 'Uzbekistani Som',
'payment_status_changed' => 'Please note that the status of your payment has been updated. We recommend refreshing the page to view the most current version.',
'credit_status_changed' => 'Please note that the status of your credit has been updated. We recommend refreshing the page to view the most current version.',
'credit_updated' => 'Credit Updated',
'payment_updated' => 'Payment Updated',
'search_placeholder' => 'Find invoices, clients, and more',
'invalid_vat_number' => "The VAT number is not valid for the selected country. Format should be Country Code followed by number only ie, DE123456789",
'acts_as_sender' => 'Acts as Sender',
'acts_as_receiver' => 'Acts as Receiver',
);
return $lang;

View File

@ -5359,8 +5359,52 @@ $lang = array(
'updated_records' => 'Hồ sơ đã cập nhật',
'vat_not_registered' => 'Người bán không đăng ký VAT',
'small_company_info' => 'Không tiết lộ thuế bán hàng theo § 19 UStG',
'peppol_onboarding' => 'Có vẻ như đây là lần đầu tiên bạn sử dụng PEPPOL.',
'get_started' => 'Bắt đầu',
'configure_peppol' => 'Cấu hình PEPPOL',
'step' => 'Bước chân',
'peppol_whitelabel_warning' => 'Cần có giấy phép nhãn trắng đến sử dụng hóa đơn điện tử trên mạng PEPPOL.',
'peppol_plan_warning' => 'Cần có gói doanh nghiệp đến sử dụng hóa đơn điện tử qua mạng PEPPOL.',
'peppol_credits_info' => 'Cần có Ecredit đến gửi và nhận hóa đơn điện tử. Chúng được tính phí theo từng chứng từ.',
'buy_credits' => 'Mua tín dụng E',
'peppol_successfully_configured' => 'PEPPOL đã được cấu hình thành công.',
'peppol_not_paid_message' => 'Cần có gói Enterprise cho PEPPOL. Vui lòng nâng cấp gói của bạn.',
'peppol_country_not_supported' => 'Mạng PEPPOL hiện chưa khả dụng ở quốc gia này.',
'peppol_disconnect' => 'Ngắt kết nối khỏi mạng PEPPOL',
'peppol_disconnect_short' => 'Ngắt kết nối khỏi PEPPOL.',
'peppol_disconnect_long' => 'Mã số VAT của bạn sẽ bị xóa khỏi mạng PEPPOL sau khi ngắt kết nối. Bạn sẽ không thể đến hoặc nhận tài liệu điện tử.',
'log_duration_words' => 'Thời gian ghi nhật ký bằng từ',
'log_duration' => 'Thời gian ghi nhật ký'
'log_duration' => 'Thời gian ghi nhật ký',
'merged_vendors' => 'Thành công sáp nhập nhà cung cấp',
'hidden_taxes_warning' => 'Một số loại thuế bị ẩn Quá hạn đến Cài đặt thuế hiện hành . :link',
'tax3' => 'Thuế thứ ba',
'negative_payment_warning' => 'Bạn có chắc chắn đến Tạo một Sự chi trả giá âm ? Điều này không thể được sử dụng như một khoản tín dụng hoặc Sự chi trả .',
'currency_Bermudian_Dollar' => 'Đô la Bermuda',
'currency_Central_African_CFA_Franc' => 'Franc CFA Trung Phi',
'currency_Congolese_Franc' => 'Franc Congo',
'currency_Djiboutian_Franc' => 'Franc Djibouti',
'currency_Eritrean_Nakfa' => 'Nakfa Eritrea',
'currency_Falkland_Islands_Pound' => 'Bảng Anh Quần đảo Falklan',
'currency_Guinean_Franc' => 'Franc Guinea',
'currency_Iraqi_Dinar' => 'Dinar Iraq',
'currency_Lesotho_Loti' => 'Loti Lesotho',
'currency_Mongolian_Tugrik' => 'Tugrik Mông Cổ',
'currency_Seychellois_Rupee' => 'Rupee Seychelles',
'currency_Solomon_Islands_Dollar' => 'Đô la Quần đảo Solomon',
'currency_Somali_Shilling' => 'Shilling Somali',
'currency_South_Sudanese_Pound' => 'Bảng Nam Sudan',
'currency_Sudanese_Pound' => 'Bảng Sudan',
'currency_Tajikistani_Somoni' => 'Somoni Tajikistan',
'currency_Turkmenistani_Manat' => 'Đồng Manat Turkmenistan',
'currency_Uzbekistani_Som' => 'Som Uzbekistan',
'payment_status_changed' => 'Xin Ghi chú rằng trạng thái Sự chi trả của bạn đã được đã cập nhật . Chúng tôi khuyên bạn nên làm mới trang đến Xem phiên bản mới nhất.',
'credit_status_changed' => 'Vui lòng Ghi chú rằng trạng thái tín dụng của bạn đã được đã cập nhật . Chúng tôi khuyên bạn nên làm mới trang đến Xem phiên bản mới nhất.',
'credit_updated' => 'đã cập nhật tín dụng',
'payment_updated' => 'đã cập nhật Sự chi trả',
'search_placeholder' => 'Tìm Hóa đơn , Khách hàng , v.v.',
'invalid_vat_number' => "Mã số VAT không hợp lệ đối với quốc gia đã chọn. Định dạng phải là Mã quốc gia theo sau là số, ví dụ: DE123456789",
'acts_as_sender' => 'Hoạt động như Người gửi',
'acts_as_receiver' => 'Hoạt động như Người nhận',
);
return $lang;

109
public/build/assets/app-2353b88b.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -172,7 +172,6 @@ class PeppolTest extends TestCase
$this->assertCount(0, $errors);
}

View File

@ -22,8 +22,20 @@ use App\DataMapper\Tax\TaxModel;
use App\DataMapper\ClientSettings;
use App\DataMapper\CompanySettings;
use App\Services\EDocument\Standards\Peppol;
use Symfony\Component\Serializer\Serializer;
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
use InvoiceNinja\EInvoice\Models\Peppol\Invoice as PeppolInvoice;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use App\Services\EDocument\Gateway\Storecove\PeppolToStorecoveNormalizer;
use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter;
use App\Services\EDocument\Gateway\Storecove\Models\Invoice as StorecoveInvoice;
class StorecoveTest extends TestCase
{
@ -1320,6 +1332,81 @@ class StorecoveTest extends TestCase
}
public function testNormalizingToStorecove()
{
$e_invoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
$invoice = $this->createATData();
$stub = json_decode('{"Invoice":{"Note":"Nooo","PaymentMeans":[{"ID":{"value":"afdasfasdfasdfas"},"PayeeFinancialAccount":{"Name":"PFA-NAME","ID":{"value":"DE89370400440532013000"},"AliasName":"PFA-Alias","AccountTypeCode":{"value":"CHECKING"},"AccountFormatCode":{"value":"IBAN"},"CurrencyCode":{"value":"EUR"},"FinancialInstitutionBranch":{"ID":{"value":"DEUTDEMMXXX"},"Name":"Deutsche Bank"}}}]}}');
foreach ($stub as $key => $value) {
$e_invoice->{$key} = $value;
}
$invoice->e_invoice = $e_invoice;
try {
// Assuming $invoice is already defined or created earlier in your test
$p = new Peppol($invoice);
$p->run();
$peppolInvoice = $p->getInvoice();
nlog("Peppol Invoice: " . json_encode($peppolInvoice, JSON_PRETTY_PRINT));
// Create the serializer with all necessary normalizers
$classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());
$metadataAwareNameConverter = new MetadataAwareNameConverter($classMetadataFactory);
$objectNormalizer = new ObjectNormalizer($classMetadataFactory, $metadataAwareNameConverter);
$encoders = [new JsonEncoder()];
$normalizers = [
new ArrayDenormalizer(),
$objectNormalizer,
new ObjectNormalizer(), // This is a fallback normalizer
];
$serializer = new Serializer($normalizers, $encoders);
// Create the PeppolToStorecoveNormalizer with the serializer
$peppolToStorecoveNormalizer = new PeppolToStorecoveNormalizer($serializer);
// Denormalize the Peppol invoice to a Storecove invoice
$storecoveInvoice = $peppolToStorecoveNormalizer->denormalize($peppolInvoice, StorecoveInvoice::class);
nlog("Storecove Invoice after denormalization: " . json_encode($storecoveInvoice, JSON_PRETTY_PRINT));
// Serialize the Storecove invoice to JSON
$jsonOutput = $serializer->serialize($storecoveInvoice, 'json', [
'json_encode_options' => JSON_PRETTY_PRINT
]);
nlog("Final JSON output: " . $jsonOutput);
// Add assertions to verify the output
$this->assertInstanceOf(StorecoveInvoice::class, $storecoveInvoice);
$this->assertJson($jsonOutput);
// Add more specific assertions based on your expected output
$decodedOutput = json_decode($jsonOutput, true);
$this->assertArrayHasKey('documentCurrency', $decodedOutput);
$this->assertArrayHasKey('invoiceNumber', $decodedOutput);
$this->assertArrayHasKey('invoiceLines', $decodedOutput);
$this->assertIsArray($decodedOutput['invoiceLines']);
// Add more assertions as needed
} catch (\Exception $e) {
nlog("Error occurred: " . $e->getMessage());
nlog("Stack trace: " . $e->getTraceAsString());
throw $e; // Re-throw the exception to fail the test
}
}
public function PestAtRules()
{
$this->routing_id = 293801;