Skip to content

Commit

Permalink
Add missing ProductCharacteristic, ProductClassification and TradeCur…
Browse files Browse the repository at this point in the history
…rencyExchange
  • Loading branch information
BolZer committed Sep 24, 2024
1 parent 2e24ede commit c22ddf4
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 3 deletions.
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;
}
}
11 changes: 8 additions & 3 deletions src/zugferd2/Model/HeaderTradeSettlement.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class HeaderTradeSettlement
#[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 @@ -86,9 +93,7 @@ class HeaderTradeSettlement
#[SerializedName('InvoiceReferencedDocument')]
public ?ReferencedDocument $invoiceReferencedDocument = null;

/**
* @var TradeAccountingAccount[]
*/
/** @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 = [];
Expand Down
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/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;
}
11 changes: 11 additions & 0 deletions src/zugferd2/Model/TradeProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlElement;
use JMS\Serializer\Annotation\XmlList;

#[AccessorOrder(order: 'custom', custom: ['globalID', 'sellerAssignedID', 'buyerAssignedID', 'name', 'description', 'tradeCountry'])]
class TradeProduct
Expand Down Expand Up @@ -41,4 +42,14 @@ class TradeProduct
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
#[SerializedName('OriginTradeCountry')]
public ?TradeCountry $tradeCountry = null;

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

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

0 comments on commit c22ddf4

Please sign in to comment.