Plugin Directory

Changeset 3194989


Ignore:
Timestamp:
11/22/2024 01:55:11 PM (16 months ago)
Author:
antidot-dev
Message:

Release 3.1.12

Location:
bpost-shipping/trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • bpost-shipping/trunk/bpost-shipping.php

    r3171290 r3194989  
    66 * Author: bpost
    77 * Author URI: https://www.bpost.be/
    8  * Version: 3.1.11
     8 * Version: 3.1.12
    99 * WC requires at least: 3.0
    1010 * WC tested up to: 8.9
     
    1515define( 'BPOST_PLUGIN_DIR', __DIR__ );
    1616define( 'BPOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    17 define( 'BPOST_PLUGIN_VERSION', '3.1.11' );
     17define( 'BPOST_PLUGIN_VERSION', '3.1.12' );
    1818
    1919/**
  • bpost-shipping/trunk/languages/bpost_shipping.pot

    r3171290 r3194989  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: bpost shipping 3.1.11\n"
     5"Project-Id-Version: bpost shipping 3.1.12\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/package\n"
    7 "POT-Creation-Date: 2024-10-18 08:36:58+00:00\n"
     7"POT-Creation-Date: 2024-11-22 13:53:58+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=UTF-8\n"
     
    197197msgstr ""
    198198
    199 #. #-#-#-#-#  bpost_shipping.pot (bpost shipping 3.1.11)  #-#-#-#-#
     199#. #-#-#-#-#  bpost_shipping.pot (bpost shipping 3.1.12)  #-#-#-#-#
    200200#. Author of the plugin/theme
    201201#: classes/class-wc-bpost-shipping-method.php:261
  • bpost-shipping/trunk/readme.txt

    r3171290 r3194989  
    88Tested up to: 6.5
    99Requires PHP: 7.4
    10 Stable tag: 3.1.11
     10Stable tag: 3.1.12
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1201205. Configure your bpost shipping settings under the Woocommerce shipping > bpost shipping tab
    121121== Changelog ==
     122
     123#### 3.1.12
     124
     125* label creation could fail with Insurance option
    122126
    123127#### 3.1.11
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/.github/workflows/test.yml

    r3119293 r3194989  
    1 on: [push]
     1on:
     2  push:
     3  pull_request:
     4
    25jobs:
    36  build-and-test:
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost.php

    r3119293 r3194989  
    4343    const LABEL_FORMAT_A4 = 'A4';
    4444    const LABEL_FORMAT_A6 = 'A6';
     45
     46    const NS_V3_GLOBAL = 'http://schema.post.be/shm/deepintegration/v3/';
     47    const NS_V3_COMMON = 'http://schema.post.be/shm/deepintegration/v3/common';
     48    const NS_V3_NATIONAL = 'http://schema.post.be/shm/deepintegration/v3/national';
     49    const NS_V3_INTERNATIONAL = 'http://schema.post.be/shm/deepintegration/v3/international';
     50    const NS_V5_GLOBAL = 'http://schema.post.be/shm/deepintegration/v5/';
     51    const NS_V5_COMMON = 'http://schema.post.be/shm/deepintegration/v5/common';
     52    const NS_V5_NATIONAL = 'http://schema.post.be/shm/deepintegration/v5/national';
     53    const NS_V5_INTERNATIONAL = 'http://schema.post.be/shm/deepintegration/v5/international';
    4554
    4655    // URL for the api
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/CreateLabelInBulkForOrdersBuilder.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\HttpRequestBuilder;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Common\ValidatedValue\LabelFormat;
    67use DOMDocument;
     
    5859
    5960        $batchLabels = $document->createElement('batchLabels');
    60         $batchLabels->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/');
     61        $batchLabels->setAttribute('xmlns', Bpost::NS_V3_GLOBAL);
    6162        foreach ($this->references as $reference) {
    6263            $batchLabels->appendChild(
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/ModifyOrderBuilder.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\HttpRequestBuilder;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Box;
    67use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     
    4142
    4243        $orderUpdate = $document->createElement('orderUpdate');
    43         $orderUpdate->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/');
     44        $orderUpdate->setAttribute('xmlns', Bpost::NS_V3_GLOBAL);
    4445        $orderUpdate->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
    4546        $orderUpdate->appendChild(
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Box;
    67use Bpost\BpostApiClient\Bpost\Order\Line;
     
    159160            'tns:order'
    160161        );
    161         $order->setAttribute(
    162             'xmlns:common',
    163             'http://schema.post.be/shm/deepintegration/v5/common'
    164         );
    165         $order->setAttribute(
    166             'xmlns:tns',
    167             'http://schema.post.be/shm/deepintegration/v5/'
    168         );
    169         $order->setAttribute(
    170             'xmlns',
    171             'http://schema.post.be/shm/deepintegration/v5/national'
    172         );
    173         $order->setAttribute(
    174             'xmlns:international',
    175             'http://schema.post.be/shm/deepintegration/v5/international'
    176         );
    177         $order->setAttribute(
    178             'xmlns:xsi',
    179             'http://www.w3.org/2001/XMLSchema-instance'
    180         );
    181         $order->setAttribute(
    182             'xsi:schemaLocation',
    183             'http://schema.post.be/shm/deepintegration/v5/'
    184         );
     162        $order->setAttribute('xmlns:common', Bpost::NS_V5_COMMON);
     163        $order->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL);
     164        $order->setAttribute('xmlns', Bpost::NS_V5_NATIONAL);
     165        $order->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL);
     166        $order->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     167        $order->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL);
    185168
    186169        $document->appendChild($order);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Common\XmlHelper;
    67use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     
    233234                Sender::createFromXML(
    234235                    $xml->sender->children(
    235                         'http://schema.post.be/shm/deepintegration/v3/common'
     236                        Bpost::NS_V3_COMMON
    236237                    )
    237238                )
     
    240241        if (isset($xml->nationalBox)) {
    241242            /** @var SimpleXMLElement $nationalBoxData */
    242             $nationalBoxData = $xml->nationalBox->children('http://schema.post.be/shm/deepintegration/v3/national');
     243            $nationalBoxData = $xml->nationalBox->children(Bpost::NS_V3_NATIONAL);
    243244
    244245            // build classname based on the tag name
    245             $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($nationalBoxData->getName());
    246246            if ($nationalBoxData->getName() == 'at24-7') {
    247247                $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\At247';
     248            } else {
     249                $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($nationalBoxData->getName());
    248250            }
    249251
     
    256258        if (isset($xml->internationalBox)) {
    257259            /** @var SimpleXMLElement $internationalBoxData */
    258             $internationalBoxData = $xml->internationalBox->children('http://schema.post.be/shm/deepintegration/v3/international');
     260            $internationalBoxData = $xml->internationalBox->children(Bpost::NS_V3_INTERNATIONAL);
    259261
    260262            // build classname based on the tag name
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/At247.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Box\National\Unregistered;
    67use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging;
     
    1011use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    1112use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
     13use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
    1214use DOMDocument;
    1315use DOMElement;
     
    313315    public static function createFromXML(SimpleXMLElement $xml, National $self = null)
    314316    {
    315         $at247 = new At247();
    316 
    317         if (isset($xml->{'at24-7'}->product) && $xml->{'at24-7'}->product != '') {
    318             $at247->setProduct(
    319                 (string) $xml->{'at24-7'}->product
    320             );
    321         }
    322         if (isset($xml->{'at24-7'}->options)) {
    323             /** @var SimpleXMLElement $optionData */
    324             foreach ($xml->{'at24-7'}->options as $optionData) {
    325                 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
    326 
    327                 if (in_array($optionData->getName(), array(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED))) {
    328                     $option = Messaging::createFromXML($optionData);
    329                 } else {
    330                     $option = self::getOptionFromOptionData($optionData);
    331                 }
    332 
    333                 $at247->addOption($option);
    334             }
    335         }
    336         if (isset($xml->{'at24-7'}->weight) && $xml->{'at24-7'}->weight != '') {
    337             $at247->setWeight(
    338                 (int) $xml->{'at24-7'}->weight
    339             );
    340         }
    341         if (isset($xml->{'at24-7'}->memberId) && $xml->{'at24-7'}->memberId != '') {
    342             $at247->setMemberId(
    343                 (string) $xml->{'at24-7'}->memberId
    344             );
    345         }
    346         if (isset($xml->{'at24-7'}->receiverName) && $xml->{'at24-7'}->receiverName != '') {
    347             $at247->setReceiverName(
    348                 (string) $xml->{'at24-7'}->receiverName
    349             );
    350         }
    351         if (isset($xml->{'at24-7'}->receiverCompany) && $xml->{'at24-7'}->receiverCompany != '') {
    352             $at247->setReceiverCompany(
    353                 (string) $xml->{'at24-7'}->receiverCompany
    354             );
    355         }
    356         if (isset($xml->{'at24-7'}->parcelsDepotId) && $xml->{'at24-7'}->parcelsDepotId != '') {
    357             $at247->setParcelsDepotId(
    358                 (string) $xml->{'at24-7'}->parcelsDepotId
    359             );
    360         }
    361         if (isset($xml->{'at24-7'}->parcelsDepotName) && $xml->{'at24-7'}->parcelsDepotName != '') {
    362             $at247->setParcelsDepotName(
    363                 (string) $xml->{'at24-7'}->parcelsDepotName
    364             );
    365         }
    366         if (isset($xml->{'at24-7'}->parcelsDepotAddress)) {
     317        if ($self === null) {
     318            $self = new self();
     319        }
     320
     321        if (!isset($xml->{'at24-7'})) {
     322            throw new BpostXmlInvalidItemException();
     323        }
     324
     325        $at247Xml = $xml->{'at24-7'}[0];
     326
     327        /** @var static $self */
     328        $self = parent::createFromXML($at247Xml, $self);
     329
     330        if (!empty($at247Xml->memberId)) {
     331            $self->setMemberId(
     332                (string) $at247Xml->memberId
     333            );
     334        }
     335        if (!empty($at247Xml->receiverName)) {
     336            $self->setReceiverName(
     337                (string) $at247Xml->receiverName
     338            );
     339        }
     340        if (!empty($at247Xml->receiverCompany)) {
     341            $self->setReceiverCompany(
     342                (string) $at247Xml->receiverCompany
     343            );
     344        }
     345        if (!empty($at247Xml->parcelsDepotId)) {
     346            $self->setParcelsDepotId(
     347                (string) $at247Xml->parcelsDepotId
     348            );
     349        }
     350        if (!empty($at247Xml->parcelsDepotName)) {
     351            $self->setParcelsDepotName(
     352                (string) $at247Xml->parcelsDepotName
     353            );
     354        }
     355        if (isset($at247Xml->parcelsDepotAddress)) {
    367356            /** @var SimpleXMLElement $parcelsDepotAddressData */
    368             $parcelsDepotAddressData = $xml->{'at24-7'}->parcelsDepotAddress->children(
    369                 'http://schema.post.be/shm/deepintegration/v3/common'
    370             );
    371             $at247->setParcelsDepotAddress(
     357            $parcelsDepotAddressData = $at247Xml->parcelsDepotAddress->children(Bpost::NS_V3_COMMON);
     358            $self->setParcelsDepotAddress(
    372359                ParcelsDepotAddress::createFromXML($parcelsDepotAddressData)
    373360            );
    374361        }
    375         if (isset($xml->{'at24-7'}->requestedDeliveryDate) && $xml->{'at24-7'}->requestedDeliveryDate != '') {
    376             $at247->setRequestedDeliveryDate(
    377                 (string) $xml->{'at24-7'}->requestedDeliveryDate
    378             );
    379         }
    380 
    381         return $at247;
     362        if (!empty($at247Xml->requestedDeliveryDate)) {
     363            $self->setRequestedDeliveryDate(
     364                (string) $at247Xml->requestedDeliveryDate
     365            );
     366        }
     367
     368        return $self;
    382369    }
    383370}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtBpost.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Box\National\ShopHandlingInstruction;
    67use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging;
     
    1011use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    1112use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
     13use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
    1214use DOMDocument;
    1315use DOMElement;
     
    272274    public static function createFromXML(SimpleXMLElement $xml, National $self = null)
    273275    {
    274         $atBpost = new AtBpost();
    275 
    276         if (isset($xml->atBpost->product) && $xml->atBpost->product != '') {
    277             $atBpost->setProduct(
    278                 (string) $xml->atBpost->product
    279             );
    280         }
    281         if (isset($xml->atBpost->options)) {
    282             /** @var SimpleXMLElement $optionData */
    283             foreach ($xml->atBpost->options as $optionData) {
    284                 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
    285 
    286                 if (in_array(
    287                     $optionData->getName(),
    288                     array(
    289                         Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED,
    290                         Messaging::MESSAGING_TYPE_INFO_NEXT_DAY,
    291                         Messaging::MESSAGING_TYPE_INFO_REMINDER,
    292                         Messaging::MESSAGING_TYPE_KEEP_ME_INFORMED,
    293                     )
    294                 )
    295                 ) {
    296                     $option = Messaging::createFromXML($optionData);
    297                 } else {
    298                     $option = self::getOptionFromOptionData($optionData);
    299                 }
    300 
    301                 $atBpost->addOption($option);
    302             }
    303         }
    304         if (isset($xml->atBpost->weight) && $xml->atBpost->weight != '') {
    305             $atBpost->setWeight(
    306                 (int) $xml->atBpost->weight
    307             );
    308         }
    309         if (isset($xml->atBpost->receiverName) && $xml->atBpost->receiverName != '') {
    310             $atBpost->setReceiverName(
     276        if ($self === null) {
     277            $self = new self();
     278        }
     279
     280        if (!isset($xml->atBpost)) {
     281            throw new BpostXmlInvalidItemException();
     282        }
     283
     284        $atBpostXml = $xml->atBpost[0];
     285
     286        /** @var static $self */
     287        $self = parent::createFromXML($atBpostXml, $self);
     288
     289        if (!empty($atBpostXml->receiverName)) {
     290            $self->setReceiverName(
    311291                (string) $xml->atBpost->receiverName
    312292            );
    313293        }
    314         if (isset($xml->atBpost->receiverCompany) && $xml->atBpost->receiverCompany != '') {
    315             $atBpost->setReceiverCompany(
     294        if (!empty($atBpostXml->receiverCompany)) {
     295            $self->setReceiverCompany(
    316296                (string) $xml->atBpost->receiverCompany
    317297            );
    318298        }
    319         if (isset($xml->atBpost->pugoId) && $xml->atBpost->pugoId != '') {
    320             $atBpost->setPugoId(
     299        if (!empty($atBpostXml->pugoId)) {
     300            $self->setPugoId(
    321301                (string) $xml->atBpost->pugoId
    322302            );
    323303        }
    324         if (isset($xml->atBpost->pugoName) && $xml->atBpost->pugoName != '') {
    325             $atBpost->setPugoName(
     304        if (!empty($atBpostXml->pugoName)) {
     305            $self->setPugoName(
    326306                (string) $xml->atBpost->pugoName
    327307            );
     
    329309        if (isset($xml->atBpost->pugoAddress)) {
    330310            /** @var SimpleXMLElement $pugoAddressData */
    331             $pugoAddressData = $xml->atBpost->pugoAddress->children(
    332                 'http://schema.post.be/shm/deepintegration/v3/common'
    333             );
    334             $atBpost->setPugoAddress(
     311            $pugoAddressData = $atBpostXml->pugoAddress->children(Bpost::NS_V3_COMMON);
     312            $self->setPugoAddress(
    335313                PugoAddress::createFromXML($pugoAddressData)
    336314            );
    337315        }
    338         if (isset($xml->atBpost->requestedDeliveryDate) && $xml->atBpost->requestedDeliveryDate != '') {
    339             $atBpost->setRequestedDeliveryDate(
     316        if (!empty($atBpostXml->requestedDeliveryDate)) {
     317            $self->setRequestedDeliveryDate(
    340318                (string) $xml->atBpost->requestedDeliveryDate
    341319            );
    342320        }
    343         if (isset($xml->atBpost->shopHandlingInstruction) && $xml->atBpost->shopHandlingInstruction != '') {
    344             $atBpost->setShopHandlingInstruction(
     321        if (!empty($atBpostXml->shopHandlingInstruction)) {
     322            $self->setShopHandlingInstruction(
    345323                (string) $xml->atBpost->shopHandlingInstruction
    346324            );
    347325        }
    348326
    349         return $atBpost;
     327        return $self;
    350328    }
    351329}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtHome.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Receiver;
    67use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product;
     
    160161            $self->setReceiver(
    161162                Receiver::createFromXML(
    162                     $atHomeXml->receiver->children('http://schema.post.be/shm/deepintegration/v3/common')
     163                    $atHomeXml->receiver->children(Bpost::NS_V3_COMMON)
    163164                )
    164165            );
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtIntlPugo.php

    r3119293 r3194989  
    22namespace Bpost\BpostApiClient\Bpost\Order\Box;
    33
     4use Bpost\BpostApiClient\Bpost;
    45use Bpost\BpostApiClient\Bpost\Order\Box\National\ShopHandlingInstruction;
    56use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging;
     
    253254            /** @var \SimpleXMLElement $optionData */
    254255            foreach ($xml->atIntlPugo->options as $optionData) {
    255                 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
     256                $optionData = $optionData->children(Bpost::NS_V3_COMMON);
    256257
    257258                if (in_array(
     
    289290            $self->setReceiver(
    290291                Receiver::createFromXML(
    291                     $xml->atIntlPugo->receiver->children('http://schema.post.be/shm/deepintegration/v3/common')
     292                    $xml->atIntlPugo->receiver->children(Bpost::NS_V3_COMMON)
    292293                )
    293294            );
     
    305306        if (isset($xml->atIntlPugo->pugoAddress)) {
    306307            /** @var \SimpleXMLElement $pugoAddressData */
    307             $pugoAddressData = $xml->atIntlPugo->pugoAddress->children(
    308                 'http://schema.post.be/shm/deepintegration/v3/common'
    309             );
     308            $pugoAddressData = $xml->atIntlPugo->pugoAddress->children(Bpost::NS_V3_COMMON);
    310309            $self->setPugoAddress(
    311310                PugoAddress::createFromXML($pugoAddressData)
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/BpostOnAppointment.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Receiver;
    67use Bpost\BpostApiClient\Common\XmlHelper;
     
    126127            $self->setReceiver(
    127128                Receiver::createFromXML(
    128                     $bpostOnAppointmentXml->receiver->children('http://schema.post.be/shm/deepintegration/v3/common')
     129                    $bpostOnAppointmentXml->receiver->children(Bpost::NS_V3_COMMON)
    129130                )
    130131            );
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/International.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo;
    67use Bpost\BpostApiClient\Bpost\Order\Box\International\ParcelContent;
     
    296297        if (isset($xml->international->options)) {
    297298            /** @var SimpleXMLElement $optionData */
    298             $options = $xml->international->options->children('http://schema.post.be/shm/deepintegration/v3/common');
     299            $options = $xml->international->options->children(Bpost::NS_V3_COMMON);
    299300            foreach ($options as $optionData) {
    300301                switch ($optionData->getName()) {
     
    323324        }
    324325        if (isset($xml->international->receiver)) {
    325             $receiverData = $xml->international->receiver->children(
    326                 'http://schema.post.be/shm/deepintegration/v3/common'
    327             );
     326            $receiverData = $xml->international->receiver->children(Bpost::NS_V3_COMMON);
    328327            $international->setReceiver(
    329328                Receiver::createFromXML($receiverData)
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Bpost\Order\Box\OpeningHour\Day;
     7use Bpost\BpostApiClient\Bpost\Order\Box\Option\CashOnDelivery;
    68use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging;
    79use Bpost\BpostApiClient\Bpost\Order\Box\Option\Option;
     
    911use Bpost\BpostApiClient\Common\ComplexAttribute;
    1012use Bpost\BpostApiClient\Common\XmlHelper;
     13use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
     14use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    1115use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
    1216use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
     
    215219     * @param National         $self
    216220     *
    217      * @return AtHome
     221     * @return National
    218222     *
    219223     * @throws BpostException
     
    232236        }
    233237
    234         if (isset($nationalXml->options) && !empty($nationalXml->options)) {
     238        if (!empty($nationalXml->options)) {
    235239            /** @var SimpleXMLElement $optionData */
    236             foreach ($nationalXml->options as $optionData) {
    237                 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
    238 
    239                 if (in_array($optionData->getName(), array(
    240                         Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED,
    241                         Messaging::MESSAGING_TYPE_INFO_NEXT_DAY,
    242                         Messaging::MESSAGING_TYPE_INFO_REMINDER,
    243                         Messaging::MESSAGING_TYPE_KEEP_ME_INFORMED,
    244                     ))
    245                 ) {
    246                     $option = Messaging::createFromXML($optionData);
    247                 } else {
    248                     $option = self::getOptionFromOptionData($optionData);
    249                 }
    250 
    251                 $self->addOption($option);
     240            foreach ($nationalXml->options->children(Bpost::NS_V3_COMMON) as $optionData) {
     241                $self->addOption(self::getOptionFromOptionData($optionData));
    252242            }
    253243        }
     
    280270     *
    281271     * @throws BpostNotImplementedException
     272     * @throws BpostInvalidLengthException
     273     * @throws BpostInvalidValueException
    282274     */
    283275    protected static function getOptionFromOptionData(SimpleXMLElement $optionData)
    284276    {
    285         $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName());
    286         XmlHelper::assertMethodCreateFromXmlExists($className);
    287 
    288         return call_user_func(
    289             array($className, 'createFromXML'),
    290             $optionData
    291         );
     277        switch ($optionData->getName()) {
     278            case Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED:
     279            case Messaging::MESSAGING_TYPE_INFO_NEXT_DAY:
     280            case Messaging::MESSAGING_TYPE_INFO_REMINDER:
     281            case Messaging::MESSAGING_TYPE_KEEP_ME_INFORMED:
     282                return Messaging::createFromXML($optionData);
     283
     284            case 'cod':
     285                return CashOnDelivery::createFromXML($optionData);
     286
     287            default:
     288                $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName());
     289
     290                XmlHelper::assertMethodCreateFromXmlExists($className);
     291
     292                return call_user_func(
     293                    array($className, 'createFromXML'),
     294                    $optionData
     295                );
     296        }
    292297    }
    293298}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/AutomaticSecondPresentation.php

    r3119293 r3194989  
    3232        return $document->createElement(XmlHelper::getPrefixedTagName('automaticSecondPresentation', $prefix));
    3333    }
    34 
    35     /**
    36      * @param SimpleXMLElement $xml
    37      *
    38      * @return static
    39      */
    40     public static function createFromXML(SimpleXMLElement $xml)
    41     {
    42         return new static();
    43     }
    4434}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/CashOnDelivery.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Common\XmlHelper;
     7use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
     8use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    69use DomDocument;
    710use DomElement;
     11use SimpleXMLElement;
    812
    913/**
     
    133137        return $cod;
    134138    }
     139
     140    /**
     141     * @param SimpleXMLElement $xml
     142     *
     143     * @return static
     144     *
     145     * @throws BpostInvalidLengthException
     146     * @throws BpostInvalidValueException
     147     */
     148    public static function createFromXML(SimpleXMLElement $xml)
     149    {
     150        $details = $xml->children(Bpost::NS_V3_COMMON);
     151
     152        return new static(floatval($details->codAmount), (string) $details->iban, (string) $details->bic);
     153    }
    135154}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Insured.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Common\XmlHelper;
    67use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     
    2728    const INSURANCE_AMOUNT_UP_TO_2500_EUROS = 2;
    2829    const INSURANCE_AMOUNT_UP_TO_5000_EUROS = 3;
     30    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    2931    const INSURANCE_AMOUNT_UP_TO_7500_EUROS = 4;
     32    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    3033    const INSURANCE_AMOUNT_UP_TO_10000_EUROS = 5;
     34    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    3135    const INSURANCE_AMOUNT_UP_TO_12500_EUROS = 6;
     36    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    3237    const INSURANCE_AMOUNT_UP_TO_15000_EUROS = 7;
     38    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    3339    const INSURANCE_AMOUNT_UP_TO_17500_EUROS = 8;
     40    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    3441    const INSURANCE_AMOUNT_UP_TO_20000_EUROS = 9;
     42    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    3543    const INSURANCE_AMOUNT_UP_TO_22500_EUROS = 10;
     44    /** @deprecated From SHM API v3.3.24: insurance is limited to 5000€ */
    3645    const INSURANCE_AMOUNT_UP_TO_25000_EUROS = 11;
    3746
     
    109118            self::INSURANCE_AMOUNT_UP_TO_2500_EUROS,
    110119            self::INSURANCE_AMOUNT_UP_TO_5000_EUROS,
    111             self::INSURANCE_AMOUNT_UP_TO_7500_EUROS,
    112             self::INSURANCE_AMOUNT_UP_TO_10000_EUROS,
    113             self::INSURANCE_AMOUNT_UP_TO_12500_EUROS,
    114             self::INSURANCE_AMOUNT_UP_TO_15000_EUROS,
    115             self::INSURANCE_AMOUNT_UP_TO_17500_EUROS,
    116             self::INSURANCE_AMOUNT_UP_TO_20000_EUROS,
    117             self::INSURANCE_AMOUNT_UP_TO_22500_EUROS,
    118             self::INSURANCE_AMOUNT_UP_TO_25000_EUROS,
    119120        );
    120121    }
     
    138139     *
    139140     * @param DomDocument $document
    140      * @param string      $prefix
    141141     *
    142142     * @return DomElement
     
    167167    public static function createFromXML(SimpleXMLElement $xml)
    168168    {
    169         $insuranceDetail = $xml->children('common', true);
    170 
     169        $insuranceDetail = $xml->children(Bpost::NS_V3_COMMON);
    171170        $type = $insuranceDetail->getName();
    172         $value = $insuranceDetail->attributes()->value !== null ? (int) $insuranceDetail->attributes()->value : null;
     171        $value = intval($insuranceDetail->attributes()->value) ?: null;
    173172
    174173        if ($type === static::INSURANCE_TYPE_ADDITIONAL_INSURANCE && $value === 1) {
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Messaging.php

    r3119293 r3194989  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
    44
     5use Bpost\BpostApiClient\Bpost;
    56use Bpost\BpostApiClient\Common\XmlHelper;
    67use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
     
    237238        $messaging = new Messaging($xml->getName(), (string) $xml->attributes()->language);
    238239
    239         $children = $xml->children('http://schema.post.be/shm/deepintegration/v3/common');
     240        $children = $xml->children(Bpost::NS_V3_COMMON);
    240241        if ((string) $children->emailAddress !== '') {
    241242            $messaging->setEmailAddress((string) $children->emailAddress);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Option.php

    r3119293 r3194989  
    55use DOMDocument;
    66use DOMElement;
     7use SimpleXMLElement;
    78
    89/**
     
    2526     */
    2627    abstract public function toXML(DOMDocument $document, $prefix = null);
     28
     29    public static function createFromXML(SimpleXMLElement $xml)
     30    {
     31        return new static();
     32    }
    2733}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Signed.php

    r3119293 r3194989  
    3232        return $document->createElement(XmlHelper::getPrefixedTagName('signed', $prefix));
    3333    }
    34 
    35     /**
    36      * @param SimpleXMLElement $xml
    37      *
    38      * @return static
    39      */
    40     public static function createFromXML(SimpleXMLElement $xml)
    41     {
    42         return new static();
    43     }
    4434}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/FormHandler.php

    r3119293 r3194989  
    130130                break;
    131131
    132                 // maximum 2 chars
     132            // maximum 2 chars
    133133            case 'customerCountry':
    134134                if (mb_strlen($value) > 2) {
     
    138138                break;
    139139
    140                 // maximum 8 chars
     140            // maximum 8 chars
     141            case 'customerPostalCode':
    141142            case 'customerStreetNumber':
    142143            case 'customerBox':
     
    147148                break;
    148149
    149                 // maximum 20 chars
     150            // maximum 20 chars
    150151            case 'customerPhoneNumber':
    151152                if (mb_strlen($value) > 20) {
     
    155156                break;
    156157
    157                 // maximum 32 chars
    158             case 'customerPostalCode':
    159                 if (mb_strlen($value) > 32) {
    160                     throw new BpostInvalidLengthException($key, mb_strlen($value), 32);
    161                 }
    162                 $this->parameters[$key] = (string) $value;
    163                 break;
    164 
    165                 // maximum 40 chars
    166             case 'customerFirstName':
    167             case 'customerLastName':
     158            // maximum 40 chars
    168159            case 'customerCompany':
    169160            case 'customerStreet':
     
    175166                break;
    176167
    177                 // maximum 50 chars
     168            // sum = maximum 40 chars
     169            case 'customerFirstName':
     170            case 'customerLastName':
     171                $names = array(
     172                    'customerFirstName' => $this->parameters['customerFirstName'] ?: '',
     173                    'customerLastName' => $this->parameters['customerLastName'] ?: '',
     174                );
     175                $names[$key] = $value;
     176                $sum = array_sum(array_map(function ($item) {
     177                    return mb_strlen($item);
     178                }, $names));
     179                if ($sum > 40) {
     180                    throw new BpostInvalidLengthException($key, $sum, 40);
     181                }
     182                $this->parameters[$key] = (string) $value;
     183                break;
     184
     185            // maximum 50 chars
    178186            case 'orderReference':
    179187            case 'costCenter':
     
    185193                break;
    186194
    187                 // integers
     195            // integers
    188196            case 'orderTotalPrice':
    189197            case 'orderWeight':
     
    191199                break;
    192200
    193                 // array
     201            // array
    194202            case 'orderLine':
    195203                if (!isset($this->parameters[$key])) {
     
    199207                break;
    200208
    201                 // unknown
     209            // unknown
    202210            case 'deliveryMethodOverrides':
    203211            case 'extra':
  • bpost-shipping/trunk/vendor/composer/installed.json

    r3119293 r3194989  
    88                "type": "git",
    99                "url": "https://github.com/Antidot-be/bpost-api-library.git",
    10                 "reference": "f7a3a903e7acb7e7e159016ed37bef05c4aa408d"
     10                "reference": "eec236b2b2f5373e91d6ce41ea93db57430f78f2"
    1111            },
    1212            "dist": {
    1313                "type": "zip",
    14                 "url": "https://api.github.com/repos/Antidot-be/bpost-api-library/zipball/f7a3a903e7acb7e7e159016ed37bef05c4aa408d",
    15                 "reference": "f7a3a903e7acb7e7e159016ed37bef05c4aa408d",
     14                "url": "https://api.github.com/repos/Antidot-be/bpost-api-library/zipball/eec236b2b2f5373e91d6ce41ea93db57430f78f2",
     15                "reference": "eec236b2b2f5373e91d6ce41ea93db57430f78f2",
    1616                "shasum": ""
    1717            },
     
    2828                "phpunit/phpunit": "^5"
    2929            },
    30             "time": "2024-07-16T14:04:09+00:00",
     30            "time": "2024-10-15T14:27:22+00:00",
    3131            "default-branch": true,
    3232            "type": "library",
  • bpost-shipping/trunk/vendor/composer/installed.php

    r3119293 r3194989  
    1919                0 => '9999999-dev',
    2020            ),
    21             'reference' => 'f7a3a903e7acb7e7e159016ed37bef05c4aa408d',
     21            'reference' => 'eec236b2b2f5373e91d6ce41ea93db57430f78f2',
    2222            'dev_requirement' => false,
    2323        ),
Note: See TracChangeset for help on using the changeset viewer.