Skip to content

Commit

Permalink
Update for Factur-X 1.0.07 - ZUGFeRD 2.3 (#62)
Browse files Browse the repository at this point in the history
* Add new XSD files for factur-x 1.0.07
* Add new testcase for Reader
* Move position of description of TradeParty up

* Add missing property SellerOrderReferencedDocument to HeaderTradeAgreement
* Add missing ReceivableSpecifiedTradeAccountingAccount to HeaderTradeSettlement
* Add missing DespatchAdviceReferencedDocument to HeaderTradeDelivery
* Add missing reason code for TradeAllowanceCharge
* Add missing TaxCurrencyCode to HeaderTradeSettlement
* Add missing ProductCharacteristic, ProductClassification and TradeCurrencyExchange
* Add missing TestIndicator in ExchangedDocumentContext
* Add missing TradePaymentDiscountTerms to TradePaymentTerms
* Add missing IncludedReferencedProduct to ProductType

* Fix TradePrice AppliedTradeAllowanceCharge cardinality
  • Loading branch information
BolZer authored Sep 25, 2024
1 parent c18c19b commit 8a91257
Show file tree
Hide file tree
Showing 97 changed files with 128,401 additions and 81,993 deletions.
11 changes: 7 additions & 4 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = (new PhpCsFixer\Finder())
->in([__DIR__ . '/src', __DIR__ . '/tests']);
$finder = (new Finder())
->in([__DIR__ . '/src', __DIR__ . '/tests'])
;

return (new PhpCsFixer\Config())
return (new Config())
->setRiskyAllowed(false)
->setRules([
'@PSR2' => true,
Expand Down Expand Up @@ -32,4 +35,4 @@
'php_unit_test_class_requires_covers' => false,
'php_unit_internal_class' => false,
])
->setFinder($finder);
->setFinder($finder);
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"ext-libxml": "*",
"friendsofphp/php-cs-fixer": "^3.16",
"phpstan/phpstan": "^1.10",
"rector/rector": "^1.0"
"rector/rector": "^1.0",
"symfony/finder": "^5.4"
},
"autoload": {
"psr-4": {
Expand Down
23 changes: 11 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions src/zugferd2/Model/ClassCode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace Easybill\ZUGFeRD2\Model;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlAttribute;
use JMS\Serializer\Annotation\XmlValue;

class ClassCode
{
#[Type('string')]
#[XmlAttribute]
#[SerializedName('listID')]
public ?string $listID = null;

#[Type('string')]
#[XmlValue(cdata: false)]
public string $value;

public static function create(string $id, ?string $listID = null): self
{
$self = new self();
$self->value = $id;
$self->listID = $listID;
return $self;
}
}
5 changes: 5 additions & 0 deletions src/zugferd2/Model/ExchangedDocumentContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

class ExchangedDocumentContext
{
#[Type(Indicator::class)]
#[XmlElement(namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('TestIndicator')]
public ?Indicator $testIndicator = null;

#[Type(DocumentContextParameter::class)]
#[XmlElement(namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('BusinessProcessSpecifiedDocumentContextParameter')]
Expand Down
6 changes: 6 additions & 0 deletions src/zugferd2/Model/HeaderTradeAgreement.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'buyerTaxRepresentativeTradeParty',
'buyerOrderReferencedDocument',
'contractReferencedDocument',
'sellerOrderReferencedDocument',
'additionalReferencedDocuments',
'specifiedProcuringProject',
])]
Expand Down Expand Up @@ -63,6 +64,11 @@ class HeaderTradeAgreement
#[XmlList(entry: 'AdditionalReferencedDocument', inline: true, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
public array $additionalReferencedDocuments = [];

#[Type(ReferencedDocument::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('SellerOrderReferencedDocument')]
public ?ReferencedDocument $sellerOrderReferencedDocument;

#[Type(ProcuringProject::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('SpecifiedProcuringProject')]
Expand Down
5 changes: 5 additions & 0 deletions src/zugferd2/Model/HeaderTradeDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ class HeaderTradeDelivery
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('DeliveryNoteReferencedDocument')]
public ?ReferencedDocument $deliveryNoteReferencedDocument = null;

#[Type(ReferencedDocument::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('DespatchAdviceReferencedDocument')]
public ?ReferencedDocument $despatchAdviceReferencedDocument = null;
}
22 changes: 22 additions & 0 deletions src/zugferd2/Model/HeaderTradeSettlement.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,33 @@ class HeaderTradeSettlement
#[SerializedName('PaymentReference')]
public ?string $paymentReference = null;

#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('TaxCurrencyCode')]
public string $taxCurrencyCode;

#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('InvoiceCurrencyCode')]
public string $currency;

#[Type(TradeParty::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('InvoiceeTradeParty')]
public ?TradeParty $invoiceeTradeParty = null;

#[Type(TradeParty::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('PayeeTradeParty')]
public ?TradeParty $payeeTradeParty = null;

/**
* @var TradeCurrencyExchange[]
*/
#[Type('array<Easybill\ZUGFeRD2\Model\TradeCurrencyExchange>')]
#[XmlList(entry: 'TaxApplicableTradeCurrencyExchange', inline: true, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
public array $taxApplicableTradeCurrencyExchange = [];

/**
* @var TradeSettlementPaymentMeans[]
*/
Expand Down Expand Up @@ -80,4 +97,9 @@ class HeaderTradeSettlement
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('InvoiceReferencedDocument')]
public ?ReferencedDocument $invoiceReferencedDocument = null;

/** @var TradeAccountingAccount[] */
#[Type('array<Easybill\ZUGFeRD2\Model\TradeAccountingAccount>')]
#[XmlList(entry: 'ReceivableSpecifiedTradeAccountingAccount', inline: true, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
public array $receivableSpecifiedTradeAccountingAccount = [];
}
5 changes: 5 additions & 0 deletions src/zugferd2/Model/LineTradeDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class LineTradeDelivery
#[SerializedName('BilledQuantity')]
public Quantity $billedQuantity;

#[Type(Quantity::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('PackageQuantity')]
public ?Quantity $packageQuantity;

#[Type(SupplyChainEvent::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('ActualDeliverySupplyChainEvent')]
Expand Down
22 changes: 22 additions & 0 deletions src/zugferd2/Model/ProductCharacteristic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Easybill\ZUGFeRD2\Model;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlElement;

class ProductCharacteristic
{
#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('Description')]
public string $description;

#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('Value')]
public string $value;
}
17 changes: 17 additions & 0 deletions src/zugferd2/Model/ProductClassification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Easybill\ZUGFeRD2\Model;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlElement;

class ProductClassification
{
#[Type(ClassCode::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('ClassCode')]
public ?ClassCode $classCode = null;
}
32 changes: 32 additions & 0 deletions src/zugferd2/Model/ProductType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Easybill\ZUGFeRD2\Model;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlElement;

class ProductType
{
#[Type(Id::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('GlobalID')]
public ?Id $id;

#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('SellerAssignedID')]
public ?string $sellerAssignedID = null;

#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('Name')]
public ?string $name = null;

#[Type(Quantity::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('UnitQuantity')]
public ?Quantity $unitQuantity = null;
}
5 changes: 5 additions & 0 deletions src/zugferd2/Model/TradeAllowanceCharge.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ class TradeAllowanceCharge
#[JMS\SerializedName('ActualAmount')]
public Amount $actualAmount;

#[JMS\Type('string')]
#[JMS\XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[JMS\SerializedName('ReasonCode')]
public ?string $reasonCode = null;

#[JMS\Type('string')]
#[JMS\XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[JMS\SerializedName('Reason')]
Expand Down
32 changes: 32 additions & 0 deletions src/zugferd2/Model/TradeCurrencyExchange.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Easybill\ZUGFeRD2\Model;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlElement;

class TradeCurrencyExchange
{
#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('SourceCurrencyCode')]
public string $sourceCurrencyCode;

#[Type('string')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('TargetCurrencyCode')]
public string $targetCurrencyCode;

#[Type('float')]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('ConversionRate')]
public float $conversionRate;

#[Type(DateTime::class)]
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('ConversionRateDateTime')]
public ?DateTime $conversionRateDateTime = null;
}
2 changes: 1 addition & 1 deletion src/zugferd2/Model/TradeParty.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use JMS\Serializer\Annotation\XmlElement;
use JMS\Serializer\Annotation\XmlList;

#[AccessorOrder(order: 'custom', custom: ['id', 'globalID', 'name', 'definedTradeContact', 'postalTradeAddress', 'uriUniversalCommunication', 'taxRegistrations'])]
#[AccessorOrder(order: 'custom', custom: ['id', 'globalID', 'name', 'description', 'definedTradeContact', 'postalTradeAddress', 'uriUniversalCommunication', 'taxRegistrations'])]
class TradeParty
{
#[Type(Id::class)]
Expand Down
20 changes: 20 additions & 0 deletions src/zugferd2/Model/TradePaymentDiscountTerms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Easybill\ZUGFeRD2\Model;

use JMS\Serializer\Annotation as JMS;

class TradePaymentDiscountTerms
{
#[JMS\Type(Quantity::class)]
#[JMS\XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[JMS\SerializedName('BasisPeriodMeasure')]
public ?Quantity $basisPeriodMeasure = null;

#[JMS\Type('string')]
#[JMS\XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[JMS\SerializedName('CalculationPercent')]
public ?string $calculationPercent = null;
}
5 changes: 5 additions & 0 deletions src/zugferd2/Model/TradePaymentTerms.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class TradePaymentTerms
#[JMS\SerializedName('Description')]
public ?string $description = null;

#[JMS\Type(TradePaymentDiscountTerms::class)]
#[JMS\XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[JMS\SerializedName('ApplicableTradePaymentDiscountTerms')]
public ?TradePaymentDiscountTerms $applicableTradePaymentDiscountTerms = null;

#[JMS\Type(DateTime::class)]
#[JMS\XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[JMS\SerializedName('DueDateDateTime')]
Expand Down
Loading

0 comments on commit 8a91257

Please sign in to comment.