Skip to content

Commit

Permalink
feat: update xml namespaces for api v5 #32
Browse files Browse the repository at this point in the history
  • Loading branch information
kouinkouin committed Nov 29, 2022
1 parent b48056e commit 8ea7cb7
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getXml()
$document->formatOutput = true;

$batchLabels = $document->createElement('batchLabels');
$batchLabels->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/');
$batchLabels->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v5/');
foreach ($this->references as $reference) {
$batchLabels->appendChild(
$document->createElement('order', $reference)
Expand Down
2 changes: 1 addition & 1 deletion src/Bpost/HttpRequestBuilder/ModifyOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getXml()
$document->formatOutput = true;

$orderUpdate = $document->createElement('orderUpdate');
$orderUpdate->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/');
$orderUpdate->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v5/');
$orderUpdate->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$orderUpdate->appendChild(
$document->createElement('status', $this->status)
Expand Down
10 changes: 5 additions & 5 deletions src/Bpost/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,27 +160,27 @@ public function toXML(DOMDocument $document, $accountId)
);
$order->setAttribute(
'xmlns:common',
'http://schema.post.be/shm/deepintegration/v3/common'
'http://schema.post.be/shm/deepintegration/v5/common'
);
$order->setAttribute(
'xmlns:tns',
'http://schema.post.be/shm/deepintegration/v3/'
'http://schema.post.be/shm/deepintegration/v5/'
);
$order->setAttribute(
'xmlns',
'http://schema.post.be/shm/deepintegration/v3/national'
'http://schema.post.be/shm/deepintegration/v5/national'
);
$order->setAttribute(
'xmlns:international',
'http://schema.post.be/shm/deepintegration/v3/international'
'http://schema.post.be/shm/deepintegration/v5/international'
);
$order->setAttribute(
'xmlns:xsi',
'http://www.w3.org/2001/XMLSchema-instance'
);
$order->setAttribute(
'xsi:schemaLocation',
'http://schema.post.be/shm/deepintegration/v3/'
'http://schema.post.be/shm/deepintegration/v5/'
);

$document->appendChild($order);
Expand Down
6 changes: 3 additions & 3 deletions src/Bpost/Order/Box.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ public static function createFromXML(SimpleXMLElement $xml)
$box->setSender(
Sender::createFromXML(
$xml->sender->children(
'http://schema.post.be/shm/deepintegration/v3/common'
'http://schema.post.be/shm/deepintegration/v5/common'
)
)
);
}
if (isset($xml->nationalBox)) {
/** @var SimpleXMLElement $nationalBoxData */
$nationalBoxData = $xml->nationalBox->children('http://schema.post.be/shm/deepintegration/v3/national');
$nationalBoxData = $xml->nationalBox->children('http://schema.post.be/shm/deepintegration/v5/national');

// build classname based on the tag name
$className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($nationalBoxData->getName());
Expand All @@ -264,7 +264,7 @@ public static function createFromXML(SimpleXMLElement $xml)
}
if (isset($xml->internationalBox)) {
/** @var SimpleXMLElement $internationalBoxData */
$internationalBoxData = $xml->internationalBox->children('http://schema.post.be/shm/deepintegration/v3/international');
$internationalBoxData = $xml->internationalBox->children('http://schema.post.be/shm/deepintegration/v5/international');

// build classname based on the tag name
$className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($internationalBoxData->getName());
Expand Down
4 changes: 2 additions & 2 deletions src/Bpost/Order/Box/At247.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul
if (isset($xml->{'at24-7'}->options)) {
/** @var SimpleXMLElement $optionData */
foreach ($xml->{'at24-7'}->options as $optionData) {
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v5/common');

if (in_array($optionData->getName(), array(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED))) {
$option = Messaging::createFromXML($optionData);
Expand Down Expand Up @@ -369,7 +369,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul
if (isset($xml->{'at24-7'}->parcelsDepotAddress)) {
/** @var SimpleXMLElement $parcelsDepotAddressData */
$parcelsDepotAddressData = $xml->{'at24-7'}->parcelsDepotAddress->children(
'http://schema.post.be/shm/deepintegration/v3/common'
'http://schema.post.be/shm/deepintegration/v5/common'
);
$at247->setParcelsDepotAddress(
ParcelsDepotAddress::createFromXML($parcelsDepotAddressData)
Expand Down
4 changes: 2 additions & 2 deletions src/Bpost/Order/Box/AtBpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul
if (isset($xml->atBpost->options)) {
/** @var SimpleXMLElement $optionData */
foreach ($xml->atBpost->options as $optionData) {
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v5/common');

if (in_array(
$optionData->getName(),
Expand Down Expand Up @@ -328,7 +328,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul
if (isset($xml->atBpost->pugoAddress)) {
/** @var SimpleXMLElement $pugoAddressData */
$pugoAddressData = $xml->atBpost->pugoAddress->children(
'http://schema.post.be/shm/deepintegration/v3/common'
'http://schema.post.be/shm/deepintegration/v5/common'
);
$atBpost->setPugoAddress(
PugoAddress::createFromXML($pugoAddressData)
Expand Down
2 changes: 1 addition & 1 deletion src/Bpost/Order/Box/AtHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul
if (isset($atHomeXml->receiver)) {
$self->setReceiver(
Receiver::createFromXML(
$atHomeXml->receiver->children('http://schema.post.be/shm/deepintegration/v3/common')
$atHomeXml->receiver->children('http://schema.post.be/shm/deepintegration/v5/common')
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bpost/Order/Box/BpostOnAppointment.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul
if (isset($bpostOnAppointmentXml->receiver)) {
$self->setReceiver(
Receiver::createFromXML(
$bpostOnAppointmentXml->receiver->children('http://schema.post.be/shm/deepintegration/v3/common')
$bpostOnAppointmentXml->receiver->children('http://schema.post.be/shm/deepintegration/v5/common')
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Bpost/Order/Box/International.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public static function createFromXML(SimpleXMLElement $xml)
if (isset($xml->international->options)) {
/** @var SimpleXMLElement $optionData */
foreach ($xml->international->options as $optionData) {
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v5/common');

if (in_array($optionData->getName(), array(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED))) {
$option = Messaging::createFromXML($optionData);
Expand All @@ -265,7 +265,7 @@ public static function createFromXML(SimpleXMLElement $xml)
}
if (isset($xml->international->receiver)) {
$receiverData = $xml->international->receiver->children(
'http://schema.post.be/shm/deepintegration/v3/common'
'http://schema.post.be/shm/deepintegration/v5/common'
);
$international->setReceiver(
Receiver::createFromXML($receiverData)
Expand Down
2 changes: 1 addition & 1 deletion src/Bpost/Order/Box/National.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public static function createFromXML(SimpleXMLElement $nationalXml, National $se
if (isset($nationalXml->options) && !empty($nationalXml->options)) {
/** @var SimpleXMLElement $optionData */
foreach ($nationalXml->options as $optionData) {
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
$optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v5/common');

if (in_array($optionData->getName(), array(
Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private function getExpectedXml()
{
return <<< XML
<?xml version="1.0" encoding="UTF-8"?>
<batchLabels xmlns="http://schema.post.be/shm/deepintegration/v3/">
<batchLabels xmlns="http://schema.post.be/shm/deepintegration/v5/">
<order>order_ref_1</order>
<order>order_ref_2</order>
</batchLabels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private function getOrderXml()
{
return <<< XML
<?xml version="1.0" encoding="utf-8"?>
<tns:order xmlns="http://schema.post.be/shm/deepintegration/v3/national" xmlns:common="http://schema.post.be/shm/deepintegration/v3/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v3/" xmlns:international="http://schema.post.be/shm/deepintegration/v3/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v3/">
<tns:order xmlns="http://schema.post.be/shm/deepintegration/v5/national" xmlns:common="http://schema.post.be/shm/deepintegration/v5/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v5/" xmlns:international="http://schema.post.be/shm/deepintegration/v5/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v5/">
<tns:accountId>123456789</tns:accountId>
<tns:reference>ref_1</tns:reference>
<tns:costCenter>Cost Center</tns:costCenter>
Expand Down
2 changes: 1 addition & 1 deletion tests/Bpost/HttpRequestBuilder/ModifyOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function dataResults()
'input' => array('123', 'pending'),
'url' => '/orders/123',
'xml' => '<?xml version="1.0" encoding="utf-8"?>
<orderUpdate xmlns="http://schema.post.be/shm/deepintegration/v3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<orderUpdate xmlns="http://schema.post.be/shm/deepintegration/v5/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<status>PENDING</status>
</orderUpdate>
',
Expand Down
2 changes: 1 addition & 1 deletion tests/Bpost/Label/BarcodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ private function getBarcodeXml()
{
return <<<XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<barcodeWithReference xmlns="http://schema.post.be/shm/deepintegration/v3/" xmlns:ns2="http://schema.post.be/shm/deepintegration/v3/common" xmlns:ns3="http://schema.post.be/shm/deepintegration/v3/national" xmlns:ns4="http://schema.post.be/shm/deepintegration/v3/international">
<barcodeWithReference xmlns="http://schema.post.be/shm/deepintegration/v5/" xmlns:ns2="http://schema.post.be/shm/deepintegration/v5/common" xmlns:ns3="http://schema.post.be/shm/deepintegration/v5/national" xmlns:ns4="http://schema.post.be/shm/deepintegration/v5/international">
<barcode>323299901059912015292030</barcode>
<reference>test_barcode_with_reference</reference>
</barcodeWithReference>
Expand Down
8 changes: 4 additions & 4 deletions tests/Bpost/LabelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ private function getCreateLabelForOrderXml()
return str_replace('{bytes}', $this->getCreateLabelForOrderBytes(), <<< XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<label
xmlns="http://schema.post.be/shm/deepintegration/v3/"
xmlns:ns2="http://schema.post.be/shm/deepintegration/v3/common"
xmlns:ns3="http://schema.post.be/shm/deepintegration/v3/national"
xmlns:ns4="http://schema.post.be/shm/deepintegration/v3/international">
xmlns="http://schema.post.be/shm/deepintegration/v5/"
xmlns:ns2="http://schema.post.be/shm/deepintegration/v5/common"
xmlns:ns3="http://schema.post.be/shm/deepintegration/v5/national"
xmlns:ns4="http://schema.post.be/shm/deepintegration/v5/international">
<barcodeWithReference>
<barcode>323299901059912015292030</barcode>
<reference>test_barcode_with_reference</reference>
Expand Down
8 changes: 4 additions & 4 deletions tests/Bpost/LabelsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ private function getCreateLabelForOrderXml()
return str_replace('{bytes}', $this->getCreateLabelForOrderBytes(), <<< XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<labels
xmlns="http://schema.post.be/shm/deepintegration/v3/"
xmlns:ns2="http://schema.post.be/shm/deepintegration/v3/common"
xmlns:ns3="http://schema.post.be/shm/deepintegration/v3/national"
xmlns:ns4="http://schema.post.be/shm/deepintegration/v3/international"
xmlns="http://schema.post.be/shm/deepintegration/v5/"
xmlns:ns2="http://schema.post.be/shm/deepintegration/v5/common"
xmlns:ns3="http://schema.post.be/shm/deepintegration/v5/national"
xmlns:ns4="http://schema.post.be/shm/deepintegration/v5/international"
>
<label>
<barcodeWithReference>
Expand Down
14 changes: 7 additions & 7 deletions tests/Bpost/Order/Box/AtHomeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ private function generateDomDocument(\DOMDocument $document, \DOMElement $elemen
{
$element->setAttribute(
'xmlns:common',
'http://schema.post.be/shm/deepintegration/v3/common'
'http://schema.post.be/shm/deepintegration/v5/common'
);
$element->setAttribute(
'xmlns:tns',
'http://schema.post.be/shm/deepintegration/v3/'
'http://schema.post.be/shm/deepintegration/v5/'
);
$element->setAttribute(
'xmlns',
'http://schema.post.be/shm/deepintegration/v3/national'
'http://schema.post.be/shm/deepintegration/v5/national'
);
$element->setAttribute(
'xmlns:international',
'http://schema.post.be/shm/deepintegration/v3/international'
'http://schema.post.be/shm/deepintegration/v5/international'
);
$element->setAttribute(
'xmlns:xsi',
'http://www.w3.org/2001/XMLSchema-instance'
);
$element->setAttribute(
'xsi:schemaLocation',
'http://schema.post.be/shm/deepintegration/v3/'
'http://schema.post.be/shm/deepintegration/v5/'
);

$document->appendChild($element);
Expand Down Expand Up @@ -130,7 +130,7 @@ public function testFaultyProperties()
private function getXml() {
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<tns:nationalBox xmlns="http://schema.post.be/shm/deepintegration/v3/national" xmlns:common="http://schema.post.be/shm/deepintegration/v3/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v3/" xmlns:international="http://schema.post.be/shm/deepintegration/v3/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v3/">
<tns:nationalBox xmlns="http://schema.post.be/shm/deepintegration/v5/national" xmlns:common="http://schema.post.be/shm/deepintegration/v5/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v5/" xmlns:international="http://schema.post.be/shm/deepintegration/v5/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v5/">
<atHome>
<product>bpack 24h Pro</product>
<receiver>
Expand All @@ -156,7 +156,7 @@ private function getXml() {
private function getNotAtHomeXml() {
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<tns:nationalBox xmlns="http://schema.post.be/shm/deepintegration/v3/national" xmlns:common="http://schema.post.be/shm/deepintegration/v3/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v3/" xmlns:international="http://schema.post.be/shm/deepintegration/v3/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v3/">
<tns:nationalBox xmlns="http://schema.post.be/shm/deepintegration/v5/national" xmlns:common="http://schema.post.be/shm/deepintegration/v5/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v5/" xmlns:international="http://schema.post.be/shm/deepintegration/v5/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v5/">
<notAtHome>
<product>bpack 24h Pro</product>
</notAtHome>
Expand Down
14 changes: 7 additions & 7 deletions tests/Bpost/Order/Box/BpostOnAppointmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ private function generateDomDocument(\DOMDocument $document, \DOMElement $elemen
{
$element->setAttribute(
'xmlns:common',
'http://schema.post.be/shm/deepintegration/v3/common'
'http://schema.post.be/shm/deepintegration/v5/common'
);
$element->setAttribute(
'xmlns:tns',
'http://schema.post.be/shm/deepintegration/v3/'
'http://schema.post.be/shm/deepintegration/v5/'
);
$element->setAttribute(
'xmlns',
'http://schema.post.be/shm/deepintegration/v3/national'
'http://schema.post.be/shm/deepintegration/v5/national'
);
$element->setAttribute(
'xmlns:international',
'http://schema.post.be/shm/deepintegration/v3/international'
'http://schema.post.be/shm/deepintegration/v5/international'
);
$element->setAttribute(
'xmlns:xsi',
'http://www.w3.org/2001/XMLSchema-instance'
);
$element->setAttribute(
'xsi:schemaLocation',
'http://schema.post.be/shm/deepintegration/v3/'
'http://schema.post.be/shm/deepintegration/v5/'
);

$document->appendChild($element);
Expand Down Expand Up @@ -113,7 +113,7 @@ private function getNormalXml()
{
return <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<nationalBox xmlns="http://schema.post.be/shm/deepintegration/v3/national" xmlns:common="http://schema.post.be/shm/deepintegration/v3/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v3/" xmlns:international="http://schema.post.be/shm/deepintegration/v3/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v3/">
<nationalBox xmlns="http://schema.post.be/shm/deepintegration/v5/national" xmlns:common="http://schema.post.be/shm/deepintegration/v5/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v5/" xmlns:international="http://schema.post.be/shm/deepintegration/v5/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v5/">
<bpostOnAppointment>
<product>bpack 24h Pro</product>
<receiver>
Expand All @@ -140,7 +140,7 @@ private function getNotBpostOnAppointmentXml()
{
return <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<nationalBox xmlns="http://schema.post.be/shm/deepintegration/v3/national" xmlns:common="http://schema.post.be/shm/deepintegration/v3/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v3/" xmlns:international="http://schema.post.be/shm/deepintegration/v3/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v3/">
<nationalBox xmlns="http://schema.post.be/shm/deepintegration/v5/national" xmlns:common="http://schema.post.be/shm/deepintegration/v5/common" xmlns:tns="http://schema.post.be/shm/deepintegration/v5/" xmlns:international="http://schema.post.be/shm/deepintegration/v5/international" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.post.be/shm/deepintegration/v5/">
<bpostAtHome>
<product>bpack 24h Pro</product>
<receiver>
Expand Down
Loading

0 comments on commit 8ea7cb7

Please sign in to comment.