Skip to content

Commit

Permalink
Merge pull request #7 from MaximilianKresse/feature/buyer-reference
Browse files Browse the repository at this point in the history
Feature - Added Agreement::BuyerReference
  • Loading branch information
PATROMO authored Jan 20, 2020
2 parents a981bac + 0c71804 commit a445e42
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.php text eol=lf
27 changes: 27 additions & 0 deletions src/Easybill/ZUGFeRD/Model/Trade/Agreement.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
class Agreement
{

/**
* @var string
* @Type("string")
* @XmlElement(cdata = false, namespace = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12")
* @SerializedName("BuyerReference")
*/
private $buyerReference;

/**
* @var TradeParty
* @Type("Easybill\ZUGFeRD\Model\Trade\TradeParty")
Expand All @@ -23,6 +31,25 @@ class Agreement
*/
private $buyer;

/**
* @return string
*/
public function getBuyerReference()
{
return $this->name;
}

/**
* @param string $buyerReference
*
* @return self
*/
public function setBuyerReference($buyerReference)
{
$this->buyerReference = $buyerReference;
return $this;
}

/**
* @return \Easybill\ZUGFeRD\Model\Trade\TradeParty
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Easybill/ZUGFeRD/Tests/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function testGetXML()
</rsm:HeaderExchangedDocument>
<rsm:SpecifiedSupplyChainTradeTransaction>
<ram:ApplicableSupplyChainTradeAgreement>
<ram:BuyerReference>AB-312</ram:BuyerReference>
<ram:SellerTradeParty>
<ram:Name>Lieferant GmbH</ram:Name>
<ram:PostalTradeAddress>
Expand Down Expand Up @@ -216,6 +217,7 @@ public function testGetXML()
private function setAgreement(\Easybill\ZUGFeRD\Model\Trade\Trade $trade)
{
$trade->getAgreement()
->setBuyerReference('AB-312')
->setSeller(
new \Easybill\ZUGFeRD\Model\Trade\TradeParty('Lieferant GmbH',
new \Easybill\ZUGFeRD\Model\Address('80333', 'Lieferantenstraße 20', null, 'München', 'DE'),
Expand Down

0 comments on commit a445e42

Please sign in to comment.