Version Notes
==== v1.1.5 =====
==== Bug fixes ====
- Fixed a problem with account validation only using test mode account credentials
- Made a minor security improvement to the notification system.
- Fixed an issue where shipments could not be confirmed if the shipping address did not have an email address.
- Fixed an issue where PostNl Checkout would incorrectly identify a product as being out of stock.
- Fixed an issue where for some shops PostNl Checkout would not function due to incorrect usage of https in an http environment.
==== v1.1.4 =====
==== New features ====
- Added a default test account to the extension. New installation will automatically have a PostNL test account pre-configured.
- Added the option to undo a confirmation as long as the shipment has not been received by PostNL.
- Added the option to delete shipping labels. This allows you to correct an address after a shipping label has been printed. Before this change if you noticed an error in the address after you had already printed a shipping label, you had to place en entire new order to correct it. Now you can simply delete the shipping label, edit the address and print a new shipping label with the new address.
==== Minor change ====
- The validate settings button in the extension’s configuration page now also validates settings while the extension is set to test mode.
- Removed the 'EU Pack Standard (Belgium only, no signature)' product option. If you use this option, please contact the Total Internet Group servicedesk.
- The extension's test mode is now available by default. In earlier versions you had to allow test mode through a setting under advanced options.
- When a confirmation expires, the barcode's track & trace link will now also be removed.
- Improved various texts and translations.
==== Bug fixes ====
- Solved an issue where certain configurations of the PostNL shipping method would only appear if the Magento tablerates shipping method was also active.
- Solved an issue where filtering the order and shipment grids in the Magento backend on certain columns would cause an error.
- Solved an issue where the shipment status cron would stop as soon as it encountered an error, rather than continue processing the remaining shipments.
- Solved an issue where you could not confirm a shipment without a barcode due to process locking when developer mode is active.
- Solved issue in Safari where labels would be printed as .pdf.html, rather than just .pdf files.
==== v1.1.3 ====
- FIxed an issue with the extension's activation procedure.
==== v1.1.2 ====
- Updated manual.
==== v1.1.1 ====
- Fixed issue where filtering the first column of the shipment grid could cause errors.
- Removed PHP extension dependencies from the PostNL extension packages. Magento connect would sometimes falsely report a PHP extension as missing preventing the PostNL extension from being installed.
==== v1.1.0 ====
- First public release.
==== v1.0.8 ====
- Improved compatibility with Magento 1.6 and 1.11.
==== v1.0.7 ====
- Improved configuration fields.
- Improved translations.
==== v1.0.6 ====
- Improved shipment grid interface. It shoulod now be more clear which shipments have been confirmed and when they should be handed over to PostNL.
- Improved PostNL Checkout payment method handling. The Checkout summary page should now remember your chosen bank when you attempt to pay using iDEAL. 100% support for all payment methods is not guaranteed.
==== v1.0.5 ====
- Several bug fixes.
- Improved configuration interface.
==== v1.0.4 ====
- Several minor bug fixes.
- Improved Dutch translations.
- Added additional information to several fields in system/config.
==== v1.0.3 ====
- Several bug fixes. Including an issue preventing the extension from functioning properly with the compiler active.
- Several improvements to the Dutch translations.
- Improved the extension's system > config interface
- Added the Klarna payment method to PostNL Checkout
==== v1.0.2 ====
- A large number of bug fixes and general improvements
- Improved error handling. Almost all errors will now automatically provide you with a link where you can find more information and a possible solution.
==== v1.0.1 ====
- Added a filter to the possible product options you may select, based on the selected orders when mass-creating shipments from the order grid.
- Improved several translations.
- Fixed several minor bugs.
==== v1.0.0 ====
This is the initial beta release of the extension. If you have any questions, please contact the Total Internet Group Servicedesk
Release Info
Developer | TIG |
Extension | tig_postnl |
Version | 1.1.5 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.1.5
- app/code/community/TIG/PostNL/Block/Checkout/Cart/CheckoutLink.php +54 -55
- app/code/community/TIG/PostNL/Helper/Checkout.php +107 -129
- app/code/community/TIG/PostNL/Model/Core/Cif.php +402 -397
- app/code/community/TIG/PostNL/Model/ExtensionControl/Observer/Cron.php +30 -30
- app/code/community/TIG/PostNL/controllers/Adminhtml/ConfigController.php +4 -2
- app/code/community/TIG/PostNL/etc/config.xml +1 -1
- app/code/community/TIG/PostNL/etc/system.xml +1 -1
- app/design/frontend/base/default/template/TIG/PostNL/checkout/cart/js.phtml +25 -25
- package.xml +15 -5
- skin/adminhtml/default/default/media/TIG/PostNL/manual.pdf +0 -0
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* ___________ __ __
|
4 |
-
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
-
* \/
|
9 |
-
* ___ __ __
|
10 |
-
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
-
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
-
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
-
* \/ \/
|
15 |
-
* ________
|
16 |
-
* / _____/_______ ____ __ __ ______
|
17 |
-
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
-
* \______ /|__| \____/ |____/ | __/
|
20 |
-
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
-
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
@@ -43,37 +43,37 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends Mage_Core_Block_Templa
|
|
43 |
*/
|
44 |
const CHECKOUT_BUTTON_TEST_BASE_URL = 'https://tppcb-sandbox.e-id.nl/Button/Checkout';
|
45 |
const CHECKOUT_BUTTON_LIVE_BASE_URL = 'https://checkout.postnl.nl/Button/Checkout';
|
46 |
-
|
47 |
/**
|
48 |
* XML path to public webshop ID setting
|
49 |
*/
|
50 |
const XML_PATH_PUBLIC_WEBSHOP_ID = 'postnl/cif/public_webshop_id';
|
51 |
-
|
52 |
/**
|
53 |
* XML path to 'hide_button_if_disallowed' setting
|
54 |
*/
|
55 |
const XML_PATH_HIDE_BUTTON_IF_DISALLOWED = 'postnl/checkout/hide_button_if_disallowed';
|
56 |
-
|
57 |
/**
|
58 |
* XML path to the 'instruction_cms_page' setting
|
59 |
*/
|
60 |
const XML_PATH_INSTRUCTION_CMS_PAGE = 'postnl/checkout/instruction_cms_page';
|
61 |
-
|
62 |
/**
|
63 |
* Gets the checkout URL
|
64 |
-
*
|
65 |
* @return string
|
66 |
*/
|
67 |
public function getCheckoutUrl()
|
68 |
{
|
69 |
$url = Mage::helper('checkout/url')->getCheckoutUrl();
|
70 |
-
|
71 |
return $url;
|
72 |
}
|
73 |
-
|
74 |
/**
|
75 |
* Check if the button should be disabled
|
76 |
-
*
|
77 |
* @return boolean
|
78 |
*/
|
79 |
public function isDisabled()
|
@@ -81,22 +81,22 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends Mage_Core_Block_Templa
|
|
81 |
if (!$this->canUsePostnlCheckout()) {
|
82 |
return true;
|
83 |
}
|
84 |
-
|
85 |
return false;
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
* Check if the button should be displayed
|
90 |
-
*
|
91 |
* @return boolean
|
92 |
*/
|
93 |
public function canUsePostnlCheckout()
|
94 |
{
|
95 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
96 |
-
|
97 |
$helper = Mage::helper('postnl/checkout');
|
98 |
$canUseCheckout = $helper->canUsePostnlCheckout($quote);
|
99 |
-
|
100 |
/**
|
101 |
* If Checkout is not available, log the reason why for debugging purposes
|
102 |
*/
|
@@ -105,27 +105,27 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends Mage_Core_Block_Templa
|
|
105 |
if (is_null($configErrors)) {
|
106 |
$configErrors = Mage::registry('postnl_enabled_checkout_errors');
|
107 |
}
|
108 |
-
|
109 |
if (is_null($configErrors)) {
|
110 |
return $canUseCheckout;
|
111 |
}
|
112 |
-
|
113 |
$errorMessage = $helper->__('PostNL Checkout is not available due to the following reasons:');
|
114 |
foreach ($configErrors as $error) {
|
115 |
$errorMessage .= PHP_EOL . $error['message'];
|
116 |
}
|
117 |
-
|
118 |
Mage::register('postnl_checkout_logged', true);
|
119 |
$helper->log($errorMessage);
|
120 |
}
|
121 |
-
|
122 |
return $canUseCheckout;
|
123 |
-
|
124 |
}
|
125 |
-
|
126 |
/**
|
127 |
* Gets this webshop's public ID
|
128 |
-
*
|
129 |
* @return string
|
130 |
*/
|
131 |
public function getPublicWebshopId()
|
@@ -133,18 +133,18 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends Mage_Core_Block_Templa
|
|
133 |
if ($this->hasPublicWebshopId()) {
|
134 |
return $this->getData('public_webshop_id');
|
135 |
}
|
136 |
-
|
137 |
$webshopId = Mage::getStoreConfig(self::XML_PATH_PUBLIC_WEBSHOP_ID, Mage::app()->getStore()->getId());
|
138 |
-
|
139 |
$this->setPublicWebshopId($webshopId);
|
140 |
return $webshopId;
|
141 |
}
|
142 |
-
|
143 |
/**
|
144 |
* Gets the checkout button src attribute
|
145 |
-
*
|
146 |
* @param boolean $forceDisabled
|
147 |
-
*
|
148 |
* @return string
|
149 |
*/
|
150 |
public function getSrc($forceDisabled = false)
|
@@ -154,24 +154,24 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends Mage_Core_Block_Templa
|
|
154 |
} else {
|
155 |
$baseUrl = self::CHECKOUT_BUTTON_LIVE_BASE_URL;
|
156 |
}
|
157 |
-
|
158 |
$webshopId = $this->getPublicWebshopId();
|
159 |
-
|
160 |
-
$url = $baseUrl
|
161 |
. '?publicId=' . $webshopId
|
162 |
. '&format=Large'
|
163 |
. '&type=Orange';
|
164 |
-
|
165 |
if ($forceDisabled === true || $this->isDisabled()) {
|
166 |
$url .= '&disabled=true';
|
167 |
}
|
168 |
-
|
169 |
return $url;
|
170 |
}
|
171 |
-
|
172 |
/**
|
173 |
* Gets the URL of a CMS page containing instructions on how to use PostNL Checkout
|
174 |
-
*
|
175 |
* @return boolean|string
|
176 |
*/
|
177 |
public function getInstructionUrl()
|
@@ -180,14 +180,14 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends Mage_Core_Block_Templa
|
|
180 |
if (!$instructionPage) {
|
181 |
return false;
|
182 |
}
|
183 |
-
|
184 |
$pageUrl = Mage::helper('cms/page')->getPageUrl($instructionPage);
|
185 |
return $pageUrl;
|
186 |
}
|
187 |
-
|
188 |
/**
|
189 |
* Returns the block's html. Checks if the 'use_postnl_checkout' param is set. If not, returns and empty string
|
190 |
-
*
|
191 |
* @return string
|
192 |
*/
|
193 |
protected function _toHtml()
|
@@ -198,26 +198,25 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends Mage_Core_Block_Templa
|
|
198 |
* If Checkout is not available, log the reason why for debugging purposes
|
199 |
*/
|
200 |
$configErrors = Mage::registry('postnl_enabled_checkout_errors');
|
201 |
-
|
202 |
if (is_null($configErrors)) {
|
203 |
-
return
|
204 |
}
|
205 |
-
|
206 |
$errorMessage = $helper->__('PostNL Checkout is not available due to the following reasons:');
|
207 |
foreach ($configErrors as $error) {
|
208 |
$errorMessage .= PHP_EOL . $error['message'];
|
209 |
}
|
210 |
-
|
211 |
Mage::register('postnl_checkout_logged', true);
|
212 |
$helper->log($errorMessage);
|
213 |
-
|
214 |
/**
|
215 |
* Do not render the checkout button
|
216 |
*/
|
217 |
return '';
|
218 |
}
|
219 |
-
|
220 |
return parent::_toHtml();
|
221 |
}
|
222 |
}
|
223 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* ___________ __ __
|
4 |
+
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
+
* \/
|
9 |
+
* ___ __ __
|
10 |
+
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
+
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
+
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
+
* \/ \/
|
15 |
+
* ________
|
16 |
+
* / _____/_______ ____ __ __ ______
|
17 |
+
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
+
* \______ /|__| \____/ |____/ | __/
|
20 |
+
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
+
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
43 |
*/
|
44 |
const CHECKOUT_BUTTON_TEST_BASE_URL = 'https://tppcb-sandbox.e-id.nl/Button/Checkout';
|
45 |
const CHECKOUT_BUTTON_LIVE_BASE_URL = 'https://checkout.postnl.nl/Button/Checkout';
|
46 |
+
|
47 |
/**
|
48 |
* XML path to public webshop ID setting
|
49 |
*/
|
50 |
const XML_PATH_PUBLIC_WEBSHOP_ID = 'postnl/cif/public_webshop_id';
|
51 |
+
|
52 |
/**
|
53 |
* XML path to 'hide_button_if_disallowed' setting
|
54 |
*/
|
55 |
const XML_PATH_HIDE_BUTTON_IF_DISALLOWED = 'postnl/checkout/hide_button_if_disallowed';
|
56 |
+
|
57 |
/**
|
58 |
* XML path to the 'instruction_cms_page' setting
|
59 |
*/
|
60 |
const XML_PATH_INSTRUCTION_CMS_PAGE = 'postnl/checkout/instruction_cms_page';
|
61 |
+
|
62 |
/**
|
63 |
* Gets the checkout URL
|
64 |
+
*
|
65 |
* @return string
|
66 |
*/
|
67 |
public function getCheckoutUrl()
|
68 |
{
|
69 |
$url = Mage::helper('checkout/url')->getCheckoutUrl();
|
70 |
+
|
71 |
return $url;
|
72 |
}
|
73 |
+
|
74 |
/**
|
75 |
* Check if the button should be disabled
|
76 |
+
*
|
77 |
* @return boolean
|
78 |
*/
|
79 |
public function isDisabled()
|
81 |
if (!$this->canUsePostnlCheckout()) {
|
82 |
return true;
|
83 |
}
|
84 |
+
|
85 |
return false;
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
* Check if the button should be displayed
|
90 |
+
*
|
91 |
* @return boolean
|
92 |
*/
|
93 |
public function canUsePostnlCheckout()
|
94 |
{
|
95 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
96 |
+
|
97 |
$helper = Mage::helper('postnl/checkout');
|
98 |
$canUseCheckout = $helper->canUsePostnlCheckout($quote);
|
99 |
+
|
100 |
/**
|
101 |
* If Checkout is not available, log the reason why for debugging purposes
|
102 |
*/
|
105 |
if (is_null($configErrors)) {
|
106 |
$configErrors = Mage::registry('postnl_enabled_checkout_errors');
|
107 |
}
|
108 |
+
|
109 |
if (is_null($configErrors)) {
|
110 |
return $canUseCheckout;
|
111 |
}
|
112 |
+
|
113 |
$errorMessage = $helper->__('PostNL Checkout is not available due to the following reasons:');
|
114 |
foreach ($configErrors as $error) {
|
115 |
$errorMessage .= PHP_EOL . $error['message'];
|
116 |
}
|
117 |
+
|
118 |
Mage::register('postnl_checkout_logged', true);
|
119 |
$helper->log($errorMessage);
|
120 |
}
|
121 |
+
|
122 |
return $canUseCheckout;
|
123 |
+
|
124 |
}
|
125 |
+
|
126 |
/**
|
127 |
* Gets this webshop's public ID
|
128 |
+
*
|
129 |
* @return string
|
130 |
*/
|
131 |
public function getPublicWebshopId()
|
133 |
if ($this->hasPublicWebshopId()) {
|
134 |
return $this->getData('public_webshop_id');
|
135 |
}
|
136 |
+
|
137 |
$webshopId = Mage::getStoreConfig(self::XML_PATH_PUBLIC_WEBSHOP_ID, Mage::app()->getStore()->getId());
|
138 |
+
|
139 |
$this->setPublicWebshopId($webshopId);
|
140 |
return $webshopId;
|
141 |
}
|
142 |
+
|
143 |
/**
|
144 |
* Gets the checkout button src attribute
|
145 |
+
*
|
146 |
* @param boolean $forceDisabled
|
147 |
+
*
|
148 |
* @return string
|
149 |
*/
|
150 |
public function getSrc($forceDisabled = false)
|
154 |
} else {
|
155 |
$baseUrl = self::CHECKOUT_BUTTON_LIVE_BASE_URL;
|
156 |
}
|
157 |
+
|
158 |
$webshopId = $this->getPublicWebshopId();
|
159 |
+
|
160 |
+
$url = $baseUrl
|
161 |
. '?publicId=' . $webshopId
|
162 |
. '&format=Large'
|
163 |
. '&type=Orange';
|
164 |
+
|
165 |
if ($forceDisabled === true || $this->isDisabled()) {
|
166 |
$url .= '&disabled=true';
|
167 |
}
|
168 |
+
|
169 |
return $url;
|
170 |
}
|
171 |
+
|
172 |
/**
|
173 |
* Gets the URL of a CMS page containing instructions on how to use PostNL Checkout
|
174 |
+
*
|
175 |
* @return boolean|string
|
176 |
*/
|
177 |
public function getInstructionUrl()
|
180 |
if (!$instructionPage) {
|
181 |
return false;
|
182 |
}
|
183 |
+
|
184 |
$pageUrl = Mage::helper('cms/page')->getPageUrl($instructionPage);
|
185 |
return $pageUrl;
|
186 |
}
|
187 |
+
|
188 |
/**
|
189 |
* Returns the block's html. Checks if the 'use_postnl_checkout' param is set. If not, returns and empty string
|
190 |
+
*
|
191 |
* @return string
|
192 |
*/
|
193 |
protected function _toHtml()
|
198 |
* If Checkout is not available, log the reason why for debugging purposes
|
199 |
*/
|
200 |
$configErrors = Mage::registry('postnl_enabled_checkout_errors');
|
201 |
+
|
202 |
if (is_null($configErrors)) {
|
203 |
+
return '';
|
204 |
}
|
205 |
+
|
206 |
$errorMessage = $helper->__('PostNL Checkout is not available due to the following reasons:');
|
207 |
foreach ($configErrors as $error) {
|
208 |
$errorMessage .= PHP_EOL . $error['message'];
|
209 |
}
|
210 |
+
|
211 |
Mage::register('postnl_checkout_logged', true);
|
212 |
$helper->log($errorMessage);
|
213 |
+
|
214 |
/**
|
215 |
* Do not render the checkout button
|
216 |
*/
|
217 |
return '';
|
218 |
}
|
219 |
+
|
220 |
return parent::_toHtml();
|
221 |
}
|
222 |
}
|
|
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* ___________ __ __
|
4 |
-
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
-
* \/
|
9 |
-
* ___ __ __
|
10 |
-
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
-
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
-
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
-
* \/ \/
|
15 |
-
* ________
|
16 |
-
* / _____/_______ ____ __ __ ______
|
17 |
-
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
-
* \______ /|__| \____/ |____/ | __/
|
20 |
-
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
-
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
@@ -43,33 +43,33 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
43 |
*/
|
44 |
const XML_PATH_CHECKOUT_ACTIVE = 'postnl/checkout/active';
|
45 |
const XML_PATH_USE_CHECKOUT = 'postnl/cif/use_checkout';
|
46 |
-
|
47 |
/**
|
48 |
* XML path to all PostNL Checkout payment methods.
|
49 |
* N.B. last part of the XML path is missing.
|
50 |
*/
|
51 |
const XML_PATH_CHECKOUT_PAYMENT_METHOD = 'postnl/checkout_payment_methods';
|
52 |
-
|
53 |
/**
|
54 |
* XML path to test / live mode setting
|
55 |
*/
|
56 |
const XML_PATH_TEST_MODE = 'postnl/checkout/mode';
|
57 |
-
|
58 |
/**
|
59 |
* XML path for config options used to determine whether or not PostNL Checkout is available
|
60 |
*/
|
61 |
const XML_PATH_SHOW_CHECKOUT_FOR_LETTER = 'postnl/checkout/show_checkout_for_letter';
|
62 |
const XML_PATH_SHOW_CHECKOUT_FOR_BACKORDERS = 'postnl/checkout/show_checkout_for_backorders';
|
63 |
-
|
64 |
/**
|
65 |
* Log filename to log all non-specific PostNL debug messages
|
66 |
*/
|
67 |
const POSTNL_DEBUG_LOG_FILE = 'TIG_PostNL_Checkout_Debug.log';
|
68 |
-
|
69 |
/**
|
70 |
-
* Array of payment methods supported by PostNL Checkout.
|
71 |
* Keys are the names used in system.xml, values are codes used by PostNL Checkout.
|
72 |
-
*
|
73 |
* @var array
|
74 |
*/
|
75 |
protected $_checkoutPaymentMethods = array(
|
@@ -82,14 +82,14 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
82 |
'vooraf_betalen' => 'VOORAF',
|
83 |
'termijnen' => 'TERMIJNEN',
|
84 |
'giftcard' => 'KADOBON',
|
85 |
-
'rabobank_internetkassa' => 'RABOINTKASSA',
|
86 |
'afterpay' => 'AFTERPAY',
|
87 |
'klarna' => 'KLARNA',
|
88 |
);
|
89 |
-
|
90 |
/**
|
91 |
* An array of required configuration settings
|
92 |
-
*
|
93 |
* @var array
|
94 |
*/
|
95 |
protected $_checkoutRequiredFields = array(
|
@@ -97,11 +97,11 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
97 |
'postnl/cif/webshop_id',
|
98 |
'postnl/cif/public_webshop_id',
|
99 |
);
|
100 |
-
|
101 |
/**
|
102 |
* Array containing conversions between PostNL CHeckout payment option fields and those used by Magento payment methods.
|
103 |
* This array should be extended as time goes on in order to support as many payment methods as possible.
|
104 |
-
*
|
105 |
* @var array
|
106 |
*/
|
107 |
protected $_optionConversionArray = array(
|
@@ -129,10 +129,10 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
129 |
'0161' => 'FVLBNL22',
|
130 |
),
|
131 |
);
|
132 |
-
|
133 |
/**
|
134 |
* Gets a list of payment methods supported by PostNL Checkout
|
135 |
-
*
|
136 |
* @return array
|
137 |
*/
|
138 |
public function getCheckoutPaymentMethods()
|
@@ -140,10 +140,10 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
140 |
$paymentMethods = $this->_checkoutPaymentMethods;
|
141 |
return $paymentMethods;
|
142 |
}
|
143 |
-
|
144 |
/**
|
145 |
* Returns an array of configuration settings that must be entered for PostNL Checkout to function
|
146 |
-
*
|
147 |
* @return array
|
148 |
*/
|
149 |
public function getCheckoutRequiredFields()
|
@@ -151,10 +151,10 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
151 |
$requiredFields = $this->_checkoutRequiredFields;
|
152 |
return $requiredFields;
|
153 |
}
|
154 |
-
|
155 |
/**
|
156 |
* Returns a conversion array used to convert PostNL Checkout payment method fields to those used by Magento payment methods.
|
157 |
-
*
|
158 |
* @return array
|
159 |
*/
|
160 |
public function getOptionConversionArray()
|
@@ -162,44 +162,44 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
162 |
$conversionArray = array(
|
163 |
'conversion_array' => $this->_optionConversionArray
|
164 |
);
|
165 |
-
|
166 |
$conversionObject = new Varien_Object($conversionArray);
|
167 |
-
|
168 |
/**
|
169 |
-
* You can observe this event in order to add (or modify) conversion options. This prevents you from having to overload
|
170 |
* this helper if you want to change this functionality.
|
171 |
*/
|
172 |
Mage::dispatchEvent(
|
173 |
-
'postnl_checkout_option_conversion_before',
|
174 |
array(
|
175 |
'conversion_object' => $conversionObject,
|
176 |
)
|
177 |
);
|
178 |
-
|
179 |
return $conversionObject->getConversionArray();;
|
180 |
}
|
181 |
-
|
182 |
/**
|
183 |
* Restores a quote to working order
|
184 |
-
*
|
185 |
* @param Mage_Sales_Model_Quote $quote
|
186 |
-
*
|
187 |
* @return Mage_Sales_Model_Quote
|
188 |
*/
|
189 |
public function restoreQuote(Mage_Sales_Model_Quote $quote)
|
190 |
{
|
191 |
$quote->setIsActive(true)
|
192 |
->save();
|
193 |
-
|
194 |
return $quote;
|
195 |
}
|
196 |
-
|
197 |
/**
|
198 |
* Check if PostNL Checkout may be used for a specified quote
|
199 |
-
*
|
200 |
* @param Mage_Sales_Model_Quote $quote
|
201 |
* @param boolean $sendPing
|
202 |
-
*
|
203 |
* @return boolean
|
204 |
*/
|
205 |
public function canUsePostnlCheckout(Mage_Sales_Model_Quote $quote, $sendPing = false)
|
@@ -207,13 +207,13 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
207 |
if (Mage::registry('can_use_postnl_checkout') !== null) {
|
208 |
return Mage::registry('can_use_postnl_checkout');
|
209 |
}
|
210 |
-
|
211 |
$checkoutEnabled = $this->isCheckoutEnabled();
|
212 |
if (!$checkoutEnabled) {
|
213 |
Mage::register('can_use_postnl_checkout', false);
|
214 |
return false;
|
215 |
}
|
216 |
-
|
217 |
/**
|
218 |
* PostNL Checkout cannot be used for virtual orders
|
219 |
*/
|
@@ -228,7 +228,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
228 |
Mage::register('can_use_postnl_checkout', false);
|
229 |
return false;
|
230 |
}
|
231 |
-
|
232 |
/**
|
233 |
* Check if the quote has a valid minimum amount
|
234 |
*/
|
@@ -243,7 +243,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
243 |
Mage::register('can_use_postnl_checkout', false);
|
244 |
return false;
|
245 |
}
|
246 |
-
|
247 |
/**
|
248 |
* Check that dutch addresses are allowed
|
249 |
*/
|
@@ -258,9 +258,9 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
258 |
Mage::register('can_use_postnl_checkout', false);
|
259 |
return false;
|
260 |
}
|
261 |
-
|
262 |
$storeId = $quote->getStoreId();
|
263 |
-
|
264 |
/**
|
265 |
* Check if PostNL Checkout may be used for 'letter' orders and if not, if the quote could fit in an envelope
|
266 |
*/
|
@@ -279,7 +279,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
279 |
return false;
|
280 |
}
|
281 |
}
|
282 |
-
|
283 |
/**
|
284 |
* Check if PostNL Checkout may be used for out-og-stock orders and if not, whether the quote has any such products
|
285 |
*/
|
@@ -298,7 +298,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
298 |
return false;
|
299 |
}
|
300 |
}
|
301 |
-
|
302 |
if ($sendPing === true) {
|
303 |
/**
|
304 |
* Send a ping request to see if the PostNL Checkout service is available
|
@@ -311,13 +311,13 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
311 |
Mage::register('can_use_postnl_checkout', false);
|
312 |
return false;
|
313 |
}
|
314 |
-
|
315 |
if ($result !== 'OK') {
|
316 |
Mage::register('can_use_postnl_checkout', false);
|
317 |
return false;
|
318 |
}
|
319 |
}
|
320 |
-
|
321 |
Mage::register('can_use_postnl_checkout', true);
|
322 |
return true;
|
323 |
}
|
@@ -325,12 +325,12 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
325 |
/**
|
326 |
* Checks if a quote is a letter.
|
327 |
* For now it only checks if the total weight of the quote is less than 2 KG
|
328 |
-
*
|
329 |
* @param mixed $quoteItems Either a quote object, or an array or collection of quote items
|
330 |
* @param null|int $storeId
|
331 |
-
*
|
332 |
* @return boolean
|
333 |
-
*
|
334 |
* @todo Expand this method to also check the size of products to see if they fit in an envelope
|
335 |
*/
|
336 |
public function quoteIsLetter($quoteItems, $storeId = null)
|
@@ -338,30 +338,30 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
338 |
if ($quoteItems instanceof Mage_Sales_Model_Quote) {
|
339 |
$quoteItems = $quoteItems->getAllItems();
|
340 |
}
|
341 |
-
|
342 |
if (is_null($storeId)) {
|
343 |
$storeId = Mage::app()->getStore()->getId();
|
344 |
}
|
345 |
-
|
346 |
$totalWeight = 0;
|
347 |
foreach ($quoteItems as $item) {
|
348 |
$totalWeight += $item->getRowWeight();
|
349 |
}
|
350 |
-
|
351 |
$kilograms = Mage::helper('postnl/cif')->standardizeWeight($totalWeight, $storeId);
|
352 |
-
|
353 |
if ($kilograms < 2) {
|
354 |
return true;
|
355 |
}
|
356 |
-
|
357 |
return false;
|
358 |
}
|
359 |
|
360 |
/**
|
361 |
* Check if a quote has out of stock products
|
362 |
-
*
|
363 |
* @param mixed $quoteItems Either a quote object, or an array or collection of quote items
|
364 |
-
*
|
365 |
* @return boolean
|
366 |
*/
|
367 |
public function quoteHasOutOfStockItems($quoteItems)
|
@@ -369,44 +369,22 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
369 |
if ($quoteItems instanceof Mage_Sales_Model_Quote) {
|
370 |
$quoteItems = $quoteItems->getAllItems();
|
371 |
}
|
372 |
-
|
373 |
-
$
|
374 |
foreach ($quoteItems as $item) {
|
375 |
-
$
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
*
|
381 |
-
* The resulting query:
|
382 |
-
* SELECT `main_table`.`item_id` , `cp_table`.`type_id`
|
383 |
-
* FROM `cataloginventory_stock_item` AS `main_table`
|
384 |
-
* INNER JOIN `catalog_product_entity` AS `cp_table` ON main_table.product_id = cp_table.entity_id
|
385 |
-
* WHERE (
|
386 |
-
* product_id
|
387 |
-
* IN (
|
388 |
-
* {$productIds}
|
389 |
-
* )
|
390 |
-
* )
|
391 |
-
* AND (
|
392 |
-
* qty <=0
|
393 |
-
* )
|
394 |
-
*/
|
395 |
-
$stockCollection = Mage::getResourceModel('cataloginventory/stock_item_collection');
|
396 |
-
$stockCollection->addFieldToSelect('item_id')
|
397 |
-
->addFieldToFilter('product_id', array('in' => $productIds))
|
398 |
-
->addFieldToFilter('qty', array('lteq' => 0));
|
399 |
-
|
400 |
-
if ($stockCollection->getSize() > 0) {
|
401 |
-
return true;
|
402 |
}
|
403 |
-
|
404 |
return false;
|
405 |
}
|
406 |
-
|
407 |
/**
|
408 |
* Check if the module is set to test mode
|
409 |
-
*
|
410 |
* @return boolean
|
411 |
*/
|
412 |
public function isTestMode($storeId = false)
|
@@ -414,28 +392,28 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
414 |
if (Mage::registry('postnl_checkout_test_mode') !== null) {
|
415 |
return Mage::registry('postnl_checkout_test_mode');
|
416 |
}
|
417 |
-
|
418 |
if ($storeId === false) {
|
419 |
$storeId = Mage::app()->getStore()->getId();
|
420 |
}
|
421 |
-
|
422 |
$testModeAllowed = $this->isTestModeAllowed();
|
423 |
if (!$testModeAllowed) {
|
424 |
Mage::register('postnl_checkout_test_mode', false);
|
425 |
return false;
|
426 |
}
|
427 |
-
|
428 |
$testMode = Mage::getStoreConfigFlag(self::XML_PATH_TEST_MODE, $storeId);
|
429 |
-
|
430 |
Mage::register('postnl_checkout_test_mode', $testMode);
|
431 |
return $testMode;
|
432 |
}
|
433 |
-
|
434 |
/**
|
435 |
* Checks if PostNL Checkout is active
|
436 |
-
*
|
437 |
* @param null|int $storeId
|
438 |
-
*
|
439 |
* @return boolean
|
440 |
*/
|
441 |
public function isCheckoutActive($storeId = null)
|
@@ -443,22 +421,22 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
443 |
if (is_null($storeId)) {
|
444 |
$storeId = Mage::app()->getStore()->getId();
|
445 |
}
|
446 |
-
|
447 |
$useCheckout = Mage::getStoreConfigFlag(self::XML_PATH_USE_CHECKOUT, $storeId);
|
448 |
-
|
449 |
if (!$useCheckout) {
|
450 |
return false;
|
451 |
}
|
452 |
-
|
453 |
$isActive = Mage::getStoreConfigFlag(self::XML_PATH_CHECKOUT_ACTIVE, $storeId);
|
454 |
return $isActive;
|
455 |
}
|
456 |
-
|
457 |
/**
|
458 |
* Check if PostNL checkout is enabled
|
459 |
-
*
|
460 |
* @param null|int $storeId
|
461 |
-
*
|
462 |
* @return boolean
|
463 |
*/
|
464 |
public function isCheckoutEnabled($storeId = null)
|
@@ -466,7 +444,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
466 |
if (is_null($storeId)) {
|
467 |
$storeId = Mage::app()->getStore()->getId();
|
468 |
}
|
469 |
-
|
470 |
$isPostnlEnabled = $this->isEnabled($storeId, false, $this->isTestMode());
|
471 |
if ($isPostnlEnabled === false) {
|
472 |
$errors = array(
|
@@ -478,7 +456,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
478 |
Mage::register('postnl_enabled_checkout_errors', $errors);
|
479 |
return false;
|
480 |
}
|
481 |
-
|
482 |
$isCheckoutActive = $this->isCheckoutActive($storeId);
|
483 |
if (!$isCheckoutActive) {
|
484 |
$errors = array(
|
@@ -490,20 +468,20 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
490 |
Mage::register('postnl_enabled_checkout_errors', $errors);
|
491 |
return false;
|
492 |
}
|
493 |
-
|
494 |
$isConfigured = $this->isCheckoutConfigured($storeId);
|
495 |
if (!$isConfigured) {
|
496 |
return false;
|
497 |
}
|
498 |
-
|
499 |
return true;
|
500 |
}
|
501 |
-
|
502 |
/**
|
503 |
* Check if all required fields are entered
|
504 |
-
*
|
505 |
* @param null|int $storeId
|
506 |
-
*
|
507 |
* @return boolean
|
508 |
*/
|
509 |
public function isCheckoutConfigured($storeId = null)
|
@@ -511,41 +489,41 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
511 |
if (is_null($storeId)) {
|
512 |
$storeId = Mage::app()->getStore()->getId();
|
513 |
}
|
514 |
-
|
515 |
$errors = array();
|
516 |
-
|
517 |
/**
|
518 |
* Get the system > config fields for this section
|
519 |
*/
|
520 |
$configFields = Mage::getSingleton('adminhtml/config');
|
521 |
$sections = $configFields->getSections('postnl');
|
522 |
$section = $sections->postnl;
|
523 |
-
|
524 |
/**
|
525 |
* First check if all required configuration settings are entered
|
526 |
*/
|
527 |
$requiredFields = $this->getCheckoutRequiredFields();
|
528 |
foreach ($requiredFields as $requiredField) {
|
529 |
$value = Mage::getStoreConfig($requiredField, $storeId);
|
530 |
-
|
531 |
if ($value === null || $value === '') {
|
532 |
$fieldParts = explode('/', $requiredField);
|
533 |
$field = $fieldParts[2];
|
534 |
$group = $fieldParts[1];
|
535 |
-
|
536 |
$label = (string) $section->groups->$group->fields->$field->label;
|
537 |
$groupLabel = (string) $section->groups->$group->label;
|
538 |
$groupName = $section->groups->$group->getName();
|
539 |
-
|
540 |
$errors[] = array(
|
541 |
'code' => 'POSTNL-0034',
|
542 |
'message' => $this->__('%s > %s is required.', $this->__($groupLabel), $this->__($label)),
|
543 |
);
|
544 |
-
|
545 |
$this->saveConfigState(array('postnl_' . $groupName => 1));
|
546 |
}
|
547 |
}
|
548 |
-
|
549 |
/**
|
550 |
* If any errors were detected, add them to the registry and return false
|
551 |
*/
|
@@ -553,7 +531,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
553 |
Mage::register('postnl_is_configured_checkout_errors', $errors);
|
554 |
return false;
|
555 |
}
|
556 |
-
|
557 |
/**
|
558 |
* Go through each supported payment method. At least one of them must be activated.
|
559 |
*/
|
@@ -566,7 +544,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
566 |
return true;
|
567 |
}
|
568 |
}
|
569 |
-
|
570 |
/**
|
571 |
* If no payment method was activated the extension is not configured properly
|
572 |
*/
|
@@ -576,11 +554,11 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
|
|
576 |
'message' => $this->__('You need to enable at least one payment method.'),
|
577 |
)
|
578 |
);
|
579 |
-
|
580 |
$this->saveConfigState(array('postnl_checkout_payment_methods' => 1));
|
581 |
-
|
582 |
Mage::register(
|
583 |
-
'postnl_is_configured_checkout_errors',
|
584 |
$errors
|
585 |
);
|
586 |
return false;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* ___________ __ __
|
4 |
+
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
+
* \/
|
9 |
+
* ___ __ __
|
10 |
+
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
+
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
+
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
+
* \/ \/
|
15 |
+
* ________
|
16 |
+
* / _____/_______ ____ __ __ ______
|
17 |
+
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
+
* \______ /|__| \____/ |____/ | __/
|
20 |
+
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
+
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
43 |
*/
|
44 |
const XML_PATH_CHECKOUT_ACTIVE = 'postnl/checkout/active';
|
45 |
const XML_PATH_USE_CHECKOUT = 'postnl/cif/use_checkout';
|
46 |
+
|
47 |
/**
|
48 |
* XML path to all PostNL Checkout payment methods.
|
49 |
* N.B. last part of the XML path is missing.
|
50 |
*/
|
51 |
const XML_PATH_CHECKOUT_PAYMENT_METHOD = 'postnl/checkout_payment_methods';
|
52 |
+
|
53 |
/**
|
54 |
* XML path to test / live mode setting
|
55 |
*/
|
56 |
const XML_PATH_TEST_MODE = 'postnl/checkout/mode';
|
57 |
+
|
58 |
/**
|
59 |
* XML path for config options used to determine whether or not PostNL Checkout is available
|
60 |
*/
|
61 |
const XML_PATH_SHOW_CHECKOUT_FOR_LETTER = 'postnl/checkout/show_checkout_for_letter';
|
62 |
const XML_PATH_SHOW_CHECKOUT_FOR_BACKORDERS = 'postnl/checkout/show_checkout_for_backorders';
|
63 |
+
|
64 |
/**
|
65 |
* Log filename to log all non-specific PostNL debug messages
|
66 |
*/
|
67 |
const POSTNL_DEBUG_LOG_FILE = 'TIG_PostNL_Checkout_Debug.log';
|
68 |
+
|
69 |
/**
|
70 |
+
* Array of payment methods supported by PostNL Checkout.
|
71 |
* Keys are the names used in system.xml, values are codes used by PostNL Checkout.
|
72 |
+
*
|
73 |
* @var array
|
74 |
*/
|
75 |
protected $_checkoutPaymentMethods = array(
|
82 |
'vooraf_betalen' => 'VOORAF',
|
83 |
'termijnen' => 'TERMIJNEN',
|
84 |
'giftcard' => 'KADOBON',
|
85 |
+
'rabobank_internetkassa' => 'RABOINTKASSA',
|
86 |
'afterpay' => 'AFTERPAY',
|
87 |
'klarna' => 'KLARNA',
|
88 |
);
|
89 |
+
|
90 |
/**
|
91 |
* An array of required configuration settings
|
92 |
+
*
|
93 |
* @var array
|
94 |
*/
|
95 |
protected $_checkoutRequiredFields = array(
|
97 |
'postnl/cif/webshop_id',
|
98 |
'postnl/cif/public_webshop_id',
|
99 |
);
|
100 |
+
|
101 |
/**
|
102 |
* Array containing conversions between PostNL CHeckout payment option fields and those used by Magento payment methods.
|
103 |
* This array should be extended as time goes on in order to support as many payment methods as possible.
|
104 |
+
*
|
105 |
* @var array
|
106 |
*/
|
107 |
protected $_optionConversionArray = array(
|
129 |
'0161' => 'FVLBNL22',
|
130 |
),
|
131 |
);
|
132 |
+
|
133 |
/**
|
134 |
* Gets a list of payment methods supported by PostNL Checkout
|
135 |
+
*
|
136 |
* @return array
|
137 |
*/
|
138 |
public function getCheckoutPaymentMethods()
|
140 |
$paymentMethods = $this->_checkoutPaymentMethods;
|
141 |
return $paymentMethods;
|
142 |
}
|
143 |
+
|
144 |
/**
|
145 |
* Returns an array of configuration settings that must be entered for PostNL Checkout to function
|
146 |
+
*
|
147 |
* @return array
|
148 |
*/
|
149 |
public function getCheckoutRequiredFields()
|
151 |
$requiredFields = $this->_checkoutRequiredFields;
|
152 |
return $requiredFields;
|
153 |
}
|
154 |
+
|
155 |
/**
|
156 |
* Returns a conversion array used to convert PostNL Checkout payment method fields to those used by Magento payment methods.
|
157 |
+
*
|
158 |
* @return array
|
159 |
*/
|
160 |
public function getOptionConversionArray()
|
162 |
$conversionArray = array(
|
163 |
'conversion_array' => $this->_optionConversionArray
|
164 |
);
|
165 |
+
|
166 |
$conversionObject = new Varien_Object($conversionArray);
|
167 |
+
|
168 |
/**
|
169 |
+
* You can observe this event in order to add (or modify) conversion options. This prevents you from having to overload
|
170 |
* this helper if you want to change this functionality.
|
171 |
*/
|
172 |
Mage::dispatchEvent(
|
173 |
+
'postnl_checkout_option_conversion_before',
|
174 |
array(
|
175 |
'conversion_object' => $conversionObject,
|
176 |
)
|
177 |
);
|
178 |
+
|
179 |
return $conversionObject->getConversionArray();;
|
180 |
}
|
181 |
+
|
182 |
/**
|
183 |
* Restores a quote to working order
|
184 |
+
*
|
185 |
* @param Mage_Sales_Model_Quote $quote
|
186 |
+
*
|
187 |
* @return Mage_Sales_Model_Quote
|
188 |
*/
|
189 |
public function restoreQuote(Mage_Sales_Model_Quote $quote)
|
190 |
{
|
191 |
$quote->setIsActive(true)
|
192 |
->save();
|
193 |
+
|
194 |
return $quote;
|
195 |
}
|
196 |
+
|
197 |
/**
|
198 |
* Check if PostNL Checkout may be used for a specified quote
|
199 |
+
*
|
200 |
* @param Mage_Sales_Model_Quote $quote
|
201 |
* @param boolean $sendPing
|
202 |
+
*
|
203 |
* @return boolean
|
204 |
*/
|
205 |
public function canUsePostnlCheckout(Mage_Sales_Model_Quote $quote, $sendPing = false)
|
207 |
if (Mage::registry('can_use_postnl_checkout') !== null) {
|
208 |
return Mage::registry('can_use_postnl_checkout');
|
209 |
}
|
210 |
+
|
211 |
$checkoutEnabled = $this->isCheckoutEnabled();
|
212 |
if (!$checkoutEnabled) {
|
213 |
Mage::register('can_use_postnl_checkout', false);
|
214 |
return false;
|
215 |
}
|
216 |
+
|
217 |
/**
|
218 |
* PostNL Checkout cannot be used for virtual orders
|
219 |
*/
|
228 |
Mage::register('can_use_postnl_checkout', false);
|
229 |
return false;
|
230 |
}
|
231 |
+
|
232 |
/**
|
233 |
* Check if the quote has a valid minimum amount
|
234 |
*/
|
243 |
Mage::register('can_use_postnl_checkout', false);
|
244 |
return false;
|
245 |
}
|
246 |
+
|
247 |
/**
|
248 |
* Check that dutch addresses are allowed
|
249 |
*/
|
258 |
Mage::register('can_use_postnl_checkout', false);
|
259 |
return false;
|
260 |
}
|
261 |
+
|
262 |
$storeId = $quote->getStoreId();
|
263 |
+
|
264 |
/**
|
265 |
* Check if PostNL Checkout may be used for 'letter' orders and if not, if the quote could fit in an envelope
|
266 |
*/
|
279 |
return false;
|
280 |
}
|
281 |
}
|
282 |
+
|
283 |
/**
|
284 |
* Check if PostNL Checkout may be used for out-og-stock orders and if not, whether the quote has any such products
|
285 |
*/
|
298 |
return false;
|
299 |
}
|
300 |
}
|
301 |
+
|
302 |
if ($sendPing === true) {
|
303 |
/**
|
304 |
* Send a ping request to see if the PostNL Checkout service is available
|
311 |
Mage::register('can_use_postnl_checkout', false);
|
312 |
return false;
|
313 |
}
|
314 |
+
|
315 |
if ($result !== 'OK') {
|
316 |
Mage::register('can_use_postnl_checkout', false);
|
317 |
return false;
|
318 |
}
|
319 |
}
|
320 |
+
|
321 |
Mage::register('can_use_postnl_checkout', true);
|
322 |
return true;
|
323 |
}
|
325 |
/**
|
326 |
* Checks if a quote is a letter.
|
327 |
* For now it only checks if the total weight of the quote is less than 2 KG
|
328 |
+
*
|
329 |
* @param mixed $quoteItems Either a quote object, or an array or collection of quote items
|
330 |
* @param null|int $storeId
|
331 |
+
*
|
332 |
* @return boolean
|
333 |
+
*
|
334 |
* @todo Expand this method to also check the size of products to see if they fit in an envelope
|
335 |
*/
|
336 |
public function quoteIsLetter($quoteItems, $storeId = null)
|
338 |
if ($quoteItems instanceof Mage_Sales_Model_Quote) {
|
339 |
$quoteItems = $quoteItems->getAllItems();
|
340 |
}
|
341 |
+
|
342 |
if (is_null($storeId)) {
|
343 |
$storeId = Mage::app()->getStore()->getId();
|
344 |
}
|
345 |
+
|
346 |
$totalWeight = 0;
|
347 |
foreach ($quoteItems as $item) {
|
348 |
$totalWeight += $item->getRowWeight();
|
349 |
}
|
350 |
+
|
351 |
$kilograms = Mage::helper('postnl/cif')->standardizeWeight($totalWeight, $storeId);
|
352 |
+
|
353 |
if ($kilograms < 2) {
|
354 |
return true;
|
355 |
}
|
356 |
+
|
357 |
return false;
|
358 |
}
|
359 |
|
360 |
/**
|
361 |
* Check if a quote has out of stock products
|
362 |
+
*
|
363 |
* @param mixed $quoteItems Either a quote object, or an array or collection of quote items
|
364 |
+
*
|
365 |
* @return boolean
|
366 |
*/
|
367 |
public function quoteHasOutOfStockItems($quoteItems)
|
369 |
if ($quoteItems instanceof Mage_Sales_Model_Quote) {
|
370 |
$quoteItems = $quoteItems->getAllItems();
|
371 |
}
|
372 |
+
|
373 |
+
/** @var Mage_Sales_Model_Quote_Item $item */
|
374 |
foreach ($quoteItems as $item) {
|
375 |
+
$product = $item->getProduct();
|
376 |
+
|
377 |
+
if (!$product->isInStock()) {
|
378 |
+
return true;
|
379 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
}
|
381 |
+
|
382 |
return false;
|
383 |
}
|
384 |
+
|
385 |
/**
|
386 |
* Check if the module is set to test mode
|
387 |
+
*
|
388 |
* @return boolean
|
389 |
*/
|
390 |
public function isTestMode($storeId = false)
|
392 |
if (Mage::registry('postnl_checkout_test_mode') !== null) {
|
393 |
return Mage::registry('postnl_checkout_test_mode');
|
394 |
}
|
395 |
+
|
396 |
if ($storeId === false) {
|
397 |
$storeId = Mage::app()->getStore()->getId();
|
398 |
}
|
399 |
+
|
400 |
$testModeAllowed = $this->isTestModeAllowed();
|
401 |
if (!$testModeAllowed) {
|
402 |
Mage::register('postnl_checkout_test_mode', false);
|
403 |
return false;
|
404 |
}
|
405 |
+
|
406 |
$testMode = Mage::getStoreConfigFlag(self::XML_PATH_TEST_MODE, $storeId);
|
407 |
+
|
408 |
Mage::register('postnl_checkout_test_mode', $testMode);
|
409 |
return $testMode;
|
410 |
}
|
411 |
+
|
412 |
/**
|
413 |
* Checks if PostNL Checkout is active
|
414 |
+
*
|
415 |
* @param null|int $storeId
|
416 |
+
*
|
417 |
* @return boolean
|
418 |
*/
|
419 |
public function isCheckoutActive($storeId = null)
|
421 |
if (is_null($storeId)) {
|
422 |
$storeId = Mage::app()->getStore()->getId();
|
423 |
}
|
424 |
+
|
425 |
$useCheckout = Mage::getStoreConfigFlag(self::XML_PATH_USE_CHECKOUT, $storeId);
|
426 |
+
|
427 |
if (!$useCheckout) {
|
428 |
return false;
|
429 |
}
|
430 |
+
|
431 |
$isActive = Mage::getStoreConfigFlag(self::XML_PATH_CHECKOUT_ACTIVE, $storeId);
|
432 |
return $isActive;
|
433 |
}
|
434 |
+
|
435 |
/**
|
436 |
* Check if PostNL checkout is enabled
|
437 |
+
*
|
438 |
* @param null|int $storeId
|
439 |
+
*
|
440 |
* @return boolean
|
441 |
*/
|
442 |
public function isCheckoutEnabled($storeId = null)
|
444 |
if (is_null($storeId)) {
|
445 |
$storeId = Mage::app()->getStore()->getId();
|
446 |
}
|
447 |
+
|
448 |
$isPostnlEnabled = $this->isEnabled($storeId, false, $this->isTestMode());
|
449 |
if ($isPostnlEnabled === false) {
|
450 |
$errors = array(
|
456 |
Mage::register('postnl_enabled_checkout_errors', $errors);
|
457 |
return false;
|
458 |
}
|
459 |
+
|
460 |
$isCheckoutActive = $this->isCheckoutActive($storeId);
|
461 |
if (!$isCheckoutActive) {
|
462 |
$errors = array(
|
468 |
Mage::register('postnl_enabled_checkout_errors', $errors);
|
469 |
return false;
|
470 |
}
|
471 |
+
|
472 |
$isConfigured = $this->isCheckoutConfigured($storeId);
|
473 |
if (!$isConfigured) {
|
474 |
return false;
|
475 |
}
|
476 |
+
|
477 |
return true;
|
478 |
}
|
479 |
+
|
480 |
/**
|
481 |
* Check if all required fields are entered
|
482 |
+
*
|
483 |
* @param null|int $storeId
|
484 |
+
*
|
485 |
* @return boolean
|
486 |
*/
|
487 |
public function isCheckoutConfigured($storeId = null)
|
489 |
if (is_null($storeId)) {
|
490 |
$storeId = Mage::app()->getStore()->getId();
|
491 |
}
|
492 |
+
|
493 |
$errors = array();
|
494 |
+
|
495 |
/**
|
496 |
* Get the system > config fields for this section
|
497 |
*/
|
498 |
$configFields = Mage::getSingleton('adminhtml/config');
|
499 |
$sections = $configFields->getSections('postnl');
|
500 |
$section = $sections->postnl;
|
501 |
+
|
502 |
/**
|
503 |
* First check if all required configuration settings are entered
|
504 |
*/
|
505 |
$requiredFields = $this->getCheckoutRequiredFields();
|
506 |
foreach ($requiredFields as $requiredField) {
|
507 |
$value = Mage::getStoreConfig($requiredField, $storeId);
|
508 |
+
|
509 |
if ($value === null || $value === '') {
|
510 |
$fieldParts = explode('/', $requiredField);
|
511 |
$field = $fieldParts[2];
|
512 |
$group = $fieldParts[1];
|
513 |
+
|
514 |
$label = (string) $section->groups->$group->fields->$field->label;
|
515 |
$groupLabel = (string) $section->groups->$group->label;
|
516 |
$groupName = $section->groups->$group->getName();
|
517 |
+
|
518 |
$errors[] = array(
|
519 |
'code' => 'POSTNL-0034',
|
520 |
'message' => $this->__('%s > %s is required.', $this->__($groupLabel), $this->__($label)),
|
521 |
);
|
522 |
+
|
523 |
$this->saveConfigState(array('postnl_' . $groupName => 1));
|
524 |
}
|
525 |
}
|
526 |
+
|
527 |
/**
|
528 |
* If any errors were detected, add them to the registry and return false
|
529 |
*/
|
531 |
Mage::register('postnl_is_configured_checkout_errors', $errors);
|
532 |
return false;
|
533 |
}
|
534 |
+
|
535 |
/**
|
536 |
* Go through each supported payment method. At least one of them must be activated.
|
537 |
*/
|
544 |
return true;
|
545 |
}
|
546 |
}
|
547 |
+
|
548 |
/**
|
549 |
* If no payment method was activated the extension is not configured properly
|
550 |
*/
|
554 |
'message' => $this->__('You need to enable at least one payment method.'),
|
555 |
)
|
556 |
);
|
557 |
+
|
558 |
$this->saveConfigState(array('postnl_checkout_payment_methods' => 1));
|
559 |
+
|
560 |
Mage::register(
|
561 |
+
'postnl_is_configured_checkout_errors',
|
562 |
$errors
|
563 |
);
|
564 |
return false;
|
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* ___________ __ __
|
4 |
-
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
-
* \/
|
9 |
-
* ___ __ __
|
10 |
-
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
-
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
-
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
-
* \/ \/
|
15 |
-
* ________
|
16 |
-
* / _____/_______ ____ __ __ ______
|
17 |
-
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
-
* \______ /|__| \____/ |____/ | __/
|
20 |
-
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
-
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
@@ -36,10 +36,10 @@
|
|
36 |
* @copyright Copyright (c) 2013 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
|
37 |
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
38 |
*/
|
39 |
-
|
40 |
/**
|
41 |
* Class containing all default methods used for CIF communication by this extension.
|
42 |
-
*
|
43 |
* If you wish to add new methods you can etxend this class or create a new class that extends TIG_PostNL_Model_Core_Cif_Abstract
|
44 |
*/
|
45 |
class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
@@ -52,7 +52,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
52 |
const XML_PATH_COLLECTION_LOCATION = 'postnl/cif/collection_location';
|
53 |
const XML_PATH_GLOBAL_BARCODE_TYPE = 'postnl/cif/global_barcode_type';
|
54 |
const XML_PATH_GLOBAL_BARCODE_RANGE = 'postnl/cif/global_barcode_range';
|
55 |
-
|
56 |
/**
|
57 |
* Constants containing XML paths to cif address configuration options
|
58 |
*/
|
@@ -67,7 +67,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
67 |
const XML_PATH_DOORCODE_FIELD = 'postnl/cif_address/doorcode_field';
|
68 |
const XML_PATH_FLOOR_FIELD = 'postnl/cif_address/floor_field';
|
69 |
const XML_PATH_REMARK_FIELD = 'postnl/cif_address/remark_field';
|
70 |
-
|
71 |
/**
|
72 |
* Constants containing xml paths to cif customs configuration options
|
73 |
*/
|
@@ -80,32 +80,32 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
80 |
const XML_PATH_GLOBALPACK_DESCRIPTION_ATTRIBUTE = 'postnl/cif_globalpack_settings/description_attribute';
|
81 |
const XML_PATH_GLOBALPACK_PRODUCT_SORTING_ATTRIBUTE = 'postnl/cif_globalpack_settings/product_sorting_attribute';
|
82 |
const XML_PATH_GLOBALPACK_PRODUCT_SORTING_DIRECTION = 'postnl/cif_globalpack_settings/product_sorting_direction';
|
83 |
-
|
84 |
/**
|
85 |
* XML path to setting that dtermines whether to use a seperate return address
|
86 |
*/
|
87 |
const XML_PATH_USE_SENDER_ADDRESS_AS_RETURN = 'postnl/cif_return_address/use_sender_address';
|
88 |
-
|
89 |
/**
|
90 |
* XML path to sender address data.
|
91 |
-
*
|
92 |
* N.B. missing last part so this will return an array of all fields.
|
93 |
*/
|
94 |
const XML_PATH_SENDER_ADDRESS = 'postnl/cif_sender_address';
|
95 |
-
|
96 |
/**
|
97 |
* XML path to return address data.
|
98 |
-
*
|
99 |
* N.B. missing last part so this will return an array of all fields.
|
100 |
*/
|
101 |
const XML_PATH_RETURN_ADDRESS = 'postnl/cif_return_address';
|
102 |
-
|
103 |
/**
|
104 |
* XML paths for shipment reference info
|
105 |
*/
|
106 |
const XML_PATH_SHIPMENT_REFERENCE_TYPE = 'postnl/cif_labels_and_confirming/shipment_reference_type';
|
107 |
const XML_PATH_CUSTOM_SHIPMENT_REFERENCE = 'postnl/cif_labels_and_confirming/custom_shipment_reference';
|
108 |
-
|
109 |
/**
|
110 |
* Possible barcodes series per barcode type
|
111 |
*/
|
@@ -114,27 +114,27 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
114 |
const EU_BARCODE_SERIE_LONG = '00000000-99999999';
|
115 |
const EU_BARCODE_SERIE_SHORT = '0000000-9999999';
|
116 |
const GLOBAL_BARCODE_SERIE = '0000-9999';
|
117 |
-
|
118 |
/**
|
119 |
* XML path to weight per parcel config setting
|
120 |
*/
|
121 |
-
const XML_PATH_WEIGHT_PER_PARCEL = 'postnl/cif_labels_and_confirming/weight_per_parcel';
|
122 |
-
|
123 |
/**
|
124 |
-
* Regular expression used to split streetname from housenumber. This regex works well for dutch
|
125 |
-
* addresses, but may fail for international addresses. We strongly recommend using split address
|
126 |
* lines instead.
|
127 |
*/
|
128 |
const SPLIT_STREET_REGEX = '#\A(.*?)\s+(\d+[a-zA-Z]{0,1}\s{0,1}[-]{1}\s{0,1}\d*[a-zA-Z]{0,1}|\d+[a-zA-Z-]{0,1}\d*[a-zA-Z]{0,1})#';
|
129 |
-
|
130 |
/**
|
131 |
* Regular expression used to split housenumber and housenumber extension
|
132 |
*/
|
133 |
const SPLIT_HOUSENUMBER_REGEX = '#^([\d]+)(.*)#s';
|
134 |
-
|
135 |
/**
|
136 |
* array containing possible address types
|
137 |
-
*
|
138 |
* @var array
|
139 |
*/
|
140 |
protected $_addressTypes = array(
|
@@ -145,13 +145,13 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
145 |
'Alternative' => '08', // alternative sender. Parcels that cannot be delivered will be returned here
|
146 |
'Delivery' => '09', // for use with PakjeGemak
|
147 |
);
|
148 |
-
|
149 |
/**
|
150 |
* array containing all available printer types. These are used to determine the output type of shipping labels
|
151 |
* currently only GraphicFile|PDF is supported
|
152 |
-
*
|
153 |
* printer type syntax is: <printer family>|<printer type>
|
154 |
-
*
|
155 |
* @var array
|
156 |
*/
|
157 |
protected $_printerTypes = array(
|
@@ -164,26 +164,26 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
164 |
'GraphicFile|JPG 600 dpi',
|
165 |
'GraphicFile|PDF',
|
166 |
'GraphicFile|PS',
|
167 |
-
|
168 |
//Intermec FingerPrint
|
169 |
'IntermecEasyCoder PF4i',
|
170 |
-
|
171 |
//Intermec IDP
|
172 |
'Intermec|EasyCoder E4',
|
173 |
-
|
174 |
//Intermec IPL
|
175 |
'Intermec|EasyCoder PF4i IPL',
|
176 |
-
|
177 |
//Sato
|
178 |
'Sato|GL408e',
|
179 |
-
|
180 |
//Tec TCPL
|
181 |
'TEC|B472',
|
182 |
-
|
183 |
//TECISQ
|
184 |
'Meto|SP 40',
|
185 |
'TEC|B-SV4D',
|
186 |
-
|
187 |
//Zebra EPS2
|
188 |
'Zebra|LP 2844',
|
189 |
'Intermec|Easycoder C4',
|
@@ -191,7 +191,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
191 |
'Zebra|EPL 2 Printers',
|
192 |
'Eltron|Orion',
|
193 |
'Intermec|PF8d',
|
194 |
-
|
195 |
//Zebra ZPL II
|
196 |
'Zebra|LP 2844-Z',
|
197 |
'Zebra|Stripe S600',
|
@@ -208,23 +208,23 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
208 |
'Zebra|S4M',
|
209 |
'Zebra|GK420d',
|
210 |
);
|
211 |
-
|
212 |
/**
|
213 |
-
* Array of countires which may send their full street data in a single line,
|
214 |
* rather than having to split them into streetname, housenr and extension parts
|
215 |
-
*
|
216 |
* @var array
|
217 |
*/
|
218 |
protected $_allowedFullStreetCountries = array(
|
219 |
'NL',
|
220 |
'BE'
|
221 |
);
|
222 |
-
|
223 |
/**
|
224 |
* These shipment types require an invoice in the customs declaration. Other possible shipment types are:
|
225 |
* - Gift
|
226 |
* - Documents
|
227 |
-
*
|
228 |
* @var array
|
229 |
*/
|
230 |
protected $_invoiceRequiredShipmentTypes = array(
|
@@ -232,50 +232,50 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
232 |
'Commercial Sample',
|
233 |
'Returned Goods',
|
234 |
);
|
235 |
-
|
236 |
/**
|
237 |
* Get possible address types
|
238 |
-
*
|
239 |
* @return array
|
240 |
*/
|
241 |
public function getAddressTypes()
|
242 |
{
|
243 |
return $this->_addressTypes;
|
244 |
}
|
245 |
-
|
246 |
/**
|
247 |
* Get possible printer types
|
248 |
-
*
|
249 |
* @return array
|
250 |
*/
|
251 |
public function getPrinterTypes()
|
252 |
{
|
253 |
return $this->_printerTypes;
|
254 |
}
|
255 |
-
|
256 |
/**
|
257 |
* Get country IDs that allow fullstreet usage
|
258 |
-
*
|
259 |
* @return array
|
260 |
*/
|
261 |
public function getAllowedFullStreetCountries()
|
262 |
{
|
263 |
return $this->_allowedFullStreetCountries;
|
264 |
}
|
265 |
-
|
266 |
/**
|
267 |
* Get shipment types that require an invoice number
|
268 |
-
*
|
269 |
* @return array
|
270 |
*/
|
271 |
public function getInvoiceRequiredShipmentTypes()
|
272 |
{
|
273 |
return $this->_invoiceRequiredShipmentTypes;
|
274 |
}
|
275 |
-
|
276 |
/**
|
277 |
* Gets the current store id. If no store id is specified, return the default admin store id
|
278 |
-
*
|
279 |
* @return int
|
280 |
*/
|
281 |
public function getStoreId()
|
@@ -286,32 +286,32 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
286 |
|
287 |
$storeId = Mage_Core_Model_App::ADMIN_STORE_ID;
|
288 |
$this->setStoreId($storeId);
|
289 |
-
|
290 |
return $storeId;
|
291 |
}
|
292 |
-
|
293 |
/**
|
294 |
* Retrieves a barcode from CIF
|
295 |
-
*
|
296 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
297 |
* @param string $barcodeType Which kind of barcode to generate
|
298 |
-
*
|
299 |
* @return string
|
300 |
-
*
|
301 |
* @throws TIG_PostNL_Exception
|
302 |
*/
|
303 |
public function generateBarcode($shipment, $barcodeType = 'NL')
|
304 |
{
|
305 |
$this->setStoreId($shipment->getStoreId());
|
306 |
-
|
307 |
$barcode = $this->_getBarcodeData($barcodeType);
|
308 |
-
|
309 |
$message = $this->_getMessage('');
|
310 |
$customer = $this->_getCustomer();
|
311 |
$range = $barcode['range'];
|
312 |
$type = $barcode['type'];
|
313 |
$serie = $barcode['serie'];
|
314 |
-
|
315 |
$soapParams = array(
|
316 |
'Message' => $message,
|
317 |
'Customer' => $customer,
|
@@ -321,14 +321,14 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
321 |
'Serie' => $serie,
|
322 |
),
|
323 |
);
|
324 |
-
|
325 |
$response = $this->call(
|
326 |
-
'Barcode',
|
327 |
'GenerateBarcode',
|
328 |
$soapParams
|
329 |
);
|
330 |
-
|
331 |
-
if (!is_object($response)
|
332 |
|| !isset($response->Barcode)
|
333 |
) {
|
334 |
throw new TIG_PostNL_Exception(
|
@@ -336,7 +336,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
336 |
'POSTNL-0054'
|
337 |
);
|
338 |
}
|
339 |
-
|
340 |
return $response->Barcode;
|
341 |
}
|
342 |
|
@@ -344,32 +344,32 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
344 |
* Requests a new barcode from CIF as a ping request. This can be used to validate account settings or to check if the CIF
|
345 |
* service is up and running. This is not meant to be used to generate an actual barcode for a shipment. Use the
|
346 |
* generateBarcode method for that.
|
347 |
-
*
|
348 |
* The generateBarcode CIF call was chosena s it is the simplest CIF function available.
|
349 |
-
*
|
350 |
* @param array $data Array containing all data required for the request.
|
351 |
-
*
|
352 |
* @return string
|
353 |
-
*
|
354 |
* @throws TIG_PostNL_Exception
|
355 |
*/
|
356 |
public function generateBarcodePing($data)
|
357 |
{
|
358 |
$this->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID);
|
359 |
-
|
360 |
$barcode = $this->_getBarcodeData('NL');
|
361 |
-
|
362 |
$message = $this->_getMessage('');
|
363 |
-
$range = $
|
364 |
$type = $barcode['type'];
|
365 |
$serie = $barcode['serie'];
|
366 |
-
|
367 |
$customer = array(
|
368 |
'CustomerCode' => $data['customerCode'],
|
369 |
'CustomerNumber' => $data['customerNumber'],
|
370 |
'CollectionLocation' => $data['locationCode'],
|
371 |
);
|
372 |
-
|
373 |
$soapParams = array(
|
374 |
'Message' => $message,
|
375 |
'Customer' => $customer,
|
@@ -379,16 +379,16 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
379 |
'Serie' => $serie,
|
380 |
),
|
381 |
);
|
382 |
-
|
383 |
$response = $this->call(
|
384 |
-
'Barcode',
|
385 |
'GenerateBarcode',
|
386 |
$soapParams,
|
387 |
$data['username'],
|
388 |
$data['password']
|
389 |
);
|
390 |
-
|
391 |
-
if (!is_object($response)
|
392 |
|| !isset($response->Barcode)
|
393 |
) {
|
394 |
throw new TIG_PostNL_Exception(
|
@@ -396,27 +396,27 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
396 |
'POSTNL-0054'
|
397 |
);
|
398 |
}
|
399 |
-
|
400 |
return $response->Barcode;
|
401 |
}
|
402 |
-
|
403 |
/**
|
404 |
* Retrieves the latest shipping status of a shipment from CIF
|
405 |
-
*
|
406 |
* @param TIG_PostNL_Model_Core_Shipment $shipment
|
407 |
-
*
|
408 |
-
* @return StdClass
|
409 |
-
*
|
410 |
* @throws TIG_PostNL_Exception
|
411 |
*/
|
412 |
public function getShipmentStatus($postnlShipment)
|
413 |
{
|
414 |
$shipment = $postnlShipment->getShipment();
|
415 |
-
|
416 |
$barcode = $postnlShipment->getMainBarcode();
|
417 |
$message = $this->_getMessage($barcode);
|
418 |
$customer = $this->_getCustomer();
|
419 |
-
|
420 |
$soapParams = array(
|
421 |
'Message' => $message,
|
422 |
'Customer' => $customer,
|
@@ -424,15 +424,15 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
424 |
'Barcode' => $barcode,
|
425 |
),
|
426 |
);
|
427 |
-
|
428 |
$response = $this->call(
|
429 |
-
'ShippingStatus',
|
430 |
-
'CurrentStatus',
|
431 |
$soapParams
|
432 |
);
|
433 |
-
|
434 |
-
if (!is_object($response)
|
435 |
-
|| !isset($response->Shipments)
|
436 |
|| (!is_array($response->Shipments) && !is_object($response->Shipments))
|
437 |
) {
|
438 |
throw new TIG_PostNL_Exception(
|
@@ -440,7 +440,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
440 |
'POSTNL-0055'
|
441 |
);
|
442 |
}
|
443 |
-
|
444 |
foreach($response->Shipments as $shipment) {
|
445 |
/**
|
446 |
* If $shipment is an array, we need the first item
|
@@ -448,38 +448,38 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
448 |
if (is_array($shipment)) {
|
449 |
$shipment = $shipment[0];
|
450 |
}
|
451 |
-
|
452 |
if ($shipment->Barcode === $barcode) { // we need the original shipment, not a related shipment (such as a return shipment)
|
453 |
return $shipment;
|
454 |
}
|
455 |
}
|
456 |
-
|
457 |
/**
|
458 |
* no shipment could be matched to the supplied barcode
|
459 |
-
*/
|
460 |
throw new TIG_PostNL_Exception(
|
461 |
Mage::helper('postnl')->__( 'Unable to match barcode to shippingStatus response: %s', var_export($response, true)),
|
462 |
'POSTNL-0063'
|
463 |
);
|
464 |
}
|
465 |
-
|
466 |
/**
|
467 |
* Retrieves the latest shipping status of a shipment from CIF including full status history
|
468 |
-
*
|
469 |
* @param TIG_PostNL_Model_Core_Shipment $shipment
|
470 |
-
*
|
471 |
-
* @return StdClass
|
472 |
-
*
|
473 |
* @throws TIG_PostNL_Exception
|
474 |
*/
|
475 |
public function getCompleteShipmentStatus($postnlShipment)
|
476 |
{
|
477 |
$shipment = $postnlShipment->getShipment();
|
478 |
-
|
479 |
$barcode = $postnlShipment->getMainBarcode();
|
480 |
$message = $this->_getMessage($barcode);
|
481 |
$customer = $this->_getCustomer();
|
482 |
-
|
483 |
$soapParams = array(
|
484 |
'Message' => $message,
|
485 |
'Customer' => $customer,
|
@@ -487,21 +487,21 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
487 |
'Barcode' => $barcode,
|
488 |
),
|
489 |
);
|
490 |
-
|
491 |
$response = $this->call(
|
492 |
-
'ShippingStatus',
|
493 |
-
'CurrentStatus',
|
494 |
$soapParams
|
495 |
);
|
496 |
-
|
497 |
$response = $this->call(
|
498 |
-
'ShippingStatus',
|
499 |
-
'CompleteStatus',
|
500 |
$soapParams
|
501 |
);
|
502 |
-
|
503 |
-
if (!is_object($response)
|
504 |
-
|| !isset($response->Shipments)
|
505 |
|| (!is_array($response->Shipments) && !is_object($response->Shipments))
|
506 |
) {
|
507 |
throw new TIG_PostNL_Exception(
|
@@ -509,40 +509,40 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
509 |
'POSTNL-0055'
|
510 |
);
|
511 |
}
|
512 |
-
|
513 |
foreach($response->Shipments as $shipment) {
|
514 |
$shipment = $shipment[0];
|
515 |
if ($shipment->Barcode === $barcode) { // we need the original shipment, not a related shipment (such as a return shipment)
|
516 |
return $shipment;
|
517 |
}
|
518 |
}
|
519 |
-
|
520 |
/**
|
521 |
* no shipment could be matched to the supplied barcode
|
522 |
-
*/
|
523 |
throw new TIG_PostNL_Exception(
|
524 |
Mage::helper('postnl')->__( 'Unable to match barcode to shippingStatus response: %s', var_export($response, true)),
|
525 |
'POSTNL-0063'
|
526 |
);
|
527 |
}
|
528 |
-
|
529 |
/**
|
530 |
* Confirms the choen shipment without generating labels
|
531 |
-
*
|
532 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
533 |
* @param string $barcode
|
534 |
-
*
|
535 |
* @return array
|
536 |
-
*
|
537 |
* @throws TIG_PostNL_Exception
|
538 |
*/
|
539 |
public function confirmShipment($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false)
|
540 |
{
|
541 |
$shipment = $postnlShipment->getShipment();
|
542 |
-
|
543 |
$message = $this->_getMessage($barcode);
|
544 |
$customer = $this->_getCustomer($shipment);
|
545 |
-
|
546 |
/**
|
547 |
* Create a single shipment object
|
548 |
*/
|
@@ -555,54 +555,54 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
555 |
'Shipment' => $this->_getShipment($postnlShipment, $barcode, $mainBarcode,$shipmentNumber)
|
556 |
);
|
557 |
}
|
558 |
-
|
559 |
$soapParams = array(
|
560 |
'Message' => $message,
|
561 |
'Customer' => $customer,
|
562 |
'Shipments' => $cifShipment,
|
563 |
);
|
564 |
-
|
565 |
$response = $this->call(
|
566 |
-
'Confirming',
|
567 |
-
'Confirming',
|
568 |
$soapParams
|
569 |
);
|
570 |
-
|
571 |
if (!is_object($response)) {
|
572 |
throw new TIG_PostNL_Exception(
|
573 |
Mage::helper('postnl')->__('Invalid confirmShipment response: %s', var_export($response, true)),
|
574 |
'POSTNL-0056'
|
575 |
);
|
576 |
}
|
577 |
-
|
578 |
-
if (isset($response->ConfirmingResponseShipment)
|
579 |
&& (is_object($response->ConfirmingResponseShipment)
|
580 |
|| is_array($response->ConfirmingResponseShipment)
|
581 |
)
|
582 |
) {
|
583 |
return $response;
|
584 |
}
|
585 |
-
|
586 |
throw new TIG_PostNL_Exception(
|
587 |
Mage::helper('postnl')->__('Invalid confirmShipment response: %s', var_export($response, true)),
|
588 |
'POSTNL-0056'
|
589 |
);
|
590 |
}
|
591 |
-
|
592 |
/**
|
593 |
* Generates shipping labels for the chosen shipment
|
594 |
-
*
|
595 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
596 |
* @param string $printerType The printertype used. Currently only 'GraphicFile|PDF' is fully supported
|
597 |
-
*
|
598 |
* @return array
|
599 |
-
*
|
600 |
* @throws TIG_PostNL_Exception
|
601 |
*/
|
602 |
public function generateLabels($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false, $printerType = 'GraphicFile|PDF')
|
603 |
{
|
604 |
$shipment = $postnlShipment->getShipment();
|
605 |
-
|
606 |
$availablePrinterTypes = $this->_printerTypes;
|
607 |
if (!in_array($printerType, $availablePrinterTypes)) {
|
608 |
throw new TIG_PostNL_Exception(
|
@@ -610,7 +610,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
610 |
'POSTNL-0062'
|
611 |
);
|
612 |
}
|
613 |
-
|
614 |
/**
|
615 |
* Create a single shipment object
|
616 |
*/
|
@@ -619,24 +619,24 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
619 |
} else {
|
620 |
$cifShipment = $this->_getShipment($postnlShipment, $barcode, $mainBarcode, $shipmentNumber);
|
621 |
}
|
622 |
-
|
623 |
$message = $this->_getMessage($barcode, array('Printertype' => $printerType));
|
624 |
$customer = $this->_getCustomer($shipment);
|
625 |
-
|
626 |
$soapParams = array(
|
627 |
'Message' => $message,
|
628 |
'Customer' => $customer,
|
629 |
'Shipment' => $cifShipment,
|
630 |
);
|
631 |
-
|
632 |
$response = $this->call(
|
633 |
-
'Labelling',
|
634 |
-
'GenerateLabel',
|
635 |
$soapParams
|
636 |
);
|
637 |
-
|
638 |
-
if (!is_object($response)
|
639 |
-
|| !isset($response->Labels)
|
640 |
|| !is_object($response->Labels)
|
641 |
) {
|
642 |
throw new TIG_PostNL_Exception(
|
@@ -644,24 +644,24 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
644 |
'POSTNL-0057'
|
645 |
);
|
646 |
}
|
647 |
-
|
648 |
return $response;
|
649 |
}
|
650 |
-
|
651 |
/**
|
652 |
* Generates shipping labels for the chosen shipment without confirming it
|
653 |
-
*
|
654 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
655 |
* @param string $printerType The printertype used. Currently only 'GraphicFile|PDF' is fully supported
|
656 |
-
*
|
657 |
* @return array
|
658 |
-
*
|
659 |
* @throws TIG_PostNL_Exception
|
660 |
*/
|
661 |
public function generateLabelsWithoutConfirm($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false, $printerType = 'GraphicFile|PDF')
|
662 |
{
|
663 |
$shipment = $postnlShipment->getShipment();
|
664 |
-
|
665 |
$availablePrinterTypes = $this->_printerTypes;
|
666 |
if (!in_array($printerType, $availablePrinterTypes)) {
|
667 |
throw new TIG_PostNL_Exception(
|
@@ -669,7 +669,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
669 |
'POSTNL-0062'
|
670 |
);
|
671 |
}
|
672 |
-
|
673 |
/**
|
674 |
* Create a single shipment object
|
675 |
*/
|
@@ -678,24 +678,24 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
678 |
} else {
|
679 |
$cifShipment = $this->_getShipment($postnlShipment, $barcode, $mainBarcode, $shipmentNumber);
|
680 |
}
|
681 |
-
|
682 |
$message = $this->_getMessage($barcode, array('Printertype' => $printerType));
|
683 |
$customer = $this->_getCustomer($shipment);
|
684 |
-
|
685 |
$soapParams = array(
|
686 |
'Message' => $message,
|
687 |
'Customer' => $customer,
|
688 |
'Shipment' => $cifShipment,
|
689 |
);
|
690 |
-
|
691 |
$response = $this->call(
|
692 |
-
'Labelling',
|
693 |
-
'GenerateLabelWithoutConfirm',
|
694 |
$soapParams
|
695 |
);
|
696 |
-
|
697 |
-
if (!is_object($response)
|
698 |
-
|| !isset($response->Labels)
|
699 |
|| !is_object($response->Labels)
|
700 |
) {
|
701 |
throw new TIG_PostNL_Exception(
|
@@ -703,15 +703,15 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
703 |
'POSTNL-0058'
|
704 |
);
|
705 |
}
|
706 |
-
|
707 |
return $response;
|
708 |
}
|
709 |
-
|
710 |
/**
|
711 |
* Gets the Message parameter
|
712 |
-
*
|
713 |
* @param array $extra An array of additional parameters to add
|
714 |
-
*
|
715 |
* @return array
|
716 |
*/
|
717 |
protected function _getMessage($barcode, $extra = array())
|
@@ -720,24 +720,24 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
720 |
. $this->_getCustomerNumber()
|
721 |
. $barcode
|
722 |
. microtime();
|
723 |
-
|
724 |
$message = array(
|
725 |
'MessageID' => md5($messageIdString),
|
726 |
'MessageTimeStamp' => date('d-m-Y H:i:s', Mage::getModel('core/date')->gmtTimestamp()),
|
727 |
);
|
728 |
-
|
729 |
if ($extra) {
|
730 |
$message = array_merge($message, $extra);
|
731 |
}
|
732 |
-
|
733 |
return $message;
|
734 |
}
|
735 |
-
|
736 |
/**
|
737 |
* Gets the customer parameter
|
738 |
-
*
|
739 |
* @param Mage_Sales_Model_Order_Shipment | boolean $shipment
|
740 |
-
*
|
741 |
* @return array
|
742 |
*/
|
743 |
protected function _getCustomer($shipment = false)
|
@@ -746,36 +746,40 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
746 |
'CustomerCode' => $this->_getCustomerCode(),
|
747 |
'CustomerNumber' => $this->_getCustomerNumber(),
|
748 |
);
|
749 |
-
|
750 |
if ($shipment) {
|
751 |
$additionalCustomerData = array(
|
752 |
'Address' => $this->_getAddress('Sender'),
|
753 |
'CollectionLocation' => $this->_getCollectionLocation(),
|
754 |
);
|
755 |
-
|
756 |
$customer = array_merge($customer, $additionalCustomerData);
|
757 |
}
|
758 |
-
|
759 |
return $customer;
|
760 |
}
|
761 |
-
|
762 |
/**
|
763 |
* Creates the CIF shipment object based on a PostNL shipment
|
764 |
-
*
|
765 |
-
* @param TIG_PostNL_Model_Core_Shipment $
|
766 |
-
*
|
|
|
|
|
|
|
767 |
* @return array
|
768 |
-
*
|
769 |
-
* @todo
|
770 |
*/
|
771 |
protected function _getShipment($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false)
|
772 |
{
|
773 |
$shipment = $postnlShipment->getShipment();
|
|
|
774 |
$shippingAddress = $shipment->getShippingAddress();
|
775 |
-
|
776 |
$parcelCount = $postnlShipment->getParcelCount();
|
777 |
$shipmentWeight = $postnlShipment->getTotalWeight(true, true);
|
778 |
-
|
779 |
/**
|
780 |
* If a shipmentNumber is provided it means that this is not a single shipment and the weight of the shipment
|
781 |
* needs to be calculated
|
@@ -783,7 +787,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
783 |
if ($shipmentNumber !== false) {
|
784 |
$parcelWeight = Mage::getStoreConfig(self::XML_PATH_WEIGHT_PER_PARCEL, $postnlShipment->getStoreId());
|
785 |
$parcelWeight = Mage::helper('postnl/cif')->standardizeWeight($parcelWeight, $shipment->getStoreId(), true); //convert the parcelweight to grams
|
786 |
-
|
787 |
/**
|
788 |
* All parcels except for the last one weigh a configured amount. The last parcel weighs the remainder
|
789 |
*/
|
@@ -793,14 +797,14 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
793 |
$shipmentWeight = $shipmentWeight % $parcelWeight;
|
794 |
}
|
795 |
}
|
796 |
-
|
797 |
/**
|
798 |
* Shipment weight may not be less than 1 gram
|
799 |
*/
|
800 |
if ($shipmentWeight < 1) {
|
801 |
$shipmentWeight = 1;
|
802 |
}
|
803 |
-
|
804 |
$shipmentData = array(
|
805 |
'Barcode' => $barcode,
|
806 |
'CollectionTimeStampEnd' => '',
|
@@ -810,51 +814,51 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
810 |
'ProductCodeDelivery' => $postnlShipment->getProductCode(),
|
811 |
'Reference' => $shipment->getReference(),
|
812 |
'Contacts' => array(
|
813 |
-
'Contact' => $this->_getContact($shippingAddress),
|
814 |
),
|
815 |
'Dimension' => array(
|
816 |
'Weight' => round($shipmentWeight),
|
817 |
),
|
818 |
'Reference' => $this->_getReference($shipment),
|
819 |
);
|
820 |
-
|
821 |
/**
|
822 |
* Add group data (for multi-collo shipments)
|
823 |
*/
|
824 |
if ($parcelCount > 1) {
|
825 |
$groups = array(
|
826 |
'Group' => $this->_getGroup(
|
827 |
-
$parcelCount,
|
828 |
-
$mainBarcode,
|
829 |
$shipmentNumber
|
830 |
),
|
831 |
);
|
832 |
-
|
833 |
$shipmentData['Groups'] = $groups;
|
834 |
}
|
835 |
-
|
836 |
/**
|
837 |
* Add address data
|
838 |
*/
|
839 |
$useSenderAddressAsReturn = Mage::getStoreConfig(self::XML_PATH_USE_SENDER_ADDRESS_AS_RETURN, $this->getStoreId());
|
840 |
$pakjeGemakAddress = $postnlShipment->getPakjeGemakAddress();
|
841 |
-
|
842 |
$addresses = array(
|
843 |
'Address' => array(
|
844 |
$this->_getAddress('Receiver', $shippingAddress)
|
845 |
),
|
846 |
);
|
847 |
-
|
848 |
if (!$useSenderAddressAsReturn) {
|
849 |
$addresses['Address'][] = $this->_getAddress('Alternative');
|
850 |
}
|
851 |
-
|
852 |
if ($pakjeGemakAddress) {
|
853 |
$addresses['Address'][] =$this->_getAddress('Delivery', $pakjeGemakAddress);
|
854 |
}
|
855 |
-
|
856 |
$shipmentData['Addresses'] = $addresses;
|
857 |
-
|
858 |
/**
|
859 |
* Add extra cover data and COD data
|
860 |
* In the case of a multi-collo shipment this is only added to the first parcel
|
@@ -864,23 +868,23 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
864 |
) {
|
865 |
$shipmentData['Amounts'] = $this->_getAmount($postnlShipment);
|
866 |
}
|
867 |
-
|
868 |
/**
|
869 |
* Add customs data
|
870 |
*/
|
871 |
if ($postnlShipment->isGlobalShipment()) {
|
872 |
$shipmentData['Customs'] = $this->_getCustoms($postnlShipment);
|
873 |
}
|
874 |
-
|
875 |
return $shipmentData;
|
876 |
}
|
877 |
-
|
878 |
/**
|
879 |
* Gets an array containing required address data
|
880 |
-
*
|
881 |
* @param string $shippingAddress
|
882 |
* @param Mage_Sales_Model_Order_Address $address
|
883 |
-
*
|
884 |
* @return array
|
885 |
*/
|
886 |
protected function _getAddress($addressType, $shippingAddress= false)
|
@@ -892,7 +896,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
892 |
'POSTNL-0108'
|
893 |
);
|
894 |
}
|
895 |
-
|
896 |
/**
|
897 |
* Determine which address to use. Currently only 'Sender' and 'Receiver' are fully supported.
|
898 |
* Other possible address types will use the default 'receiver' address.
|
@@ -906,14 +910,14 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
906 |
* conventional Mage_Sales_Model_Order_Address object.
|
907 |
*/
|
908 |
$senderAddress = Mage::getStoreConfig(self::XML_PATH_SENDER_ADDRESS, $this->getStoreId());
|
909 |
-
|
910 |
$streetData = array(
|
911 |
'streetname' => $senderAddress['streetname'],
|
912 |
'housenumber' => $senderAddress['housenumber'],
|
913 |
'housenumberExtension' => $senderAddress['housenumber_extension'],
|
914 |
'fullStreet' => '',
|
915 |
);
|
916 |
-
|
917 |
$address = new Varien_Object($senderAddress);
|
918 |
break;
|
919 |
case 'Alternative':
|
@@ -924,21 +928,21 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
924 |
if ($useSenderAddress) {
|
925 |
return false;
|
926 |
}
|
927 |
-
|
928 |
/**
|
929 |
* Get all cif_return_address fields as an array and convert that to a Varien_Object
|
930 |
* This allows the _prepareAddress method to access this data in the same way as a
|
931 |
* conventional Mage_Sales_Model_Order_Address object.
|
932 |
*/
|
933 |
$returnAddress = Mage::getStoreConfig(self::XML_PATH_RETURN_ADDRESS, $this->getStoreId());
|
934 |
-
|
935 |
$streetData = array(
|
936 |
'streetname' => $returnAddress['streetname'],
|
937 |
'housenumber' => $returnAddress['housenumber'],
|
938 |
'housenumberExtension' => $returnAddress['housenumber_extension'],
|
939 |
'fullStreet' => '',
|
940 |
);
|
941 |
-
|
942 |
$address = new Varien_Object($returnAddress);
|
943 |
break;
|
944 |
case 'PakjeGemak': //no break
|
@@ -947,19 +951,19 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
947 |
$address = $shippingAddress;
|
948 |
break;
|
949 |
}
|
950 |
-
|
951 |
$addressArray = $this->_prepareAddressArray($address, $streetData);
|
952 |
$addressArray['AddressType'] = $availableAddressTypes[$addressType];
|
953 |
-
|
954 |
return $addressArray;
|
955 |
}
|
956 |
|
957 |
/**
|
958 |
* Forms an array of address data compatible with CIF
|
959 |
-
*
|
960 |
* @param Mage_Sales_Model_Order_Address $address
|
961 |
* @param array | boolean $streetData Optional parameter containing streetname, housenr, housenr extension and fullStreet values.
|
962 |
-
*
|
963 |
* @return array
|
964 |
*/
|
965 |
protected function _prepareAddressArray($address, $streetData = false)
|
@@ -967,7 +971,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
967 |
if ($streetData === false) {
|
968 |
$streetData = $this->_getStreetData($address);
|
969 |
}
|
970 |
-
|
971 |
$addressArray = array(
|
972 |
'FirstName' => $address->getFirstname(),
|
973 |
'Name' => $address->getLastname(),
|
@@ -987,18 +991,18 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
987 |
'Floor' => $this->_getFloor($address),
|
988 |
'Remark' => $this->_getRemark($address),
|
989 |
);
|
990 |
-
|
991 |
return $addressArray;
|
992 |
}
|
993 |
-
|
994 |
/**
|
995 |
* Gets data for the barcode that's requested. Depending on the destination of the shipment
|
996 |
* several barcode types may be requested.
|
997 |
-
*
|
998 |
* @param string $barcodeType
|
999 |
-
*
|
1000 |
* @return array
|
1001 |
-
*
|
1002 |
* @throws TIG_PostNL_Exception
|
1003 |
*/
|
1004 |
protected function _getBarcodeData($barcodeType)
|
@@ -1040,23 +1044,23 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1040 |
'POSTNL-0111'
|
1041 |
);
|
1042 |
}
|
1043 |
-
|
1044 |
$barcodeData = array(
|
1045 |
'type' => $type,
|
1046 |
'range' => $range,
|
1047 |
'serie' => $serie,
|
1048 |
);
|
1049 |
-
|
1050 |
return $barcodeData;
|
1051 |
}
|
1052 |
-
|
1053 |
/**
|
1054 |
* Generates the CIF amount object containing the shipment's insured amount (if any)
|
1055 |
-
*
|
1056 |
* @param TIG_PostNL_Model_Core_Shipment $shipment
|
1057 |
-
*
|
1058 |
* @return array
|
1059 |
-
*
|
1060 |
* @todo implement COD
|
1061 |
*/
|
1062 |
protected function _getAmount($postnlShipment)
|
@@ -1065,7 +1069,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1065 |
if (!$postnlShipment->hasExtraCover() && !$postnlShipment->isCod()) {
|
1066 |
return $amount;
|
1067 |
}
|
1068 |
-
|
1069 |
if ($postnlShipment->hasExtraCover() && $postnlShipment->getExtraCoverAmount() > 0) {
|
1070 |
$extraCover = number_format($postnlShipment->getExtraCoverAmount(), 2, '.', '');
|
1071 |
$amount[] = array(
|
@@ -1078,38 +1082,39 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1078 |
'Value' => $extraCover,
|
1079 |
);
|
1080 |
}
|
1081 |
-
|
1082 |
if ($postnlShipment->isCod()) {
|
1083 |
//TODO implement COD here
|
1084 |
}
|
1085 |
-
|
1086 |
return $amount;
|
1087 |
}
|
1088 |
-
|
1089 |
/**
|
1090 |
* Creates the CIF contact object
|
1091 |
-
*
|
1092 |
* @param Mage_Sales_Model_Order_Address $address
|
1093 |
-
*
|
|
|
1094 |
* @return array
|
1095 |
-
*
|
1096 |
* @todo check if SMSNr is required for pakjegemak
|
1097 |
*/
|
1098 |
-
protected function _getContact($address)
|
1099 |
{
|
1100 |
$contact = array(
|
1101 |
'ContactType' => '01', // Receiver
|
1102 |
-
'Email' => $
|
1103 |
'SMSNr' => '', // never sure if clean 06 number - TODO: check needed for PakjeGemak?
|
1104 |
'TelNr' => $address->getTelephone(),
|
1105 |
);
|
1106 |
-
|
1107 |
return $contact;
|
1108 |
}
|
1109 |
-
|
1110 |
/**
|
1111 |
* Creates the CIF group object
|
1112 |
-
*
|
1113 |
* @return array
|
1114 |
*/
|
1115 |
protected function _getGroup($groupCount = 1, $mainBarcode = false, $shipmentNumber = false)
|
@@ -1123,44 +1128,44 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1123 |
);
|
1124 |
return $group;
|
1125 |
}
|
1126 |
-
|
1127 |
$group = array(
|
1128 |
'GroupCount' => $groupCount,
|
1129 |
'GroupSequence' => $shipmentNumber,
|
1130 |
'GroupType' => '03',
|
1131 |
'MainBarcode' => $mainBarcode,
|
1132 |
);
|
1133 |
-
|
1134 |
return $group;
|
1135 |
}
|
1136 |
-
|
1137 |
/**
|
1138 |
* Retrieves streetname, housenumber and housenumber extension from the shipping address.
|
1139 |
-
* The shipping address may be in multiple streetlines configuration or single line
|
1140 |
-
* configuration. In the case of multi-line, each part of the street data will be in a seperate
|
1141 |
-
* field. In the single line configuration, each part will be in the same field and will have
|
1142 |
* to be split using PREG.
|
1143 |
-
*
|
1144 |
* PREG cannot be relied on as it is impossible to create a regex that can filter all
|
1145 |
* possible street syntaxes. Therefore we strongly recommend to use multiple street lines. This
|
1146 |
-
* can be enabled in Magento community in system > config > customer configuration. Or if you
|
1147 |
-
* use Enterprise, in customers > attributes > manage customer address attributes.
|
1148 |
-
*
|
1149 |
* @param Mage_Sales_Model_Order_Address $address
|
1150 |
-
*
|
1151 |
* @return array
|
1152 |
*/
|
1153 |
protected function _getStreetData($address)
|
1154 |
{
|
1155 |
$storeId = $this->getStoreId();
|
1156 |
$splitStreet = Mage::getStoreConfigFlag(self::XML_PATH_SPLIT_STREET, $storeId);
|
1157 |
-
|
1158 |
/**
|
1159 |
* Website uses multi-line address mode
|
1160 |
*/
|
1161 |
if ($splitStreet) {
|
1162 |
$streetData = $this->_getMultiLineStreetData($address);
|
1163 |
-
|
1164 |
/**
|
1165 |
* If $streetData is false it means a required field was missing. In this
|
1166 |
* case the alternative methods are used to obtain the address data.
|
@@ -1169,13 +1174,13 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1169 |
return $streetData;
|
1170 |
}
|
1171 |
}
|
1172 |
-
|
1173 |
/**
|
1174 |
* Website uses single-line address mode
|
1175 |
*/
|
1176 |
$allowedFullStreetCountries = $this->getAllowedFullStreetCountries();
|
1177 |
$fullStreet = $address->getStreetFull();
|
1178 |
-
|
1179 |
/**
|
1180 |
* Select countries don't have to split their street values into seperate part
|
1181 |
*/
|
@@ -1188,20 +1193,20 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1188 |
);
|
1189 |
return $streetData;
|
1190 |
}
|
1191 |
-
|
1192 |
/**
|
1193 |
* All other countries must split them using PREG
|
1194 |
*/
|
1195 |
$streetData = $this->_getSplitStreetData($fullStreet);
|
1196 |
-
|
1197 |
return $streetData;
|
1198 |
}
|
1199 |
-
|
1200 |
/**
|
1201 |
* Retrieves streetname, housenumber and housenumber extension from the shipping address in the multiple streetlines configuration.
|
1202 |
-
*
|
1203 |
* @param Mage_Sales_Model_Order_Address $address
|
1204 |
-
*
|
1205 |
* @return array
|
1206 |
*/
|
1207 |
protected function _getMultiLineStreetData($address)
|
@@ -1209,17 +1214,17 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1209 |
$storeId = $this->getStoreId();
|
1210 |
$streetnameField = (int) Mage::getStoreConfig(self::XML_PATH_STREETNAME_FIELD, $storeId);
|
1211 |
$housenumberField = (int) Mage::getStoreConfig(self::XML_PATH_HOUSENUMBER_FIELD, $storeId);
|
1212 |
-
|
1213 |
$streetname = $address->getStreet($streetnameField);
|
1214 |
$housenumber = $address->getStreet($housenumberField);
|
1215 |
-
|
1216 |
/**
|
1217 |
* If street or housenr fields are empty, use alternative options to obtain the address data
|
1218 |
*/
|
1219 |
if (is_null($streetname) || is_null($housenumber)) {
|
1220 |
return false;
|
1221 |
}
|
1222 |
-
|
1223 |
/**
|
1224 |
* Split the housenumber into a number and an extension
|
1225 |
*/
|
@@ -1232,24 +1237,24 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1232 |
$housenumber = $housenumberParts['number'];
|
1233 |
$housenumberExtension = $housenumberParts['extension'];
|
1234 |
}
|
1235 |
-
|
1236 |
$streetData = array(
|
1237 |
'streetname' => $streetname,
|
1238 |
'housenumber' => $housenumber,
|
1239 |
'housenumberExtension' => $housenumberExtension,
|
1240 |
'fullStreet' => '',
|
1241 |
);
|
1242 |
-
|
1243 |
return $streetData;
|
1244 |
}
|
1245 |
-
|
1246 |
/**
|
1247 |
* Splits street data into seperate parts for streetname, housenumber and extension.
|
1248 |
-
*
|
1249 |
* @param string $fullStreet The full streetname including all parts
|
1250 |
-
*
|
1251 |
* @return array
|
1252 |
-
*
|
1253 |
* @throws TIG_PostNL_Exception
|
1254 |
*/
|
1255 |
protected function _getSplitStreetData($fullStreet)
|
@@ -1261,44 +1266,44 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1261 |
'POSTNL-0060'
|
1262 |
);
|
1263 |
}
|
1264 |
-
|
1265 |
$streetname = '';
|
1266 |
$housenumber = '';
|
1267 |
if (isset($matches[1])) {
|
1268 |
$streetname = $matches[1];
|
1269 |
}
|
1270 |
-
|
1271 |
if (isset($matches[2])) {
|
1272 |
$housenumber = $matches[2];
|
1273 |
}
|
1274 |
-
|
1275 |
$housenumberParts = $this->_splitHousenumber($housenumber);
|
1276 |
$housenumber = $housenumberParts['number'];
|
1277 |
$housenumberExtension = $housenumberParts['extension'];
|
1278 |
-
|
1279 |
$streetData = array(
|
1280 |
'streetname' => $streetname,
|
1281 |
'housenumber' => $housenumber,
|
1282 |
'housenumberExtension' => $housenumberExtension,
|
1283 |
'fullStreet' => '',
|
1284 |
);
|
1285 |
-
|
1286 |
return $streetData;
|
1287 |
}
|
1288 |
-
|
1289 |
/**
|
1290 |
* Splits a supplier housenumber into a number and an extension
|
1291 |
-
*
|
1292 |
* @param string $housenumber
|
1293 |
-
*
|
1294 |
* @return array
|
1295 |
-
*
|
1296 |
* @throws TIG_PostNL_Exception
|
1297 |
*/
|
1298 |
protected function _splitHousenumber($housenumber)
|
1299 |
{
|
1300 |
$housenumber = trim($housenumber);
|
1301 |
-
|
1302 |
$result = preg_match(self::SPLIT_HOUSENUMBER_REGEX, $housenumber, $matches);
|
1303 |
if (!$result || !is_array($matches)) {
|
1304 |
throw new TIG_PostNL_Exception(
|
@@ -1306,37 +1311,37 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1306 |
'POSTNL-0059'
|
1307 |
);
|
1308 |
}
|
1309 |
-
|
1310 |
$extension = '';
|
1311 |
$number = '';
|
1312 |
if (isset($matches[1])) {
|
1313 |
$number = $matches[1];
|
1314 |
}
|
1315 |
-
|
1316 |
if (isset($matches[2])) {
|
1317 |
$extension = trim($matches[2]);
|
1318 |
}
|
1319 |
-
|
1320 |
$housenumberParts = array(
|
1321 |
'number' => $number,
|
1322 |
'extension' => $extension,
|
1323 |
);
|
1324 |
-
|
1325 |
return $housenumberParts;
|
1326 |
}
|
1327 |
-
|
1328 |
/**
|
1329 |
* create Customs CIF object
|
1330 |
-
*
|
1331 |
* @param TIG_PostNL_Model_Core_Shipment $postnlShipment
|
1332 |
-
*
|
1333 |
* @return array
|
1334 |
*/
|
1335 |
protected function _getCustoms($postnlShipment)
|
1336 |
{
|
1337 |
$shipment = $postnlShipment->getShipment();
|
1338 |
$shipmentType = $postnlShipment->getShipmentType();
|
1339 |
-
|
1340 |
$customs = array(
|
1341 |
'ShipmentType' => $shipmentType, // Gift / Documents / Commercial Goods / Commercial Sample / Returned Goods
|
1342 |
'HandleAsNonDeliverable' => 'false',
|
@@ -1345,14 +1350,14 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1345 |
'License' => 'false',
|
1346 |
'Currency' => 'EUR',
|
1347 |
);
|
1348 |
-
|
1349 |
/**
|
1350 |
* Check if the shipment should be treated as abandoned when it can't be delivered or if it should be returned to the sender
|
1351 |
*/
|
1352 |
if ($postnlShipment->getTreatAsAbandoned()) {
|
1353 |
$customs['HandleAsNonDeliverable'] = 'true';
|
1354 |
}
|
1355 |
-
|
1356 |
/**
|
1357 |
* Add license info
|
1358 |
*/
|
@@ -1360,7 +1365,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1360 |
$customs['License'] = 'true';
|
1361 |
$customs['LicenseNr'] = $this->_getCustomsLicense();
|
1362 |
}
|
1363 |
-
|
1364 |
/**
|
1365 |
* Add certificate info
|
1366 |
*/
|
@@ -1368,10 +1373,10 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1368 |
$customs['Certificate'] = 'true';
|
1369 |
$customs['CertificateNr'] = $this->_getCustomsCertificate();
|
1370 |
}
|
1371 |
-
|
1372 |
/**
|
1373 |
* Add invoice info
|
1374 |
-
*
|
1375 |
* This is mandatory for certain shipment types as well as when neither a certificate nor a license is available
|
1376 |
*/
|
1377 |
$invoiceRequiredShipmentTypes = $this->getInvoiceRequiredShipmentTypes();
|
@@ -1384,14 +1389,14 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1384 |
$customs['Invoice'] = 'true';
|
1385 |
$customs['InvoiceNr'] = $shipmentId;
|
1386 |
}
|
1387 |
-
|
1388 |
/**
|
1389 |
* Add information about the contents of the shipment
|
1390 |
*/
|
1391 |
$itemCount = 0;
|
1392 |
$content = array();
|
1393 |
$items = $this->_sortCustomsItems($shipment->getAllItems());
|
1394 |
-
|
1395 |
foreach ($items as $item) {
|
1396 |
/**
|
1397 |
* A maximum of 5 rows are allowed
|
@@ -1399,22 +1404,22 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1399 |
if (++$itemCount > 5) {
|
1400 |
break;
|
1401 |
}
|
1402 |
-
|
1403 |
/**
|
1404 |
* Calculate the item's weight in kg
|
1405 |
*/
|
1406 |
$itemWeight = Mage::helper('postnl/cif')->standardizeWeight(
|
1407 |
-
$item->getWeight(),
|
1408 |
$this->getStoreId()
|
1409 |
);
|
1410 |
-
|
1411 |
/**
|
1412 |
* Item weight may not be less than 1 gram
|
1413 |
*/
|
1414 |
if ($itemWeight < 0.01) {
|
1415 |
$itemWeight = 0.01;
|
1416 |
}
|
1417 |
-
|
1418 |
$itemData = array(
|
1419 |
'Description' => $this->_getCustomsDescription($item),
|
1420 |
'Quantity' => $item->getQty(),
|
@@ -1423,10 +1428,10 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1423 |
'HSTariffNr' => $this->_getHSTariff($item),
|
1424 |
'CountryOfOrigin' => $this->_getCountryOfOrigin($item),
|
1425 |
);
|
1426 |
-
|
1427 |
$content[] = $itemData;
|
1428 |
}
|
1429 |
-
|
1430 |
/**
|
1431 |
* If no information was present, supply an array of empty lines instead
|
1432 |
*/
|
@@ -1442,17 +1447,17 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1442 |
),
|
1443 |
);
|
1444 |
}
|
1445 |
-
|
1446 |
$customs['Content'] = $content;
|
1447 |
-
|
1448 |
return $customs;
|
1449 |
}
|
1450 |
-
|
1451 |
/**
|
1452 |
* Sorts an array of shipment items based on a product attribute that is defined in the module configuration
|
1453 |
-
*
|
1454 |
* @param array $items
|
1455 |
-
*
|
1456 |
* @return array
|
1457 |
*/
|
1458 |
protected function _sortCustomsItems($items)
|
@@ -1462,7 +1467,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1462 |
*/
|
1463 |
$sortingAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_PRODUCT_SORTING_ATTRIBUTE, $this->getStoreId());
|
1464 |
$sortingDirection = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_PRODUCT_SORTING_DIRECTION, $this->getStoreId());
|
1465 |
-
|
1466 |
/**
|
1467 |
* Place the item's sorting value in a temporary array where the key is the item's ID
|
1468 |
*/
|
@@ -1472,68 +1477,68 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1472 |
$sortingAttributeValue = $product->getDataUsingMethod($sortingAttribute);
|
1473 |
$sortedItems[$item->getId()] = $sortingAttributeValue;
|
1474 |
}
|
1475 |
-
|
1476 |
/**
|
1477 |
* Sort the array in the specified direction using 'natural' sorting
|
1478 |
-
*
|
1479 |
* @link http://us1.php.net/manual/en/function.natsort.php
|
1480 |
*/
|
1481 |
natsort($sortedItems);
|
1482 |
if ($sortingDirection == 'desc') {
|
1483 |
$sortedItems = array_reverse($sortedItems, true); //keep key-value associations
|
1484 |
}
|
1485 |
-
|
1486 |
/**
|
1487 |
* Switch the sorting values with the items
|
1488 |
*/
|
1489 |
foreach ($items as $item) {
|
1490 |
$sortedItems[$item->getId()] = $item;
|
1491 |
}
|
1492 |
-
|
1493 |
return $sortedItems;
|
1494 |
}
|
1495 |
-
|
1496 |
/**
|
1497 |
* Get a shipment item's HS tariff
|
1498 |
-
*
|
1499 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1500 |
-
*
|
1501 |
* @return string
|
1502 |
*/
|
1503 |
protected function _getHSTariff($shipmentItem)
|
1504 |
{
|
1505 |
$storeId = $this->getStoreId();
|
1506 |
-
|
1507 |
/**
|
1508 |
* HS Tariff is an optional attribute. Check if it's used and if not, return a default value of 000000
|
1509 |
*/
|
1510 |
if (!Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_USE_HS_TARIFF_ATTRIBUTE, $storeId)) {
|
1511 |
return '000000';
|
1512 |
}
|
1513 |
-
|
1514 |
if ($this->getHSTariffAttribute() !== null) {
|
1515 |
$hsTariffAttribute = $this->getHSTariffAttribute();
|
1516 |
} else {
|
1517 |
$hsTariffAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_HS_TARIFF_ATTRIBUTE, $storeId);
|
1518 |
$this->setHSTariffAttribute($hsTariffAttribute);
|
1519 |
}
|
1520 |
-
|
1521 |
$hsTariff = $shipmentItem->getOrderItem()
|
1522 |
->getProduct()
|
1523 |
->getDataUsingMethod($hsTariffAttribute);
|
1524 |
-
|
1525 |
if (empty($hsTariff)) {
|
1526 |
-
$hsTariff = '000000';
|
1527 |
}
|
1528 |
-
|
1529 |
return $hsTariff;
|
1530 |
}
|
1531 |
-
|
1532 |
/**
|
1533 |
* Get a shipment item's country of origin
|
1534 |
-
*
|
1535 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1536 |
-
*
|
1537 |
* @return string
|
1538 |
*/
|
1539 |
protected function _getCountryOfOrigin($shipmentItem)
|
@@ -1545,26 +1550,26 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1545 |
$countryOfOriginAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_COUNTRY_OF_ORIGIN_ATTRIBUTE, $storeId);
|
1546 |
$this->setCountryOfOriginAttribute($countryOfOriginAttribute);
|
1547 |
}
|
1548 |
-
|
1549 |
$countryOfOrigin = $shipmentItem->getOrderItem()
|
1550 |
->getProduct()
|
1551 |
->getDataUsingMethod($countryOfOriginAttribute);
|
1552 |
-
|
1553 |
if (empty($countryOfOrigin)) {
|
1554 |
throw new TIG_PostNL_Exception(
|
1555 |
Mage::helper('postnl')->__('Missing country of origin value for product #%s.', $shipmentItem->getProductId()),
|
1556 |
'POSTNL-0091'
|
1557 |
);
|
1558 |
}
|
1559 |
-
|
1560 |
return $countryOfOrigin;
|
1561 |
}
|
1562 |
-
|
1563 |
/**
|
1564 |
* Get a shipment item's customs value
|
1565 |
-
*
|
1566 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1567 |
-
*
|
1568 |
* @return string
|
1569 |
*/
|
1570 |
protected function _getCustomsValue($shipmentItem)
|
@@ -1576,11 +1581,11 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1576 |
$customsValueAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_CUSTOMS_VALUE_ATTRIBUTE, $storeId);
|
1577 |
$this->setCustomsValueAttribute($customsValueAttribute);
|
1578 |
}
|
1579 |
-
|
1580 |
$customsValue = $shipmentItem->getOrderItem()
|
1581 |
->getProduct()
|
1582 |
->getDataUsingMethod($customsValueAttribute);
|
1583 |
-
|
1584 |
if (empty($customsValue)) {
|
1585 |
throw new TIG_PostNL_Exception(
|
1586 |
Mage::helper('postnl')->__('Missing customs value for product #%s.', $shipmentItem->getProductId()),
|
@@ -1590,12 +1595,12 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1590 |
|
1591 |
return $customsValue;
|
1592 |
}
|
1593 |
-
|
1594 |
/**
|
1595 |
* Get a shipment item's customs description
|
1596 |
-
*
|
1597 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1598 |
-
*
|
1599 |
* @return string
|
1600 |
*/
|
1601 |
protected function _getCustomsDescription($shipmentItem)
|
@@ -1607,123 +1612,123 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1607 |
$descriptionAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_DESCRIPTION_ATTRIBUTE, $storeId);
|
1608 |
$this->setCustomsDescriptionAttribute($descriptionAttribute);
|
1609 |
}
|
1610 |
-
|
1611 |
$description = $shipmentItem->getOrderItem()
|
1612 |
->getProduct()
|
1613 |
->getDataUsingMethod($descriptionAttribute);
|
1614 |
-
|
1615 |
if (empty($description)) {
|
1616 |
throw new TIG_PostNL_Exception(
|
1617 |
Mage::helper('postnl')->__('Missing customs description for product #%s.', $shipmentItem->getProductId()),
|
1618 |
'POSTNL-0093'
|
1619 |
);
|
1620 |
}
|
1621 |
-
|
1622 |
return $description;
|
1623 |
}
|
1624 |
-
|
1625 |
/**
|
1626 |
* Gets the customer code from system/config
|
1627 |
-
*
|
1628 |
* @return string
|
1629 |
*/
|
1630 |
protected function _getCustomerCode()
|
1631 |
{
|
1632 |
$storeId = $this->getStoreId();
|
1633 |
$customerCode = (string) Mage::getStoreConfig(self::XML_PATH_CUSTOMER_CODE, $storeId);
|
1634 |
-
|
1635 |
return $customerCode;
|
1636 |
}
|
1637 |
-
|
1638 |
/**
|
1639 |
* Gets the customer number from system/config
|
1640 |
-
*
|
1641 |
* @return string
|
1642 |
*/
|
1643 |
protected function _getCustomerNumber()
|
1644 |
{
|
1645 |
$storeId = $this->getStoreId();
|
1646 |
$customerNumber = (string) Mage::getStoreConfig(self::XML_PATH_CUSTOMER_NUMBER, $storeId);
|
1647 |
-
|
1648 |
return $customerNumber;
|
1649 |
}
|
1650 |
-
|
1651 |
/**
|
1652 |
* Gets the collection location from system/config
|
1653 |
-
*
|
1654 |
* @return string
|
1655 |
*/
|
1656 |
protected function _getCollectionLocation()
|
1657 |
{
|
1658 |
$storeId = $this->getStoreId();
|
1659 |
$collectionLocation = (string) Mage::getStoreConfig(self::XML_PATH_COLLECTION_LOCATION, $storeId);
|
1660 |
-
|
1661 |
return $collectionLocation;
|
1662 |
}
|
1663 |
-
|
1664 |
/**
|
1665 |
* Gets the global barcode type from system/config
|
1666 |
-
*
|
1667 |
* @return string
|
1668 |
*/
|
1669 |
protected function _getGlobalBarcodeType()
|
1670 |
{
|
1671 |
$storeId = $this->getStoreId();
|
1672 |
$barcodeType = (string) Mage::getStoreConfig(self::XML_PATH_GLOBAL_BARCODE_TYPE, $storeId);
|
1673 |
-
|
1674 |
return $barcodeType;
|
1675 |
}
|
1676 |
-
|
1677 |
/**
|
1678 |
* Gets the global barcode range from system/config
|
1679 |
-
*
|
1680 |
* @return string
|
1681 |
*/
|
1682 |
protected function _getGlobalBarcodeRange()
|
1683 |
{
|
1684 |
$storeId = $this->getStoreId();
|
1685 |
$barcodeRange = (string) Mage::getStoreConfig(self::XML_PATH_GLOBAL_BARCODE_RANGE, $storeId);
|
1686 |
-
|
1687 |
return $barcodeRange;
|
1688 |
}
|
1689 |
-
|
1690 |
/**
|
1691 |
* Gets the customs license from system/config
|
1692 |
-
*
|
1693 |
* @return string
|
1694 |
*/
|
1695 |
protected function _getCustomsLicense()
|
1696 |
{
|
1697 |
$storeId = $this->getStoreId();
|
1698 |
$customsLicense = (string) Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_CUSTOMS_LICENSE_NUMBER, $storeId);
|
1699 |
-
|
1700 |
if (empty($customsLicense)) {
|
1701 |
return false;
|
1702 |
}
|
1703 |
-
|
1704 |
return $customsLicense;
|
1705 |
}
|
1706 |
-
|
1707 |
/**
|
1708 |
* Gets the customs certificate from system/config
|
1709 |
-
*
|
1710 |
* @return string
|
1711 |
*/
|
1712 |
protected function _getCustomsCertificate()
|
1713 |
{
|
1714 |
$storeId = $this->getStoreId();
|
1715 |
$customsCertificate = (string) Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_CUSTOMS_CERTIFICATE_NUMBER, $storeId);
|
1716 |
-
|
1717 |
if (empty($customsCertificate)) {
|
1718 |
return false;
|
1719 |
}
|
1720 |
-
|
1721 |
return $customsCertificate;
|
1722 |
-
}
|
1723 |
-
|
1724 |
/**
|
1725 |
* Get the area field from an address if enabled
|
1726 |
-
*
|
1727 |
* @return string
|
1728 |
*/
|
1729 |
protected function _getArea($address)
|
@@ -1732,21 +1737,21 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1732 |
$areaField = (string) Mage::getStoreConfig(self::XML_PATH_AREA_FIELD, $storeId);
|
1733 |
if ($areaField) {
|
1734 |
$area = $address->getStreet($areaField);
|
1735 |
-
|
1736 |
return $area;
|
1737 |
}
|
1738 |
-
|
1739 |
/**
|
1740 |
* Attempt to get the area through the magic getter instead
|
1741 |
*/
|
1742 |
$area = $address->getArea();
|
1743 |
-
|
1744 |
return $area;
|
1745 |
}
|
1746 |
-
|
1747 |
/**
|
1748 |
* Get the area building name from an address if enabled
|
1749 |
-
*
|
1750 |
* @return string
|
1751 |
*/
|
1752 |
protected function _getBuildingName($address)
|
@@ -1755,21 +1760,21 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1755 |
$buildingNameField = (string) Mage::getStoreConfig(self::XML_PATH_BUILDING_NAME_FIELD, $storeId);
|
1756 |
if ($buildingNameField) {
|
1757 |
$buildingName = $address->getStreet($buildingNameField);
|
1758 |
-
|
1759 |
return $buildingName;
|
1760 |
}
|
1761 |
-
|
1762 |
/**
|
1763 |
* Attempt to get the building name through the magic getter instead
|
1764 |
*/
|
1765 |
$buildingName = $address->getBuildingName();
|
1766 |
-
|
1767 |
return $buildingName;
|
1768 |
}
|
1769 |
-
|
1770 |
/**
|
1771 |
* Get the department field from an address if enabled
|
1772 |
-
*
|
1773 |
* @return string
|
1774 |
*/
|
1775 |
protected function _getDepartment($address)
|
@@ -1778,21 +1783,21 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1778 |
$departmentField = (string) Mage::getStoreConfig(self::XML_PATH_DEPARTMENT_FIELD, $storeId);
|
1779 |
if ($departmentField) {
|
1780 |
$department = $address->getStreet($departmentField);
|
1781 |
-
|
1782 |
return $department;
|
1783 |
}
|
1784 |
-
|
1785 |
/**
|
1786 |
* Attempt to get department through the magic getter instead
|
1787 |
*/
|
1788 |
$department = $address->getDepartment();
|
1789 |
-
|
1790 |
return $department;
|
1791 |
}
|
1792 |
-
|
1793 |
/**
|
1794 |
* Get the doorcode field from an address if enabled
|
1795 |
-
*
|
1796 |
* @return string
|
1797 |
*/
|
1798 |
protected function _getDoorcode($address)
|
@@ -1801,21 +1806,21 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1801 |
$doorcodeField = (string) Mage::getStoreConfig(self::XML_PATH_DOORCODE_FIELD, $storeId);
|
1802 |
if (!$doorcodeField) {
|
1803 |
$doorcode = $address->getStreet($doorcodeField);
|
1804 |
-
|
1805 |
return $doorcode;
|
1806 |
}
|
1807 |
-
|
1808 |
/**
|
1809 |
* Attempt to get the doorcode through the magic getter instead
|
1810 |
*/
|
1811 |
$doorcode = $address->getDoorcode();
|
1812 |
-
|
1813 |
return $doorcode;
|
1814 |
}
|
1815 |
-
|
1816 |
/**
|
1817 |
* Get the floor field from an address if enabled
|
1818 |
-
*
|
1819 |
* @return string
|
1820 |
*/
|
1821 |
protected function _getFloor($address)
|
@@ -1824,21 +1829,21 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1824 |
$floorField = (string) Mage::getStoreConfig(self::XML_PATH_FLOOR_FIELD, $storeId);
|
1825 |
if ($floorField) {
|
1826 |
$floor = $address->getStreet($floorField);
|
1827 |
-
|
1828 |
return $floor;
|
1829 |
}
|
1830 |
-
|
1831 |
/**
|
1832 |
* Attempt to get the floor through the magic getter instead
|
1833 |
*/
|
1834 |
$floor = $address->getFloor();
|
1835 |
-
|
1836 |
return $floor;
|
1837 |
}
|
1838 |
-
|
1839 |
/**
|
1840 |
* Get the remark field from an address if enabled
|
1841 |
-
*
|
1842 |
* @return string
|
1843 |
*/
|
1844 |
protected function _getRemark($address)
|
@@ -1847,32 +1852,32 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1847 |
$remarkField = (string) Mage::getStoreConfig(self::XML_PATH_REMARK_FIELD, $storeId);
|
1848 |
if ($remarkField) {
|
1849 |
$remark = $address->getStreet($remarkField);
|
1850 |
-
|
1851 |
return $remark;
|
1852 |
}
|
1853 |
-
|
1854 |
/**
|
1855 |
* Attempt to get the remark through the magic getter instead
|
1856 |
*/
|
1857 |
$remark = $address->getRemark();
|
1858 |
-
|
1859 |
return $remark;
|
1860 |
}
|
1861 |
-
|
1862 |
/**
|
1863 |
* Get a shipment's reference. By default this will be the shipment's increment ID
|
1864 |
-
*
|
1865 |
* @param Mage_Sales_Model_Order_Shipment
|
1866 |
-
*
|
1867 |
* @return string
|
1868 |
-
*
|
1869 |
* @throws TIG_PostNL_Exception
|
1870 |
*/
|
1871 |
protected function _getReference($shipment)
|
1872 |
{
|
1873 |
$storeId = $this->getStoreId();
|
1874 |
$referenceType = Mage::getStoreConfig(self::XML_PATH_SHIPMENT_REFERENCE_TYPE, $storeId);
|
1875 |
-
|
1876 |
/**
|
1877 |
* Parse the reference type
|
1878 |
*/
|
@@ -1896,18 +1901,18 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
|
1896 |
'POSTNL-0043'
|
1897 |
);
|
1898 |
}
|
1899 |
-
|
1900 |
/**
|
1901 |
* For custom references we need to replace several optional variables
|
1902 |
*/
|
1903 |
if ($referenceType == 'custom') {
|
1904 |
$reference = str_replace('{{var shipment_increment_id}}', $shipment->getIncrementId(), $reference);
|
1905 |
$reference = str_replace('{{var order_increment_id}}', $shipment->getOrder()->getIncrementId(), $reference);
|
1906 |
-
|
1907 |
$store = Mage::getModel('core/store')->load($storeId);
|
1908 |
$reference = str_replace('{{var store_frontend_name}}', $store->getFrontendName(), $reference);
|
1909 |
}
|
1910 |
-
|
1911 |
return $reference;
|
1912 |
}
|
1913 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* ___________ __ __
|
4 |
+
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
+
* \/
|
9 |
+
* ___ __ __
|
10 |
+
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
+
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
+
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
+
* \/ \/
|
15 |
+
* ________
|
16 |
+
* / _____/_______ ____ __ __ ______
|
17 |
+
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
+
* \______ /|__| \____/ |____/ | __/
|
20 |
+
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
+
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
36 |
* @copyright Copyright (c) 2013 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
|
37 |
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
38 |
*/
|
39 |
+
|
40 |
/**
|
41 |
* Class containing all default methods used for CIF communication by this extension.
|
42 |
+
*
|
43 |
* If you wish to add new methods you can etxend this class or create a new class that extends TIG_PostNL_Model_Core_Cif_Abstract
|
44 |
*/
|
45 |
class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
|
52 |
const XML_PATH_COLLECTION_LOCATION = 'postnl/cif/collection_location';
|
53 |
const XML_PATH_GLOBAL_BARCODE_TYPE = 'postnl/cif/global_barcode_type';
|
54 |
const XML_PATH_GLOBAL_BARCODE_RANGE = 'postnl/cif/global_barcode_range';
|
55 |
+
|
56 |
/**
|
57 |
* Constants containing XML paths to cif address configuration options
|
58 |
*/
|
67 |
const XML_PATH_DOORCODE_FIELD = 'postnl/cif_address/doorcode_field';
|
68 |
const XML_PATH_FLOOR_FIELD = 'postnl/cif_address/floor_field';
|
69 |
const XML_PATH_REMARK_FIELD = 'postnl/cif_address/remark_field';
|
70 |
+
|
71 |
/**
|
72 |
* Constants containing xml paths to cif customs configuration options
|
73 |
*/
|
80 |
const XML_PATH_GLOBALPACK_DESCRIPTION_ATTRIBUTE = 'postnl/cif_globalpack_settings/description_attribute';
|
81 |
const XML_PATH_GLOBALPACK_PRODUCT_SORTING_ATTRIBUTE = 'postnl/cif_globalpack_settings/product_sorting_attribute';
|
82 |
const XML_PATH_GLOBALPACK_PRODUCT_SORTING_DIRECTION = 'postnl/cif_globalpack_settings/product_sorting_direction';
|
83 |
+
|
84 |
/**
|
85 |
* XML path to setting that dtermines whether to use a seperate return address
|
86 |
*/
|
87 |
const XML_PATH_USE_SENDER_ADDRESS_AS_RETURN = 'postnl/cif_return_address/use_sender_address';
|
88 |
+
|
89 |
/**
|
90 |
* XML path to sender address data.
|
91 |
+
*
|
92 |
* N.B. missing last part so this will return an array of all fields.
|
93 |
*/
|
94 |
const XML_PATH_SENDER_ADDRESS = 'postnl/cif_sender_address';
|
95 |
+
|
96 |
/**
|
97 |
* XML path to return address data.
|
98 |
+
*
|
99 |
* N.B. missing last part so this will return an array of all fields.
|
100 |
*/
|
101 |
const XML_PATH_RETURN_ADDRESS = 'postnl/cif_return_address';
|
102 |
+
|
103 |
/**
|
104 |
* XML paths for shipment reference info
|
105 |
*/
|
106 |
const XML_PATH_SHIPMENT_REFERENCE_TYPE = 'postnl/cif_labels_and_confirming/shipment_reference_type';
|
107 |
const XML_PATH_CUSTOM_SHIPMENT_REFERENCE = 'postnl/cif_labels_and_confirming/custom_shipment_reference';
|
108 |
+
|
109 |
/**
|
110 |
* Possible barcodes series per barcode type
|
111 |
*/
|
114 |
const EU_BARCODE_SERIE_LONG = '00000000-99999999';
|
115 |
const EU_BARCODE_SERIE_SHORT = '0000000-9999999';
|
116 |
const GLOBAL_BARCODE_SERIE = '0000-9999';
|
117 |
+
|
118 |
/**
|
119 |
* XML path to weight per parcel config setting
|
120 |
*/
|
121 |
+
const XML_PATH_WEIGHT_PER_PARCEL = 'postnl/cif_labels_and_confirming/weight_per_parcel';
|
122 |
+
|
123 |
/**
|
124 |
+
* Regular expression used to split streetname from housenumber. This regex works well for dutch
|
125 |
+
* addresses, but may fail for international addresses. We strongly recommend using split address
|
126 |
* lines instead.
|
127 |
*/
|
128 |
const SPLIT_STREET_REGEX = '#\A(.*?)\s+(\d+[a-zA-Z]{0,1}\s{0,1}[-]{1}\s{0,1}\d*[a-zA-Z]{0,1}|\d+[a-zA-Z-]{0,1}\d*[a-zA-Z]{0,1})#';
|
129 |
+
|
130 |
/**
|
131 |
* Regular expression used to split housenumber and housenumber extension
|
132 |
*/
|
133 |
const SPLIT_HOUSENUMBER_REGEX = '#^([\d]+)(.*)#s';
|
134 |
+
|
135 |
/**
|
136 |
* array containing possible address types
|
137 |
+
*
|
138 |
* @var array
|
139 |
*/
|
140 |
protected $_addressTypes = array(
|
145 |
'Alternative' => '08', // alternative sender. Parcels that cannot be delivered will be returned here
|
146 |
'Delivery' => '09', // for use with PakjeGemak
|
147 |
);
|
148 |
+
|
149 |
/**
|
150 |
* array containing all available printer types. These are used to determine the output type of shipping labels
|
151 |
* currently only GraphicFile|PDF is supported
|
152 |
+
*
|
153 |
* printer type syntax is: <printer family>|<printer type>
|
154 |
+
*
|
155 |
* @var array
|
156 |
*/
|
157 |
protected $_printerTypes = array(
|
164 |
'GraphicFile|JPG 600 dpi',
|
165 |
'GraphicFile|PDF',
|
166 |
'GraphicFile|PS',
|
167 |
+
|
168 |
//Intermec FingerPrint
|
169 |
'IntermecEasyCoder PF4i',
|
170 |
+
|
171 |
//Intermec IDP
|
172 |
'Intermec|EasyCoder E4',
|
173 |
+
|
174 |
//Intermec IPL
|
175 |
'Intermec|EasyCoder PF4i IPL',
|
176 |
+
|
177 |
//Sato
|
178 |
'Sato|GL408e',
|
179 |
+
|
180 |
//Tec TCPL
|
181 |
'TEC|B472',
|
182 |
+
|
183 |
//TECISQ
|
184 |
'Meto|SP 40',
|
185 |
'TEC|B-SV4D',
|
186 |
+
|
187 |
//Zebra EPS2
|
188 |
'Zebra|LP 2844',
|
189 |
'Intermec|Easycoder C4',
|
191 |
'Zebra|EPL 2 Printers',
|
192 |
'Eltron|Orion',
|
193 |
'Intermec|PF8d',
|
194 |
+
|
195 |
//Zebra ZPL II
|
196 |
'Zebra|LP 2844-Z',
|
197 |
'Zebra|Stripe S600',
|
208 |
'Zebra|S4M',
|
209 |
'Zebra|GK420d',
|
210 |
);
|
211 |
+
|
212 |
/**
|
213 |
+
* Array of countires which may send their full street data in a single line,
|
214 |
* rather than having to split them into streetname, housenr and extension parts
|
215 |
+
*
|
216 |
* @var array
|
217 |
*/
|
218 |
protected $_allowedFullStreetCountries = array(
|
219 |
'NL',
|
220 |
'BE'
|
221 |
);
|
222 |
+
|
223 |
/**
|
224 |
* These shipment types require an invoice in the customs declaration. Other possible shipment types are:
|
225 |
* - Gift
|
226 |
* - Documents
|
227 |
+
*
|
228 |
* @var array
|
229 |
*/
|
230 |
protected $_invoiceRequiredShipmentTypes = array(
|
232 |
'Commercial Sample',
|
233 |
'Returned Goods',
|
234 |
);
|
235 |
+
|
236 |
/**
|
237 |
* Get possible address types
|
238 |
+
*
|
239 |
* @return array
|
240 |
*/
|
241 |
public function getAddressTypes()
|
242 |
{
|
243 |
return $this->_addressTypes;
|
244 |
}
|
245 |
+
|
246 |
/**
|
247 |
* Get possible printer types
|
248 |
+
*
|
249 |
* @return array
|
250 |
*/
|
251 |
public function getPrinterTypes()
|
252 |
{
|
253 |
return $this->_printerTypes;
|
254 |
}
|
255 |
+
|
256 |
/**
|
257 |
* Get country IDs that allow fullstreet usage
|
258 |
+
*
|
259 |
* @return array
|
260 |
*/
|
261 |
public function getAllowedFullStreetCountries()
|
262 |
{
|
263 |
return $this->_allowedFullStreetCountries;
|
264 |
}
|
265 |
+
|
266 |
/**
|
267 |
* Get shipment types that require an invoice number
|
268 |
+
*
|
269 |
* @return array
|
270 |
*/
|
271 |
public function getInvoiceRequiredShipmentTypes()
|
272 |
{
|
273 |
return $this->_invoiceRequiredShipmentTypes;
|
274 |
}
|
275 |
+
|
276 |
/**
|
277 |
* Gets the current store id. If no store id is specified, return the default admin store id
|
278 |
+
*
|
279 |
* @return int
|
280 |
*/
|
281 |
public function getStoreId()
|
286 |
|
287 |
$storeId = Mage_Core_Model_App::ADMIN_STORE_ID;
|
288 |
$this->setStoreId($storeId);
|
289 |
+
|
290 |
return $storeId;
|
291 |
}
|
292 |
+
|
293 |
/**
|
294 |
* Retrieves a barcode from CIF
|
295 |
+
*
|
296 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
297 |
* @param string $barcodeType Which kind of barcode to generate
|
298 |
+
*
|
299 |
* @return string
|
300 |
+
*
|
301 |
* @throws TIG_PostNL_Exception
|
302 |
*/
|
303 |
public function generateBarcode($shipment, $barcodeType = 'NL')
|
304 |
{
|
305 |
$this->setStoreId($shipment->getStoreId());
|
306 |
+
|
307 |
$barcode = $this->_getBarcodeData($barcodeType);
|
308 |
+
|
309 |
$message = $this->_getMessage('');
|
310 |
$customer = $this->_getCustomer();
|
311 |
$range = $barcode['range'];
|
312 |
$type = $barcode['type'];
|
313 |
$serie = $barcode['serie'];
|
314 |
+
|
315 |
$soapParams = array(
|
316 |
'Message' => $message,
|
317 |
'Customer' => $customer,
|
321 |
'Serie' => $serie,
|
322 |
),
|
323 |
);
|
324 |
+
|
325 |
$response = $this->call(
|
326 |
+
'Barcode',
|
327 |
'GenerateBarcode',
|
328 |
$soapParams
|
329 |
);
|
330 |
+
|
331 |
+
if (!is_object($response)
|
332 |
|| !isset($response->Barcode)
|
333 |
) {
|
334 |
throw new TIG_PostNL_Exception(
|
336 |
'POSTNL-0054'
|
337 |
);
|
338 |
}
|
339 |
+
|
340 |
return $response->Barcode;
|
341 |
}
|
342 |
|
344 |
* Requests a new barcode from CIF as a ping request. This can be used to validate account settings or to check if the CIF
|
345 |
* service is up and running. This is not meant to be used to generate an actual barcode for a shipment. Use the
|
346 |
* generateBarcode method for that.
|
347 |
+
*
|
348 |
* The generateBarcode CIF call was chosena s it is the simplest CIF function available.
|
349 |
+
*
|
350 |
* @param array $data Array containing all data required for the request.
|
351 |
+
*
|
352 |
* @return string
|
353 |
+
*
|
354 |
* @throws TIG_PostNL_Exception
|
355 |
*/
|
356 |
public function generateBarcodePing($data)
|
357 |
{
|
358 |
$this->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID);
|
359 |
+
|
360 |
$barcode = $this->_getBarcodeData('NL');
|
361 |
+
|
362 |
$message = $this->_getMessage('');
|
363 |
+
$range = $data['customerCode'];
|
364 |
$type = $barcode['type'];
|
365 |
$serie = $barcode['serie'];
|
366 |
+
|
367 |
$customer = array(
|
368 |
'CustomerCode' => $data['customerCode'],
|
369 |
'CustomerNumber' => $data['customerNumber'],
|
370 |
'CollectionLocation' => $data['locationCode'],
|
371 |
);
|
372 |
+
|
373 |
$soapParams = array(
|
374 |
'Message' => $message,
|
375 |
'Customer' => $customer,
|
379 |
'Serie' => $serie,
|
380 |
),
|
381 |
);
|
382 |
+
|
383 |
$response = $this->call(
|
384 |
+
'Barcode',
|
385 |
'GenerateBarcode',
|
386 |
$soapParams,
|
387 |
$data['username'],
|
388 |
$data['password']
|
389 |
);
|
390 |
+
|
391 |
+
if (!is_object($response)
|
392 |
|| !isset($response->Barcode)
|
393 |
) {
|
394 |
throw new TIG_PostNL_Exception(
|
396 |
'POSTNL-0054'
|
397 |
);
|
398 |
}
|
399 |
+
|
400 |
return $response->Barcode;
|
401 |
}
|
402 |
+
|
403 |
/**
|
404 |
* Retrieves the latest shipping status of a shipment from CIF
|
405 |
+
*
|
406 |
* @param TIG_PostNL_Model_Core_Shipment $shipment
|
407 |
+
*
|
408 |
+
* @return StdClass
|
409 |
+
*
|
410 |
* @throws TIG_PostNL_Exception
|
411 |
*/
|
412 |
public function getShipmentStatus($postnlShipment)
|
413 |
{
|
414 |
$shipment = $postnlShipment->getShipment();
|
415 |
+
|
416 |
$barcode = $postnlShipment->getMainBarcode();
|
417 |
$message = $this->_getMessage($barcode);
|
418 |
$customer = $this->_getCustomer();
|
419 |
+
|
420 |
$soapParams = array(
|
421 |
'Message' => $message,
|
422 |
'Customer' => $customer,
|
424 |
'Barcode' => $barcode,
|
425 |
),
|
426 |
);
|
427 |
+
|
428 |
$response = $this->call(
|
429 |
+
'ShippingStatus',
|
430 |
+
'CurrentStatus',
|
431 |
$soapParams
|
432 |
);
|
433 |
+
|
434 |
+
if (!is_object($response)
|
435 |
+
|| !isset($response->Shipments)
|
436 |
|| (!is_array($response->Shipments) && !is_object($response->Shipments))
|
437 |
) {
|
438 |
throw new TIG_PostNL_Exception(
|
440 |
'POSTNL-0055'
|
441 |
);
|
442 |
}
|
443 |
+
|
444 |
foreach($response->Shipments as $shipment) {
|
445 |
/**
|
446 |
* If $shipment is an array, we need the first item
|
448 |
if (is_array($shipment)) {
|
449 |
$shipment = $shipment[0];
|
450 |
}
|
451 |
+
|
452 |
if ($shipment->Barcode === $barcode) { // we need the original shipment, not a related shipment (such as a return shipment)
|
453 |
return $shipment;
|
454 |
}
|
455 |
}
|
456 |
+
|
457 |
/**
|
458 |
* no shipment could be matched to the supplied barcode
|
459 |
+
*/
|
460 |
throw new TIG_PostNL_Exception(
|
461 |
Mage::helper('postnl')->__( 'Unable to match barcode to shippingStatus response: %s', var_export($response, true)),
|
462 |
'POSTNL-0063'
|
463 |
);
|
464 |
}
|
465 |
+
|
466 |
/**
|
467 |
* Retrieves the latest shipping status of a shipment from CIF including full status history
|
468 |
+
*
|
469 |
* @param TIG_PostNL_Model_Core_Shipment $shipment
|
470 |
+
*
|
471 |
+
* @return StdClass
|
472 |
+
*
|
473 |
* @throws TIG_PostNL_Exception
|
474 |
*/
|
475 |
public function getCompleteShipmentStatus($postnlShipment)
|
476 |
{
|
477 |
$shipment = $postnlShipment->getShipment();
|
478 |
+
|
479 |
$barcode = $postnlShipment->getMainBarcode();
|
480 |
$message = $this->_getMessage($barcode);
|
481 |
$customer = $this->_getCustomer();
|
482 |
+
|
483 |
$soapParams = array(
|
484 |
'Message' => $message,
|
485 |
'Customer' => $customer,
|
487 |
'Barcode' => $barcode,
|
488 |
),
|
489 |
);
|
490 |
+
|
491 |
$response = $this->call(
|
492 |
+
'ShippingStatus',
|
493 |
+
'CurrentStatus',
|
494 |
$soapParams
|
495 |
);
|
496 |
+
|
497 |
$response = $this->call(
|
498 |
+
'ShippingStatus',
|
499 |
+
'CompleteStatus',
|
500 |
$soapParams
|
501 |
);
|
502 |
+
|
503 |
+
if (!is_object($response)
|
504 |
+
|| !isset($response->Shipments)
|
505 |
|| (!is_array($response->Shipments) && !is_object($response->Shipments))
|
506 |
) {
|
507 |
throw new TIG_PostNL_Exception(
|
509 |
'POSTNL-0055'
|
510 |
);
|
511 |
}
|
512 |
+
|
513 |
foreach($response->Shipments as $shipment) {
|
514 |
$shipment = $shipment[0];
|
515 |
if ($shipment->Barcode === $barcode) { // we need the original shipment, not a related shipment (such as a return shipment)
|
516 |
return $shipment;
|
517 |
}
|
518 |
}
|
519 |
+
|
520 |
/**
|
521 |
* no shipment could be matched to the supplied barcode
|
522 |
+
*/
|
523 |
throw new TIG_PostNL_Exception(
|
524 |
Mage::helper('postnl')->__( 'Unable to match barcode to shippingStatus response: %s', var_export($response, true)),
|
525 |
'POSTNL-0063'
|
526 |
);
|
527 |
}
|
528 |
+
|
529 |
/**
|
530 |
* Confirms the choen shipment without generating labels
|
531 |
+
*
|
532 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
533 |
* @param string $barcode
|
534 |
+
*
|
535 |
* @return array
|
536 |
+
*
|
537 |
* @throws TIG_PostNL_Exception
|
538 |
*/
|
539 |
public function confirmShipment($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false)
|
540 |
{
|
541 |
$shipment = $postnlShipment->getShipment();
|
542 |
+
|
543 |
$message = $this->_getMessage($barcode);
|
544 |
$customer = $this->_getCustomer($shipment);
|
545 |
+
|
546 |
/**
|
547 |
* Create a single shipment object
|
548 |
*/
|
555 |
'Shipment' => $this->_getShipment($postnlShipment, $barcode, $mainBarcode,$shipmentNumber)
|
556 |
);
|
557 |
}
|
558 |
+
|
559 |
$soapParams = array(
|
560 |
'Message' => $message,
|
561 |
'Customer' => $customer,
|
562 |
'Shipments' => $cifShipment,
|
563 |
);
|
564 |
+
|
565 |
$response = $this->call(
|
566 |
+
'Confirming',
|
567 |
+
'Confirming',
|
568 |
$soapParams
|
569 |
);
|
570 |
+
|
571 |
if (!is_object($response)) {
|
572 |
throw new TIG_PostNL_Exception(
|
573 |
Mage::helper('postnl')->__('Invalid confirmShipment response: %s', var_export($response, true)),
|
574 |
'POSTNL-0056'
|
575 |
);
|
576 |
}
|
577 |
+
|
578 |
+
if (isset($response->ConfirmingResponseShipment)
|
579 |
&& (is_object($response->ConfirmingResponseShipment)
|
580 |
|| is_array($response->ConfirmingResponseShipment)
|
581 |
)
|
582 |
) {
|
583 |
return $response;
|
584 |
}
|
585 |
+
|
586 |
throw new TIG_PostNL_Exception(
|
587 |
Mage::helper('postnl')->__('Invalid confirmShipment response: %s', var_export($response, true)),
|
588 |
'POSTNL-0056'
|
589 |
);
|
590 |
}
|
591 |
+
|
592 |
/**
|
593 |
* Generates shipping labels for the chosen shipment
|
594 |
+
*
|
595 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
596 |
* @param string $printerType The printertype used. Currently only 'GraphicFile|PDF' is fully supported
|
597 |
+
*
|
598 |
* @return array
|
599 |
+
*
|
600 |
* @throws TIG_PostNL_Exception
|
601 |
*/
|
602 |
public function generateLabels($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false, $printerType = 'GraphicFile|PDF')
|
603 |
{
|
604 |
$shipment = $postnlShipment->getShipment();
|
605 |
+
|
606 |
$availablePrinterTypes = $this->_printerTypes;
|
607 |
if (!in_array($printerType, $availablePrinterTypes)) {
|
608 |
throw new TIG_PostNL_Exception(
|
610 |
'POSTNL-0062'
|
611 |
);
|
612 |
}
|
613 |
+
|
614 |
/**
|
615 |
* Create a single shipment object
|
616 |
*/
|
619 |
} else {
|
620 |
$cifShipment = $this->_getShipment($postnlShipment, $barcode, $mainBarcode, $shipmentNumber);
|
621 |
}
|
622 |
+
|
623 |
$message = $this->_getMessage($barcode, array('Printertype' => $printerType));
|
624 |
$customer = $this->_getCustomer($shipment);
|
625 |
+
|
626 |
$soapParams = array(
|
627 |
'Message' => $message,
|
628 |
'Customer' => $customer,
|
629 |
'Shipment' => $cifShipment,
|
630 |
);
|
631 |
+
|
632 |
$response = $this->call(
|
633 |
+
'Labelling',
|
634 |
+
'GenerateLabel',
|
635 |
$soapParams
|
636 |
);
|
637 |
+
|
638 |
+
if (!is_object($response)
|
639 |
+
|| !isset($response->Labels)
|
640 |
|| !is_object($response->Labels)
|
641 |
) {
|
642 |
throw new TIG_PostNL_Exception(
|
644 |
'POSTNL-0057'
|
645 |
);
|
646 |
}
|
647 |
+
|
648 |
return $response;
|
649 |
}
|
650 |
+
|
651 |
/**
|
652 |
* Generates shipping labels for the chosen shipment without confirming it
|
653 |
+
*
|
654 |
* @param Mage_Sales_Model_Order_Shipment $shipment
|
655 |
* @param string $printerType The printertype used. Currently only 'GraphicFile|PDF' is fully supported
|
656 |
+
*
|
657 |
* @return array
|
658 |
+
*
|
659 |
* @throws TIG_PostNL_Exception
|
660 |
*/
|
661 |
public function generateLabelsWithoutConfirm($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false, $printerType = 'GraphicFile|PDF')
|
662 |
{
|
663 |
$shipment = $postnlShipment->getShipment();
|
664 |
+
|
665 |
$availablePrinterTypes = $this->_printerTypes;
|
666 |
if (!in_array($printerType, $availablePrinterTypes)) {
|
667 |
throw new TIG_PostNL_Exception(
|
669 |
'POSTNL-0062'
|
670 |
);
|
671 |
}
|
672 |
+
|
673 |
/**
|
674 |
* Create a single shipment object
|
675 |
*/
|
678 |
} else {
|
679 |
$cifShipment = $this->_getShipment($postnlShipment, $barcode, $mainBarcode, $shipmentNumber);
|
680 |
}
|
681 |
+
|
682 |
$message = $this->_getMessage($barcode, array('Printertype' => $printerType));
|
683 |
$customer = $this->_getCustomer($shipment);
|
684 |
+
|
685 |
$soapParams = array(
|
686 |
'Message' => $message,
|
687 |
'Customer' => $customer,
|
688 |
'Shipment' => $cifShipment,
|
689 |
);
|
690 |
+
|
691 |
$response = $this->call(
|
692 |
+
'Labelling',
|
693 |
+
'GenerateLabelWithoutConfirm',
|
694 |
$soapParams
|
695 |
);
|
696 |
+
|
697 |
+
if (!is_object($response)
|
698 |
+
|| !isset($response->Labels)
|
699 |
|| !is_object($response->Labels)
|
700 |
) {
|
701 |
throw new TIG_PostNL_Exception(
|
703 |
'POSTNL-0058'
|
704 |
);
|
705 |
}
|
706 |
+
|
707 |
return $response;
|
708 |
}
|
709 |
+
|
710 |
/**
|
711 |
* Gets the Message parameter
|
712 |
+
*
|
713 |
* @param array $extra An array of additional parameters to add
|
714 |
+
*
|
715 |
* @return array
|
716 |
*/
|
717 |
protected function _getMessage($barcode, $extra = array())
|
720 |
. $this->_getCustomerNumber()
|
721 |
. $barcode
|
722 |
. microtime();
|
723 |
+
|
724 |
$message = array(
|
725 |
'MessageID' => md5($messageIdString),
|
726 |
'MessageTimeStamp' => date('d-m-Y H:i:s', Mage::getModel('core/date')->gmtTimestamp()),
|
727 |
);
|
728 |
+
|
729 |
if ($extra) {
|
730 |
$message = array_merge($message, $extra);
|
731 |
}
|
732 |
+
|
733 |
return $message;
|
734 |
}
|
735 |
+
|
736 |
/**
|
737 |
* Gets the customer parameter
|
738 |
+
*
|
739 |
* @param Mage_Sales_Model_Order_Shipment | boolean $shipment
|
740 |
+
*
|
741 |
* @return array
|
742 |
*/
|
743 |
protected function _getCustomer($shipment = false)
|
746 |
'CustomerCode' => $this->_getCustomerCode(),
|
747 |
'CustomerNumber' => $this->_getCustomerNumber(),
|
748 |
);
|
749 |
+
|
750 |
if ($shipment) {
|
751 |
$additionalCustomerData = array(
|
752 |
'Address' => $this->_getAddress('Sender'),
|
753 |
'CollectionLocation' => $this->_getCollectionLocation(),
|
754 |
);
|
755 |
+
|
756 |
$customer = array_merge($customer, $additionalCustomerData);
|
757 |
}
|
758 |
+
|
759 |
return $customer;
|
760 |
}
|
761 |
+
|
762 |
/**
|
763 |
* Creates the CIF shipment object based on a PostNL shipment
|
764 |
+
*
|
765 |
+
* @param TIG_PostNL_Model_Core_Shipment $postnlShipment
|
766 |
+
* @param string $barcode
|
767 |
+
* @param bool $mainBarcode
|
768 |
+
* @param bool $shipmentNumber
|
769 |
+
*
|
770 |
* @return array
|
771 |
+
*
|
772 |
+
* @todo modify to support OVM and PostNL checkout shipments
|
773 |
*/
|
774 |
protected function _getShipment($postnlShipment, $barcode, $mainBarcode = false, $shipmentNumber = false)
|
775 |
{
|
776 |
$shipment = $postnlShipment->getShipment();
|
777 |
+
$order = $shipment->getOrder();
|
778 |
$shippingAddress = $shipment->getShippingAddress();
|
779 |
+
|
780 |
$parcelCount = $postnlShipment->getParcelCount();
|
781 |
$shipmentWeight = $postnlShipment->getTotalWeight(true, true);
|
782 |
+
|
783 |
/**
|
784 |
* If a shipmentNumber is provided it means that this is not a single shipment and the weight of the shipment
|
785 |
* needs to be calculated
|
787 |
if ($shipmentNumber !== false) {
|
788 |
$parcelWeight = Mage::getStoreConfig(self::XML_PATH_WEIGHT_PER_PARCEL, $postnlShipment->getStoreId());
|
789 |
$parcelWeight = Mage::helper('postnl/cif')->standardizeWeight($parcelWeight, $shipment->getStoreId(), true); //convert the parcelweight to grams
|
790 |
+
|
791 |
/**
|
792 |
* All parcels except for the last one weigh a configured amount. The last parcel weighs the remainder
|
793 |
*/
|
797 |
$shipmentWeight = $shipmentWeight % $parcelWeight;
|
798 |
}
|
799 |
}
|
800 |
+
|
801 |
/**
|
802 |
* Shipment weight may not be less than 1 gram
|
803 |
*/
|
804 |
if ($shipmentWeight < 1) {
|
805 |
$shipmentWeight = 1;
|
806 |
}
|
807 |
+
|
808 |
$shipmentData = array(
|
809 |
'Barcode' => $barcode,
|
810 |
'CollectionTimeStampEnd' => '',
|
814 |
'ProductCodeDelivery' => $postnlShipment->getProductCode(),
|
815 |
'Reference' => $shipment->getReference(),
|
816 |
'Contacts' => array(
|
817 |
+
'Contact' => $this->_getContact($shippingAddress, $order),
|
818 |
),
|
819 |
'Dimension' => array(
|
820 |
'Weight' => round($shipmentWeight),
|
821 |
),
|
822 |
'Reference' => $this->_getReference($shipment),
|
823 |
);
|
824 |
+
|
825 |
/**
|
826 |
* Add group data (for multi-collo shipments)
|
827 |
*/
|
828 |
if ($parcelCount > 1) {
|
829 |
$groups = array(
|
830 |
'Group' => $this->_getGroup(
|
831 |
+
$parcelCount,
|
832 |
+
$mainBarcode,
|
833 |
$shipmentNumber
|
834 |
),
|
835 |
);
|
836 |
+
|
837 |
$shipmentData['Groups'] = $groups;
|
838 |
}
|
839 |
+
|
840 |
/**
|
841 |
* Add address data
|
842 |
*/
|
843 |
$useSenderAddressAsReturn = Mage::getStoreConfig(self::XML_PATH_USE_SENDER_ADDRESS_AS_RETURN, $this->getStoreId());
|
844 |
$pakjeGemakAddress = $postnlShipment->getPakjeGemakAddress();
|
845 |
+
|
846 |
$addresses = array(
|
847 |
'Address' => array(
|
848 |
$this->_getAddress('Receiver', $shippingAddress)
|
849 |
),
|
850 |
);
|
851 |
+
|
852 |
if (!$useSenderAddressAsReturn) {
|
853 |
$addresses['Address'][] = $this->_getAddress('Alternative');
|
854 |
}
|
855 |
+
|
856 |
if ($pakjeGemakAddress) {
|
857 |
$addresses['Address'][] =$this->_getAddress('Delivery', $pakjeGemakAddress);
|
858 |
}
|
859 |
+
|
860 |
$shipmentData['Addresses'] = $addresses;
|
861 |
+
|
862 |
/**
|
863 |
* Add extra cover data and COD data
|
864 |
* In the case of a multi-collo shipment this is only added to the first parcel
|
868 |
) {
|
869 |
$shipmentData['Amounts'] = $this->_getAmount($postnlShipment);
|
870 |
}
|
871 |
+
|
872 |
/**
|
873 |
* Add customs data
|
874 |
*/
|
875 |
if ($postnlShipment->isGlobalShipment()) {
|
876 |
$shipmentData['Customs'] = $this->_getCustoms($postnlShipment);
|
877 |
}
|
878 |
+
|
879 |
return $shipmentData;
|
880 |
}
|
881 |
+
|
882 |
/**
|
883 |
* Gets an array containing required address data
|
884 |
+
*
|
885 |
* @param string $shippingAddress
|
886 |
* @param Mage_Sales_Model_Order_Address $address
|
887 |
+
*
|
888 |
* @return array
|
889 |
*/
|
890 |
protected function _getAddress($addressType, $shippingAddress= false)
|
896 |
'POSTNL-0108'
|
897 |
);
|
898 |
}
|
899 |
+
|
900 |
/**
|
901 |
* Determine which address to use. Currently only 'Sender' and 'Receiver' are fully supported.
|
902 |
* Other possible address types will use the default 'receiver' address.
|
910 |
* conventional Mage_Sales_Model_Order_Address object.
|
911 |
*/
|
912 |
$senderAddress = Mage::getStoreConfig(self::XML_PATH_SENDER_ADDRESS, $this->getStoreId());
|
913 |
+
|
914 |
$streetData = array(
|
915 |
'streetname' => $senderAddress['streetname'],
|
916 |
'housenumber' => $senderAddress['housenumber'],
|
917 |
'housenumberExtension' => $senderAddress['housenumber_extension'],
|
918 |
'fullStreet' => '',
|
919 |
);
|
920 |
+
|
921 |
$address = new Varien_Object($senderAddress);
|
922 |
break;
|
923 |
case 'Alternative':
|
928 |
if ($useSenderAddress) {
|
929 |
return false;
|
930 |
}
|
931 |
+
|
932 |
/**
|
933 |
* Get all cif_return_address fields as an array and convert that to a Varien_Object
|
934 |
* This allows the _prepareAddress method to access this data in the same way as a
|
935 |
* conventional Mage_Sales_Model_Order_Address object.
|
936 |
*/
|
937 |
$returnAddress = Mage::getStoreConfig(self::XML_PATH_RETURN_ADDRESS, $this->getStoreId());
|
938 |
+
|
939 |
$streetData = array(
|
940 |
'streetname' => $returnAddress['streetname'],
|
941 |
'housenumber' => $returnAddress['housenumber'],
|
942 |
'housenumberExtension' => $returnAddress['housenumber_extension'],
|
943 |
'fullStreet' => '',
|
944 |
);
|
945 |
+
|
946 |
$address = new Varien_Object($returnAddress);
|
947 |
break;
|
948 |
case 'PakjeGemak': //no break
|
951 |
$address = $shippingAddress;
|
952 |
break;
|
953 |
}
|
954 |
+
|
955 |
$addressArray = $this->_prepareAddressArray($address, $streetData);
|
956 |
$addressArray['AddressType'] = $availableAddressTypes[$addressType];
|
957 |
+
|
958 |
return $addressArray;
|
959 |
}
|
960 |
|
961 |
/**
|
962 |
* Forms an array of address data compatible with CIF
|
963 |
+
*
|
964 |
* @param Mage_Sales_Model_Order_Address $address
|
965 |
* @param array | boolean $streetData Optional parameter containing streetname, housenr, housenr extension and fullStreet values.
|
966 |
+
*
|
967 |
* @return array
|
968 |
*/
|
969 |
protected function _prepareAddressArray($address, $streetData = false)
|
971 |
if ($streetData === false) {
|
972 |
$streetData = $this->_getStreetData($address);
|
973 |
}
|
974 |
+
|
975 |
$addressArray = array(
|
976 |
'FirstName' => $address->getFirstname(),
|
977 |
'Name' => $address->getLastname(),
|
991 |
'Floor' => $this->_getFloor($address),
|
992 |
'Remark' => $this->_getRemark($address),
|
993 |
);
|
994 |
+
|
995 |
return $addressArray;
|
996 |
}
|
997 |
+
|
998 |
/**
|
999 |
* Gets data for the barcode that's requested. Depending on the destination of the shipment
|
1000 |
* several barcode types may be requested.
|
1001 |
+
*
|
1002 |
* @param string $barcodeType
|
1003 |
+
*
|
1004 |
* @return array
|
1005 |
+
*
|
1006 |
* @throws TIG_PostNL_Exception
|
1007 |
*/
|
1008 |
protected function _getBarcodeData($barcodeType)
|
1044 |
'POSTNL-0111'
|
1045 |
);
|
1046 |
}
|
1047 |
+
|
1048 |
$barcodeData = array(
|
1049 |
'type' => $type,
|
1050 |
'range' => $range,
|
1051 |
'serie' => $serie,
|
1052 |
);
|
1053 |
+
|
1054 |
return $barcodeData;
|
1055 |
}
|
1056 |
+
|
1057 |
/**
|
1058 |
* Generates the CIF amount object containing the shipment's insured amount (if any)
|
1059 |
+
*
|
1060 |
* @param TIG_PostNL_Model_Core_Shipment $shipment
|
1061 |
+
*
|
1062 |
* @return array
|
1063 |
+
*
|
1064 |
* @todo implement COD
|
1065 |
*/
|
1066 |
protected function _getAmount($postnlShipment)
|
1069 |
if (!$postnlShipment->hasExtraCover() && !$postnlShipment->isCod()) {
|
1070 |
return $amount;
|
1071 |
}
|
1072 |
+
|
1073 |
if ($postnlShipment->hasExtraCover() && $postnlShipment->getExtraCoverAmount() > 0) {
|
1074 |
$extraCover = number_format($postnlShipment->getExtraCoverAmount(), 2, '.', '');
|
1075 |
$amount[] = array(
|
1082 |
'Value' => $extraCover,
|
1083 |
);
|
1084 |
}
|
1085 |
+
|
1086 |
if ($postnlShipment->isCod()) {
|
1087 |
//TODO implement COD here
|
1088 |
}
|
1089 |
+
|
1090 |
return $amount;
|
1091 |
}
|
1092 |
+
|
1093 |
/**
|
1094 |
* Creates the CIF contact object
|
1095 |
+
*
|
1096 |
* @param Mage_Sales_Model_Order_Address $address
|
1097 |
+
* @param Mage_Sales_Model_Order $order
|
1098 |
+
*
|
1099 |
* @return array
|
1100 |
+
*
|
1101 |
* @todo check if SMSNr is required for pakjegemak
|
1102 |
*/
|
1103 |
+
protected function _getContact($address, Mage_Sales_Model_Order $order)
|
1104 |
{
|
1105 |
$contact = array(
|
1106 |
'ContactType' => '01', // Receiver
|
1107 |
+
'Email' => $order->getCustomerEmail(),
|
1108 |
'SMSNr' => '', // never sure if clean 06 number - TODO: check needed for PakjeGemak?
|
1109 |
'TelNr' => $address->getTelephone(),
|
1110 |
);
|
1111 |
+
|
1112 |
return $contact;
|
1113 |
}
|
1114 |
+
|
1115 |
/**
|
1116 |
* Creates the CIF group object
|
1117 |
+
*
|
1118 |
* @return array
|
1119 |
*/
|
1120 |
protected function _getGroup($groupCount = 1, $mainBarcode = false, $shipmentNumber = false)
|
1128 |
);
|
1129 |
return $group;
|
1130 |
}
|
1131 |
+
|
1132 |
$group = array(
|
1133 |
'GroupCount' => $groupCount,
|
1134 |
'GroupSequence' => $shipmentNumber,
|
1135 |
'GroupType' => '03',
|
1136 |
'MainBarcode' => $mainBarcode,
|
1137 |
);
|
1138 |
+
|
1139 |
return $group;
|
1140 |
}
|
1141 |
+
|
1142 |
/**
|
1143 |
* Retrieves streetname, housenumber and housenumber extension from the shipping address.
|
1144 |
+
* The shipping address may be in multiple streetlines configuration or single line
|
1145 |
+
* configuration. In the case of multi-line, each part of the street data will be in a seperate
|
1146 |
+
* field. In the single line configuration, each part will be in the same field and will have
|
1147 |
* to be split using PREG.
|
1148 |
+
*
|
1149 |
* PREG cannot be relied on as it is impossible to create a regex that can filter all
|
1150 |
* possible street syntaxes. Therefore we strongly recommend to use multiple street lines. This
|
1151 |
+
* can be enabled in Magento community in system > config > customer configuration. Or if you
|
1152 |
+
* use Enterprise, in customers > attributes > manage customer address attributes.
|
1153 |
+
*
|
1154 |
* @param Mage_Sales_Model_Order_Address $address
|
1155 |
+
*
|
1156 |
* @return array
|
1157 |
*/
|
1158 |
protected function _getStreetData($address)
|
1159 |
{
|
1160 |
$storeId = $this->getStoreId();
|
1161 |
$splitStreet = Mage::getStoreConfigFlag(self::XML_PATH_SPLIT_STREET, $storeId);
|
1162 |
+
|
1163 |
/**
|
1164 |
* Website uses multi-line address mode
|
1165 |
*/
|
1166 |
if ($splitStreet) {
|
1167 |
$streetData = $this->_getMultiLineStreetData($address);
|
1168 |
+
|
1169 |
/**
|
1170 |
* If $streetData is false it means a required field was missing. In this
|
1171 |
* case the alternative methods are used to obtain the address data.
|
1174 |
return $streetData;
|
1175 |
}
|
1176 |
}
|
1177 |
+
|
1178 |
/**
|
1179 |
* Website uses single-line address mode
|
1180 |
*/
|
1181 |
$allowedFullStreetCountries = $this->getAllowedFullStreetCountries();
|
1182 |
$fullStreet = $address->getStreetFull();
|
1183 |
+
|
1184 |
/**
|
1185 |
* Select countries don't have to split their street values into seperate part
|
1186 |
*/
|
1193 |
);
|
1194 |
return $streetData;
|
1195 |
}
|
1196 |
+
|
1197 |
/**
|
1198 |
* All other countries must split them using PREG
|
1199 |
*/
|
1200 |
$streetData = $this->_getSplitStreetData($fullStreet);
|
1201 |
+
|
1202 |
return $streetData;
|
1203 |
}
|
1204 |
+
|
1205 |
/**
|
1206 |
* Retrieves streetname, housenumber and housenumber extension from the shipping address in the multiple streetlines configuration.
|
1207 |
+
*
|
1208 |
* @param Mage_Sales_Model_Order_Address $address
|
1209 |
+
*
|
1210 |
* @return array
|
1211 |
*/
|
1212 |
protected function _getMultiLineStreetData($address)
|
1214 |
$storeId = $this->getStoreId();
|
1215 |
$streetnameField = (int) Mage::getStoreConfig(self::XML_PATH_STREETNAME_FIELD, $storeId);
|
1216 |
$housenumberField = (int) Mage::getStoreConfig(self::XML_PATH_HOUSENUMBER_FIELD, $storeId);
|
1217 |
+
|
1218 |
$streetname = $address->getStreet($streetnameField);
|
1219 |
$housenumber = $address->getStreet($housenumberField);
|
1220 |
+
|
1221 |
/**
|
1222 |
* If street or housenr fields are empty, use alternative options to obtain the address data
|
1223 |
*/
|
1224 |
if (is_null($streetname) || is_null($housenumber)) {
|
1225 |
return false;
|
1226 |
}
|
1227 |
+
|
1228 |
/**
|
1229 |
* Split the housenumber into a number and an extension
|
1230 |
*/
|
1237 |
$housenumber = $housenumberParts['number'];
|
1238 |
$housenumberExtension = $housenumberParts['extension'];
|
1239 |
}
|
1240 |
+
|
1241 |
$streetData = array(
|
1242 |
'streetname' => $streetname,
|
1243 |
'housenumber' => $housenumber,
|
1244 |
'housenumberExtension' => $housenumberExtension,
|
1245 |
'fullStreet' => '',
|
1246 |
);
|
1247 |
+
|
1248 |
return $streetData;
|
1249 |
}
|
1250 |
+
|
1251 |
/**
|
1252 |
* Splits street data into seperate parts for streetname, housenumber and extension.
|
1253 |
+
*
|
1254 |
* @param string $fullStreet The full streetname including all parts
|
1255 |
+
*
|
1256 |
* @return array
|
1257 |
+
*
|
1258 |
* @throws TIG_PostNL_Exception
|
1259 |
*/
|
1260 |
protected function _getSplitStreetData($fullStreet)
|
1266 |
'POSTNL-0060'
|
1267 |
);
|
1268 |
}
|
1269 |
+
|
1270 |
$streetname = '';
|
1271 |
$housenumber = '';
|
1272 |
if (isset($matches[1])) {
|
1273 |
$streetname = $matches[1];
|
1274 |
}
|
1275 |
+
|
1276 |
if (isset($matches[2])) {
|
1277 |
$housenumber = $matches[2];
|
1278 |
}
|
1279 |
+
|
1280 |
$housenumberParts = $this->_splitHousenumber($housenumber);
|
1281 |
$housenumber = $housenumberParts['number'];
|
1282 |
$housenumberExtension = $housenumberParts['extension'];
|
1283 |
+
|
1284 |
$streetData = array(
|
1285 |
'streetname' => $streetname,
|
1286 |
'housenumber' => $housenumber,
|
1287 |
'housenumberExtension' => $housenumberExtension,
|
1288 |
'fullStreet' => '',
|
1289 |
);
|
1290 |
+
|
1291 |
return $streetData;
|
1292 |
}
|
1293 |
+
|
1294 |
/**
|
1295 |
* Splits a supplier housenumber into a number and an extension
|
1296 |
+
*
|
1297 |
* @param string $housenumber
|
1298 |
+
*
|
1299 |
* @return array
|
1300 |
+
*
|
1301 |
* @throws TIG_PostNL_Exception
|
1302 |
*/
|
1303 |
protected function _splitHousenumber($housenumber)
|
1304 |
{
|
1305 |
$housenumber = trim($housenumber);
|
1306 |
+
|
1307 |
$result = preg_match(self::SPLIT_HOUSENUMBER_REGEX, $housenumber, $matches);
|
1308 |
if (!$result || !is_array($matches)) {
|
1309 |
throw new TIG_PostNL_Exception(
|
1311 |
'POSTNL-0059'
|
1312 |
);
|
1313 |
}
|
1314 |
+
|
1315 |
$extension = '';
|
1316 |
$number = '';
|
1317 |
if (isset($matches[1])) {
|
1318 |
$number = $matches[1];
|
1319 |
}
|
1320 |
+
|
1321 |
if (isset($matches[2])) {
|
1322 |
$extension = trim($matches[2]);
|
1323 |
}
|
1324 |
+
|
1325 |
$housenumberParts = array(
|
1326 |
'number' => $number,
|
1327 |
'extension' => $extension,
|
1328 |
);
|
1329 |
+
|
1330 |
return $housenumberParts;
|
1331 |
}
|
1332 |
+
|
1333 |
/**
|
1334 |
* create Customs CIF object
|
1335 |
+
*
|
1336 |
* @param TIG_PostNL_Model_Core_Shipment $postnlShipment
|
1337 |
+
*
|
1338 |
* @return array
|
1339 |
*/
|
1340 |
protected function _getCustoms($postnlShipment)
|
1341 |
{
|
1342 |
$shipment = $postnlShipment->getShipment();
|
1343 |
$shipmentType = $postnlShipment->getShipmentType();
|
1344 |
+
|
1345 |
$customs = array(
|
1346 |
'ShipmentType' => $shipmentType, // Gift / Documents / Commercial Goods / Commercial Sample / Returned Goods
|
1347 |
'HandleAsNonDeliverable' => 'false',
|
1350 |
'License' => 'false',
|
1351 |
'Currency' => 'EUR',
|
1352 |
);
|
1353 |
+
|
1354 |
/**
|
1355 |
* Check if the shipment should be treated as abandoned when it can't be delivered or if it should be returned to the sender
|
1356 |
*/
|
1357 |
if ($postnlShipment->getTreatAsAbandoned()) {
|
1358 |
$customs['HandleAsNonDeliverable'] = 'true';
|
1359 |
}
|
1360 |
+
|
1361 |
/**
|
1362 |
* Add license info
|
1363 |
*/
|
1365 |
$customs['License'] = 'true';
|
1366 |
$customs['LicenseNr'] = $this->_getCustomsLicense();
|
1367 |
}
|
1368 |
+
|
1369 |
/**
|
1370 |
* Add certificate info
|
1371 |
*/
|
1373 |
$customs['Certificate'] = 'true';
|
1374 |
$customs['CertificateNr'] = $this->_getCustomsCertificate();
|
1375 |
}
|
1376 |
+
|
1377 |
/**
|
1378 |
* Add invoice info
|
1379 |
+
*
|
1380 |
* This is mandatory for certain shipment types as well as when neither a certificate nor a license is available
|
1381 |
*/
|
1382 |
$invoiceRequiredShipmentTypes = $this->getInvoiceRequiredShipmentTypes();
|
1389 |
$customs['Invoice'] = 'true';
|
1390 |
$customs['InvoiceNr'] = $shipmentId;
|
1391 |
}
|
1392 |
+
|
1393 |
/**
|
1394 |
* Add information about the contents of the shipment
|
1395 |
*/
|
1396 |
$itemCount = 0;
|
1397 |
$content = array();
|
1398 |
$items = $this->_sortCustomsItems($shipment->getAllItems());
|
1399 |
+
|
1400 |
foreach ($items as $item) {
|
1401 |
/**
|
1402 |
* A maximum of 5 rows are allowed
|
1404 |
if (++$itemCount > 5) {
|
1405 |
break;
|
1406 |
}
|
1407 |
+
|
1408 |
/**
|
1409 |
* Calculate the item's weight in kg
|
1410 |
*/
|
1411 |
$itemWeight = Mage::helper('postnl/cif')->standardizeWeight(
|
1412 |
+
$item->getWeight(),
|
1413 |
$this->getStoreId()
|
1414 |
);
|
1415 |
+
|
1416 |
/**
|
1417 |
* Item weight may not be less than 1 gram
|
1418 |
*/
|
1419 |
if ($itemWeight < 0.01) {
|
1420 |
$itemWeight = 0.01;
|
1421 |
}
|
1422 |
+
|
1423 |
$itemData = array(
|
1424 |
'Description' => $this->_getCustomsDescription($item),
|
1425 |
'Quantity' => $item->getQty(),
|
1428 |
'HSTariffNr' => $this->_getHSTariff($item),
|
1429 |
'CountryOfOrigin' => $this->_getCountryOfOrigin($item),
|
1430 |
);
|
1431 |
+
|
1432 |
$content[] = $itemData;
|
1433 |
}
|
1434 |
+
|
1435 |
/**
|
1436 |
* If no information was present, supply an array of empty lines instead
|
1437 |
*/
|
1447 |
),
|
1448 |
);
|
1449 |
}
|
1450 |
+
|
1451 |
$customs['Content'] = $content;
|
1452 |
+
|
1453 |
return $customs;
|
1454 |
}
|
1455 |
+
|
1456 |
/**
|
1457 |
* Sorts an array of shipment items based on a product attribute that is defined in the module configuration
|
1458 |
+
*
|
1459 |
* @param array $items
|
1460 |
+
*
|
1461 |
* @return array
|
1462 |
*/
|
1463 |
protected function _sortCustomsItems($items)
|
1467 |
*/
|
1468 |
$sortingAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_PRODUCT_SORTING_ATTRIBUTE, $this->getStoreId());
|
1469 |
$sortingDirection = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_PRODUCT_SORTING_DIRECTION, $this->getStoreId());
|
1470 |
+
|
1471 |
/**
|
1472 |
* Place the item's sorting value in a temporary array where the key is the item's ID
|
1473 |
*/
|
1477 |
$sortingAttributeValue = $product->getDataUsingMethod($sortingAttribute);
|
1478 |
$sortedItems[$item->getId()] = $sortingAttributeValue;
|
1479 |
}
|
1480 |
+
|
1481 |
/**
|
1482 |
* Sort the array in the specified direction using 'natural' sorting
|
1483 |
+
*
|
1484 |
* @link http://us1.php.net/manual/en/function.natsort.php
|
1485 |
*/
|
1486 |
natsort($sortedItems);
|
1487 |
if ($sortingDirection == 'desc') {
|
1488 |
$sortedItems = array_reverse($sortedItems, true); //keep key-value associations
|
1489 |
}
|
1490 |
+
|
1491 |
/**
|
1492 |
* Switch the sorting values with the items
|
1493 |
*/
|
1494 |
foreach ($items as $item) {
|
1495 |
$sortedItems[$item->getId()] = $item;
|
1496 |
}
|
1497 |
+
|
1498 |
return $sortedItems;
|
1499 |
}
|
1500 |
+
|
1501 |
/**
|
1502 |
* Get a shipment item's HS tariff
|
1503 |
+
*
|
1504 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1505 |
+
*
|
1506 |
* @return string
|
1507 |
*/
|
1508 |
protected function _getHSTariff($shipmentItem)
|
1509 |
{
|
1510 |
$storeId = $this->getStoreId();
|
1511 |
+
|
1512 |
/**
|
1513 |
* HS Tariff is an optional attribute. Check if it's used and if not, return a default value of 000000
|
1514 |
*/
|
1515 |
if (!Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_USE_HS_TARIFF_ATTRIBUTE, $storeId)) {
|
1516 |
return '000000';
|
1517 |
}
|
1518 |
+
|
1519 |
if ($this->getHSTariffAttribute() !== null) {
|
1520 |
$hsTariffAttribute = $this->getHSTariffAttribute();
|
1521 |
} else {
|
1522 |
$hsTariffAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_HS_TARIFF_ATTRIBUTE, $storeId);
|
1523 |
$this->setHSTariffAttribute($hsTariffAttribute);
|
1524 |
}
|
1525 |
+
|
1526 |
$hsTariff = $shipmentItem->getOrderItem()
|
1527 |
->getProduct()
|
1528 |
->getDataUsingMethod($hsTariffAttribute);
|
1529 |
+
|
1530 |
if (empty($hsTariff)) {
|
1531 |
+
$hsTariff = '000000';
|
1532 |
}
|
1533 |
+
|
1534 |
return $hsTariff;
|
1535 |
}
|
1536 |
+
|
1537 |
/**
|
1538 |
* Get a shipment item's country of origin
|
1539 |
+
*
|
1540 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1541 |
+
*
|
1542 |
* @return string
|
1543 |
*/
|
1544 |
protected function _getCountryOfOrigin($shipmentItem)
|
1550 |
$countryOfOriginAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_COUNTRY_OF_ORIGIN_ATTRIBUTE, $storeId);
|
1551 |
$this->setCountryOfOriginAttribute($countryOfOriginAttribute);
|
1552 |
}
|
1553 |
+
|
1554 |
$countryOfOrigin = $shipmentItem->getOrderItem()
|
1555 |
->getProduct()
|
1556 |
->getDataUsingMethod($countryOfOriginAttribute);
|
1557 |
+
|
1558 |
if (empty($countryOfOrigin)) {
|
1559 |
throw new TIG_PostNL_Exception(
|
1560 |
Mage::helper('postnl')->__('Missing country of origin value for product #%s.', $shipmentItem->getProductId()),
|
1561 |
'POSTNL-0091'
|
1562 |
);
|
1563 |
}
|
1564 |
+
|
1565 |
return $countryOfOrigin;
|
1566 |
}
|
1567 |
+
|
1568 |
/**
|
1569 |
* Get a shipment item's customs value
|
1570 |
+
*
|
1571 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1572 |
+
*
|
1573 |
* @return string
|
1574 |
*/
|
1575 |
protected function _getCustomsValue($shipmentItem)
|
1581 |
$customsValueAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_CUSTOMS_VALUE_ATTRIBUTE, $storeId);
|
1582 |
$this->setCustomsValueAttribute($customsValueAttribute);
|
1583 |
}
|
1584 |
+
|
1585 |
$customsValue = $shipmentItem->getOrderItem()
|
1586 |
->getProduct()
|
1587 |
->getDataUsingMethod($customsValueAttribute);
|
1588 |
+
|
1589 |
if (empty($customsValue)) {
|
1590 |
throw new TIG_PostNL_Exception(
|
1591 |
Mage::helper('postnl')->__('Missing customs value for product #%s.', $shipmentItem->getProductId()),
|
1595 |
|
1596 |
return $customsValue;
|
1597 |
}
|
1598 |
+
|
1599 |
/**
|
1600 |
* Get a shipment item's customs description
|
1601 |
+
*
|
1602 |
* @param Mage_Sales_Model_Order_Shipment_item
|
1603 |
+
*
|
1604 |
* @return string
|
1605 |
*/
|
1606 |
protected function _getCustomsDescription($shipmentItem)
|
1612 |
$descriptionAttribute = Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_DESCRIPTION_ATTRIBUTE, $storeId);
|
1613 |
$this->setCustomsDescriptionAttribute($descriptionAttribute);
|
1614 |
}
|
1615 |
+
|
1616 |
$description = $shipmentItem->getOrderItem()
|
1617 |
->getProduct()
|
1618 |
->getDataUsingMethod($descriptionAttribute);
|
1619 |
+
|
1620 |
if (empty($description)) {
|
1621 |
throw new TIG_PostNL_Exception(
|
1622 |
Mage::helper('postnl')->__('Missing customs description for product #%s.', $shipmentItem->getProductId()),
|
1623 |
'POSTNL-0093'
|
1624 |
);
|
1625 |
}
|
1626 |
+
|
1627 |
return $description;
|
1628 |
}
|
1629 |
+
|
1630 |
/**
|
1631 |
* Gets the customer code from system/config
|
1632 |
+
*
|
1633 |
* @return string
|
1634 |
*/
|
1635 |
protected function _getCustomerCode()
|
1636 |
{
|
1637 |
$storeId = $this->getStoreId();
|
1638 |
$customerCode = (string) Mage::getStoreConfig(self::XML_PATH_CUSTOMER_CODE, $storeId);
|
1639 |
+
|
1640 |
return $customerCode;
|
1641 |
}
|
1642 |
+
|
1643 |
/**
|
1644 |
* Gets the customer number from system/config
|
1645 |
+
*
|
1646 |
* @return string
|
1647 |
*/
|
1648 |
protected function _getCustomerNumber()
|
1649 |
{
|
1650 |
$storeId = $this->getStoreId();
|
1651 |
$customerNumber = (string) Mage::getStoreConfig(self::XML_PATH_CUSTOMER_NUMBER, $storeId);
|
1652 |
+
|
1653 |
return $customerNumber;
|
1654 |
}
|
1655 |
+
|
1656 |
/**
|
1657 |
* Gets the collection location from system/config
|
1658 |
+
*
|
1659 |
* @return string
|
1660 |
*/
|
1661 |
protected function _getCollectionLocation()
|
1662 |
{
|
1663 |
$storeId = $this->getStoreId();
|
1664 |
$collectionLocation = (string) Mage::getStoreConfig(self::XML_PATH_COLLECTION_LOCATION, $storeId);
|
1665 |
+
|
1666 |
return $collectionLocation;
|
1667 |
}
|
1668 |
+
|
1669 |
/**
|
1670 |
* Gets the global barcode type from system/config
|
1671 |
+
*
|
1672 |
* @return string
|
1673 |
*/
|
1674 |
protected function _getGlobalBarcodeType()
|
1675 |
{
|
1676 |
$storeId = $this->getStoreId();
|
1677 |
$barcodeType = (string) Mage::getStoreConfig(self::XML_PATH_GLOBAL_BARCODE_TYPE, $storeId);
|
1678 |
+
|
1679 |
return $barcodeType;
|
1680 |
}
|
1681 |
+
|
1682 |
/**
|
1683 |
* Gets the global barcode range from system/config
|
1684 |
+
*
|
1685 |
* @return string
|
1686 |
*/
|
1687 |
protected function _getGlobalBarcodeRange()
|
1688 |
{
|
1689 |
$storeId = $this->getStoreId();
|
1690 |
$barcodeRange = (string) Mage::getStoreConfig(self::XML_PATH_GLOBAL_BARCODE_RANGE, $storeId);
|
1691 |
+
|
1692 |
return $barcodeRange;
|
1693 |
}
|
1694 |
+
|
1695 |
/**
|
1696 |
* Gets the customs license from system/config
|
1697 |
+
*
|
1698 |
* @return string
|
1699 |
*/
|
1700 |
protected function _getCustomsLicense()
|
1701 |
{
|
1702 |
$storeId = $this->getStoreId();
|
1703 |
$customsLicense = (string) Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_CUSTOMS_LICENSE_NUMBER, $storeId);
|
1704 |
+
|
1705 |
if (empty($customsLicense)) {
|
1706 |
return false;
|
1707 |
}
|
1708 |
+
|
1709 |
return $customsLicense;
|
1710 |
}
|
1711 |
+
|
1712 |
/**
|
1713 |
* Gets the customs certificate from system/config
|
1714 |
+
*
|
1715 |
* @return string
|
1716 |
*/
|
1717 |
protected function _getCustomsCertificate()
|
1718 |
{
|
1719 |
$storeId = $this->getStoreId();
|
1720 |
$customsCertificate = (string) Mage::getStoreConfig(self::XML_PATH_GLOBALPACK_CUSTOMS_CERTIFICATE_NUMBER, $storeId);
|
1721 |
+
|
1722 |
if (empty($customsCertificate)) {
|
1723 |
return false;
|
1724 |
}
|
1725 |
+
|
1726 |
return $customsCertificate;
|
1727 |
+
}
|
1728 |
+
|
1729 |
/**
|
1730 |
* Get the area field from an address if enabled
|
1731 |
+
*
|
1732 |
* @return string
|
1733 |
*/
|
1734 |
protected function _getArea($address)
|
1737 |
$areaField = (string) Mage::getStoreConfig(self::XML_PATH_AREA_FIELD, $storeId);
|
1738 |
if ($areaField) {
|
1739 |
$area = $address->getStreet($areaField);
|
1740 |
+
|
1741 |
return $area;
|
1742 |
}
|
1743 |
+
|
1744 |
/**
|
1745 |
* Attempt to get the area through the magic getter instead
|
1746 |
*/
|
1747 |
$area = $address->getArea();
|
1748 |
+
|
1749 |
return $area;
|
1750 |
}
|
1751 |
+
|
1752 |
/**
|
1753 |
* Get the area building name from an address if enabled
|
1754 |
+
*
|
1755 |
* @return string
|
1756 |
*/
|
1757 |
protected function _getBuildingName($address)
|
1760 |
$buildingNameField = (string) Mage::getStoreConfig(self::XML_PATH_BUILDING_NAME_FIELD, $storeId);
|
1761 |
if ($buildingNameField) {
|
1762 |
$buildingName = $address->getStreet($buildingNameField);
|
1763 |
+
|
1764 |
return $buildingName;
|
1765 |
}
|
1766 |
+
|
1767 |
/**
|
1768 |
* Attempt to get the building name through the magic getter instead
|
1769 |
*/
|
1770 |
$buildingName = $address->getBuildingName();
|
1771 |
+
|
1772 |
return $buildingName;
|
1773 |
}
|
1774 |
+
|
1775 |
/**
|
1776 |
* Get the department field from an address if enabled
|
1777 |
+
*
|
1778 |
* @return string
|
1779 |
*/
|
1780 |
protected function _getDepartment($address)
|
1783 |
$departmentField = (string) Mage::getStoreConfig(self::XML_PATH_DEPARTMENT_FIELD, $storeId);
|
1784 |
if ($departmentField) {
|
1785 |
$department = $address->getStreet($departmentField);
|
1786 |
+
|
1787 |
return $department;
|
1788 |
}
|
1789 |
+
|
1790 |
/**
|
1791 |
* Attempt to get department through the magic getter instead
|
1792 |
*/
|
1793 |
$department = $address->getDepartment();
|
1794 |
+
|
1795 |
return $department;
|
1796 |
}
|
1797 |
+
|
1798 |
/**
|
1799 |
* Get the doorcode field from an address if enabled
|
1800 |
+
*
|
1801 |
* @return string
|
1802 |
*/
|
1803 |
protected function _getDoorcode($address)
|
1806 |
$doorcodeField = (string) Mage::getStoreConfig(self::XML_PATH_DOORCODE_FIELD, $storeId);
|
1807 |
if (!$doorcodeField) {
|
1808 |
$doorcode = $address->getStreet($doorcodeField);
|
1809 |
+
|
1810 |
return $doorcode;
|
1811 |
}
|
1812 |
+
|
1813 |
/**
|
1814 |
* Attempt to get the doorcode through the magic getter instead
|
1815 |
*/
|
1816 |
$doorcode = $address->getDoorcode();
|
1817 |
+
|
1818 |
return $doorcode;
|
1819 |
}
|
1820 |
+
|
1821 |
/**
|
1822 |
* Get the floor field from an address if enabled
|
1823 |
+
*
|
1824 |
* @return string
|
1825 |
*/
|
1826 |
protected function _getFloor($address)
|
1829 |
$floorField = (string) Mage::getStoreConfig(self::XML_PATH_FLOOR_FIELD, $storeId);
|
1830 |
if ($floorField) {
|
1831 |
$floor = $address->getStreet($floorField);
|
1832 |
+
|
1833 |
return $floor;
|
1834 |
}
|
1835 |
+
|
1836 |
/**
|
1837 |
* Attempt to get the floor through the magic getter instead
|
1838 |
*/
|
1839 |
$floor = $address->getFloor();
|
1840 |
+
|
1841 |
return $floor;
|
1842 |
}
|
1843 |
+
|
1844 |
/**
|
1845 |
* Get the remark field from an address if enabled
|
1846 |
+
*
|
1847 |
* @return string
|
1848 |
*/
|
1849 |
protected function _getRemark($address)
|
1852 |
$remarkField = (string) Mage::getStoreConfig(self::XML_PATH_REMARK_FIELD, $storeId);
|
1853 |
if ($remarkField) {
|
1854 |
$remark = $address->getStreet($remarkField);
|
1855 |
+
|
1856 |
return $remark;
|
1857 |
}
|
1858 |
+
|
1859 |
/**
|
1860 |
* Attempt to get the remark through the magic getter instead
|
1861 |
*/
|
1862 |
$remark = $address->getRemark();
|
1863 |
+
|
1864 |
return $remark;
|
1865 |
}
|
1866 |
+
|
1867 |
/**
|
1868 |
* Get a shipment's reference. By default this will be the shipment's increment ID
|
1869 |
+
*
|
1870 |
* @param Mage_Sales_Model_Order_Shipment
|
1871 |
+
*
|
1872 |
* @return string
|
1873 |
+
*
|
1874 |
* @throws TIG_PostNL_Exception
|
1875 |
*/
|
1876 |
protected function _getReference($shipment)
|
1877 |
{
|
1878 |
$storeId = $this->getStoreId();
|
1879 |
$referenceType = Mage::getStoreConfig(self::XML_PATH_SHIPMENT_REFERENCE_TYPE, $storeId);
|
1880 |
+
|
1881 |
/**
|
1882 |
* Parse the reference type
|
1883 |
*/
|
1901 |
'POSTNL-0043'
|
1902 |
);
|
1903 |
}
|
1904 |
+
|
1905 |
/**
|
1906 |
* For custom references we need to replace several optional variables
|
1907 |
*/
|
1908 |
if ($referenceType == 'custom') {
|
1909 |
$reference = str_replace('{{var shipment_increment_id}}', $shipment->getIncrementId(), $reference);
|
1910 |
$reference = str_replace('{{var order_increment_id}}', $shipment->getOrder()->getIncrementId(), $reference);
|
1911 |
+
|
1912 |
$store = Mage::getModel('core/store')->load($storeId);
|
1913 |
$reference = str_replace('{{var store_frontend_name}}', $store->getFrontendName(), $reference);
|
1914 |
}
|
1915 |
+
|
1916 |
return $reference;
|
1917 |
}
|
1918 |
}
|
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* ___________ __ __
|
4 |
-
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
-
* \/
|
9 |
-
* ___ __ __
|
10 |
-
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
-
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
-
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
-
* \/ \/
|
15 |
-
* ________
|
16 |
-
* / _____/_______ ____ __ __ ______
|
17 |
-
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
-
* \______ /|__| \____/ |____/ | __/
|
20 |
-
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
-
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
@@ -40,42 +40,42 @@ class TIG_PostNL_Model_ExtensionControl_Observer_Cron
|
|
40 |
{
|
41 |
/**
|
42 |
* updates the shop's statistics with the extension control system.
|
43 |
-
*
|
44 |
* @return TIG_PostNL_Model_ExtensionControl_Observer_Cron
|
45 |
*/
|
46 |
public function updateStatistics()
|
47 |
{
|
48 |
$helper = Mage::helper('postnl');
|
49 |
-
|
50 |
/**
|
51 |
* Check if the PostNL module is active
|
52 |
*/
|
53 |
if (!$helper->isEnabled()) {
|
54 |
return $this;
|
55 |
}
|
56 |
-
|
57 |
/**
|
58 |
* Check if the extension may send statistics to the extension control system
|
59 |
*/
|
60 |
if (!Mage::helper('postnl/webservices')->canSendStatistics()) {
|
61 |
return $this;
|
62 |
}
|
63 |
-
|
64 |
$helper->cronLog('UpdateStatistics cron starting...');
|
65 |
-
|
66 |
/**
|
67 |
* Attempt to update the shop's statistics
|
68 |
*/
|
69 |
try {
|
70 |
$helper->cronLog('Updating shop statistics.');
|
71 |
-
|
72 |
$webservices = Mage::getModel('postnl_extensioncontrol/webservices');
|
73 |
$webservices->updateStatistics();
|
74 |
} catch (Exception $e) {
|
75 |
$helper->cronLog('An error occurred: ' . $e->getMessage());
|
76 |
$helper->logException($e);
|
77 |
}
|
78 |
-
|
79 |
$helper->cronLog('UpdateStatistics has finished.');
|
80 |
return $this;
|
81 |
}
|
@@ -88,31 +88,31 @@ class TIG_PostNL_Model_ExtensionControl_Observer_Cron
|
|
88 |
public function checkFeedUpdate()
|
89 |
{
|
90 |
$helper = Mage::helper('postnl');
|
91 |
-
|
92 |
/**
|
93 |
* Check if the PostNL module is active
|
94 |
*/
|
95 |
if (!$helper->isEnabled()) {
|
96 |
return $this;
|
97 |
}
|
98 |
-
|
99 |
/**
|
100 |
* Check if the extension may send statistics to the extension control system
|
101 |
*/
|
102 |
if (!Mage::helper('postnl/webservices')->canReceiveUpdates()) {
|
103 |
return $this;
|
104 |
}
|
105 |
-
|
106 |
$helper->cronLog('CheckFeedUpdate cron starting...');
|
107 |
|
108 |
$feedData = array();
|
109 |
-
|
110 |
/**
|
111 |
* Get the feed
|
112 |
*/
|
113 |
$feed = Mage::getModel('postnl_extensioncontrol/feed');
|
114 |
$feedXml = $feed->getFeedData();
|
115 |
-
|
116 |
/**
|
117 |
* Parse the feed
|
118 |
*/
|
@@ -122,16 +122,16 @@ class TIG_PostNL_Model_ExtensionControl_Observer_Cron
|
|
122 |
if ($severity < 1 || $severity > 4) {
|
123 |
$severity = 4;
|
124 |
}
|
125 |
-
|
126 |
/**
|
127 |
* Add a notification for each item that is new
|
128 |
*/
|
129 |
$feedData[] = array(
|
130 |
'severity' => $severity,
|
131 |
'date_added' => $feed->getDate((string) $item->pubDate),
|
132 |
-
'title' => (string) $item->title,
|
133 |
-
'description' => (string) $item->description,
|
134 |
-
'url' => (string) $item->link,
|
135 |
);
|
136 |
}
|
137 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* ___________ __ __
|
4 |
+
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
+
* \/
|
9 |
+
* ___ __ __
|
10 |
+
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
+
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
+
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
+
* \/ \/
|
15 |
+
* ________
|
16 |
+
* / _____/_______ ____ __ __ ______
|
17 |
+
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
+
* \______ /|__| \____/ |____/ | __/
|
20 |
+
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
+
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
40 |
{
|
41 |
/**
|
42 |
* updates the shop's statistics with the extension control system.
|
43 |
+
*
|
44 |
* @return TIG_PostNL_Model_ExtensionControl_Observer_Cron
|
45 |
*/
|
46 |
public function updateStatistics()
|
47 |
{
|
48 |
$helper = Mage::helper('postnl');
|
49 |
+
|
50 |
/**
|
51 |
* Check if the PostNL module is active
|
52 |
*/
|
53 |
if (!$helper->isEnabled()) {
|
54 |
return $this;
|
55 |
}
|
56 |
+
|
57 |
/**
|
58 |
* Check if the extension may send statistics to the extension control system
|
59 |
*/
|
60 |
if (!Mage::helper('postnl/webservices')->canSendStatistics()) {
|
61 |
return $this;
|
62 |
}
|
63 |
+
|
64 |
$helper->cronLog('UpdateStatistics cron starting...');
|
65 |
+
|
66 |
/**
|
67 |
* Attempt to update the shop's statistics
|
68 |
*/
|
69 |
try {
|
70 |
$helper->cronLog('Updating shop statistics.');
|
71 |
+
|
72 |
$webservices = Mage::getModel('postnl_extensioncontrol/webservices');
|
73 |
$webservices->updateStatistics();
|
74 |
} catch (Exception $e) {
|
75 |
$helper->cronLog('An error occurred: ' . $e->getMessage());
|
76 |
$helper->logException($e);
|
77 |
}
|
78 |
+
|
79 |
$helper->cronLog('UpdateStatistics has finished.');
|
80 |
return $this;
|
81 |
}
|
88 |
public function checkFeedUpdate()
|
89 |
{
|
90 |
$helper = Mage::helper('postnl');
|
91 |
+
|
92 |
/**
|
93 |
* Check if the PostNL module is active
|
94 |
*/
|
95 |
if (!$helper->isEnabled()) {
|
96 |
return $this;
|
97 |
}
|
98 |
+
|
99 |
/**
|
100 |
* Check if the extension may send statistics to the extension control system
|
101 |
*/
|
102 |
if (!Mage::helper('postnl/webservices')->canReceiveUpdates()) {
|
103 |
return $this;
|
104 |
}
|
105 |
+
|
106 |
$helper->cronLog('CheckFeedUpdate cron starting...');
|
107 |
|
108 |
$feedData = array();
|
109 |
+
|
110 |
/**
|
111 |
* Get the feed
|
112 |
*/
|
113 |
$feed = Mage::getModel('postnl_extensioncontrol/feed');
|
114 |
$feedXml = $feed->getFeedData();
|
115 |
+
|
116 |
/**
|
117 |
* Parse the feed
|
118 |
*/
|
122 |
if ($severity < 1 || $severity > 4) {
|
123 |
$severity = 4;
|
124 |
}
|
125 |
+
|
126 |
/**
|
127 |
* Add a notification for each item that is new
|
128 |
*/
|
129 |
$feedData[] = array(
|
130 |
'severity' => $severity,
|
131 |
'date_added' => $feed->getDate((string) $item->pubDate),
|
132 |
+
'title' => $helper->escapeHtml((string) $item->title),
|
133 |
+
'description' => $helper->escapeHtml((string) $item->description),
|
134 |
+
'url' => $helper->escapeHtml((string) $item->link),
|
135 |
);
|
136 |
}
|
137 |
|
@@ -52,7 +52,7 @@ class TIG_PostNL_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Ac
|
|
52 |
/**
|
53 |
* @var boolean
|
54 |
*/
|
55 |
-
protected $_isTestMode;
|
56 |
|
57 |
/**
|
58 |
* Validate the extension's account settings.
|
@@ -84,7 +84,9 @@ class TIG_PostNL_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Ac
|
|
84 |
|
85 |
$data = $this->_getInheritedValues($data);
|
86 |
|
87 |
-
|
|
|
|
|
88 |
|
89 |
/**
|
90 |
* If the password field has not been edited since the last time it was saved, it will contain 6 asteriscs for security
|
52 |
/**
|
53 |
* @var boolean
|
54 |
*/
|
55 |
+
protected $_isTestMode = false;
|
56 |
|
57 |
/**
|
58 |
* Validate the extension's account settings.
|
84 |
|
85 |
$data = $this->_getInheritedValues($data);
|
86 |
|
87 |
+
if ($data['isTestMode'] === 'true') {
|
88 |
+
$this->_isTestMode = true;
|
89 |
+
}
|
90 |
|
91 |
/**
|
92 |
* If the password field has not been edited since the last time it was saved, it will contain 6 asteriscs for security
|
@@ -41,7 +41,7 @@
|
|
41 |
<config>
|
42 |
<modules>
|
43 |
<TIG_PostNL>
|
44 |
-
<version>1.1.
|
45 |
</TIG_PostNL>
|
46 |
</modules>
|
47 |
|
41 |
<config>
|
42 |
<modules>
|
43 |
<TIG_PostNL>
|
44 |
+
<version>1.1.5</version>
|
45 |
</TIG_PostNL>
|
46 |
</modules>
|
47 |
|
@@ -660,7 +660,7 @@
|
|
660 |
</email_header>
|
661 |
<send_track_and_trace_email translate="label comment" module="postnl">
|
662 |
<label>Send track & trace email to customer</label>
|
663 |
-
<comment>If enabled, a track & trace
|
664 |
<frontend_type>select</frontend_type>
|
665 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
666 |
<sort_order>130</sort_order>
|
660 |
</email_header>
|
661 |
<send_track_and_trace_email translate="label comment" module="postnl">
|
662 |
<label>Send track & trace email to customer</label>
|
663 |
+
<comment>If enabled, a track & trace email will be sent to the customer roughly 20 minutes after a shipment has been confirmed.</comment>
|
664 |
<frontend_type>select</frontend_type>
|
665 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
666 |
<sort_order>130</sort_order>
|
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* ___________ __ __
|
4 |
-
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
-
* \/
|
9 |
-
* ___ __ __
|
10 |
-
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
-
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
-
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
-
* \/ \/
|
15 |
-
* ________
|
16 |
-
* / _____/_______ ____ __ __ ______
|
17 |
-
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
-
* \______ /|__| \____/ |____/ | __/
|
20 |
-
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
-
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
@@ -49,7 +49,7 @@
|
|
49 |
onComplete: function(response) {
|
50 |
var responseText = response.responseText;
|
51 |
$('waiting_for_ping_spinner').hide();
|
52 |
-
|
53 |
$('postnl_checkout_seperator').show();
|
54 |
if (responseText == 'OK') {
|
55 |
$('postnl_checkout').show();
|
@@ -58,34 +58,34 @@
|
|
58 |
}
|
59 |
}
|
60 |
});
|
61 |
-
|
62 |
var PostNLCheckout = new Class.create();
|
63 |
PostNLCheckout.prototype = {
|
64 |
initialize: function(url, successUrl, environment) {
|
65 |
this.url = url;
|
66 |
this.createIframe();
|
67 |
this.overlay = $('postnl-overlay');
|
68 |
-
|
69 |
PostNL_OP_Checkout.initCheckout(
|
70 |
function() {
|
71 |
if ($('postnl-overlay')) {
|
72 |
$('postnl-overlay').show();
|
73 |
}
|
74 |
window.location = successUrl;
|
75 |
-
},
|
76 |
function() {
|
77 |
// Cancel Action
|
78 |
-
},
|
79 |
function() {
|
80 |
// Login Action
|
81 |
-
},
|
82 |
environment
|
83 |
);
|
84 |
},
|
85 |
createIframe: function() {
|
86 |
var iframe = document.createElement("div");
|
87 |
iframe.id = "iframe";
|
88 |
-
iframe.setAttribute("style", "z-index:9999999;");
|
89 |
document.body.appendChild(iframe);
|
90 |
},
|
91 |
startCheckout: function(elem) {
|
@@ -106,19 +106,19 @@
|
|
106 |
alert('<?php echo $this->__('An error occurred. Please use our regular checkout instead.'); ?>');
|
107 |
document.body.style.cursor = 'default';
|
108 |
this.overlay.hide();
|
109 |
-
|
110 |
return false;
|
111 |
}
|
112 |
-
|
113 |
var data = eval('(' + transport.responseText + ')');
|
114 |
PostNL_OP_Checkout.showCheckout(data[0].orderToken);
|
115 |
document.body.style.cursor = 'default';
|
116 |
this.overlay.hide();
|
117 |
}
|
118 |
};
|
119 |
-
|
120 |
postnlcheckoutWidget = new PostNLCheckout(
|
121 |
-
'<?php echo $this->getUrl('postnl/checkout/prepareOrder'
|
122 |
'<?php echo $_continueUrl; ?>',
|
123 |
<?php echo $_environment; ?>
|
124 |
);
|
1 |
<?php
|
2 |
/**
|
3 |
+
* ___________ __ __
|
4 |
+
* \__ ___/____ _/ |_ _____ | |
|
5 |
* | | / _ \\ __\\__ \ | |
|
6 |
* | | | |_| || | / __ \_| |__
|
7 |
* |____| \____/ |__| (____ /|____/
|
8 |
+
* \/
|
9 |
+
* ___ __ __
|
10 |
+
* | | ____ _/ |_ ____ _______ ____ ____ _/ |_
|
11 |
* | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
|
12 |
+
* | || | \| | \ ___/ | | \/| | \\ ___/ | |
|
13 |
+
* |___||___| /|__| \_____>|__| |___| / \_____>|__|
|
14 |
+
* \/ \/
|
15 |
+
* ________
|
16 |
+
* / _____/_______ ____ __ __ ______
|
17 |
+
* / \ ___\_ __ \ / _ \ | | \\____ \
|
18 |
* \ \_\ \| | \/| |_| || | /| |_| |
|
19 |
+
* \______ /|__| \____/ |____/ | __/
|
20 |
+
* \/ |__|
|
21 |
*
|
22 |
* NOTICE OF LICENSE
|
23 |
*
|
24 |
* This source file is subject to the Creative Commons License.
|
25 |
+
* It is available through the world-wide-web at this URL:
|
26 |
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
|
27 |
* If you are unable to obtain it through the world-wide-web, please send an email
|
28 |
* to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
|
49 |
onComplete: function(response) {
|
50 |
var responseText = response.responseText;
|
51 |
$('waiting_for_ping_spinner').hide();
|
52 |
+
|
53 |
$('postnl_checkout_seperator').show();
|
54 |
if (responseText == 'OK') {
|
55 |
$('postnl_checkout').show();
|
58 |
}
|
59 |
}
|
60 |
});
|
61 |
+
|
62 |
var PostNLCheckout = new Class.create();
|
63 |
PostNLCheckout.prototype = {
|
64 |
initialize: function(url, successUrl, environment) {
|
65 |
this.url = url;
|
66 |
this.createIframe();
|
67 |
this.overlay = $('postnl-overlay');
|
68 |
+
|
69 |
PostNL_OP_Checkout.initCheckout(
|
70 |
function() {
|
71 |
if ($('postnl-overlay')) {
|
72 |
$('postnl-overlay').show();
|
73 |
}
|
74 |
window.location = successUrl;
|
75 |
+
},
|
76 |
function() {
|
77 |
// Cancel Action
|
78 |
+
},
|
79 |
function() {
|
80 |
// Login Action
|
81 |
+
},
|
82 |
environment
|
83 |
);
|
84 |
},
|
85 |
createIframe: function() {
|
86 |
var iframe = document.createElement("div");
|
87 |
iframe.id = "iframe";
|
88 |
+
iframe.setAttribute("style", "z-index:9999999;");
|
89 |
document.body.appendChild(iframe);
|
90 |
},
|
91 |
startCheckout: function(elem) {
|
106 |
alert('<?php echo $this->__('An error occurred. Please use our regular checkout instead.'); ?>');
|
107 |
document.body.style.cursor = 'default';
|
108 |
this.overlay.hide();
|
109 |
+
|
110 |
return false;
|
111 |
}
|
112 |
+
|
113 |
var data = eval('(' + transport.responseText + ')');
|
114 |
PostNL_OP_Checkout.showCheckout(data[0].orderToken);
|
115 |
document.body.style.cursor = 'default';
|
116 |
this.overlay.hide();
|
117 |
}
|
118 |
};
|
119 |
+
|
120 |
postnlcheckoutWidget = new PostNLCheckout(
|
121 |
+
'<?php echo $this->getUrl('postnl/checkout/prepareOrder'); ?>',
|
122 |
'<?php echo $_continueUrl; ?>',
|
123 |
<?php echo $_environment; ?>
|
124 |
);
|
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>tig_postnl</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US">Creative Commons License</license>
|
7 |
<channel>community</channel>
|
@@ -20,7 +20,17 @@ Services included:
|
|
20 |
- Viewing detailed shipping status information
|
21 |
- PostNL Checkout
|
22 |
- Emailing customers track & trace information, allowing them to track their shipment from the moment you confirm it to the moment it arrives at their doorstep</description>
|
23 |
-
<notes>==== v1.1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |

|
25 |
==== New features ====
|
26 |
- Added a default test account to the extension. New installation will automatically have a PostNL test account pre-configured.
|
@@ -105,9 +115,9 @@ Services included:
|
|
105 |

|
106 |
This is the initial beta release of the extension. If you have any questions, please contact the Total Internet Group Servicedesk</notes>
|
107 |
<authors><author><name>TiG</name><user>supporttotal</user><email>servicedesk@totalinternetgroup.nl</email></author></authors>
|
108 |
-
<date>2014-
|
109 |
-
<time>
|
110 |
-
<contents><target name="magecommunity"><dir name="TIG"><dir name="PostNL"><dir name="Block"><dir name="Adminhtml"><file name="CronNotification.php" hash="ec6263ed9fca94273bbc5d5493cac0ce"/><dir name="Sales"><dir name="Order"><file name="ProductOptions.php" hash="f46f9e9ba1a37ceff2db6d3131a21ebb"/><dir name="Shipment"><dir name="Create"><file name="ShipmentOptions.php" hash="6a63d89143a8b310f93ef73385f3eda0"/></dir><dir name="View"><file name="ShippingStatus.php" hash="297af21cb49e6b2cdfee192dfbf5f239"/><dir name="Tab"><file name="StatusHistory.php" hash="7b6bd52216822f7dc71fc998e8056376"/></dir><file name="Tabs.php" hash="a213c367f78e84fafd05d9d6310db5f5"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="ActivateButton.php" hash="2f57922bb9347b0b9d21a1a82529ffb4"/><file name="ActivatedFieldHeader.php" hash="4af748c827c108c2d72f12d1e9de0681"/><file name="ConfigCheck.php" hash="37dab6f23c95abb7d3b65fc4a5a89a00"/><file name="InfoBox.php" hash="4b93fd3c1e44230c4d8c3fb93ec581f3"/><file name="SplitAddressCheck.php" hash="cc8509b1f1fee9d825980382dc0833c2"/><file name="SupportTab.php" hash="e34f2bf7e87060698e0560894319b3b0"/><dir name="TextBox"><file name="Abstract.php" hash="423c2b84db587309a8a6d90dabc4de4f"/></dir><file name="ValidateButton.php" hash="5a30e6615a96e05cf3600855c15544de"/><file name="WarningBox.php" hash="36dce34841f2252f466e78dc2eddf1ba"/></dir><file name="Fieldset.php" hash="1bc60b1e6644802198c62666b50d3acf"/></dir><file name="Form.php" hash="a4fe68b2216fdccafb1bfecfa3f8e1a1"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Action.php" hash="9fc6e2f204f2238ab29699b614589134"/><file name="Barcode.php" hash="74858ac29b17c675cb2d8f55b8cba3fc"/><file name="ConfirmDate.php" hash="3d6692b46faaeedf55ab74e4b239790f"/><file name="ConfirmStatus.php" hash="db96b519fa025bb9f5f5737bb0e80bf2"/><file name="ShipmentType.php" hash="2a817a37ab1ccdc8a7e836f0443d012f"/><file name="ShippingPhase.php" hash="9ee0fc92ee2cc623edb3df86247d2d06"/><file name="Time.php" hash="dbf5b70742e0877eff7f01ec65319e3b"/><file name="Translate.php" hash="46d83e4013d6ab1d14d39f303703e5c4"/><file name="YesNo.php" hash="1bdb10008eecb146fd185040e24d48e5"/></dir></dir></dir></dir></dir><dir name="Checkout"><dir name="Cart"><file name="CheckoutLink.php" hash="b0c3e048cfcbb6d91000ab4df4b502cc"/><file name="Js.php" hash="acb7f5ad743ca311153b639f6ea33c75"/></dir><dir name="Summary"><file name="Totals.php" hash="bbe4ec0aaf15ecc40bff8504d67aa1e4"/></dir><file name="Summary.php" hash="a2b997d74cee541fd570327a496e30fb"/></dir><dir name="Core"><file name="ShippingStatus.php" hash="c92beeec25228692afcc2f64ed44dd01"/></dir></dir><file name="Exception.php" hash="5b9f750676440653abfee244727aa29f"/><dir name="Helper"><file name="Carrier.php" hash="9625f891a86da6b84c4bdf5f1ff37597"/><file name="Checkout.php" hash="cf0907c1d9601c137c2fd8b3c1d3487d"/><file name="Cif.php" hash="0285a984fe853a189081a4aa9e4db057"/><file name="Data.php" hash="dd3ecac31d13ecabc4bf2e4d17d1cdad"/><file name="Webservices.php" hash="0cc54fac78af257b2740d9519e9570d3"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Observer"><file name="OrderGrid.php" hash="f0b59f8fcf1293ff1fafb464c4e05d2f"/><file name="ShipmentGrid.php" hash="6d6acc13423d2b9cb954c8aae681ebac"/><file name="ShipmentView.php" hash="208a690d8a09658dfc8f0dfcb2696b77"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="ShipmentGridColumns.php" hash="fec7db9a0c5ba79c6a0987ddec42e4cc"/></dir></dir></dir></dir><dir name="Carrier"><file name="Postnl.php" hash="f0143161e67fcd16e6739015c776d0f9"/><dir name="System"><dir name="Config"><dir name="Source"><file name="RateType.php" hash="940bf2381b879188d6e4aa756d0d0dce"/></dir></dir></dir></dir><dir name="Checkout"><file name="Cif.php" hash="9ab1f1c983f5b3ba41a9019e723ec1c3"/><dir name="Observer"><file name="Order.php" hash="5cf7b700b2286a6916f23e72e3346beb"/><file name="Shipment.php" hash="217a3bf9d730f1061e9d3117edc6c2a3"/></dir><file name="Order.php" hash="619b8f385b29357449644def665f58c0"/><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="fe0751975beca120d547a2a6db7eb9a8"/></dir><file name="Order.php" hash="d821477695f495031b62eb85b383f981"/></dir><file name="Service.php" hash="6ff1b8c9d595b14059c6422c3472c90a"/><dir name="System"><dir name="Config"><dir name="Source"><file name="ActivePaymentMethods.php" hash="7e9ff249f3ca3ca28e8e4831e2a9b4cb"/><file name="CmsPage.php" hash="0ed3351761c49cad9f3611704f61aa5e"/></dir></dir></dir></dir><dir name="Core"><dir name="Cif"><file name="Abstract.php" hash="e85f0bd137fcc02c01c47995cb03325d"/><file name="Exception.php" hash="c448a27c6ecd9c2886344f13c9e58ac1"/></dir><file name="Cif.php" hash="0bc0de043cb254dd20b17759d8fb2484"/><file name="Label.php" hash="ae592a2943250e840f9d6ba2b3553c6c"/><dir name="Observer"><file name="Barcode.php" hash="49eb5448e784f9d2d2a74bb317002b95"/><file name="Cron.php" hash="cd9ae8fd4f38c22dbeca892bad7cd6a7"/><file name="SaveShipment.php" hash="ea2a8ee51d856075e9beec7e5c71dbf0"/></dir><dir name="Resource"><dir name="Shipment"><dir name="Barcode"><file name="Collection.php" hash="cba086559e46ab05eb745820cb674940"/></dir><file name="Barcode.php" hash="3fababe4d418342d5b69a153bd366017"/><file name="Collection.php" hash="f2dab6fa63764c98a2ab06871f68fefe"/><dir name="Label"><file name="Collection.php" hash="178f85ee761975231fc5d8a51c6ae466"/></dir><file name="Label.php" hash="c73b399ac5562259d0f1fd142be9fee0"/><dir name="Status"><dir name="History"><file name="Collection.php" hash="07cdf9dd45423e5d315e31b2dd7f951a"/></dir><file name="History.php" hash="cf483a122ebc9aca139a13bcb730e85c"/></dir></dir><file name="Shipment.php" hash="221e5c5728908f15d7558f8e6fe1103e"/></dir><dir name="Shipment"><file name="Barcode.php" hash="89aa40330448be2ceb79d052e1aa6e9b"/><file name="Label.php" hash="791fb2ff0dc51e5a72c2982c01bd9f9d"/><file name="Process.php" hash="752a7cf14a23f3389e2f19fa7419605e"/><dir name="Status"><file name="History.php" hash="bc1e67b513e58e6373d122eb6b1e5eea"/></dir></dir><file name="Shipment.php" hash="4f605ac483c26aa255fe000212bbdc7c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="AllProductOptions.php" hash="6be78f115cc735069f1fe6c07cf70271"/><file name="Attributes.php" hash="a8384fbf1524c432f7b087dad9a7c813"/><file name="DebugMode.php" hash="0bbcbc4f0c771723b2031eb95dc7ca13"/><file name="Direction.php" hash="a93d5436ed8e231261217af00b799c92"/><file name="EuProductOptions.php" hash="2694e91d9c3f5c736b86ec44a1c2a101"/><file name="GlobalProductOptions.php" hash="5f211b4b8d96a9b7d34d1960c142a43d"/><file name="LabelSize.php" hash="88e3cf3ca607dca603e4b5b42a563912"/><file name="PakjeGemakProductOptions.php" hash="12d97c5b30c2d587fb6e8ce078a6b582"/><file name="ReferenceType.php" hash="559bfab1b5fc1ff7b42eed0a3654708a"/><file name="ShipmentGridMassaction.php" hash="77b9b2c30aa82eea994faade8add6714"/><file name="StandardProductOptions.php" hash="9ebac04faa76287a1c349bf97c5c3b6d"/><file name="StreetField.php" hash="eb5c59b91a92c64189f239469a8472bb"/><file name="StreetFieldWithDefault.php" hash="336dbc8571b59d5d1970d5a13efa5954"/><file name="WeightUnit.php" hash="b3f1ccc564b64f8874e5b3dfd4a2e456"/></dir></dir></dir></dir><dir name="ExtensionControl"><file name="Feed.php" hash="edf1fa5590f6f39bf5082a20e20a8408"/><dir name="Observer"><file name="Cron.php" hash="0e38a6072f2ecc2423ac360a3eb4d5d8"/></dir><dir name="Webservices"><file name="Abstract.php" hash="35bb7474364056366434734b42536a47"/></dir><file name="Webservices.php" hash="708433a4f84fe645c482bebb256e0ea8"/></dir><file name="Inbox.php" hash="9e3067d0e9b3137e33bcc99eea829a22"/><dir name="Resource"><dir name="Db"><dir name="Collection"><file name="Postnl.php" hash="a337c73f47df77a3de420ad13198dcfa"/></dir></dir><dir name="Order"><dir name="Grid"><file name="Collection.php" hash="6cd139d824f9fba6ec6205f0a9aed54e"/></dir><dir name="Shipment"><dir name="Grid"><file name="Collection.php" hash="abaf6d8cdd36d96778a8341afd01a48e"/></dir></dir></dir><file name="Setup.php" hash="77d7d376e08fb007c3af925cee5c8f7a"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Testlive.php" hash="ba607caaa1e297cb91f20a840daa3ea8"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="2f97c4694df8aad70bcb4a44e6385495"/><file name="ExtensionControlController.php" hash="73b172250955a15b531ff9fb43fdc003"/><file name="ShipmentController.php" hash="d57adbc99d486f4114e4fb747b682e66"/></dir><file name="CheckoutController.php" hash="4ca43ba622a2e0cbc9a1459b43bd6687"/></dir><dir name="data"><dir name="postnl_setup"><file name="data-install-1.0.0.php" hash="5d24b54be571e8c1ee6e7a74afe99113"/><file name="data-install-1.0.3.php" hash="b42e23def5a1d5f2759e069b70e0b617"/><file name="data-install-1.1.4.php" hash="f01176a445496a73dbd16c617f753c77"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8686744c313445cf0a79087b63ab31db"/><file name="config.xml" hash="bc6912a4ce005c9831492327bdf976d7"/><file name="system.xml" hash="2a421c973efc6df275eeede260966eeb"/></dir><dir name="sql"><dir name="postnl_setup"><file name="install-1.0.0.php" hash="97b8584781e5e7cf6abe204387578fa0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="TIG"><file name="postnl.xml" hash="ec012e0f62047ecfcd40db5e28fb717b"/></dir></dir><dir name="template"><dir name="TIG"><dir name="PostNL"><dir name="checkout"><dir name="cart"><file name="js.phtml" hash="d3a53229d6838ab254a5749dcb475a21"/><file name="link.phtml" hash="9f783975ca668d2a2dbb6ee4d9d6f9be"/><file name="spinner.phtml" hash="0f66e5018bb120753e349c9206deac3b"/></dir><dir name="summary"><file name="totals.phtml" hash="05be26ff83cb33b0af5231b07e7bbe10"/></dir><file name="summary.phtml" hash="d6dc6f0614868e4f9f3fee48473c95d3"/></dir><dir name="sales"><dir name="order"><dir name="shipment"><file name="shipping_status.phtml" hash="02e80c01ca12ac4bd3040ca5f7916c47"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="TIG"><file name="postnl.xml" hash="ef6de7a094b85cf296beb996d8d0d3ca"/></dir></dir><dir name="template"><dir name="TIG"><dir name="PostNL"><file name="cron_notification.phtml" hash="aa24f6b3473640c44f47a0f49081fc59"/><dir name="sales"><dir name="order"><file name="filter_massaction.phtml" hash="92c5c6ad1a8b4fcbd5cd3b955c12c6ec"/><file name="product_options.phtml" hash="7635dff53db6ad6d6f43e0bb96804f65"/><dir name="shipment"><dir name="create"><file name="shipment_options.phtml" hash="5027b8f14937190623f6b6febbe167dd"/></dir><dir name="view"><file name="shipping_status.phtml" hash="704b07c07c84783d9342f54d2789e3e9"/><dir name="tab"><file name="status_history.phtml" hash="2e64eb69b6e3dc90713d41496dcdd642"/></dir></dir><file name="view.phtml" hash="c767d27a2b1fa0bae476eaa3cb879f47"/></dir></dir><dir name="shipment"><file name="testmode_warning.phtml" hash="e9d2d3cf738a464eec67e4798a161903"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="config_check.phtml" hash="93574dfe0c836e205138dcdc647991de"/><file name="field_header.phtml" hash="806634be75eea5a462ec8df61e0acaee"/><file name="info_box.phtml" hash="da355f0ea45558343880ed5ae54c3b1c"/><file name="js.phtml" hash="53c1fb76b4fed4125248f03c5c4a3e1e"/><file name="split_address_check.phtml" hash="d9bf074af0f6b7dafb235008fc908312"/><file name="support_tab.phtml" hash="4431ec65a8c299e9721cf4223b351b86"/><file name="warning_box.phtml" hash="344231e59acd6740f4ad5df742a16a4a"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TIG_PostNL.xml" hash="4868726d0f27d7d2c11fd6c2a5deb22d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="TIG"><dir name="PostNL"><file name="cart.css" hash="3e0ba5de132ddfac90f0e7bb834f4361"/><file name="messages.css" hash="19d03101c862b45535bc08344c12716a"/><file name="shipping_status.css" hash="0162a5c3dcd72eb01a8b4c6bb0ee075d"/></dir></dir></dir><dir name="images"><dir name="TIG"><dir name="PostNL"><file name="bkg_progress_small.png" hash="fc6c9f28b6a6aae6f0096d504c0952df"/><file name="overlay.png" hash="f08feb852288bea420ba3af68ae34a1f"/><file name="postnl_email_logo.png" hash="8bd358b514e04e7ceca03efb38f8fded"/><file name="postnl_spinner.gif" hash="cef321b68ab934932ee317986823db67"/></dir></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="images"><dir name="TIG"><dir name="PostNL"><file name="overlay.png" hash="f08feb852288bea420ba3af68ae34a1f"/><file name="postnl_spinner.gif" hash="c97d0bd9ccc8fa0b460c07caeb63c293"/></dir></dir></dir><dir name="css"><dir name="TIG"><dir name="PostNL"><file name="cart.css" hash="4f8b417defed03e6ae8c4ec292b2e2c3"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="TIG"><dir name="PostNL"><file name="messages.css" hash="524a400b943a4504303b0646440648f1"/><file name="shipping_status.css" hash="46f19403af66e08fe5182bac5a6a20fe"/><file name="system_config_edit.css" hash="b4c897ee8801ed42f6c83754fb2abb08"/><file name="system_config_edit_postnl.css" hash="ace354fced0cf01b004e3f681118c2bb"/></dir></dir></dir><dir name="images"><dir name="TIG"><dir name="PostNL"><file name="bkg_progress_grey.png" hash="8d4d5144292b98a23475367ede717b17"/><file name="bkg_progress_grey_begin.png" hash="6815c9264e78f8f9d2805c595f8800c4"/><file name="bkg_progress_grey_end.png" hash="dae90fdb38adf65e6ccc209b6a80372c"/><file name="bkg_progress_grey_seperator.png" hash="10178e12fd14fb783b4ae0fbd55a4a81"/><file name="bkg_progress_orange.png" hash="8a59f76e36ee0492f5341b8e5e7ee79b"/><file name="bkg_progress_orange_begin.png" hash="ecc84d5252e397f4a783ee7e0c426d63"/><file name="bkg_progress_orange_end.png" hash="d0a81dfea1a3eddc699482a62af01fc9"/><file name="bkg_progress_orange_grey_seperator.png" hash="ab558953ec4c40ef44653ab481084345"/><file name="bkg_progress_orange_seperator.png" hash="a774eb89763d95f2e60d03f8702fba86"/><file name="bkg_progress_sprite.png" hash="3230379a4544f85062a6ba91fa8083e2"/><file name="btn_download_icon.png" hash="142d5ebbe43ad09dde97cd32e1ef4303"/><file name="glyph_error.gif" hash="a138b803d772f552aa2e49e1c506edbd"/><file name="glyph_info.gif" hash="40f72d28be63ecf2b6ef44c7ea730104"/><file name="glyph_manual.png" hash="771db63b6ffc9de1c06da564796adc6e"/><file name="glyph_pdf.png" hash="a5ea929f4014a88d7320d0293913ace3"/><file name="glyph_success.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="glyph_warning.gif" hash="fa817cb6d49efb9855942ef2b739fc6c"/><file name="legend.gif" hash="d8fb0642901868d489d31b426f3e3406"/><file name="logo_postnl.png" hash="10b9ae4ad2c5365312c257dcdac1fc64"/><file name="tig_logo_medium.gif" hash="3e1071908cfdb7b472438482c3331ac7"/></dir></dir></dir><dir name="js"><dir name="TIG"><dir name="PostNL"><file name="shipment_options.js" hash="35383a85422ca0c2b740f438b62c250e"/><file name="validate.js" hash="729162d483749fd229c7f0f30b2e2df2"/></dir></dir></dir><dir name="media"><dir name="TIG"><dir name="PostNL"><file name="manual.pdf" hash="449de1cfa1449ac51ab19b0142f8cae9"/></dir></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="TIG"><dir name="PostNL"><dir name="Fpdf"><dir name="font"><file name="courier.php" hash="ca6fb483549604fb4a675f9e28a73b02"/><file name="courierb.php" hash="a58d7dadf3cf564ca5d5138cea76a3a9"/><file name="courierbi.php" hash="c0e416771dc56cb2397390978d112dc2"/><file name="courieri.php" hash="419961dbeeb20f08da780dccb427dec8"/><file name="helvetica.php" hash="fc53162b924ddd522bd6cfe86fab48f4"/><file name="helveticab.php" hash="4e9ffda682a131fef2e04ccd94aa342d"/><file name="helveticabi.php" hash="6db8943bd91bf13514b82872cf160d45"/><file name="helveticai.php" hash="13b795df0c33eb93c48621792f2ea12d"/><file name="symbol.php" hash="fbd9250c21af99f6398d6f817511f91f"/><file name="times.php" hash="82bc100f1f3bd8b2d9b7fb5ee8f44b3a"/><file name="timesb.php" hash="3a241a1658bf9ea2062e63f464166c31"/><file name="timesbi.php" hash="bfdd0235a71793becefff778c2b16243"/><file name="timesi.php" hash="17fd69f176915a2113fe28057b43a75e"/><file name="zapfdingbats.php" hash="2848ab2daf3128f310b5cf713ca4acee"/></dir><file name="fpdf.css" hash="84befac49464a9aac54aa511bc1fd754"/><file name="fpdf.php" hash="f9228af7ef1c18691cba2ad075bc5858"/><file name="helvetica.php" hash="fc53162b924ddd522bd6cfe86fab48f4"/><file name="license.txt" hash="fb784726cfe3615da38bc23a3cac445b"/></dir><file name="Fpdf.php" hash="a0d54e6259621bb9d4c4801c53740340"/><dir name="Fpdi"><dir name="filters"><file name="FilterASCII85.php" hash="fe706bbd320881c300ec1a9f71e4eb2b"/><file name="FilterASCII85_FPDI.php" hash="1240e0c64602864401f886546e09fe7b"/><file name="FilterLZW.php" hash="35644f48b6b65c8726fc71cfad6c0478"/><file name="FilterLZW_FPDI.php" hash="b11c50e66e20744ad20f176cae4af284"/></dir><file name="fpdf_tpl.php" hash="3966b13c398c94509e2fb6199593b104"/><file name="fpdi.php" hash="abb524d17a2cbdd3c3b7e89184aad443"/><file name="fpdi2tcpdf_bridge.php" hash="8cc7fc486b015f1e17e75d1e5d585902"/><file name="fpdi_pdf_parser.php" hash="d7a3bf0153ae9ad57976afb0be5d195d"/><file name="pdf_context.php" hash="0b69a25dbb830f3b68c054c2e43b876e"/><file name="pdf_parser.php" hash="5ff22a8c1ce5b1eee82c8017311a797e"/></dir><file name="Fpdi.php" hash="fdf663915f3930bc0dc00db46cc20944"/></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="TIG"><dir name="PostNL"><file name="track_and_trace.html" hash="7ace8a754b0ea35775e0a3b66ad96b19"/></dir></dir></dir></dir><file name="TIG_PostNL.csv" hash="0b8ce0311a509ad6733ec60a0bc98e96"/></dir><dir name="nl_NL"><dir name="template"><dir name="email"><dir name="TIG"><dir name="PostNL"><file name="track_and_trace.html" hash="122c60807ec59834e3445fe40540e8c9"/></dir></dir></dir></dir><file name="TIG_PostNL.csv" hash="be7d58fd353e5812f3468caee7d6da0b"/></dir></target></contents>
|
111 |
<compatible/>
|
112 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
113 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>tig_postnl</name>
|
4 |
+
<version>1.1.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US">Creative Commons License</license>
|
7 |
<channel>community</channel>
|
20 |
- Viewing detailed shipping status information
|
21 |
- PostNL Checkout
|
22 |
- Emailing customers track & trace information, allowing them to track their shipment from the moment you confirm it to the moment it arrives at their doorstep</description>
|
23 |
+
<notes>==== v1.1.5 =====
|
24 |
+

|
25 |
+
==== Bug fixes ====
|
26 |
+
- Fixed a problem with account validation only using test mode account credentials
|
27 |
+
- Made a minor security improvement to the notification system.
|
28 |
+
- Fixed an issue where shipments could not be confirmed if the shipping address did not have an email address.
|
29 |
+
- Fixed an issue where PostNl Checkout would incorrectly identify a product as being out of stock.
|
30 |
+
- Fixed an issue where for some shops PostNl Checkout would not function due to incorrect usage of https in an http environment.
|
31 |
+

|
32 |
+

|
33 |
+
==== v1.1.4 =====
|
34 |

|
35 |
==== New features ====
|
36 |
- Added a default test account to the extension. New installation will automatically have a PostNL test account pre-configured.
|
115 |

|
116 |
This is the initial beta release of the extension. If you have any questions, please contact the Total Internet Group Servicedesk</notes>
|
117 |
<authors><author><name>TiG</name><user>supporttotal</user><email>servicedesk@totalinternetgroup.nl</email></author></authors>
|
118 |
+
<date>2014-04-24</date>
|
119 |
+
<time>09:11:26</time>
|
120 |
+
<contents><target name="magecommunity"><dir name="TIG"><dir name="PostNL"><dir name="Block"><dir name="Adminhtml"><file name="CronNotification.php" hash="ec6263ed9fca94273bbc5d5493cac0ce"/><dir name="Sales"><dir name="Order"><file name="ProductOptions.php" hash="f46f9e9ba1a37ceff2db6d3131a21ebb"/><dir name="Shipment"><dir name="Create"><file name="ShipmentOptions.php" hash="6a63d89143a8b310f93ef73385f3eda0"/></dir><dir name="View"><file name="ShippingStatus.php" hash="297af21cb49e6b2cdfee192dfbf5f239"/><dir name="Tab"><file name="StatusHistory.php" hash="7b6bd52216822f7dc71fc998e8056376"/></dir><file name="Tabs.php" hash="a213c367f78e84fafd05d9d6310db5f5"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="ActivateButton.php" hash="2f57922bb9347b0b9d21a1a82529ffb4"/><file name="ActivatedFieldHeader.php" hash="4af748c827c108c2d72f12d1e9de0681"/><file name="ConfigCheck.php" hash="37dab6f23c95abb7d3b65fc4a5a89a00"/><file name="InfoBox.php" hash="4b93fd3c1e44230c4d8c3fb93ec581f3"/><file name="SplitAddressCheck.php" hash="cc8509b1f1fee9d825980382dc0833c2"/><file name="SupportTab.php" hash="e34f2bf7e87060698e0560894319b3b0"/><dir name="TextBox"><file name="Abstract.php" hash="423c2b84db587309a8a6d90dabc4de4f"/></dir><file name="ValidateButton.php" hash="5a30e6615a96e05cf3600855c15544de"/><file name="WarningBox.php" hash="36dce34841f2252f466e78dc2eddf1ba"/></dir><file name="Fieldset.php" hash="1bc60b1e6644802198c62666b50d3acf"/></dir><file name="Form.php" hash="a4fe68b2216fdccafb1bfecfa3f8e1a1"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Action.php" hash="9fc6e2f204f2238ab29699b614589134"/><file name="Barcode.php" hash="74858ac29b17c675cb2d8f55b8cba3fc"/><file name="ConfirmDate.php" hash="3d6692b46faaeedf55ab74e4b239790f"/><file name="ConfirmStatus.php" hash="db96b519fa025bb9f5f5737bb0e80bf2"/><file name="ShipmentType.php" hash="2a817a37ab1ccdc8a7e836f0443d012f"/><file name="ShippingPhase.php" hash="9ee0fc92ee2cc623edb3df86247d2d06"/><file name="Time.php" hash="dbf5b70742e0877eff7f01ec65319e3b"/><file name="Translate.php" hash="46d83e4013d6ab1d14d39f303703e5c4"/><file name="YesNo.php" hash="1bdb10008eecb146fd185040e24d48e5"/></dir></dir></dir></dir></dir><dir name="Checkout"><dir name="Cart"><file name="CheckoutLink.php" hash="27eac5ef24064be47b36e77fd1261083"/><file name="Js.php" hash="acb7f5ad743ca311153b639f6ea33c75"/></dir><dir name="Summary"><file name="Totals.php" hash="bbe4ec0aaf15ecc40bff8504d67aa1e4"/></dir><file name="Summary.php" hash="a2b997d74cee541fd570327a496e30fb"/></dir><dir name="Core"><file name="ShippingStatus.php" hash="c92beeec25228692afcc2f64ed44dd01"/></dir></dir><file name="Exception.php" hash="5b9f750676440653abfee244727aa29f"/><dir name="Helper"><file name="Carrier.php" hash="9625f891a86da6b84c4bdf5f1ff37597"/><file name="Checkout.php" hash="afe896974ed6a1e62f0481717cc8573a"/><file name="Cif.php" hash="0285a984fe853a189081a4aa9e4db057"/><file name="Data.php" hash="dd3ecac31d13ecabc4bf2e4d17d1cdad"/><file name="Webservices.php" hash="0cc54fac78af257b2740d9519e9570d3"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Observer"><file name="OrderGrid.php" hash="f0b59f8fcf1293ff1fafb464c4e05d2f"/><file name="ShipmentGrid.php" hash="6d6acc13423d2b9cb954c8aae681ebac"/><file name="ShipmentView.php" hash="208a690d8a09658dfc8f0dfcb2696b77"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="ShipmentGridColumns.php" hash="fec7db9a0c5ba79c6a0987ddec42e4cc"/></dir></dir></dir></dir><dir name="Carrier"><file name="Postnl.php" hash="f0143161e67fcd16e6739015c776d0f9"/><dir name="System"><dir name="Config"><dir name="Source"><file name="RateType.php" hash="940bf2381b879188d6e4aa756d0d0dce"/></dir></dir></dir></dir><dir name="Checkout"><file name="Cif.php" hash="9ab1f1c983f5b3ba41a9019e723ec1c3"/><dir name="Observer"><file name="Order.php" hash="5cf7b700b2286a6916f23e72e3346beb"/><file name="Shipment.php" hash="217a3bf9d730f1061e9d3117edc6c2a3"/></dir><file name="Order.php" hash="619b8f385b29357449644def665f58c0"/><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="fe0751975beca120d547a2a6db7eb9a8"/></dir><file name="Order.php" hash="d821477695f495031b62eb85b383f981"/></dir><file name="Service.php" hash="6ff1b8c9d595b14059c6422c3472c90a"/><dir name="System"><dir name="Config"><dir name="Source"><file name="ActivePaymentMethods.php" hash="7e9ff249f3ca3ca28e8e4831e2a9b4cb"/><file name="CmsPage.php" hash="0ed3351761c49cad9f3611704f61aa5e"/></dir></dir></dir></dir><dir name="Core"><dir name="Cif"><file name="Abstract.php" hash="e85f0bd137fcc02c01c47995cb03325d"/><file name="Exception.php" hash="c448a27c6ecd9c2886344f13c9e58ac1"/></dir><file name="Cif.php" hash="a941ebeafdbf6b8e57d23de8cba373d1"/><file name="Label.php" hash="ae592a2943250e840f9d6ba2b3553c6c"/><dir name="Observer"><file name="Barcode.php" hash="49eb5448e784f9d2d2a74bb317002b95"/><file name="Cron.php" hash="cd9ae8fd4f38c22dbeca892bad7cd6a7"/><file name="SaveShipment.php" hash="ea2a8ee51d856075e9beec7e5c71dbf0"/></dir><dir name="Resource"><dir name="Shipment"><dir name="Barcode"><file name="Collection.php" hash="cba086559e46ab05eb745820cb674940"/></dir><file name="Barcode.php" hash="3fababe4d418342d5b69a153bd366017"/><file name="Collection.php" hash="f2dab6fa63764c98a2ab06871f68fefe"/><dir name="Label"><file name="Collection.php" hash="178f85ee761975231fc5d8a51c6ae466"/></dir><file name="Label.php" hash="c73b399ac5562259d0f1fd142be9fee0"/><dir name="Status"><dir name="History"><file name="Collection.php" hash="07cdf9dd45423e5d315e31b2dd7f951a"/></dir><file name="History.php" hash="cf483a122ebc9aca139a13bcb730e85c"/></dir></dir><file name="Shipment.php" hash="221e5c5728908f15d7558f8e6fe1103e"/></dir><dir name="Shipment"><file name="Barcode.php" hash="89aa40330448be2ceb79d052e1aa6e9b"/><file name="Label.php" hash="791fb2ff0dc51e5a72c2982c01bd9f9d"/><file name="Process.php" hash="752a7cf14a23f3389e2f19fa7419605e"/><dir name="Status"><file name="History.php" hash="bc1e67b513e58e6373d122eb6b1e5eea"/></dir></dir><file name="Shipment.php" hash="4f605ac483c26aa255fe000212bbdc7c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="AllProductOptions.php" hash="6be78f115cc735069f1fe6c07cf70271"/><file name="Attributes.php" hash="a8384fbf1524c432f7b087dad9a7c813"/><file name="DebugMode.php" hash="0bbcbc4f0c771723b2031eb95dc7ca13"/><file name="Direction.php" hash="a93d5436ed8e231261217af00b799c92"/><file name="EuProductOptions.php" hash="2694e91d9c3f5c736b86ec44a1c2a101"/><file name="GlobalProductOptions.php" hash="5f211b4b8d96a9b7d34d1960c142a43d"/><file name="LabelSize.php" hash="88e3cf3ca607dca603e4b5b42a563912"/><file name="PakjeGemakProductOptions.php" hash="12d97c5b30c2d587fb6e8ce078a6b582"/><file name="ReferenceType.php" hash="559bfab1b5fc1ff7b42eed0a3654708a"/><file name="ShipmentGridMassaction.php" hash="77b9b2c30aa82eea994faade8add6714"/><file name="StandardProductOptions.php" hash="9ebac04faa76287a1c349bf97c5c3b6d"/><file name="StreetField.php" hash="eb5c59b91a92c64189f239469a8472bb"/><file name="StreetFieldWithDefault.php" hash="336dbc8571b59d5d1970d5a13efa5954"/><file name="WeightUnit.php" hash="b3f1ccc564b64f8874e5b3dfd4a2e456"/></dir></dir></dir></dir><dir name="ExtensionControl"><file name="Feed.php" hash="edf1fa5590f6f39bf5082a20e20a8408"/><dir name="Observer"><file name="Cron.php" hash="3fb847fe840e2cf1bb2e2b5767fdcfa3"/></dir><dir name="Webservices"><file name="Abstract.php" hash="35bb7474364056366434734b42536a47"/></dir><file name="Webservices.php" hash="708433a4f84fe645c482bebb256e0ea8"/></dir><file name="Inbox.php" hash="9e3067d0e9b3137e33bcc99eea829a22"/><dir name="Resource"><dir name="Db"><dir name="Collection"><file name="Postnl.php" hash="a337c73f47df77a3de420ad13198dcfa"/></dir></dir><dir name="Order"><dir name="Grid"><file name="Collection.php" hash="6cd139d824f9fba6ec6205f0a9aed54e"/></dir><dir name="Shipment"><dir name="Grid"><file name="Collection.php" hash="abaf6d8cdd36d96778a8341afd01a48e"/></dir></dir></dir><file name="Setup.php" hash="77d7d376e08fb007c3af925cee5c8f7a"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Testlive.php" hash="ba607caaa1e297cb91f20a840daa3ea8"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="5876d6a4f9109970a136cbfe9968b572"/><file name="ExtensionControlController.php" hash="73b172250955a15b531ff9fb43fdc003"/><file name="ShipmentController.php" hash="d57adbc99d486f4114e4fb747b682e66"/></dir><file name="CheckoutController.php" hash="4ca43ba622a2e0cbc9a1459b43bd6687"/></dir><dir name="data"><dir name="postnl_setup"><file name="data-install-1.0.0.php" hash="5d24b54be571e8c1ee6e7a74afe99113"/><file name="data-install-1.0.3.php" hash="b42e23def5a1d5f2759e069b70e0b617"/><file name="data-install-1.1.4.php" hash="f01176a445496a73dbd16c617f753c77"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8686744c313445cf0a79087b63ab31db"/><file name="config.xml" hash="c8fd1d01379f12dc9be48bfafa097e7b"/><file name="system.xml" hash="b7454ab0903c92b8c79dea072769527f"/></dir><dir name="sql"><dir name="postnl_setup"><file name="install-1.0.0.php" hash="97b8584781e5e7cf6abe204387578fa0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="TIG"><file name="postnl.xml" hash="ec012e0f62047ecfcd40db5e28fb717b"/></dir></dir><dir name="template"><dir name="TIG"><dir name="PostNL"><dir name="checkout"><dir name="cart"><file name="js.phtml" hash="96b49eb9fea6b30a7feabdbff813a6ae"/><file name="link.phtml" hash="9f783975ca668d2a2dbb6ee4d9d6f9be"/><file name="spinner.phtml" hash="0f66e5018bb120753e349c9206deac3b"/></dir><dir name="summary"><file name="totals.phtml" hash="05be26ff83cb33b0af5231b07e7bbe10"/></dir><file name="summary.phtml" hash="d6dc6f0614868e4f9f3fee48473c95d3"/></dir><dir name="sales"><dir name="order"><dir name="shipment"><file name="shipping_status.phtml" hash="02e80c01ca12ac4bd3040ca5f7916c47"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="TIG"><file name="postnl.xml" hash="ef6de7a094b85cf296beb996d8d0d3ca"/></dir></dir><dir name="template"><dir name="TIG"><dir name="PostNL"><file name="cron_notification.phtml" hash="aa24f6b3473640c44f47a0f49081fc59"/><dir name="sales"><dir name="order"><file name="filter_massaction.phtml" hash="92c5c6ad1a8b4fcbd5cd3b955c12c6ec"/><file name="product_options.phtml" hash="7635dff53db6ad6d6f43e0bb96804f65"/><dir name="shipment"><dir name="create"><file name="shipment_options.phtml" hash="5027b8f14937190623f6b6febbe167dd"/></dir><dir name="view"><file name="shipping_status.phtml" hash="704b07c07c84783d9342f54d2789e3e9"/><dir name="tab"><file name="status_history.phtml" hash="2e64eb69b6e3dc90713d41496dcdd642"/></dir></dir><file name="view.phtml" hash="c767d27a2b1fa0bae476eaa3cb879f47"/></dir></dir><dir name="shipment"><file name="testmode_warning.phtml" hash="e9d2d3cf738a464eec67e4798a161903"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="config_check.phtml" hash="93574dfe0c836e205138dcdc647991de"/><file name="field_header.phtml" hash="806634be75eea5a462ec8df61e0acaee"/><file name="info_box.phtml" hash="da355f0ea45558343880ed5ae54c3b1c"/><file name="js.phtml" hash="53c1fb76b4fed4125248f03c5c4a3e1e"/><file name="split_address_check.phtml" hash="d9bf074af0f6b7dafb235008fc908312"/><file name="support_tab.phtml" hash="4431ec65a8c299e9721cf4223b351b86"/><file name="warning_box.phtml" hash="344231e59acd6740f4ad5df742a16a4a"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TIG_PostNL.xml" hash="4868726d0f27d7d2c11fd6c2a5deb22d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="TIG"><dir name="PostNL"><file name="cart.css" hash="3e0ba5de132ddfac90f0e7bb834f4361"/><file name="messages.css" hash="19d03101c862b45535bc08344c12716a"/><file name="shipping_status.css" hash="0162a5c3dcd72eb01a8b4c6bb0ee075d"/></dir></dir></dir><dir name="images"><dir name="TIG"><dir name="PostNL"><file name="bkg_progress_small.png" hash="fc6c9f28b6a6aae6f0096d504c0952df"/><file name="overlay.png" hash="f08feb852288bea420ba3af68ae34a1f"/><file name="postnl_email_logo.png" hash="8bd358b514e04e7ceca03efb38f8fded"/><file name="postnl_spinner.gif" hash="cef321b68ab934932ee317986823db67"/></dir></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="images"><dir name="TIG"><dir name="PostNL"><file name="overlay.png" hash="f08feb852288bea420ba3af68ae34a1f"/><file name="postnl_spinner.gif" hash="c97d0bd9ccc8fa0b460c07caeb63c293"/></dir></dir></dir><dir name="css"><dir name="TIG"><dir name="PostNL"><file name="cart.css" hash="4f8b417defed03e6ae8c4ec292b2e2c3"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="TIG"><dir name="PostNL"><file name="messages.css" hash="524a400b943a4504303b0646440648f1"/><file name="shipping_status.css" hash="46f19403af66e08fe5182bac5a6a20fe"/><file name="system_config_edit.css" hash="b4c897ee8801ed42f6c83754fb2abb08"/><file name="system_config_edit_postnl.css" hash="ace354fced0cf01b004e3f681118c2bb"/></dir></dir></dir><dir name="images"><dir name="TIG"><dir name="PostNL"><file name="bkg_progress_grey.png" hash="8d4d5144292b98a23475367ede717b17"/><file name="bkg_progress_grey_begin.png" hash="6815c9264e78f8f9d2805c595f8800c4"/><file name="bkg_progress_grey_end.png" hash="dae90fdb38adf65e6ccc209b6a80372c"/><file name="bkg_progress_grey_seperator.png" hash="10178e12fd14fb783b4ae0fbd55a4a81"/><file name="bkg_progress_orange.png" hash="8a59f76e36ee0492f5341b8e5e7ee79b"/><file name="bkg_progress_orange_begin.png" hash="ecc84d5252e397f4a783ee7e0c426d63"/><file name="bkg_progress_orange_end.png" hash="d0a81dfea1a3eddc699482a62af01fc9"/><file name="bkg_progress_orange_grey_seperator.png" hash="ab558953ec4c40ef44653ab481084345"/><file name="bkg_progress_orange_seperator.png" hash="a774eb89763d95f2e60d03f8702fba86"/><file name="bkg_progress_sprite.png" hash="3230379a4544f85062a6ba91fa8083e2"/><file name="btn_download_icon.png" hash="142d5ebbe43ad09dde97cd32e1ef4303"/><file name="glyph_error.gif" hash="a138b803d772f552aa2e49e1c506edbd"/><file name="glyph_info.gif" hash="40f72d28be63ecf2b6ef44c7ea730104"/><file name="glyph_manual.png" hash="771db63b6ffc9de1c06da564796adc6e"/><file name="glyph_pdf.png" hash="a5ea929f4014a88d7320d0293913ace3"/><file name="glyph_success.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="glyph_warning.gif" hash="fa817cb6d49efb9855942ef2b739fc6c"/><file name="legend.gif" hash="d8fb0642901868d489d31b426f3e3406"/><file name="logo_postnl.png" hash="10b9ae4ad2c5365312c257dcdac1fc64"/><file name="tig_logo_medium.gif" hash="3e1071908cfdb7b472438482c3331ac7"/></dir></dir></dir><dir name="js"><dir name="TIG"><dir name="PostNL"><file name="shipment_options.js" hash="35383a85422ca0c2b740f438b62c250e"/><file name="validate.js" hash="729162d483749fd229c7f0f30b2e2df2"/></dir></dir></dir><dir name="media"><dir name="TIG"><dir name="PostNL"><file name="manual.pdf" hash="3caf725c7f2afdfa7551f6f8dcb0b71d"/></dir></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="TIG"><dir name="PostNL"><dir name="Fpdf"><dir name="font"><file name="courier.php" hash="ca6fb483549604fb4a675f9e28a73b02"/><file name="courierb.php" hash="a58d7dadf3cf564ca5d5138cea76a3a9"/><file name="courierbi.php" hash="c0e416771dc56cb2397390978d112dc2"/><file name="courieri.php" hash="419961dbeeb20f08da780dccb427dec8"/><file name="helvetica.php" hash="fc53162b924ddd522bd6cfe86fab48f4"/><file name="helveticab.php" hash="4e9ffda682a131fef2e04ccd94aa342d"/><file name="helveticabi.php" hash="6db8943bd91bf13514b82872cf160d45"/><file name="helveticai.php" hash="13b795df0c33eb93c48621792f2ea12d"/><file name="symbol.php" hash="fbd9250c21af99f6398d6f817511f91f"/><file name="times.php" hash="82bc100f1f3bd8b2d9b7fb5ee8f44b3a"/><file name="timesb.php" hash="3a241a1658bf9ea2062e63f464166c31"/><file name="timesbi.php" hash="bfdd0235a71793becefff778c2b16243"/><file name="timesi.php" hash="17fd69f176915a2113fe28057b43a75e"/><file name="zapfdingbats.php" hash="2848ab2daf3128f310b5cf713ca4acee"/></dir><file name="fpdf.css" hash="84befac49464a9aac54aa511bc1fd754"/><file name="fpdf.php" hash="f9228af7ef1c18691cba2ad075bc5858"/><file name="helvetica.php" hash="fc53162b924ddd522bd6cfe86fab48f4"/><file name="license.txt" hash="fb784726cfe3615da38bc23a3cac445b"/></dir><file name="Fpdf.php" hash="a0d54e6259621bb9d4c4801c53740340"/><dir name="Fpdi"><dir name="filters"><file name="FilterASCII85.php" hash="fe706bbd320881c300ec1a9f71e4eb2b"/><file name="FilterASCII85_FPDI.php" hash="1240e0c64602864401f886546e09fe7b"/><file name="FilterLZW.php" hash="35644f48b6b65c8726fc71cfad6c0478"/><file name="FilterLZW_FPDI.php" hash="b11c50e66e20744ad20f176cae4af284"/></dir><file name="fpdf_tpl.php" hash="3966b13c398c94509e2fb6199593b104"/><file name="fpdi.php" hash="abb524d17a2cbdd3c3b7e89184aad443"/><file name="fpdi2tcpdf_bridge.php" hash="8cc7fc486b015f1e17e75d1e5d585902"/><file name="fpdi_pdf_parser.php" hash="d7a3bf0153ae9ad57976afb0be5d195d"/><file name="pdf_context.php" hash="0b69a25dbb830f3b68c054c2e43b876e"/><file name="pdf_parser.php" hash="5ff22a8c1ce5b1eee82c8017311a797e"/></dir><file name="Fpdi.php" hash="fdf663915f3930bc0dc00db46cc20944"/></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="TIG"><dir name="PostNL"><file name="track_and_trace.html" hash="7ace8a754b0ea35775e0a3b66ad96b19"/></dir></dir></dir></dir><file name="TIG_PostNL.csv" hash="0b8ce0311a509ad6733ec60a0bc98e96"/></dir><dir name="nl_NL"><dir name="template"><dir name="email"><dir name="TIG"><dir name="PostNL"><file name="track_and_trace.html" hash="122c60807ec59834e3445fe40540e8c9"/></dir></dir></dir></dir><file name="TIG_PostNL.csv" hash="be7d58fd353e5812f3468caee7d6da0b"/></dir></target></contents>
|
121 |
<compatible/>
|
122 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
123 |
</package>
|
Binary file
|