Skip to content

Commit

Permalink
AdditionalReferencedDocument (#32)
Browse files Browse the repository at this point in the history
* added AdditionalReferencedDocument
  • Loading branch information
Lorenz Schäfer authored Dec 15, 2020
1 parent 2cd7b1a commit 0491de3
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
28 changes: 28 additions & 0 deletions src/zugferd211/Model/BinaryObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Easybill\ZUGFeRD211\Model;

use JMS\Serializer\Annotation as JMS;

class BinaryObject
{
/**
* @JMS\Type("string")
* @JMS\XmlAttribute
* @JMS\SerializedName("mimeCode")
*/
public string $mimeCode;

/**
* @JMS\Type("string")
* @JMS\XmlAttribute
* @JMS\SerializedName("filename")
*/
public string $filename;

/**
* @JMS\Type("string")
* @JMS\XmlValue(cdata=false)
*/
public string $value;
}
8 changes: 8 additions & 0 deletions src/zugferd211/Model/HeaderTradeAgreement.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlElement;
use JMS\Serializer\Annotation\XmlList;

class HeaderTradeAgreement
{
Expand Down Expand Up @@ -35,4 +36,11 @@ class HeaderTradeAgreement
* @SerializedName("BuyerOrderReferencedDocument")
*/
public ?ReferencedDocument $buyerOrderReferencedDocument = null;

/**
* @var ReferencedDocument[]
* @Type("array<Easybill\ZUGFeRD211\Model\ReferencedDocument>")
* @XmlList(inline = true, entry = "AdditionalReferencedDocument", namespace = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100")
*/
public array $additionalReferencedDocuments = [];
}
32 changes: 30 additions & 2 deletions src/zugferd211/Model/ReferencedDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,38 @@ class ReferencedDocument
*/
public Id $issuerAssignedID;

public static function create(string $orderNumber): self
/**
* @Type("Easybill\ZUGFeRD211\Model\Id")
* @XmlElement(cdata = false, namespace = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100")
* @SerializedName("URIID")
*/
public ?Id $uriid = null;

/**
* @Type("string")
* @XmlElement(cdata = false, namespace = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100")
* @SerializedName("TypeCode")
*/
public ?string $typeCode = null;

/**
* @Type("string")
* @XmlElement(cdata = false, namespace = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100")
* @SerializedName("Name")
*/
public ?string $name = null;

/**
* @Type("Easybill\ZUGFeRD211\Model\BinaryObject")
* @XmlElement(cdata = false, namespace = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100")
* @SerializedName("AttachmentBinaryObject")
*/
public ?BinaryObject $attachmentBinaryObject = null;

public static function create(string $issuerAssignedID): self
{
$self = new self();
$self->issuerAssignedID = Id::create($orderNumber);
$self->issuerAssignedID = Id::create($issuerAssignedID);
return $self;
}
}

0 comments on commit 0491de3

Please sign in to comment.