Skip to content

Commit

Permalink
Merge pull request #137 from horstoeko/Issue_136
Browse files Browse the repository at this point in the history
#136 Added "getDocumentSellerCommunication" and "getDocumentBuyerCommunication" to ZugferdDocumentReader
  • Loading branch information
horstoeko authored Oct 11, 2024
2 parents 034ef3a + 765fb73 commit 2a009cd
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/ZugferdDocumentReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,21 @@ public function getDocumentSellerContact(?string &$contactpersonname, ?string &$
return $this;
}

/**
* Get detailed information on the seller's electronic communication information
*
* @param string|null $uriScheme __BT-34-1, From BASIC WL__
* @param string|null $uri __BT-34, From BASIC WL__
* @return ZugferdDocumentReader
*/
public function getDocumentSellerCommunication(?string &$uriScheme, ?string &$uri): ZugferdDocumentReader
{
$uri = $this->getInvoiceValueByPath("getSupplyChainTradeTransaction.getApplicableHeaderTradeAgreement.getSellerTradeParty.getURIUniversalCommunication.getURIID.value", "");
$uriScheme = $this->getInvoiceValueByPath("getSupplyChainTradeTransaction.getApplicableHeaderTradeAgreement.getSellerTradeParty.getURIUniversalCommunication.getURIID.getSchemeID", "");

return $this;
}

/**
* Get detailed information about the buyer (service recipient)
*
Expand Down Expand Up @@ -831,6 +846,21 @@ public function getDocumentBuyerContact(?string &$contactpersonname, ?string &$c
return $this;
}

/**
* Get detailed information on the seller's electronic communication information
*
* @param string|null $uriScheme __BT-49-1, From BASIC WL__
* @param string|null $uri __BT-49, From BASIC WL__
* @return ZugferdDocumentReader
*/
public function getDocumentBuyerCommunication(?string &$uriScheme, ?string &$uri): ZugferdDocumentReader
{
$uri = $this->getInvoiceValueByPath("getSupplyChainTradeTransaction.getApplicableHeaderTradeAgreement.getBuyerTradeParty.getURIUniversalCommunication.getURIID.value", "");
$uriScheme = $this->getInvoiceValueByPath("getSupplyChainTradeTransaction.getApplicableHeaderTradeAgreement.getBuyerTradeParty.getURIUniversalCommunication.getURIID.getSchemeID", "");

return $this;
}

/**
* Get detailed information about the seller's tax agent
*
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/PdfReaderEn16931AllowanceChargeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -244,6 +251,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/PdfReaderEn16931Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -236,6 +243,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/PdfReaderExtended2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("EM", $uriScheme);
$this->assertEquals("moi@seller.com", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -233,6 +240,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("EM", $uriScheme);
$this->assertEquals("me@buyer.com", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/PdfReaderExtendedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ public function testDocumentSellerContact(): void
$this->assertFalse(self::$document->nextDocumentSellerContact());
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -245,6 +252,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/PdfReaderMinimumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -209,6 +216,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/PdfReaderXRechnungTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ public function testDocumentSellerContact(): void
$this->assertFalse(self::$document->nextDocumentSellerContact());
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -236,6 +243,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/ReaderBasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -246,6 +253,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/ReaderEn16931AllowanceChargeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -257,6 +264,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/ReaderEn16931Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -249,6 +256,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/ReaderExtended2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ function () {
);
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("EM", $uriScheme);
$this->assertEquals("moi@seller.com", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -247,6 +254,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("EM", $uriScheme);
$this->assertEquals("me@buyer.com", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/ReaderExtendedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ public function testDocumentSellerContact(): void
$this->assertFalse(self::$document->nextDocumentSellerContact());
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -264,6 +271,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down
14 changes: 14 additions & 0 deletions tests/testcases/ReaderXRechnungTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ public function testDocumentSellerContact(): void
$this->assertFalse(self::$document->nextDocumentSellerContact());
}

public function testGetDocumentSellerCommunication(): void
{
self::$document->getDocumentSellerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentBuyerGeneral(): void
{
self::$document->getDocumentBuyer($buyername, $buyerids, $buyerdescription);
Expand Down Expand Up @@ -250,6 +257,13 @@ function () {
);
}

public function testGetDocumentBuyerCommunication(): void
{
self::$document->getDocumentBuyerCommunication($uriScheme, $uri);
$this->assertEquals("", $uriScheme);
$this->assertEquals("", $uri);
}

public function testDocumentSellerTaxRepresentativeGeneral(): void
{
self::$document->getDocumentSellerTaxRepresentative($sellertaxreprname, $sellertaxreprids, $sellertaxreprdescription);
Expand Down

0 comments on commit 2a009cd

Please sign in to comment.