Skip to content

Commit

Permalink
Merge tag 'v1.8.0' of github.com:tig-nl/postnl-magento2
Browse files Browse the repository at this point in the history
  • Loading branch information
igorwulff committed Oct 9, 2019
2 parents 5f88fa6 + 23eff8a commit 8b9cc3d
Show file tree
Hide file tree
Showing 94 changed files with 2,188 additions and 856 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ matrix:
# PHP 7.1 is only supported in Magento 2.2.x
# PHP 7.2 is only supported in Magento 2.3.x
include:
- php: 7.0
env: MAGENTO_VERSION=2.1.16
- php: 7.0
env: MAGENTO_VERSION=2.1.17
- php: 7.0
env: MAGENTO_VERSION=2.2.7
- php: 7.1
env: MAGENTO_VERSION=2.1.18
- php: 7.0
env: MAGENTO_VERSION=2.2.8
- php: 7.1
env: MAGENTO_VERSION=2.3.0
env: MAGENTO_VERSION=2.2.9
- php: 7.1
env: MAGENTO_VERSION=2.3.1 # DI_COMPILE=true
env: MAGENTO_VERSION=2.3.1
- php: 7.2
env: MAGENTO_VERSION=2.3.2 # DI_COMPILE=true
- php: 7.2
env: MAGENTO_VERSION=2.3.1 CODE_COVERAGE=true
env: MAGENTO_VERSION=2.3.2 CODE_COVERAGE=true

before_script:
- export PATH=$PATH:$HOME/.composer/vendor/bin
Expand Down
19 changes: 18 additions & 1 deletion Api/Data/ShipmentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,19 @@ public function setShipmentType($value);
* @return string|null
*/
public function getShipmentType();


/**
* @param $value
*
* @return mixed
*/
public function setShipmentCountry($value);

/**
* @return mixed
*/
public function getShipmentCountry();

/**
* @param $value
*
Expand Down Expand Up @@ -320,6 +332,11 @@ public function getOriginalShippingAddress();
* @return \Magento\Sales\Api\Data\ShipmentInterface
*/
public function getShipment();

/**
* @return mixed
*/
public function getShippingAddress();

/**
* @return bool
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Config/Support/SupportTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

class SupportTab extends Template implements RendererInterface
{
const POSTNL_VERSION = '1.7.4';
const POSTNL_VERSION = '1.8.0';

const XPATH_SUPPORTED_MAGENTO_VERSION = 'tig_postnl/supported_magento_version';

Expand Down
4 changes: 2 additions & 2 deletions Config/CheckoutConfiguration/IsShippingOptionsActive.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
use TIG\PostNL\Service\Quote\CheckIfQuoteItemsAreInStock;
use TIG\PostNL\Service\Quote\CheckIfQuoteItemsCanBackorder;
use \TIG\PostNL\Service\Quote\CheckIfQuoteHasOption;
use TIG\PostNL\Service\Order\ProductCodeAndType;
use TIG\PostNL\Service\Order\ProductInfo;

class IsShippingOptionsActive implements CheckoutConfigurationInterface
{
Expand Down Expand Up @@ -98,7 +98,7 @@ public function getValue()
return false;
}

if ($this->quoteHasOption->get(ProductCodeAndType::OPTION_EXTRAATHOME)) {
if ($this->quoteHasOption->get(ProductInfo::OPTION_EXTRAATHOME)) {
return false;
}

Expand Down
58 changes: 58 additions & 0 deletions Config/Provider/PepsConfiguration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
*
* ..::..
* ..::::::::::::..
* ::'''''':''::'''''::
* ::.. ..: : ....::
* :::: ::: : : ::
* :::: ::: : ''' ::
* ::::..:::..::.....::
* ''::::::::::::''
* ''::''
*
*
* NOTICE OF LICENSE
*
* This source file is subject to the Creative Commons License.
* It is available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
* If you are unable to obtain it through the world-wide-web, please send an email
* to servicedesk@tig.nl so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact servicedesk@tig.nl for more information.
*
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
*/
namespace TIG\PostNL\Config\Provider;

class PepsConfiguration extends AbstractConfigProvider
{
const XPATH_BARCODE_TYPE = 'tig_postnl/peps/barcode_type';
const XPATH_BARCODE_RANGE = 'tig_postnl/peps/barcode_range';

/**
* @param null $storeId
*
* @return mixed
*/
public function getBarcodeType($storeId = null)
{
return $this->getConfigFromXpath(static::XPATH_BARCODE_TYPE, $storeId);
}

/**
* @param null $storeId
*
* @return mixed
*/
public function getBarcodeRange($storeId = null)
{
return $this->getConfigFromXpath(static::XPATH_BARCODE_RANGE, $storeId);
}
}
33 changes: 21 additions & 12 deletions Config/Provider/ProductOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class ProductOptions extends AbstractConfigProvider
const XPATH_DEFAULT_PACKAGE_DELIVERY_TYPE = 'tig_postnl/delivery_settings/default_package_type';
const XPATH_ALTERNATIVE_DEFAULT_PACKAGE_DELIVERY_TYPE = 'tig_postnl/delivery_settings/alternative_package_type';
const XPATH_DEFAULT_EPS_PRODUCT_OPTION = 'tig_postnl/delivery_settings/default_eps_option';
const XPATH_DEFAULT_GP_PRODUCT_OPTION = 'tig_postnl/globalpack/default_gp_option';

/**
* Since 1.5.1 all product options are automaticly supported.
Expand All @@ -71,15 +72,15 @@ public function getSupportedProductOptions()
*/
public function getDefaultProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_PRODUCT_OPTION);
}

/**
* @return string|int
*/
public function getUseAlternativeDefault()
{
return $this->getConfigFromXpath(self::XPATH_USE_ALTERNATIVE_DEFAULT_OPTION);
return $this->getConfigFromXpath(static::XPATH_USE_ALTERNATIVE_DEFAULT_OPTION);
}

/**
Expand All @@ -91,7 +92,7 @@ public function getAlternativeDefaultMinAmount()
return '0';
}

return $this->getConfigFromXpath(self::XPATH_ALTERNATIVE_DEFAULT_MIN_AMOUNT);
return $this->getConfigFromXpath(static::XPATH_ALTERNATIVE_DEFAULT_MIN_AMOUNT);
}

/**
Expand All @@ -103,7 +104,7 @@ public function getAlternativeDefaultProductOption()
return false;
}

return $this->getConfigFromXpath(self::XPATH_ALTERNATIVE_DEFAULT_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_ALTERNATIVE_DEFAULT_PRODUCT_OPTION);
}

/**
Expand All @@ -117,63 +118,71 @@ public function getDefaultEveningProductOption($country = null)
return $this->getDefaultEveningBeProductOption();
}

return $this->getConfigFromXpath(self::XPATH_DEFAULT_EVENING_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_EVENING_PRODUCT_OPTION);
}

/**
* @return string|int
*/
public function getDefaultExtraAtHomeProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_EXTRAATHOME_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_EXTRAATHOME_PRODUCT_OPTION);
}

/**
* @return string|int
*/
public function getDefaultEveningBeProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_EVENING_BE_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_EVENING_BE_PRODUCT_OPTION);
}

/**
* @return mixed
*/
public function getDefaultBeProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_BE_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_BE_PRODUCT_OPTION);
}

/**
* @return mixed
*/
public function getDefaultEpsProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_EPS_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_EPS_PRODUCT_OPTION);
}

/**
* @return mixed
*/
public function getDefaultGlobalpackOption()
{
return $this->getConfigFromXpath(static::XPATH_DEFAULT_GP_PRODUCT_OPTION);
}

/**
* @return mixed
*/
public function getDefaultPakjeGemakProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_PAKJEGEMAK_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_PAKJEGEMAK_PRODUCT_OPTION);
}

/**
* @return string|int
*/
public function getDefaultPakjeGemakEarlyProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_PAKJEGEMAK_EARLY_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_PAKJEGEMAK_EARLY_PRODUCT_OPTION);
}

/**
* @return string|int
*/
public function getDefaultSundayProductOption()
{
return $this->getConfigFromXpath(self::XPATH_DEFAULT_SUNDAY_PRODUCT_OPTION);
return $this->getConfigFromXpath(static::XPATH_DEFAULT_SUNDAY_PRODUCT_OPTION);
}

/**
Expand Down
18 changes: 18 additions & 0 deletions Config/Provider/ShippingOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class ShippingOptions extends AbstractConfigProvider
const XPATH_ITEM_OPTIONS_MANAGE_STOCK = 'cataloginventory/item_options/manage_stock';
const XPATH_SHIPPING_OPTION_CARGO_ACTIVE = 'tig_postnl/cargo/cargo_active';
const XPATH_SHIPPING_OPTION_EPS_BUSINESS_ACTIVE = 'tig_postnl/eps/business_active';
const XPATH_SHIPPING_OPTIONS_PEPS_ACTIVE = 'tig_postnl/peps/active';
const XPATH_SHIPPING_OPTIONS_GLOBALPACK_ACTIVE = 'tig_postnl/globalpack/enabled';

private $defaultMaxDeliverydays = '5';

Expand Down Expand Up @@ -241,6 +243,22 @@ public function canUseEpsBusinessProducts()
{
return (bool) $this->getConfigFromXpath(static::XPATH_SHIPPING_OPTION_EPS_BUSINESS_ACTIVE);
}

/**
* @return bool
*/
public function canUsePriority()
{
return (bool) $this->getConfigFromXpath(static::XPATH_SHIPPING_OPTIONS_PEPS_ACTIVE);
}

/**
* @return bool
*/
public function canUseGlobalPack()
{
return (bool) $this->getConfigFromXpath(static::XPATH_SHIPPING_OPTIONS_GLOBALPACK_ACTIVE);
}
}
/**
* @codingStandardsIgnoreEnd
Expand Down
9 changes: 7 additions & 2 deletions Config/Provider/Webshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ class Webshop extends AbstractConfigProvider
const XPATH_ADDRESS_CHECK_ENABLED = 'tig_postnl/addresscheck/enable_postcodecheck';
const XPATH_ADDRESS_CHECK_COMPATIBLE = 'tig_postnl/addresscheck/checkout_compatible';

const XPATH_POSTCODE_ADDRESS_CHECK_ENABLED = 'tig_postcode/configuration/modus';

/**
* @return bool
*/
public function getIsAddressCheckEnabled()
{
if ($this->getConfigFromXpath(self::XPATH_POSTCODE_ADDRESS_CHECK_ENABLED)) {
return false;
}

return $this->getConfigFromXpath(self::XPATH_ADDRESS_CHECK_ENABLED);
}

Expand Down Expand Up @@ -133,11 +139,10 @@ public function getCutOffTimeForDay($day)
{
switch ($day) {
case '7':
case '0':
return $this->getSundayCutOffTime();
case '6':
return $this->getSaturdayCutOffTime();
default :
default:
return $this->getCutOffTime();
}
}
Expand Down
Loading

0 comments on commit 8b9cc3d

Please sign in to comment.