Skip to content

Commit

Permalink
Shorthand methods for setting several profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Aug 5, 2024
1 parent 75eff2a commit af5a60b
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
72 changes: 72 additions & 0 deletions src/traits/HandlesProfiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,76 @@ public function clearForceDestinationProfile()

return $this;
}

/**
* Force the MINIMUM profile
*
* @return static
*/
public function setForceDestinationProfileMinimum()
{
$this->setForceDestinationProfile('urn:factur-x.eu:1p0:minimum');

return $this;
}

/**
* Force the BASICWL profile
*
* @return static
*/
public function setForceDestinationProfileBasicWL()
{
$this->setForceDestinationProfile('urn:factur-x.eu:1p0:basicwl');

return $this;
}

/**
* Force the BASIC profile
*
* @return static
*/
public function setForceDestinationProfileBasic()
{
$this->setForceDestinationProfile('urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic');

return $this;
}

/**
* Force the COMFORT (EN16931) profile
*
* @return static
*/
public function setForceDestinationProfileEn16931()
{
$this->setForceDestinationProfile('urn:cen.eu:en16931:2017');

return $this;
}

/**
* Force the EXTENDED profile
*
* @return static
*/
public function setForceDestinationProfileExtended()
{
$this->setForceDestinationProfile('urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended');

return $this;
}

/**
* Force the XRECHNUNG 3.0 profile
*
* @return static
*/
public function setForceDestinationProfileXRechnung30()
{
$this->setForceDestinationProfile('urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0');

return $this;
}
}
2 changes: 1 addition & 1 deletion tests/testcases/CiiToUblExtendedFwTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CiiToUblExtendedFwTest extends TestCase

public function testLoadAndConvert(): void
{
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/2_cii_extended_fw.xml")->enableAutomaticMode()->setForceDestinationProfile('urn:cen.eu:en16931:2017')->convert();
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/2_cii_extended_fw.xml")->enableAutomaticMode()->setForceDestinationProfileEn16931()->convert();
$this->assertNotNull(self::$document);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testcases/CiiToUblExtendedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CiiToUblExtendedTest extends TestCase

public function testLoadAndConvert(): void
{
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/2_cii_extended.xml")->enableAutomaticMode()->setForceDestinationProfile('urn:cen.eu:en16931:2017')->convert();
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/2_cii_extended.xml")->enableAutomaticMode()->setForceDestinationProfileEn16931()->convert();
$this->assertNotNull(self::$document);
}

Expand Down

0 comments on commit af5a60b

Please sign in to comment.