From 78bc43adeea87d7e278babf3269c7e9c18657508 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Tue, 3 Feb 2015 15:28:11 +0000 Subject: [PATCH 01/11] Removing up to 5KG shipping from international shipping Although Royal Mail do offer delivery above 2KG this is for printed papers and not parcels. Due to requests we decided to remove the ability to order internationally above 2Kg. --- .../Meanbee/Royalmail/Helper/Data.php | 19 ----- .../Model/Shipping/Carrier/Royalmail.php | 2 +- .../Royalmail/Internationalstandard.php | 37 ++------- .../Royalmail/Internationaltracked.php | 75 ++++++------------- 4 files changed, 29 insertions(+), 104 deletions(-) diff --git a/app/code/community/Meanbee/Royalmail/Helper/Data.php b/app/code/community/Meanbee/Royalmail/Helper/Data.php index e8de042..dbb6fcc 100644 --- a/app/code/community/Meanbee/Royalmail/Helper/Data.php +++ b/app/code/community/Meanbee/Royalmail/Helper/Data.php @@ -300,25 +300,6 @@ public function isCountryAvailableForInternationalSigned($countryCode) { return $this->_isCountryAvailableForMethod($countryCode, self::INTERNATIONAL_SIGNED); } - /** - * RoyalMail allow weights over their upper limit, and usually charge per additional 250g. - * This is a helper to add those charges onto the rates supplied. - * - * @param $rates - * @param $charge - * @param $weight - * @param int $chargePer - * @return mixed - */ - public function addAdditionalWeightCharges($rates, $charge, $weight, $chargePer = 250) { - for($i = 0; $i < count($rates); $i++) { - if($weight > $rates[$i]['upper']) { - $additional = ceil(((($weight - $rates[$i]['upper']) / $chargePer) * $charge * 100)) / 100; - $rates[$i]['cost'] += $additional; - } - } - return $rates; - } /** * A simple helper to add the insurance charges on top of the rates supplied. diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php index 41e8536..75f5a53 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php @@ -150,7 +150,7 @@ public function getMethods($name=null) { 'specialdelivery9am' => 'Special Delivery Guaranteed by 9am (Up to 2,500GBP Insurance)', - 'internationalstandard' => 'International Standard (up to 5kg)', + 'internationalstandard' => 'International Standard (up to 2kg)', 'internationaltrackedsigned' => 'International Tracked & Signed (Up to 250GBP Compensation)', 'internationaltracked' => 'International Tracked (Up to 250GBP Compensation)', 'internationalsigned' => 'International Signed (Up to 250GBP Compensation)', diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php index 8521d35..d6d349d 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php @@ -20,10 +20,6 @@ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationalstandard extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Abstract { - protected $additionalChargeEurope = 1.45; - protected $additionalChargeWz1 = 2.70; - protected $additionalChargeWz2 = 2.85; - protected $maxWeight = 5000; public function getRates() { $_helper = Mage::helper('royalmail'); @@ -31,47 +27,26 @@ public function getRates() { $worldZone = $_helper->getWorldZone($country); $weight = $this->_getWeight(); - if($weight > $this->maxWeight) { - return null; - } switch($worldZone) { case 'gb': return null; case 'eu': case 'noneu': - $rates = $_helper->addAdditionalWeightCharges( - $this->_getEuropeRates(), - $this->additionalChargeEurope, - $weight - ); + $rates = $this->_getEuropeRates(); break; case 'wz1': - $rates = $_helper->addAdditionalWeightCharges( - $this->_getWz1Rates(), - $this->additionalChargeWz1, - $weight - ); + $rates = $this->_getWz1Rates(); break; case 'wz2': - $rates = $_helper->addAdditionalWeightCharges( - $this->_getWz2Rates(), - $this->additionalChargeWz2, - $weight - ); + $rates = $this->_getWz2Rates(); break; + default: + return null; } return $rates; } - public function calculateRate($weight) { - if($weight <= $this->maxWeight) { - $rates = $this->getRates(); - return $rates[count($rates)-1]['cost']; - } - return null; - } - protected function _getEuropeRates() { return $this->_loadCsv('internationalstandard_europe'); } @@ -83,4 +58,4 @@ protected function _getWz1Rates() { protected function _getWz2Rates() { return $this->_loadCsv('internationalstandard_wz2'); } -} +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php index 45fbe1c..fe09ee3 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php @@ -20,11 +20,6 @@ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationaltracked extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Abstract { - protected $additionalChargeEu = 1.74; - protected $additionalChargeNonEu = 1.45; - protected $additionalChargeWz1 = 2.70; - protected $additionalChargeWz2 = 2.85; - protected $maxWeight = 5000; protected $insureOver = 50; protected $additionalInsuranceChargeEu = 3; protected $additionalInsuranceChargeNonEu = 2.50; @@ -35,11 +30,7 @@ public function getRates() { $_helper = Mage::helper('royalmail'); $country = $this->_getCountry(); $worldZone = $_helper->getWorldZone($country); - $weight = $this->_getWeight(); - if($weight > $this->maxWeight) { - return null; - } if (!$_helper->isCountryAvailableForInternationalTracked($country)) { return null; @@ -49,65 +40,43 @@ public function getRates() { case 'gb': return null; case 'eu': - $rates = $_helper->addAdditionalWeightCharges( - $_helper->addInsuranceCharges( - $this->_getEuRates(), - $this->additionalInsuranceChargeEu, - $this->getCartTotal(), - $this->insureOver - ), - $this->additionalChargeEu, - $weight + $rates = $_helper->addInsuranceCharges( + $this->_getEuRates(), + $this->additionalInsuranceChargeEu, + $this->getCartTotal(), + $this->insureOver ); break; case 'noneu': - $rates = $_helper->addAdditionalWeightCharges( - $_helper->addInsuranceCharges( - $this->_getNonEuRates(), - $this->additionalInsuranceChargeNonEu, - $this->getCartTotal(), - $this->insureOver - ), - $this->additionalChargeNonEu, - $weight + $rates = $_helper->addInsuranceCharges( + $this->_getNonEuRates(), + $this->additionalInsuranceChargeNonEu, + $this->getCartTotal(), + $this->insureOver ); break; case 'wz1': - $rates = $_helper->addAdditionalWeightCharges( - $_helper->addInsuranceCharges( - $this->_getWz1Rates(), - $this->additionalInsuranceChargeWz1, - $this->getCartTotal(), - $this->insureOver - ), - $this->additionalChargeWz1, - $weight + $rates = $_helper->addInsuranceCharges( + $this->_getWz1Rates(), + $this->additionalInsuranceChargeWz1, + $this->getCartTotal(), + $this->insureOver ); break; case 'wz2': - $rates = $_helper->addAdditionalWeightCharges( - $_helper->addInsuranceCharges( - $this->_getWz2Rates(), - $this->additionalInsuranceChargeWz2, - $this->getCartTotal(), - $this->insureOver - ), - $this->additionalChargeWz2, - $weight + $rates = $_helper->addInsuranceCharges( + $this->_getWz2Rates(), + $this->additionalInsuranceChargeWz2, + $this->getCartTotal(), + $this->insureOver ); break; + default: + return null; } return $rates; } - public function calculateRate($weight) { - if($weight <= $this->maxWeight) { - $rates = $this->getRates(); - return $rates[count($rates)-1]['cost']; - } - return null; - } - protected function _getEuRates() { return $this->_loadCsv('internationaltracked_eu'); } From 000acc47947a1a61f17e16ca2d467a44fa301eca Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Thu, 5 Feb 2015 09:34:08 +0000 Subject: [PATCH 02/11] Added new Royal Mail services and updated pricelists I have added support for royal mail international letters and guaranteed saturday delivery to the UK. Also I have updated the way rates are calculated by the models, now all rate s are pulled in from their own CSV files meaning an import/export functionality can easily be added in the future. --- .../Model/Shipping/Carrier/Royalmail.php | 21 +++- .../Firstclasslargelettersignedfor.php | 34 +++++++ .../Royalmail/Firstclasslettersignedfor.php | 34 +++++++ .../Royalmail/Firstclassrecordedsignedfor.php | 20 ++-- .../Royalmail/Internationallettereconomy.php | 30 ++++++ .../Royalmail/Internationallettersigned.php | 81 ++++++++++++++++ .../Royalmail/Internationalletterstandard.php | 57 +++++++++++ .../Royalmail/Internationallettertracked.php | 93 ++++++++++++++++++ .../Internationallettertrackedsigned.php | 78 +++++++++++++++ .../Carrier/Royalmail/Internationalsigned.php | 72 ++++++++++++-- .../Royalmail/Internationalstandard.php | 1 - .../Royalmail/Internationaltrackedsigned.php | 72 ++++++++++++-- .../Carrier/Royalmail/Secondclass.php | 7 +- .../Secondclasslargelettersignedfor.php | 34 +++++++ .../Royalmail/Secondclasslettersignedfor.php | 34 +++++++ .../Secondclassrecordedsignedfor.php | 20 ++-- .../Royalmail/Specialdelivery9amsaturday.php | 45 +++++++++ .../Specialdeliverynextdaysaturday.php | 45 +++++++++ .../Firstclasslargelettersignedfor.php | 61 ++++++++++++ .../Royalmail/Firstclasslettersignedfor.php | 61 ++++++++++++ .../Royalmail/Internationallettereconomy.php | 61 ++++++++++++ .../Royalmail/Internationallettersigned.php | 93 ++++++++++++++++++ .../Royalmail/Internationalletterstandard.php | 72 ++++++++++++++ .../Royalmail/Internationallettertracked.php | 97 +++++++++++++++++++ .../Internationallettertrackedsigned.php | 83 ++++++++++++++++ .../Carrier/Royalmail/Secondclass.php | 2 +- .../Secondclasslargelettersignedfor.php | 61 ++++++++++++ .../Royalmail/Secondclasslettersignedfor.php | 61 ++++++++++++ .../Secondclassrecordedsignedfor.php | 5 +- .../Royalmail/Specialdelivery9amsaturday.php | 83 ++++++++++++++++ .../Specialdeliverynextdaysaturday.php | 83 ++++++++++++++++ .../Royalmail/data/9am1000saturday.csv | 4 + .../Royalmail/data/9am2500saturday.csv | 4 + .../Meanbee/Royalmail/data/9am50saturday.csv | 4 + .../data/firstclass_largeletter_signedfor.csv | 4 + .../data/firstclass_letter_signedfor.csv | 1 + .../data/firstclass_medium_signedfor.csv | 5 + .../data/firstclass_small_signedfor.csv | 7 ++ .../data/internationallettersigned_eu.csv | 3 + .../data/internationallettersigned_wz.csv | 3 + .../data/internationalletterstandard_eu.csv | 4 + .../data/internationalletterstandard_wz.csv | 4 + .../data/internationallettertracked_eu.csv | 3 + .../data/internationallettertracked_noneu.csv | 3 + .../data/internationallettertracked_wz.csv | 3 + .../internationallettertrackedsigned_eu.csv | 3 + .../internationallettertrackedsigned_wz.csv | 3 + .../data/internationalltettereconomy.csv | 3 + .../Royalmail/data/internationalsigned_eu.csv | 9 ++ .../data/internationalsigned_wz1.csv | 9 ++ .../data/internationalsigned_wz2.csv | 9 ++ .../data/internationaltracked_eu.csv | 16 +-- .../data/internationaltrackedsigned_eu.csv | 9 ++ .../data/internationaltrackedsigned_wz1.csv | 9 ++ .../data/internationaltrackedsigned_wz2.csv | 9 ++ .../Royalmail/data/nextday1000saturday.csv | 6 ++ .../Royalmail/data/nextday2500saturday.csv | 6 ++ .../Royalmail/data/nextday500saturday.csv | 6 ++ .../secondclass_largeletter_signedfor.csv | 4 + .../data/secondclass_letter_signedfor.csv | 1 + .../data/secondclass_medium_signedfor.csv | 5 + .../Royalmail/data/secondclass_small.csv | 12 ++- .../data/secondclass_small_signedfor.csv | 5 + .../Meanbee/Royalmail/etc/config.xml | 2 +- 64 files changed, 1724 insertions(+), 55 deletions(-) create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php create mode 100644 app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php create mode 100644 app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/9am50saturday.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_wz.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/nextday2500saturday.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv create mode 100644 app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php index 75f5a53..8044fc4 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php @@ -135,10 +135,16 @@ public function getAllowedMethods() { public function getMethods($name=null) { $codes = array( // To maintain backwards comparability we need to keep letter and largeletter indices the same + 'letter' => 'First Class Letter', 'largeletter' => 'First Class Large Letter', + 'firstclasslettersignedfor' => 'First Class Letter (Signed for)', + 'firstclasslargelettersignedfor' => 'First Class Large Letter (Signed for)', + 'secondclassletter' => 'Second Class Letter', 'secondclasslargeletter' => 'Second Class Large Letter', + 'secondclasslettersignedfor' => 'Second Class Letter (Signed For)', + 'secondclasslargelettersignedfor' => 'Second Class Large Letter (Signed For)', 'secondclass' => 'Second Class Parcel', 'secondclassrecordedsignedfor' => 'Second Class Parcel (Signed for)', @@ -146,15 +152,22 @@ public function getMethods($name=null) { 'firstclass' => 'First Class Parcel', 'firstclassrecordedsignedfor' => 'First Class Parcel (Signed for)', - 'specialdeliverynextday' => 'Special Delivery Guaranteed by 1pm (Up to 500GBP Insurance)', - + 'specialdeliverynextday' => 'Special Delivery Guaranteed by 1pm (Up to 2,500GBP Insurance)', 'specialdelivery9am' => 'Special Delivery Guaranteed by 9am (Up to 2,500GBP Insurance)', + 'specialdelivery9amsaturday' => 'Special Delivery Saturday Guaranteed by 9am (Up to 2,500GBP Insurance)', + 'specialdeliverynextdaysaturday' => 'Special Delivery Saturday Guaranteed by 1pm (Up to 2,500GBP Insurance)', 'internationalstandard' => 'International Standard (up to 2kg)', 'internationaltrackedsigned' => 'International Tracked & Signed (Up to 250GBP Compensation)', 'internationaltracked' => 'International Tracked (Up to 250GBP Compensation)', 'internationalsigned' => 'International Signed (Up to 250GBP Compensation)', - 'internationaleconomy' => 'International Economy' + 'internationaleconomy' => 'International Economy', + + 'internationallettertracked' => 'International Letter Tracked', + 'internationallettersigned' => 'International Letter Signed', + 'internationallettereconomy' => 'International Letter Economy', + 'internationalletterstandard' => 'International Letter Standard', + 'internationallettertrackedsigned' => 'International Letter Tracked (Signed)', ); if ($name !== null) { @@ -167,4 +180,4 @@ public function getMethods($name=null) { return $codes; } } -} +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php new file mode 100644 index 0000000..0690e24 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php @@ -0,0 +1,34 @@ +_loadCsv('firstclass_largeletter_signedfor'); + + if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + return $rates; + } + + return null; + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php new file mode 100644 index 0000000..b235876 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php @@ -0,0 +1,34 @@ +_loadCsv('firstclass_letter_signedfor'); + + if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + return $rates; + } + + return null; + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php index f29e51d..de09a68 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php @@ -20,15 +20,23 @@ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Firstclassrecordedsignedfor extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Firstclass { - private $_extraCharge = 1.10; - public function getRates() { - $rates = parent::getRates(); + $helper = Mage::helper('royalmail'); + $rates = $this->_loadCsv($this->_getRateFile()); + + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { + return $rates; + } + + return null; + } + + protected function _getRateFile() { - for ($i = 0; $i < count($rates); $i++) { - $rates[$i]['cost'] += $this->_extraCharge; + if (Mage::getStoreConfig('carriers/royalmail/parcel_size') == Meanbee_Royalmail_Model_Parcelsize::SMALL) { + return 'firstclass_small_signedfor'; } - return $rates; + return 'firstclass_medium_signedfor'; } } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php new file mode 100644 index 0000000..051fccf --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php @@ -0,0 +1,30 @@ +getWorldZone($this->_getCountry()) !== Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { + return $this->_loadCsv('internationalltettereconomy'); + } + return null; + } +} diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php new file mode 100644 index 0000000..2b69858 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php @@ -0,0 +1,81 @@ +_getCountry(); + $worldZone = $_helper->getWorldZone($country); + + + if (!$_helper->isCountryAvailableForInternationalSigned($country)) { + return null; + } + + + switch($worldZone) { + case 'gb': + return null; + case 'eu': + $rates = $_helper->addInsuranceCharges( + $this->_getEuRates(), + $this->additionalInsuranceChargeEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz1': + $rates = $_helper->addInsuranceCharges( + $this->_getWzRates(), + $this->additionalInsuranceChargeWz1, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz2': + $rates = $_helper->addInsuranceCharges( + $this->_getWzRates(), + $this->additionalInsuranceChargeWz2, + $this->getCartTotal(), + $this->insureOver + ); + break; + default: + return null; + } + return $rates; + } + + protected function _getEuRates() { + return $this->_loadCsv('internationallettersigned_eu'); + } + + protected function _getWzRates() { + return $this->_loadCsv('internationallettersigned_wz'); + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php new file mode 100644 index 0000000..e09c975 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php @@ -0,0 +1,57 @@ +_getCountry(); + $worldZone = $_helper->getWorldZone($country); + + + switch($worldZone) { + case 'gb': + return null; + case 'eu': + case 'noneu': + $rates = $this->_getEuropeRates(); + break; + case 'wz1': + $rates = $this->_getWzRates(); + break; + case 'wz2': + $rates = $this->_getWzRates(); + break; + default: + return null; + } + return $rates; + } + + protected function _getEuropeRates() { + return $this->_loadCsv('internationalletterstandard_eu'); + } + + protected function _getWzRates() { + return $this->_loadCsv('internationalletterstandard_wz'); + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php new file mode 100644 index 0000000..1e5ff3e --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php @@ -0,0 +1,93 @@ +_getCountry(); + $worldZone = $_helper->getWorldZone($country); + + + if (!$_helper->isCountryAvailableForInternationalTracked($country)) { + return null; + } + + + switch($worldZone) { + case 'gb': + return null; + case 'eu': + $rates = $_helper->addInsuranceCharges( + $this->_getEuRates(), + $this->additionalInsuranceChargeEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'noneu': + $rates = $_helper->addInsuranceCharges( + $this->_getNonEuRates(), + $this->additionalInsuranceChargeNonEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz1': + $rates = $_helper->addInsuranceCharges( + $this->_getWzRates(), + $this->additionalInsuranceChargeWz1, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz2': + $rates = $_helper->addInsuranceCharges( + $this->_getWzRates(), + $this->additionalInsuranceChargeWz2, + $this->getCartTotal(), + $this->insureOver + ); + break; + default: + return null; + } + return $rates; + } + + protected function _getEuRates() { + return $this->_loadCsv('internationallettertracked_eu'); + } + + protected function _getNonEuRates() { + return $this->_loadCsv('internationallettertracked_noneu'); + } + + protected function _getWzRates() { + return $this->_loadCsv('internationallettertracked_wz'); + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php new file mode 100644 index 0000000..b670eda --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php @@ -0,0 +1,78 @@ +_getCountry(); + $worldZone = $_helper->getWorldZone($country); + + + if (!$_helper->isCountryAvailableForInternationalTrackedAndSigned($country)) { + return null; + } + + switch($worldZone) { + case 'gb': + return null; + case 'eu': + $rates = $_helper->addInsuranceCharges( + $this->_getEuRates(), + $this->additionalInsuranceChargeEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz1': + $rates = $_helper->addInsuranceCharges( + $this->_getWzRates(), + $this->additionalInsuranceChargeWz, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz2': + $rates = $_helper->addInsuranceCharges( + $this->_getWzRates(), + $this->additionalInsuranceChargeWz, + $this->getCartTotal(), + $this->insureOver + ); + break; + default: + return null; + } + return $rates; + } + + protected function _getEuRates() { + return $this->_loadCsv('internationallettertrackedsigned_eu'); + } + + protected function _getWzRates() { + return $this->_loadCsv('internationallettertrackedsigned_wz'); + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php index 81a54c8..4a09e41 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php @@ -18,26 +18,78 @@ */ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationalsigned - extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationalstandard { + extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Abstract { protected $insureOver = 50; - protected $additionalInsuranceCharge = 2.50; + protected $additionalInsuranceChargeEu = 2.50; + protected $additionalInsuranceChargeNonEu = 2.50; + protected $additionalInsuranceChargeWz1 = 2.50; + protected $additionalInsuranceChargeWz2 = 2.50; public function getRates() { - $helper = Mage::helper('royalmail'); + $_helper = Mage::helper('royalmail'); $country = $this->_getCountry(); + $worldZone = $_helper->getWorldZone($country); - if (!$helper->isCountryAvailableForInternationalSigned($country)) { + + if (!$_helper->isCountryAvailableForInternationalSigned($country)) { return null; } - $rates = parent::getRates(); - if($rates !== null) { - $rates = Mage::helper('royalmail')->addInsuranceCharges($rates, $this->additionalInsuranceCharge, $this->getCartTotal(), $this->insureOver); - for($i = 0; $i < count($rates); $i++) { - $rates[$i]['cost'] += 5; - } + switch($worldZone) { + case 'gb': + return null; + case 'eu': + $rates = $_helper->addInsuranceCharges( + $this->_getEuRates(), + $this->additionalInsuranceChargeEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'noneu': + $rates = $_helper->addInsuranceCharges( + $this->_getNonEuRates(), + $this->additionalInsuranceChargeNonEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz1': + $rates = $_helper->addInsuranceCharges( + $this->_getWz1Rates(), + $this->additionalInsuranceChargeWz1, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz2': + $rates = $_helper->addInsuranceCharges( + $this->_getWz2Rates(), + $this->additionalInsuranceChargeWz2, + $this->getCartTotal(), + $this->insureOver + ); + break; + default: + return null; } return $rates; } + + protected function _getEuRates() { + return $this->_loadCsv('internationalsigned_eu'); + } + + protected function _getNonEuRates() { + return $this->_loadCsv('internationalsigned_noneu'); + } + + protected function _getWz1Rates() { + return $this->_loadCsv('internationalsigned_wz1'); + } + + protected function _getWz2Rates() { + return $this->_loadCsv('internationalsigned_wz2'); + } } \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php index d6d349d..15535b9 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php @@ -25,7 +25,6 @@ public function getRates() { $_helper = Mage::helper('royalmail'); $country = $this->_getCountry(); $worldZone = $_helper->getWorldZone($country); - $weight = $this->_getWeight(); switch($worldZone) { diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php index 374c9ed..d707d66 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php @@ -18,26 +18,78 @@ */ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationaltrackedsigned - extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationalstandard { + extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Abstract { protected $insureOver = 50; - protected $additionalInsuranceCharge = 2.50; + protected $additionalInsuranceChargeEu = 2.50; + protected $additionalInsuranceChargeNonEu = 2.50; + protected $additionalInsuranceChargeWz1 = 2.50; + protected $additionalInsuranceChargeWz2 = 2.50; public function getRates() { - $helper = Mage::helper('royalmail'); + $_helper = Mage::helper('royalmail'); $country = $this->_getCountry(); + $worldZone = $_helper->getWorldZone($country); - if (!$helper->isCountryAvailableForInternationalTrackedAndSigned($country)) { + + if (!$_helper->isCountryAvailableForInternationalTrackedAndSigned($country)) { return null; } - $rates = parent::getRates(); - if($rates !== null) { - $rates = Mage::helper('royalmail')->addInsuranceCharges($rates, $this->additionalInsuranceCharge, $this->getCartTotal(), $this->insureOver); - for($i = 0; $i < count($rates); $i++) { - $rates[$i]['cost'] += 5; - } + switch($worldZone) { + case 'gb': + return null; + case 'eu': + $rates = $_helper->addInsuranceCharges( + $this->_getEuRates(), + $this->additionalInsuranceChargeEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'noneu': + $rates = $_helper->addInsuranceCharges( + $this->_getNonEuRates(), + $this->additionalInsuranceChargeNonEu, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz1': + $rates = $_helper->addInsuranceCharges( + $this->_getWz1Rates(), + $this->additionalInsuranceChargeWz1, + $this->getCartTotal(), + $this->insureOver + ); + break; + case 'wz2': + $rates = $_helper->addInsuranceCharges( + $this->_getWz2Rates(), + $this->additionalInsuranceChargeWz2, + $this->getCartTotal(), + $this->insureOver + ); + break; + default: + return null; } return $rates; } + + protected function _getEuRates() { + return $this->_loadCsv('internationaltrackedsigned_eu'); + } + + protected function _getNonEuRates() { + return $this->_loadCsv('internationaltrackedsigned_noneu'); + } + + protected function _getWz1Rates() { + return $this->_loadCsv('internationaltrackedsigned_wz1'); + } + + protected function _getWz2Rates() { + return $this->_loadCsv('internationaltrackedsigned_wz2'); + } } \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclass.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclass.php index 8cb9211..c184483 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclass.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclass.php @@ -32,12 +32,9 @@ protected function getRates() { } protected function _getRateFile() { - $weight = $this->_getWeight(); - if ($weight <= 2000) { - if (Mage::getStoreConfig('carriers/royalmail/parcel_size') == Meanbee_Royalmail_Model_Parcelsize::SMALL) { - return 'secondclass_small'; - } + if (Mage::getStoreConfig('carriers/royalmail/parcel_size') == Meanbee_Royalmail_Model_Parcelsize::SMALL) { + return 'secondclass_small'; } return 'secondclass_medium'; diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php new file mode 100644 index 0000000..daad4e1 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php @@ -0,0 +1,34 @@ +_loadCsv('secondclass_largeletter_signedfor'); + + if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + return $rates; + } + + return null; + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php new file mode 100644 index 0000000..0e1e8a9 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php @@ -0,0 +1,34 @@ +_loadCsv('secondclass_letter_signedfor'); + + if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + return $rates; + } + + return null; + } + +} \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php index 1ac578f..dfd34bd 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php @@ -20,15 +20,23 @@ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Secondclassrecordedsignedfor extends Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Secondclass { - private $_extraCharge = 1.10; - protected function getRates() { - $rates = parent::getRates(); + $helper = Mage::helper('royalmail'); + $rates = $this->_loadCsv($this->_getRateFile()); + + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { + return $rates; + } + + return null; + } + + protected function _getRateFile() { - for ($i = 0; $i < count($rates); $i++) { - $rates[$i]['cost'] += $this->_extraCharge; + if (Mage::getStoreConfig('carriers/royalmail/parcel_size') == Meanbee_Royalmail_Model_Parcelsize::SMALL) { + return 'secondclass_small_signedfor'; } - return $rates; + return 'secondclass_medium_signedfor'; } } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php new file mode 100644 index 0000000..e381b5e --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php @@ -0,0 +1,45 @@ +_getRatesCsv(); + + if ($helper->getWorldZone($this->_getCountry()) == 'gb' && $this->_getCountry() != "GG") { + return $rates; + } + + return null; + } + + protected function _getRatesCsv() { + $total = $this->getCartTotal(); + if ($total <= 50) { + return $this->_loadCsv('9am50saturday'); + } else if ($total <= 1000) { + return $this->_loadCsv('9am1000saturday'); + } else if ($total <= 2500) { + return $this->_loadCsv('9am2500saturday'); + } + return null; + } +} diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php new file mode 100644 index 0000000..be73cdb --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php @@ -0,0 +1,45 @@ +_getRatesCsv(); + + if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + return $rates; + } + + return null; + } + + protected function _getRatesCsv() { + $total = $this->getCartTotal(); + if ($total <= 500) { + return $this->_loadCsv('nextday500saturday'); + } else if ($total <= 1000) { + return $this->_loadCsv('nextday1000saturday'); + } else if ($total <= 2500) { + return $this->_loadCsv('nextday2500saturday'); + } + return null; + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php new file mode 100644 index 0000000..445ccfe --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php @@ -0,0 +1,61 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_firstclasslargelettersignedfor'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testNotAllowedFromFrance() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 50, + 1.00, + 'FR' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 2.03, + $this->_model->getCost( + $this->_getRateRequest( + 50, + 1.00, + 'GB' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 3.48, + $this->_model->getCost( + $this->_getRateRequest( + 750, + 1.00, + 'GB' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 751, + 1.00, + 'GB' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php new file mode 100644 index 0000000..5b366c4 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php @@ -0,0 +1,61 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_firstclasslettersignedfor'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testNotAllowedFromFrance() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 50, + 1.00, + 'FR' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 1.72, + $this->_model->getCost( + $this->_getRateRequest( + 50, + 1.00, + 'GB' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 1.72, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 1.00, + 'GB' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 101, + 1.00, + 'GB' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php new file mode 100644 index 0000000..b1193e4 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php @@ -0,0 +1,61 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettereconomy'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testNotAllowedFromGb() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 20, + 1.00, + 'GB' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 0.81, + $this->_model->getCost( + $this->_getRateRequest( + 20, + 1.00, + 'FR' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 2.02, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 1.00, + 'FR' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 101, + 1.00, + 'FR' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php new file mode 100644 index 0000000..6a83b6a --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php @@ -0,0 +1,93 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettersigned'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testAllowedFromEstonia() { + $this->assertEquals( + 7.35, + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'EE' + )) + ); + } + + public function testNotAllowedBelarus() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'BY' + )) + ); + } + + public function testNotAllowedFromNonEuCountry() { + $this->assertEquals( + null, + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'AM' + )) + ); + } + + public function testNotAllowedFromUnitedKingdom() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'GB' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 5.97, + $this->_model->getCost( + $this->_getRateRequest( + 20, + 1.00, + 'EE' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 10.98, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 2000.00, + 'AX' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 5001, + 1.00, + 'EE' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php new file mode 100644 index 0000000..ff5c4f1 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php @@ -0,0 +1,72 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationalletterstandard'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testAllowedFromFrance() { + $this->assertEquals( + 2.35, + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'FR' + )) + ); + } + + public function testNotAllowedFromUnitedKingdom() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'GB' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 0.97, + $this->_model->getCost( + $this->_getRateRequest( + 10, + 1.00, + 'FR' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 2.35, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 1.00, + 'FR' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 101, + 1.00, + 'FR' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php new file mode 100644 index 0000000..626ea0e --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php @@ -0,0 +1,97 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettertracked'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testAllowedFromFrance() { + $this->assertEquals( + 8.82, + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'FR' + )) + ); + } + + public function testNotAllowedFromAfghanistan() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'AF' + )) + ); + } + + /* + * The reason this is null is because Royal Mail don't actually offer a tracked delivery to noneu countries + * Mage::getHelper('royalmail')->isCountryAvailableForInternationalTracked(); + */ + public function testNotAllowedFromNonEuCountry() { + $this->assertEquals( + null, + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'AM' + )) + ); + } + + public function testNotAllowedFromUnitedKingdom() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'GB' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 7.16, + $this->_model->getCost( + $this->_getRateRequest( + 20, + 1.00, + 'FR' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 11.82, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 2000.00, + 'FR' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 5001, + 1.00, + 'FR' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php new file mode 100644 index 0000000..0704bb5 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php @@ -0,0 +1,83 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettertrackedsigned'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testAllowedFromFrance() { + $this->assertEquals( + 7.35, + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'FR' + )) + ); + } + + public function testNotAllowedFromAfghanistan() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'AF' + )) + ); + } + + public function testNotAllowedFromUnitedKingdom() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 100, + 1.00, + 'GB' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 5.97, + $this->_model->getCost( + $this->_getRateRequest( + 20, + 1.00, + 'FR' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 10.95, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 2000.00, + 'US' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 5001, + 1.00, + 'FR' + )) + ); + } + +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php index a37073b..9edd295 100644 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php @@ -27,7 +27,7 @@ public function testNotAllowedFromFrance() { public function testMinimalPrice() { $this->assertEquals( - 5.20, + 2.8, $this->_model->getCost( $this->_getRateRequest( 50, diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php new file mode 100644 index 0000000..2845208 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php @@ -0,0 +1,61 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclasslargelettersignedfor'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testNotAllowedFromFrance() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 50, + 1.00, + 'FR' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 1.83, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 1.00, + 'GB' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 3.11, + $this->_model->getCost( + $this->_getRateRequest( + 750, + 1.00, + 'GB' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 751, + 1.00, + 'GB' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php new file mode 100644 index 0000000..2fd4b8c --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php @@ -0,0 +1,61 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclasslettersignedfor'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testNotAllowedFromFrance() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 50, + 1.00, + 'FR' + )) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 1.63, + $this->_model->getCost( + $this->_getRateRequest( + 50, + 1.00, + 'GB' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 1.63, + $this->_model->getCost( + $this->_getRateRequest( + 100, + 1.00, + 'GB' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 101, + 1.00, + 'GB' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php index 710e672..6f51a5e 100644 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php @@ -25,9 +25,12 @@ public function testNotAllowedFromFrance() { ); } + + public function testMinimalPrice() { + $this->assertEquals( - 6.30, + 3.9, $this->_model->getCost( $this->_getRateRequest( 50, diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php new file mode 100644 index 0000000..7af989d --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php @@ -0,0 +1,83 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_specialdeliverysaturday'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testNotAllowedFromFrance() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 50, + 1.00, + 'FR' + )) + ); + } + + public function testMaximumBasketValue() { + $this->assertNull( + $this->_model->getCost( + $this->_getRateRequest( + 50, + 2500.01, + 'GB' + ) + ) + ); + + $this->assertNotNull( + $this->_model->getCost( + $this->_getRateRequest( + 50, + 50.00, + 'GB' + ) + ) + ); + } + + public function testMinimalPrice() { + $this->assertEquals( + 21.18, + $this->_model->getCost( + $this->_getRateRequest( + 50, + 1.00, + 'GB' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 35.64, + $this->_model->getCost( + $this->_getRateRequest( + 2000, + 2500.00, + 'GB' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 2001, + 1.00, + 'GB' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php new file mode 100644 index 0000000..b98c041 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php @@ -0,0 +1,83 @@ +_model = Mage::getModel('royalmail/shipping_carrier_royalmail_specialdeliverynextdaysaturday'); + } + + public function tearDown() { + parent::tearDown(); + + $this->_model = null; + } + + public function testNotAllowedFromFrance() { + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 50, + 1.00, + 'FR' + )) + ); + } + + public function testMaximumBasketValue() { + $this->assertNull( + $this->_model->getCost( + $this->_getRateRequest( + 50, + 2500.01, + 'GB' + ) + ) + ); + + $this->assertNotNull( + $this->_model->getCost( + $this->_getRateRequest( + 50, + 500.00, + 'GB' + ) + ) + ); + } + + public function testLowerLimit() { + $this->assertEquals( + 10.68, + $this->_model->getCost( + $this->_getRateRequest( + 50, + 1.00, + 'GB' + ) + ) + ); + } + + public function testUpperLimit() { + $this->assertEquals( + 56.04, + $this->_model->getCost( + $this->_getRateRequest( + 20000, + 2500, + 'GB' + ) + ) + ); + + $this->assertNull( + $this->_model->getCost($this->_getRateRequest( + 20001, + 1.00, + 'GB' + )) + ); + } +} diff --git a/app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv b/app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv new file mode 100644 index 0000000..813a2ca --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv @@ -0,0 +1,4 @@ +100,23.38 +500,25.72 +1000,27.46 +2000,32.14 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv b/app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv new file mode 100644 index 0000000..4a86125 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv @@ -0,0 +1,4 @@ +100,26.88 +500,29.22 +1000,30.96 +2000,35.64 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/9am50saturday.csv b/app/code/community/Meanbee/Royalmail/data/9am50saturday.csv new file mode 100644 index 0000000..52cbfa6 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/9am50saturday.csv @@ -0,0 +1,4 @@ +100,21.18 +500,23.52 +1000,25.26 +2000,29.94 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv new file mode 100644 index 0000000..c65c60b --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv @@ -0,0 +1,4 @@ +100,2.03 +250,2.34 +500,2.75 +750,3.48 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv new file mode 100644 index 0000000..9f84c5f --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv @@ -0,0 +1 @@ +100,1.72 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv new file mode 100644 index 0000000..1b356d0 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv @@ -0,0 +1,5 @@ +1000,6.75 +2000,10.0 +5000,16.95 +10000,23.0 +20000,34.5 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv new file mode 100644 index 0000000..c0614eb --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv @@ -0,0 +1,7 @@ +1000,4.30 +2000,6.55 +1000,6.75 +2000,10 +5000,16.95 +10000,23 +20000,34.5 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv new file mode 100644 index 0000000..af3b9fe --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv @@ -0,0 +1,3 @@ +20,5.97 +60,6.47 +100,7.35 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv new file mode 100644 index 0000000..8861dbd --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv @@ -0,0 +1,3 @@ +20,6.28 +60,7.15 +100,8.48 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv new file mode 100644 index 0000000..caa411f --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv @@ -0,0 +1,4 @@ +10,0.97 +20,0.97 +60,1.47 +100,2.35 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv new file mode 100644 index 0000000..2989faf --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv @@ -0,0 +1,4 @@ +10,0.97 +20,1.28 +60,2.15 +100,3.48 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv new file mode 100644 index 0000000..006d124 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv @@ -0,0 +1,3 @@ +20,7.16 +60,7.76 +100,8.82 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv new file mode 100644 index 0000000..af3b9fe --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv @@ -0,0 +1,3 @@ +20,5.97 +60,6.47 +100,7.35 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv new file mode 100644 index 0000000..8861dbd --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv @@ -0,0 +1,3 @@ +20,6.28 +60,7.15 +100,8.48 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv new file mode 100644 index 0000000..af3b9fe --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv @@ -0,0 +1,3 @@ +20,5.97 +60,6.47 +100,7.35 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_wz.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_wz.csv new file mode 100644 index 0000000..d376a4f --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_wz.csv @@ -0,0 +1,3 @@ +20,6.28 +60,7.15 +100,8.45 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv b/app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv new file mode 100644 index 0000000..a6f37d7 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv @@ -0,0 +1,3 @@ +20,0.81 +60,1.43 +100,2.02 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv new file mode 100644 index 0000000..a18b6db --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv @@ -0,0 +1,9 @@ +100,8.2 +250,8.7 +500,10.15 +750,11.6 +1000,13.05 +1250,14.5 +1500,15.95 +1750,17.4 +2000,18.85 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv new file mode 100644 index 0000000..f97197b --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv @@ -0,0 +1,9 @@ +100,8.8 +250,9.75 +500,12.45 +750,15.15 +1000,17.85 +1250,20.55 +1500,23.25 +1750,25.95 +2000,28.65 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv new file mode 100644 index 0000000..b421dc4 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv @@ -0,0 +1,9 @@ +100,9 +250,10.05 +500,12.9 +750,15.75 +1000,18.6 +1250,21.45 +1500,24.3 +1750,27.15 +2000,30 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv index 22ec93b..95e7f52 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv @@ -1,9 +1,9 @@ -100,9.84 -250,10.44 -500,12.18 -750,13.92 -1000,15.66 -1250,17.40 -1500,19.14 -1750,20.88 +100,9.84 +250,10.44 +500,12.18 +750,13.92 +1000,15.66 +1250,17.40 +1500,19.14 +1750,20.88 2000,22.62 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv new file mode 100644 index 0000000..a18b6db --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv @@ -0,0 +1,9 @@ +100,8.2 +250,8.7 +500,10.15 +750,11.6 +1000,13.05 +1250,14.5 +1500,15.95 +1750,17.4 +2000,18.85 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv new file mode 100644 index 0000000..f97197b --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv @@ -0,0 +1,9 @@ +100,8.8 +250,9.75 +500,12.45 +750,15.15 +1000,17.85 +1250,20.55 +1500,23.25 +1750,25.95 +2000,28.65 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv new file mode 100644 index 0000000..b421dc4 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv @@ -0,0 +1,9 @@ +100,9 +250,10.05 +500,12.9 +750,15.75 +1000,18.6 +1250,21.45 +1500,24.3 +1750,27.15 +2000,30 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv b/app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv new file mode 100644 index 0000000..1fcaced --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv @@ -0,0 +1,6 @@ +100,11.88 +500,12.78 +1000,14.34 +2000,17.40 +10000,36.12 +20000,53.64 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/nextday2500saturday.csv b/app/code/community/Meanbee/Royalmail/data/nextday2500saturday.csv new file mode 100644 index 0000000..85ac656 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/nextday2500saturday.csv @@ -0,0 +1,6 @@ +100,14.28 +500,15.18 +1000,16.74 +2000,19.80 +10000,38.52 +20000,56.04 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv b/app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv new file mode 100644 index 0000000..7ea1eeb --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv @@ -0,0 +1,6 @@ +100,10.68 +500,11.58 +1000,13.14 +2000,16.20 +10000,34.92 +20000,52.44 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv new file mode 100644 index 0000000..0247126 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv @@ -0,0 +1,4 @@ +100,1.83 +250,2.27 +500,2.58 +750,3.11 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv new file mode 100644 index 0000000..c73e211 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv @@ -0,0 +1 @@ +100,1.63 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv new file mode 100644 index 0000000..89d5def --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv @@ -0,0 +1,5 @@ +1000,6.3 +2000,9 +5000,14.85 +10000,21.35 +20000,29.65 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv index ab95636..42a8b8c 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv @@ -1,2 +1,10 @@ -1000,2.80 -2000,3.80 \ No newline at end of file +1000,2.8,,, +2000,3.8,,, +5000,13.75,,, +10000,20.25,,, +20000,28.55,,, +,,,, +,,,, +,,,, +,,,, +,,,, \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv new file mode 100644 index 0000000..e354efc --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv @@ -0,0 +1,5 @@ +1000,3.9 +2000,4.9 +5000,14.85 +10000,21.35 +20000,29.65 \ No newline at end of file diff --git a/app/code/community/Meanbee/Royalmail/etc/config.xml b/app/code/community/Meanbee/Royalmail/etc/config.xml index eefbc57..0bc18d3 100644 --- a/app/code/community/Meanbee/Royalmail/etc/config.xml +++ b/app/code/community/Meanbee/Royalmail/etc/config.xml @@ -85,7 +85,7 @@ GB 0 0 - small + small From 5725bc53a17efd0c16c287604033dc3e2d2f8e70 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Thu, 5 Feb 2015 10:15:32 +0000 Subject: [PATCH 03/11] Forgot to up the version number --- app/code/community/Meanbee/Royalmail/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Meanbee/Royalmail/etc/config.xml b/app/code/community/Meanbee/Royalmail/etc/config.xml index 0bc18d3..f035291 100644 --- a/app/code/community/Meanbee/Royalmail/etc/config.xml +++ b/app/code/community/Meanbee/Royalmail/etc/config.xml @@ -22,7 +22,7 @@ - 2.6.2 + 2.6.3 From 98986028ea7313c5cc2e6adf42e6c6f2f99b9327 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Thu, 5 Feb 2015 13:30:37 +0000 Subject: [PATCH 04/11] Added constants to if statements and switch statements I also merged some of the switch statements as there was unnecessary duplicate code. --- .../Shipping/Carrier/Royalmail/Firstclass.php | 2 +- .../Firstclasslargelettersignedfor.php | 2 +- .../Royalmail/Firstclasslettersignedfor.php | 2 +- .../Royalmail/Internationallettersigned.php | 8 +++---- .../Royalmail/Internationalletterstandard.php | 12 +++++----- .../Royalmail/Internationallettertracked.php | 22 ++++++------------- .../Internationallettertrackedsigned.php | 15 ++++--------- .../Carrier/Royalmail/Internationalsigned.php | 10 ++++----- .../Royalmail/Internationalstandard.php | 10 ++++----- .../Royalmail/Internationaltracked.php | 10 ++++----- .../Royalmail/Internationaltrackedsigned.php | 10 ++++----- .../Carrier/Royalmail/Largeletter.php | 2 +- .../Shipping/Carrier/Royalmail/Letter.php | 2 +- .../Secondclasslargelettersignedfor.php | 2 +- .../Royalmail/Secondclasslettersignedfor.php | 2 +- .../Carrier/Royalmail/Specialdelivery9am.php | 2 +- .../Royalmail/Specialdelivery9amsaturday.php | 2 +- .../Royalmail/Specialdeliverynextday.php | 2 +- 18 files changed, 50 insertions(+), 67 deletions(-) diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclass.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclass.php index e403448..4442ceb 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclass.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclass.php @@ -24,7 +24,7 @@ public function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_loadCsv($this->_getRateFile()); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php index 0690e24..227c8f4 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_loadCsv('firstclass_largeletter_signedfor'); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php index b235876..682089c 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_loadCsv('firstclass_letter_signedfor'); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php index 2b69858..2be4354 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php @@ -38,9 +38,9 @@ public function getRates() { switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: $rates = $_helper->addInsuranceCharges( $this->_getEuRates(), $this->additionalInsuranceChargeEu, @@ -48,7 +48,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz1': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: $rates = $_helper->addInsuranceCharges( $this->_getWzRates(), $this->additionalInsuranceChargeWz1, @@ -56,7 +56,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz2': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $_helper->addInsuranceCharges( $this->_getWzRates(), $this->additionalInsuranceChargeWz2, diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php index e09c975..ae6cd41 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php @@ -28,16 +28,14 @@ public function getRates() { switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': - case 'noneu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: $rates = $this->_getEuropeRates(); break; - case 'wz1': - $rates = $this->_getWzRates(); - break; - case 'wz2': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $this->_getWzRates(); break; default: diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php index 1e5ff3e..b6c9f1b 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php @@ -23,8 +23,7 @@ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationallettertrac protected $insureOver = 50; protected $additionalInsuranceChargeEu = 3.00; protected $additionalInsuranceChargeNonEu = 2.50; - protected $additionalInsuranceChargeWz1 = 2.50; - protected $additionalInsuranceChargeWz2 = 2.50; + protected $additionalInsuranceChargeWz = 2.50; public function getRates() { $_helper = Mage::helper('royalmail'); @@ -38,9 +37,9 @@ public function getRates() { switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: $rates = $_helper->addInsuranceCharges( $this->_getEuRates(), $this->additionalInsuranceChargeEu, @@ -48,7 +47,7 @@ public function getRates() { $this->insureOver ); break; - case 'noneu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: $rates = $_helper->addInsuranceCharges( $this->_getNonEuRates(), $this->additionalInsuranceChargeNonEu, @@ -56,18 +55,11 @@ public function getRates() { $this->insureOver ); break; - case 'wz1': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $_helper->addInsuranceCharges( $this->_getWzRates(), - $this->additionalInsuranceChargeWz1, - $this->getCartTotal(), - $this->insureOver - ); - break; - case 'wz2': - $rates = $_helper->addInsuranceCharges( - $this->_getWzRates(), - $this->additionalInsuranceChargeWz2, + $this->additionalInsuranceChargeWz, $this->getCartTotal(), $this->insureOver ); diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php index b670eda..1f18102 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php @@ -35,9 +35,9 @@ public function getRates() { } switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: $rates = $_helper->addInsuranceCharges( $this->_getEuRates(), $this->additionalInsuranceChargeEu, @@ -45,15 +45,8 @@ public function getRates() { $this->insureOver ); break; - case 'wz1': - $rates = $_helper->addInsuranceCharges( - $this->_getWzRates(), - $this->additionalInsuranceChargeWz, - $this->getCartTotal(), - $this->insureOver - ); - break; - case 'wz2': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $_helper->addInsuranceCharges( $this->_getWzRates(), $this->additionalInsuranceChargeWz, diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php index 4a09e41..f04ae83 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php @@ -37,9 +37,9 @@ public function getRates() { } switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: $rates = $_helper->addInsuranceCharges( $this->_getEuRates(), $this->additionalInsuranceChargeEu, @@ -47,7 +47,7 @@ public function getRates() { $this->insureOver ); break; - case 'noneu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: $rates = $_helper->addInsuranceCharges( $this->_getNonEuRates(), $this->additionalInsuranceChargeNonEu, @@ -55,7 +55,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz1': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: $rates = $_helper->addInsuranceCharges( $this->_getWz1Rates(), $this->additionalInsuranceChargeWz1, @@ -63,7 +63,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz2': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $_helper->addInsuranceCharges( $this->_getWz2Rates(), $this->additionalInsuranceChargeWz2, diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php index 15535b9..fb94e29 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php @@ -28,16 +28,16 @@ public function getRates() { switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': - case 'noneu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU; $rates = $this->_getEuropeRates(); break; - case 'wz1': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: $rates = $this->_getWz1Rates(); break; - case 'wz2': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $this->_getWz2Rates(); break; default: diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php index fe09ee3..1020c96 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltracked.php @@ -37,9 +37,9 @@ public function getRates() { } switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: $rates = $_helper->addInsuranceCharges( $this->_getEuRates(), $this->additionalInsuranceChargeEu, @@ -47,7 +47,7 @@ public function getRates() { $this->insureOver ); break; - case 'noneu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: $rates = $_helper->addInsuranceCharges( $this->_getNonEuRates(), $this->additionalInsuranceChargeNonEu, @@ -55,7 +55,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz1': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: $rates = $_helper->addInsuranceCharges( $this->_getWz1Rates(), $this->additionalInsuranceChargeWz1, @@ -63,7 +63,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz2': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $_helper->addInsuranceCharges( $this->_getWz2Rates(), $this->additionalInsuranceChargeWz2, diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php index d707d66..d680665 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php @@ -37,9 +37,9 @@ public function getRates() { } switch($worldZone) { - case 'gb': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; - case 'eu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: $rates = $_helper->addInsuranceCharges( $this->_getEuRates(), $this->additionalInsuranceChargeEu, @@ -47,7 +47,7 @@ public function getRates() { $this->insureOver ); break; - case 'noneu': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: $rates = $_helper->addInsuranceCharges( $this->_getNonEuRates(), $this->additionalInsuranceChargeNonEu, @@ -55,7 +55,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz1': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: $rates = $_helper->addInsuranceCharges( $this->_getWz1Rates(), $this->additionalInsuranceChargeWz1, @@ -63,7 +63,7 @@ public function getRates() { $this->insureOver ); break; - case 'wz2': + case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO: $rates = $_helper->addInsuranceCharges( $this->_getWz2Rates(), $this->additionalInsuranceChargeWz2, diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Largeletter.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Largeletter.php index bbbd9ab..95182a4 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Largeletter.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Largeletter.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_loadCsv('largeletter'); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Letter.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Letter.php index c923332..013c97e 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Letter.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Letter.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_loadCsv('letter'); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php index daad4e1..5ccbedb 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_loadCsv('secondclass_largeletter_signedfor'); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php index 0e1e8a9..220e15c 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_loadCsv('secondclass_letter_signedfor'); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php index 9aee7bd..521f866 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_getRatesCsv(); - if ($helper->getWorldZone($this->_getCountry()) == 'gb' && $this->_getCountry() != "GG") { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB && $this->_getCountry() != "GG") { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php index e381b5e..053014d 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_getRatesCsv(); - if ($helper->getWorldZone($this->_getCountry()) == 'gb' && $this->_getCountry() != "GG") { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB && $this->_getCountry() != "GG") { return $rates; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php index ee77b05..c0e12cf 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_getRatesCsv(); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } From 9006144f19b4bfe110e4e100aa4bb704536fa51d Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Mon, 2 Mar 2015 13:59:44 +0000 Subject: [PATCH 05/11] MB-35: Replace string with constant --- .../Carrier/Royalmail/Specialdeliverynextdaysaturday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php index be73cdb..6a55162 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_getRatesCsv(); - if ($helper->getWorldZone($this->_getCountry()) == 'gb') { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_SeoContent_Helper_Data::WORLD_ZONE_GB) { return $rates; } From 1823fc211993ece58d46f738ab94f46cce0755c3 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Mon, 23 Mar 2015 15:53:20 +0000 Subject: [PATCH 06/11] MB-67: Fix Royal Helper Constant in Model --- .../Carrier/Royalmail/Specialdeliverynextdaysaturday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php index 6a55162..c1dd3d4 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php @@ -24,7 +24,7 @@ protected function getRates() { $helper = Mage::helper('royalmail'); $rates = $this->_getRatesCsv(); - if ($helper->getWorldZone($this->_getCountry()) == Meanbee_SeoContent_Helper_Data::WORLD_ZONE_GB) { + if ($helper->getWorldZone($this->_getCountry()) == Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB) { return $rates; } From 72d723f7344f1ae54c5bdda8468a1d2b9fdb8296 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Wed, 22 Apr 2015 12:41:20 +0100 Subject: [PATCH 07/11] MB-75: Remove NonEU Rates RoyalMail no longer offers NON EU delivery on some methods, also files where being referenced that didn't exist. --- .../Royalmail/Internationalletterstandard.php | 3 +-- .../Carrier/Royalmail/Internationalsigned.php | 15 +-------------- .../Carrier/Royalmail/Internationalstandard.php | 3 +-- .../Royalmail/Internationaltrackedsigned.php | 15 +-------------- 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php index ae6cd41..1e5b9f5 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php @@ -31,7 +31,6 @@ public function getRates() { case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: - case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: $rates = $this->_getEuropeRates(); break; case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: @@ -52,4 +51,4 @@ protected function _getWzRates() { return $this->_loadCsv('internationalletterstandard_wz'); } -} \ No newline at end of file +} diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php index f04ae83..1fb5e9b 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalsigned.php @@ -22,7 +22,6 @@ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationalsigned protected $insureOver = 50; protected $additionalInsuranceChargeEu = 2.50; - protected $additionalInsuranceChargeNonEu = 2.50; protected $additionalInsuranceChargeWz1 = 2.50; protected $additionalInsuranceChargeWz2 = 2.50; @@ -47,14 +46,6 @@ public function getRates() { $this->insureOver ); break; - case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: - $rates = $_helper->addInsuranceCharges( - $this->_getNonEuRates(), - $this->additionalInsuranceChargeNonEu, - $this->getCartTotal(), - $this->insureOver - ); - break; case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: $rates = $_helper->addInsuranceCharges( $this->_getWz1Rates(), @@ -81,10 +72,6 @@ protected function _getEuRates() { return $this->_loadCsv('internationalsigned_eu'); } - protected function _getNonEuRates() { - return $this->_loadCsv('internationalsigned_noneu'); - } - protected function _getWz1Rates() { return $this->_loadCsv('internationalsigned_wz1'); } @@ -92,4 +79,4 @@ protected function _getWz1Rates() { protected function _getWz2Rates() { return $this->_loadCsv('internationalsigned_wz2'); } -} \ No newline at end of file +} diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php index fb94e29..c7eae07 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationalstandard.php @@ -31,7 +31,6 @@ public function getRates() { case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB: return null; case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU: - case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU; $rates = $this->_getEuropeRates(); break; case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: @@ -57,4 +56,4 @@ protected function _getWz1Rates() { protected function _getWz2Rates() { return $this->_loadCsv('internationalstandard_wz2'); } -} \ No newline at end of file +} diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php index d680665..e73d242 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php @@ -22,7 +22,6 @@ class Meanbee_Royalmail_Model_Shipping_Carrier_Royalmail_Internationaltrackedsig protected $insureOver = 50; protected $additionalInsuranceChargeEu = 2.50; - protected $additionalInsuranceChargeNonEu = 2.50; protected $additionalInsuranceChargeWz1 = 2.50; protected $additionalInsuranceChargeWz2 = 2.50; @@ -47,14 +46,6 @@ public function getRates() { $this->insureOver ); break; - case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU: - $rates = $_helper->addInsuranceCharges( - $this->_getNonEuRates(), - $this->additionalInsuranceChargeNonEu, - $this->getCartTotal(), - $this->insureOver - ); - break; case Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE: $rates = $_helper->addInsuranceCharges( $this->_getWz1Rates(), @@ -81,10 +72,6 @@ protected function _getEuRates() { return $this->_loadCsv('internationaltrackedsigned_eu'); } - protected function _getNonEuRates() { - return $this->_loadCsv('internationaltrackedsigned_noneu'); - } - protected function _getWz1Rates() { return $this->_loadCsv('internationaltrackedsigned_wz1'); } @@ -92,4 +79,4 @@ protected function _getWz1Rates() { protected function _getWz2Rates() { return $this->_loadCsv('internationaltrackedsigned_wz2'); } -} \ No newline at end of file +} From 4d46258a8ccdd21fa296fb6e256f4269dacba279 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Wed, 22 Apr 2015 16:02:57 +0100 Subject: [PATCH 08/11] Update Pricelist to 2015 Prices http://www.royalmail.com/sites/default/files/Royal-Mail-UK-and-international-parcel-and-letter-prices-30-March-2015.pdf --- .../Meanbee/Royalmail/data/9am1000.csv | 6 +++--- .../Meanbee/Royalmail/data/9am1000saturday.csv | 8 ++++---- .../Meanbee/Royalmail/data/9am2500.csv | 6 +++--- .../Meanbee/Royalmail/data/9am2500saturday.csv | 8 ++++---- .../community/Meanbee/Royalmail/data/9am50.csv | 6 +++--- .../Meanbee/Royalmail/data/9am50saturday.csv | 8 ++++---- .../data/firstclass_largeletter_signedfor.csv | 8 ++++---- .../data/firstclass_letter_signedfor.csv | 2 +- .../Royalmail/data/firstclass_medium.csv | 2 +- .../data/firstclass_medium_signedfor.csv | 6 +++--- .../Royalmail/data/firstclass_small.csv | 4 ++-- .../data/firstclass_small_signedfor.csv | 10 +++++----- .../Royalmail/data/internationaleconomy.csv | 18 +++++++++--------- .../data/internationallettersigned_eu.csv | 6 +++--- .../data/internationallettersigned_wz.csv | 6 +++--- .../data/internationalletterstandard_eu.csv | 7 +++---- .../data/internationalletterstandard_wz.csv | 7 +++---- .../data/internationallettertracked_eu.csv | 6 +++--- .../data/internationallettertracked_noneu.csv | 6 +++--- .../data/internationallettertracked_wz.csv | 6 +++--- .../internationallettertrackedsigned_eu.csv | 6 +++--- .../data/internationalltettereconomy.csv | 6 +++--- .../Royalmail/data/internationalsigned_eu.csv | 12 ++++++------ .../Royalmail/data/internationalsigned_wz1.csv | 12 ++++++------ .../Royalmail/data/internationalsigned_wz2.csv | 12 ++++++------ .../data/internationalstandard_europe.csv | 18 +++++++++--------- .../data/internationalstandard_wz1.csv | 18 +++++++++--------- .../data/internationalstandard_wz2.csv | 18 +++++++++--------- .../Royalmail/data/internationaltracked_eu.csv | 12 ++++++------ .../data/internationaltracked_noneu.csv | 14 +++++++------- .../data/internationaltracked_wz1.csv | 12 ++++++------ .../data/internationaltracked_wz2.csv | 12 ++++++------ .../data/internationaltrackedsigned_eu.csv | 12 ++++++------ .../data/internationaltrackedsigned_wz1.csv | 12 ++++++------ .../data/internationaltrackedsigned_wz2.csv | 12 ++++++------ .../Meanbee/Royalmail/data/largeletter.csv | 8 ++++---- .../Meanbee/Royalmail/data/letter.csv | 2 +- .../Meanbee/Royalmail/data/nextday1000.csv | 12 ++++++------ .../Royalmail/data/nextday1000saturday.csv | 8 ++++---- .../Meanbee/Royalmail/data/nextday2500.csv | 8 ++++---- .../Meanbee/Royalmail/data/nextday500.csv | 8 ++++---- .../Royalmail/data/nextday500saturday.csv | 8 ++++---- .../Royalmail/data/secondclass_largeletter.csv | 8 ++++---- .../data/secondclass_largeletter_signedfor.csv | 8 ++++---- .../Royalmail/data/secondclass_letter.csv | 2 +- .../data/secondclass_letter_signedfor.csv | 2 +- .../Royalmail/data/secondclass_medium.csv | 6 +++--- .../data/secondclass_medium_signedfor.csv | 6 +++--- .../Royalmail/data/secondclass_small.csv | 12 ++---------- .../data/secondclass_small_signedfor.csv | 5 +---- 50 files changed, 207 insertions(+), 220 deletions(-) diff --git a/app/code/community/Meanbee/Royalmail/data/9am1000.csv b/app/code/community/Meanbee/Royalmail/data/9am1000.csv index 631ba6d..72535d2 100644 --- a/app/code/community/Meanbee/Royalmail/data/9am1000.csv +++ b/app/code/community/Meanbee/Royalmail/data/9am1000.csv @@ -1,4 +1,4 @@ -100,20.38 -500,22.72 -1000,24.46 +100,20.56 +500,22.96 +1000,24.70 2000,29.14 diff --git a/app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv b/app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv index 813a2ca..2cb6795 100644 --- a/app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv +++ b/app/code/community/Meanbee/Royalmail/data/9am1000saturday.csv @@ -1,4 +1,4 @@ -100,23.38 -500,25.72 -1000,27.46 -2000,32.14 \ No newline at end of file +100,23.56 +500,25.96 +1000,27.70 +2000,32.14 diff --git a/app/code/community/Meanbee/Royalmail/data/9am2500.csv b/app/code/community/Meanbee/Royalmail/data/9am2500.csv index 039d9bd..9dbe004 100644 --- a/app/code/community/Meanbee/Royalmail/data/9am2500.csv +++ b/app/code/community/Meanbee/Royalmail/data/9am2500.csv @@ -1,4 +1,4 @@ -100,23.88 -500,26.22 -1000,27.96 +100,24.06 +500,26.46 +1000,28.20 2000,32.64 diff --git a/app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv b/app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv index 4a86125..23ae178 100644 --- a/app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv +++ b/app/code/community/Meanbee/Royalmail/data/9am2500saturday.csv @@ -1,4 +1,4 @@ -100,26.88 -500,29.22 -1000,30.96 -2000,35.64 \ No newline at end of file +100,27.06 +500,29.46 +1000,31.20 +2000,35.64 diff --git a/app/code/community/Meanbee/Royalmail/data/9am50.csv b/app/code/community/Meanbee/Royalmail/data/9am50.csv index 7067b2f..c20c5c5 100644 --- a/app/code/community/Meanbee/Royalmail/data/9am50.csv +++ b/app/code/community/Meanbee/Royalmail/data/9am50.csv @@ -1,4 +1,4 @@ -100,18.18 -500,20.52 -1000,22.26 +100,18.36 +500,20.76 +1000,22.50 2000,26.94 diff --git a/app/code/community/Meanbee/Royalmail/data/9am50saturday.csv b/app/code/community/Meanbee/Royalmail/data/9am50saturday.csv index 52cbfa6..0c4846f 100644 --- a/app/code/community/Meanbee/Royalmail/data/9am50saturday.csv +++ b/app/code/community/Meanbee/Royalmail/data/9am50saturday.csv @@ -1,4 +1,4 @@ -100,21.18 -500,23.52 -1000,25.26 -2000,29.94 \ No newline at end of file +100,21.36 +500,23.76 +1000,25.50 +2000,29.94 diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv index c65c60b..888d237 100644 --- a/app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_largeletter_signedfor.csv @@ -1,4 +1,4 @@ -100,2.03 -250,2.34 -500,2.75 -750,3.48 \ No newline at end of file +100,2.05 +250,2.36 +500,2.78 +750,3.52 diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv index 9f84c5f..2f66300 100644 --- a/app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_letter_signedfor.csv @@ -1 +1 @@ -100,1.72 \ No newline at end of file +100,1.73 diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_medium.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_medium.csv index e575271..7cabbc2 100644 --- a/app/code/community/Meanbee/Royalmail/data/firstclass_medium.csv +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_medium.csv @@ -1,5 +1,5 @@ 1000,5.65 -2000,8.90 +2000,9.90 5000,15.85 10000,21.90 20000,33.40 diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv index 1b356d0..cad5b61 100644 --- a/app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_medium_signedfor.csv @@ -1,5 +1,5 @@ 1000,6.75 -2000,10.0 +2000,10.00 5000,16.95 -10000,23.0 -20000,34.5 \ No newline at end of file +10000,23.00 +20000,34.50 diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_small.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_small.csv index ac34335..7b6f1c7 100644 --- a/app/code/community/Meanbee/Royalmail/data/firstclass_small.csv +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_small.csv @@ -1,2 +1,2 @@ -1000,3.20 -2000,5.45 \ No newline at end of file +1000,3.30 +2000,5.45 diff --git a/app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv index c0614eb..4e16f4e 100644 --- a/app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/firstclass_small_signedfor.csv @@ -1,7 +1,7 @@ -1000,4.30 -2000,6.55 +1000,4.10 +2000,6.25 1000,6.75 -2000,10 +2000,10.00 5000,16.95 -10000,23 -20000,34.5 \ No newline at end of file +10000,23.00 +20000,34.50 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaleconomy.csv b/app/code/community/Meanbee/Royalmail/data/internationaleconomy.csv index 560c3ed..fa031ca 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaleconomy.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaleconomy.csv @@ -1,9 +1,9 @@ -100,2.80 -250,3.65 -500,5.10 -750,6.55 -1000,8.00 -1250,9.45 -1500,10.90 -1750,12.35 -2000,13.80 \ No newline at end of file +100,3.25 +250,3.75 +500,5.30 +750,6.65 +1000,8.06 +1250,9.41 +1500,10.76 +1750,12.11 +2000,13.26 diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv index af3b9fe..b29ebe5 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_eu.csv @@ -1,3 +1,3 @@ -20,5.97 -60,6.47 -100,7.35 \ No newline at end of file +10,6.00 +20,6.00 +100,6.52 diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv index 8861dbd..63bd251 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationallettersigned_wz.csv @@ -1,3 +1,3 @@ -20,6.28 -60,7.15 -100,8.48 \ No newline at end of file +10,6.00 +20,6.33 +100,7.25 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv index caa411f..d82240c 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_eu.csv @@ -1,4 +1,3 @@ -10,0.97 -20,0.97 -60,1.47 -100,2.35 \ No newline at end of file +10,1.00 +20,1.00 +100,1.52 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv index 2989faf..b7f6f76 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalletterstandard_wz.csv @@ -1,4 +1,3 @@ -10,0.97 -20,1.28 -60,2.15 -100,3.48 \ No newline at end of file +10,1.00 +20,1.33 +100,2.25 diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv index 006d124..df9c773 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_eu.csv @@ -1,3 +1,3 @@ -20,7.16 -60,7.76 -100,8.82 \ No newline at end of file +10,7.20 +20,7.20 +100,7.83 diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv index af3b9fe..b29ebe5 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_noneu.csv @@ -1,3 +1,3 @@ -20,5.97 -60,6.47 -100,7.35 \ No newline at end of file +10,6.00 +20,6.00 +100,6.52 diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv index 8861dbd..63bd251 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertracked_wz.csv @@ -1,3 +1,3 @@ -20,6.28 -60,7.15 -100,8.48 \ No newline at end of file +10,6.00 +20,6.33 +100,7.25 diff --git a/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv index af3b9fe..d82240c 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationallettertrackedsigned_eu.csv @@ -1,3 +1,3 @@ -20,5.97 -60,6.47 -100,7.35 \ No newline at end of file +10,1.00 +20,1.00 +100,1.52 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv b/app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv index a6f37d7..b7f6f76 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalltettereconomy.csv @@ -1,3 +1,3 @@ -20,0.81 -60,1.43 -100,2.02 \ No newline at end of file +10,1.00 +20,1.33 +100,2.25 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv index a18b6db..500fa83 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalsigned_eu.csv @@ -1,9 +1,9 @@ 100,8.2 250,8.7 500,10.15 -750,11.6 -1000,13.05 -1250,14.5 -1500,15.95 -1750,17.4 -2000,18.85 \ No newline at end of file +750,11.10 +1000,12.51 +1250,13.86 +1500,15.81 +1750,14.81 +2000,16.96 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv index f97197b..65c0bdd 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz1.csv @@ -1,9 +1,9 @@ 100,8.8 250,9.75 500,12.45 -750,15.15 -1000,17.85 -1250,20.55 -1500,23.25 -1750,25.95 -2000,28.65 \ No newline at end of file +750,14.55 +1000,17.20 +1250,18.90 +1500,20.60 +1750,21.55 +2000,23.25 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv index b421dc4..b1ed441 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalsigned_wz2.csv @@ -1,9 +1,9 @@ 100,9 250,10.05 500,12.9 -750,15.75 -1000,18.6 -1250,21.45 -1500,24.3 -1750,27.15 -2000,30 \ No newline at end of file +750,15.40 +1000,18.15 +1250,20.05 +1500,21.95 +1750,23.10 +2000,25.00 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalstandard_europe.csv b/app/code/community/Meanbee/Royalmail/data/internationalstandard_europe.csv index 7240f11..05ce75a 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalstandard_europe.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalstandard_europe.csv @@ -1,9 +1,9 @@ -100,3.20 -250,3.70 -500,5.15 -750,6.60 -1000,8.05 -1250,9.50 -1500,10.95 -1750,12.40 -2000,13.85 \ No newline at end of file +100,3.45 +250,3.95 +500,5.50 +750,6.85 +1000,8.26 +1250,9.61 +1500,10.96 +1750,12.31 +2000,13.46 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz1.csv b/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz1.csv index b5e43e5..56efe68 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz1.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz1.csv @@ -1,9 +1,9 @@ -100,3.80 -250,4.75 -500,7.45 -750,10.15 -1000,12.85 -1250,15.55 -1500,18.25 -1750,20.95 -2000,23.65 \ No newline at end of file +100,4.10 +250,5.00 +500,7.70 +750,10.30 +1000,12.95 +1250,14.65 +1500,16.35 +1750,18.05 +2000,19.75 diff --git a/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz2.csv b/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz2.csv index 4cf80ba..10f926b 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz2.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationalstandard_wz2.csv @@ -1,9 +1,9 @@ -100,4.00 -250,5.05 -500,7.90 -750,10.75 -1000,13.60 -1250,16.45 -1500,19.30 -1750,22.15 -2000,25.00 \ No newline at end of file +100,4.45 +250,5.45 +500,8.45 +750,11.15 +1000,13.90 +1250,15.90 +1500,17.70 +1750,19.60 +2000,21.50 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv index 95e7f52..0dd0457 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltracked_eu.csv @@ -1,9 +1,9 @@ 100,9.84 250,10.44 500,12.18 -750,13.92 -1000,15.66 -1250,17.40 -1500,19.14 -1750,20.88 -2000,22.62 \ No newline at end of file +750,13.32 +1000,15.02 +1250,16.64 +1500,18.26 +1750,18.98 +2000,20.36 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltracked_noneu.csv b/app/code/community/Meanbee/Royalmail/data/internationaltracked_noneu.csv index 9c799aa..43e9031 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltracked_noneu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltracked_noneu.csv @@ -1,9 +1,9 @@ 100,8.20 -250,8.75 +250,8.70 500,10.15 -750,11.60 -1000,13.05 -1250,14.50 -1500,15.95 -1750,17.40 -2000,18.85 \ No newline at end of file +750,11.10 +1000,12.51 +1250,13.86 +1500,15.21 +1750,15.81 +2000,16.96 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv b/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv index 4d6d26c..90320c8 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv @@ -1,9 +1,9 @@ 100,8.80 250,9.75 500,12.45 -750,15.15 -1000,17.85 -1250,20.55 -1500,23.25 -1750,25.95 -2000,28.65 \ No newline at end of file +750,14.55 +1000,17.20 +1250,18.90 +1500,20.60 +1750,21.55 +2000,23.55 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz2.csv b/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz2.csv index 8e017bc..f3a66d0 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz2.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz2.csv @@ -1,9 +1,9 @@ 100,9.00 250,10.05 500,12.90 -750,15.75 -1000,18.60 -1250,21.45 -1500,24.30 -1750,27.15 -2000,30.00 \ No newline at end of file +750,15.40 +1000,18.15 +1250,20.05 +1500,21.95 +1750,23.10 +2000,25.00 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv index a18b6db..fafde66 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_eu.csv @@ -1,9 +1,9 @@ 100,8.2 250,8.7 500,10.15 -750,11.6 -1000,13.05 -1250,14.5 -1500,15.95 -1750,17.4 -2000,18.85 \ No newline at end of file +750,11.1 +1000,12.51 +1250,13.87 +1500,15.21 +1750,15.81 +2000,16.96 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv index f97197b..65c0bdd 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz1.csv @@ -1,9 +1,9 @@ 100,8.8 250,9.75 500,12.45 -750,15.15 -1000,17.85 -1250,20.55 -1500,23.25 -1750,25.95 -2000,28.65 \ No newline at end of file +750,14.55 +1000,17.20 +1250,18.90 +1500,20.60 +1750,21.55 +2000,23.25 diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv index b421dc4..b1ed441 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltrackedsigned_wz2.csv @@ -1,9 +1,9 @@ 100,9 250,10.05 500,12.9 -750,15.75 -1000,18.6 -1250,21.45 -1500,24.3 -1750,27.15 -2000,30 \ No newline at end of file +750,15.40 +1000,18.15 +1250,20.05 +1500,21.95 +1750,23.10 +2000,25.00 diff --git a/app/code/community/Meanbee/Royalmail/data/largeletter.csv b/app/code/community/Meanbee/Royalmail/data/largeletter.csv index 39e643e..ff5d2fc 100644 --- a/app/code/community/Meanbee/Royalmail/data/largeletter.csv +++ b/app/code/community/Meanbee/Royalmail/data/largeletter.csv @@ -1,4 +1,4 @@ -100,0.93 -250,1.24 -500,1.65 -750,2.38 +100,0.95 +250,1.26 +500,1.68 +750,2.42 diff --git a/app/code/community/Meanbee/Royalmail/data/letter.csv b/app/code/community/Meanbee/Royalmail/data/letter.csv index 7f29ebb..e39fe68 100644 --- a/app/code/community/Meanbee/Royalmail/data/letter.csv +++ b/app/code/community/Meanbee/Royalmail/data/letter.csv @@ -1 +1 @@ -100,0.62 \ No newline at end of file +100,0.63 diff --git a/app/code/community/Meanbee/Royalmail/data/nextday1000.csv b/app/code/community/Meanbee/Royalmail/data/nextday1000.csv index 96010d3..ffcbdd2 100644 --- a/app/code/community/Meanbee/Royalmail/data/nextday1000.csv +++ b/app/code/community/Meanbee/Royalmail/data/nextday1000.csv @@ -1,6 +1,6 @@ -100,7.40 -500,8.15 -1000,9.45 -2000,12.00 -10000,27.60 -20000,42.20 \ No newline at end of file +100,7.45 +500,8.25 +1000,9.55 +2000,11.00 +10000,26.60 +20000,41.20 diff --git a/app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv b/app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv index 1fcaced..af204c2 100644 --- a/app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv +++ b/app/code/community/Meanbee/Royalmail/data/nextday1000saturday.csv @@ -1,6 +1,6 @@ -100,11.88 -500,12.78 -1000,14.34 +100,11.94 +500,12.90 +1000,14.46 2000,17.40 10000,36.12 -20000,53.64 \ No newline at end of file +20000,53.64 diff --git a/app/code/community/Meanbee/Royalmail/data/nextday2500.csv b/app/code/community/Meanbee/Royalmail/data/nextday2500.csv index 5fc46e6..2377244 100644 --- a/app/code/community/Meanbee/Royalmail/data/nextday2500.csv +++ b/app/code/community/Meanbee/Royalmail/data/nextday2500.csv @@ -1,6 +1,6 @@ -100,9.40 -500,10.15 -1000,11.45 +100,9.45 +500,10.25 +1000,11.55 2000,14.00 10000,29.60 -20000,44.20 \ No newline at end of file +20000,44.20 diff --git a/app/code/community/Meanbee/Royalmail/data/nextday500.csv b/app/code/community/Meanbee/Royalmail/data/nextday500.csv index 0ea4ee4..9a1cca4 100644 --- a/app/code/community/Meanbee/Royalmail/data/nextday500.csv +++ b/app/code/community/Meanbee/Royalmail/data/nextday500.csv @@ -1,6 +1,6 @@ -100,6.40 -500,7.15 -1000,8.45 +100,6.45 +500,7.25 +1000,8.55 2000,11.00 10000,26.60 -20000,41.20 \ No newline at end of file +20000,41.20 diff --git a/app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv b/app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv index 7ea1eeb..c21e214 100644 --- a/app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv +++ b/app/code/community/Meanbee/Royalmail/data/nextday500saturday.csv @@ -1,6 +1,6 @@ -100,10.68 -500,11.58 -1000,13.14 +100,10.74 +500,11.70 +1000,13.26 2000,16.20 10000,34.92 -20000,52.44 \ No newline at end of file +20000,52.44 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter.csv index 36dac64..3a17a92 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter.csv @@ -1,4 +1,4 @@ -100,0.73 -250,1.17 -500,1.48 -750,2.01 +100,0.74 +250,1.19 +500,1.51 +750,2.05 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv index 0247126..888d237 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_largeletter_signedfor.csv @@ -1,4 +1,4 @@ -100,1.83 -250,2.27 -500,2.58 -750,3.11 \ No newline at end of file +100,2.05 +250,2.36 +500,2.78 +750,3.52 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_letter.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_letter.csv index afe323f..b6d326e 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_letter.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_letter.csv @@ -1 +1 @@ -100,0.53 +100,0.54 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv index c73e211..bf018fd 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_letter_signedfor.csv @@ -1 +1 @@ -100,1.63 \ No newline at end of file +100,1.64 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_medium.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_medium.csv index 70db5dd..eafe7ea 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_medium.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_medium.csv @@ -1,5 +1,5 @@ -1000,5.20 -2000,8.00 -5000,13.75 +1000,4.89 +2000,4.89 +5000,14.75 10000,20.25 20000,28.55 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv index 89d5def..7794bcd 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_medium_signedfor.csv @@ -1,5 +1,5 @@ -1000,6.3 -2000,9 +1000,5.99 +2000,5.99 5000,14.85 10000,21.35 -20000,29.65 \ No newline at end of file +20000,29.65 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv index 42a8b8c..ac0b18f 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_small.csv @@ -1,10 +1,2 @@ -1000,2.8,,, -2000,3.8,,, -5000,13.75,,, -10000,20.25,,, -20000,28.55,,, -,,,, -,,,, -,,,, -,,,, -,,,, \ No newline at end of file +1000,2.8 +2000,2.8 diff --git a/app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv b/app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv index e354efc..ab37ec9 100644 --- a/app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv +++ b/app/code/community/Meanbee/Royalmail/data/secondclass_small_signedfor.csv @@ -1,5 +1,2 @@ 1000,3.9 -2000,4.9 -5000,14.85 -10000,21.35 -20000,29.65 \ No newline at end of file +2000,3.9 From d83cbb71ebddd6da84a2e85d5748f6afc2cedff6 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Fri, 1 May 2015 12:08:02 +0100 Subject: [PATCH 09/11] MB-75: Refactor PHPUnit Tests Instead of having a bunch of different classes for each method I have merged all the tests into one file. The data is loaded through a fixture and testing the allowed methods and not allowed methods is all handled from the runTests method. In short next time RoyalMail update their prices I have written a script which will update our fixture, there is more tests and less code. --- .../Shipping/Carrier/Royalmail/Firstclass.php | 61 ------- .../Firstclasslargelettersignedfor.php | 61 ------- .../Royalmail/Firstclasslettersignedfor.php | 61 ------- .../Royalmail/Firstclassrecordedsignedfor.php | 61 ------- .../Royalmail/Internationaleconomy.php | 61 ------- .../Royalmail/Internationallettereconomy.php | 61 ------- .../Royalmail/Internationallettersigned.php | 93 ---------- .../Royalmail/Internationalletterstandard.php | 72 -------- .../Royalmail/Internationallettertracked.php | 97 ---------- .../Internationallettertrackedsigned.php | 83 --------- .../Carrier/Royalmail/Internationalsigned.php | 95 ---------- .../Royalmail/Internationalstandard.php | 72 -------- .../Royalmail/Internationaltracked.php | 93 ---------- .../Royalmail/Internationaltrackedsigned.php | 95 ---------- .../Carrier/Royalmail/Largeletter.php | 61 ------- .../Shipping/Carrier/Royalmail/Letter.php | 61 ------- .../Shipping/Carrier/Royalmail/Rules.php | 168 ++++++++++++++++++ .../Royalmail/Rules/providers/runTests.yaml | 132 ++++++++++++++ .../Carrier/Royalmail/Secondclass.php | 61 ------- .../Royalmail/Secondclasslargeletter.php | 61 ------- .../Secondclasslargelettersignedfor.php | 61 ------- .../Carrier/Royalmail/Secondclassletter.php | 61 ------- .../Royalmail/Secondclasslettersignedfor.php | 61 ------- .../Secondclassrecordedsignedfor.php | 64 ------- .../Carrier/Royalmail/Specialdelivery9am.php | 83 --------- .../Royalmail/Specialdelivery9amsaturday.php | 83 --------- .../Royalmail/Specialdeliverynextday.php | 83 --------- .../Specialdeliverynextdaysaturday.php | 83 --------- 28 files changed, 300 insertions(+), 1889 deletions(-) delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclass.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaleconomy.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalsigned.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalstandard.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltracked.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Largeletter.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Letter.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules.php create mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules/providers/runTests.yaml delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargeletter.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassletter.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php delete mode 100644 app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclass.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclass.php deleted file mode 100644 index 56f6d27..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclass.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_firstclass'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 3.20, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 33.40, - $this->_model->getCost( - $this->_getRateRequest( - 20000, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 20001, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php deleted file mode 100644 index 445ccfe..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslargelettersignedfor.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_firstclasslargelettersignedfor'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 2.03, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 3.48, - $this->_model->getCost( - $this->_getRateRequest( - 750, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 751, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php deleted file mode 100644 index 5b366c4..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclasslettersignedfor.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_firstclasslettersignedfor'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 1.72, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 1.72, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 101, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php deleted file mode 100644 index 25bbaee..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Firstclassrecordedsignedfor.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_firstclassrecordedsignedfor'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 4.30, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 34.50, - $this->_model->getCost( - $this->_getRateRequest( - 20000, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 20001, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaleconomy.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaleconomy.php deleted file mode 100644 index 1f7e621..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaleconomy.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationaleconomy'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromGb() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 2.80, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 13.80, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 1.00, - 'FR' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 2001, - 1.00, - 'FR' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php deleted file mode 100644 index b1193e4..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettereconomy.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettereconomy'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromGb() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 20, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 0.81, - $this->_model->getCost( - $this->_getRateRequest( - 20, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 2.02, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 1.00, - 'FR' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 101, - 1.00, - 'FR' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php deleted file mode 100644 index 6a83b6a..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettersigned.php +++ /dev/null @@ -1,93 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettersigned'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromEstonia() { - $this->assertEquals( - 7.35, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'EE' - )) - ); - } - - public function testNotAllowedBelarus() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'BY' - )) - ); - } - - public function testNotAllowedFromNonEuCountry() { - $this->assertEquals( - null, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'AM' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 5.97, - $this->_model->getCost( - $this->_getRateRequest( - 20, - 1.00, - 'EE' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 10.98, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 2000.00, - 'AX' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 5001, - 1.00, - 'EE' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php deleted file mode 100644 index ff5c4f1..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalletterstandard.php +++ /dev/null @@ -1,72 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationalletterstandard'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromFrance() { - $this->assertEquals( - 2.35, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FR' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 0.97, - $this->_model->getCost( - $this->_getRateRequest( - 10, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 2.35, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 1.00, - 'FR' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 101, - 1.00, - 'FR' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php deleted file mode 100644 index 626ea0e..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertracked.php +++ /dev/null @@ -1,97 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettertracked'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromFrance() { - $this->assertEquals( - 8.82, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FR' - )) - ); - } - - public function testNotAllowedFromAfghanistan() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'AF' - )) - ); - } - - /* - * The reason this is null is because Royal Mail don't actually offer a tracked delivery to noneu countries - * Mage::getHelper('royalmail')->isCountryAvailableForInternationalTracked(); - */ - public function testNotAllowedFromNonEuCountry() { - $this->assertEquals( - null, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'AM' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 7.16, - $this->_model->getCost( - $this->_getRateRequest( - 20, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 11.82, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 2000.00, - 'FR' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 5001, - 1.00, - 'FR' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php deleted file mode 100644 index 0704bb5..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationallettertrackedsigned.php +++ /dev/null @@ -1,83 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationallettertrackedsigned'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromFrance() { - $this->assertEquals( - 7.35, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FR' - )) - ); - } - - public function testNotAllowedFromAfghanistan() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'AF' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 5.97, - $this->_model->getCost( - $this->_getRateRequest( - 20, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 10.95, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 2000.00, - 'US' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 5001, - 1.00, - 'FR' - )) - ); - } - -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalsigned.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalsigned.php deleted file mode 100644 index 1f8d129..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalsigned.php +++ /dev/null @@ -1,95 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationalsigned'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromFiji() { - $this->assertEquals( - 9, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FJ' - )) - ); - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FR' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 9, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'FJ' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 30, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 1.00, - 'FJ' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 5001, - 1.00, - 'FR' - )) - ); - } - - public function testAdditionalInsuranceCharge() { - $this->assertEquals( - 32.5, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 100.00, - 'FJ' - ) - ) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalstandard.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalstandard.php deleted file mode 100644 index 0e6b0ca..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationalstandard.php +++ /dev/null @@ -1,72 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationalstandard'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromFrance() { - $this->assertEquals( - 3.20, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FR' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 3.20, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 13.85, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 1.00, - 'FR' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 5001, - 1.00, - 'FR' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltracked.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltracked.php deleted file mode 100644 index 8b3c081..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltracked.php +++ /dev/null @@ -1,93 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationaltracked'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromFrance() { - $this->assertEquals( - 9.84, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FR' - )) - ); - } - - public function testNotAllowedFromAfghanistan() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'AF' - )) - ); - } - - public function testAllowedFromNonEuCountry() { - $this->assertEquals( - 9, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'AU' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 9.84, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 22.62, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 1.00, - 'FR' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 5001, - 1.00, - 'FR' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php deleted file mode 100644 index 7506941..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Internationaltrackedsigned.php +++ /dev/null @@ -1,95 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_internationaltrackedsigned'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testAllowedFromFrance() { - $this->assertEquals( - 8.20, - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'FR' - )) - ); - } - - public function testNotAllowedFromAfghanistan() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'AF' - )) - ); - } - - public function testNotAllowedFromUnitedKingdom() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 100, - 1.00, - 'GB' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 8.20, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'FR' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 18.85, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 1.00, - 'FR' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 5001, - 1.00, - 'FR' - )) - ); - } - - public function testAdditionalInsuranceCharge() { - $this->assertEquals( - 21.35, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 100.00, - 'FR' - ) - ) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Largeletter.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Largeletter.php deleted file mode 100644 index 8037819..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Largeletter.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_largeletter'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 0.93, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 2.38, - $this->_model->getCost( - $this->_getRateRequest( - 750, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 751, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Letter.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Letter.php deleted file mode 100644 index cbcdbcd..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Letter.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_letter'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 0.62, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 0.62, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 101, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules.php new file mode 100644 index 0000000..00bea1d --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules.php @@ -0,0 +1,168 @@ + 'GB', + Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU => 'RS', + Meanbee_Royalmail_Helper_Data::WORLD_ZONE_EU => 'FR', + Meanbee_Royalmail_Helper_Data::WORLD_ZONE_ONE => 'US', + Meanbee_Royalmail_Helper_Data::WORLD_ZONE_TWO => 'AU', + ); + + /** + * @test + * @dataProvider dataProvider + * @dataProviderFile runTests.yaml + * + * @param $modelAlias + * @param $data + */ + public function runTests($modelAlias, $data) + { + $this->_model = Mage::getModel("royalmail/shipping_carrier_royalmail_{$modelAlias}"); + + if (!is_array($data['zones'])) { + $this->testAllowedZone($this->getCountryCode($data), $data['weights']['lowest'], $data['weights']['highest']); + $this->testNotAllowedZones($this->getNotAllowedCountryCode($data), $data['weights']['lowest'], $data['weights']['highest']); + } else { + foreach ($data['zones'] as $key => $zone) { + $this->testAllowedZone($this->getCountryCode($data, $key), $data['weights']['lowest'], $data['weights']['highest']); + $this->testNotAllowedZones($this->getNotAllowedCountryCode($data, $key), $data['weights']['lowest'], $data['weights']['highest']); + } + } + } + + /** + * Test each allowed zones set, for the maximum and minimum + * weight and prices. + * + * @param string $zone + * @param string $lowest + * @param string $highest + */ + protected function testAllowedZone($zone, $lowest, $highest) + { + $this->testWeight(floatval($lowest['price']), floatval($lowest['weight']), $zone, $this->getCartTotal($lowest)); + $this->testWeight(floatval($highest['price']), floatval($highest['weight']), $zone, $this->getCartTotal($highest)); + } + + /** + * Test each all zones which are not allowed for the maximum and + * minimum weight and prices. + * + * @param string $zone + * @param array $lowest + * @param array $highest + * @param float $cartTotal + */ + protected function testNotAllowedZones($zone, $lowest, $highest, $cartTotal = 1.00) + { + $this->assertNull( + $this->_model->getCost( + $this->_getRateRequest( + $lowest['weight'], + $cartTotal, + $zone + ) + ) + ); + $this->assertNull( + $this->_model->getCost( + $this->_getRateRequest( + $highest['weight'], + $cartTotal, + $zone + ) + ) + ); + } + + /** + * Test that the price is correct based on country code and weight. + * + * @param mixed $price + * @param float $weight + * @param string $zone + * @param float $cartTotal + */ + protected function testWeight($price, $weight, $zone, $cartTotal = 1.00) + { + $this->assertEquals( + $price, + $this->_model->getCost( + $this->_getRateRequest( + $weight, + $cartTotal, + $zone + ) + ) + ); + } + + /** + * Get the Country Code from Zone. + * + * @param $data + * @param null|string $key + * + * @return string + */ + protected function getCountryCode($data, $key = null) + { + if (isset($data['country_code'])) { + if (is_array($data['country_code'])) { + return $data['country_code'][$key]; + } else { + return $data['country_code']; + } + } + + if (is_array($data['zones'])) { + return $this->_countryCodes[$data['zones'][$key]]; + } else { + return $this->_countryCodes[$data['zones']]; + } + + } + + /** + * Get the total price of the cart. + * + * @param $data + * @return float + */ + protected function getCartTotal($data) + { + if (isset($data['cart_total'])) { + return $data['cart_total']; + } else { + return 1.00; + } + } + + /** + * Get a country code that isn't aloud for the method. + * + * @param array $data + * @param null|string $key + * + * @return string + */ + protected function getNotAllowedCountryCode($data, $key = null) + { + if(isset($data['not_allowed_zone'])) { + $data['zone'] = $data['not_allowed_zone']; + return $this->getCountryCode($data, $key); + } + $code = $this->getCountryCode($data, $key); + if($code == 'GB') { + return $this->_countryCodes[Meanbee_Royalmail_Helper_Data::WORLD_ZONE_NONEU]; + } else { + return $this->_countryCodes[Meanbee_Royalmail_Helper_Data::WORLD_ZONE_GB]; + } + } + +} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules/providers/runTests.yaml b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules/providers/runTests.yaml new file mode 100644 index 0000000..2414ba4 --- /dev/null +++ b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Rules/providers/runTests.yaml @@ -0,0 +1,132 @@ +- + model_alias: letter + data: { csv: letter, weights: { lowest: { weight: '100', price: "0.63" }, highest: { weight: '100', price: "0.63" } }, zones: gb } +- + model_alias: largeletter + data: { csv: largeletter, weights: { lowest: { weight: '250', price: '1.26' }, highest: { weight: '750', price: '2.42' } }, zones: gb } +- + model_alias: firstclasslettersignedfor + data: { csv: firstclass_letter_signedfor, weights: { lowest: { weight: '100', price: "1.73" }, highest: { weight: '100', price: "1.73" } }, zones: gb } +- + model_alias: firstclasslargelettersignedfor + data: { csv: firstclass_largeletter_signedfor, weights: { lowest: { weight: '250', price: '2.36' }, highest: { weight: '750', price: '3.52' } }, zones: gb } +- + model_alias: secondclassletter + data: { csv: secondclass_letter, weights: { lowest: { weight: '100', price: "0.54" }, highest: { weight: '100', price: "0.54" } }, zones: gb } +- + model_alias: secondclasslargeletter + data: { csv: secondclass_largeletter, weights: { lowest: { weight: '250', price: '1.19' }, highest: { weight: '750', price: '2.05' } }, zones: gb } +- + model_alias: secondclasslettersignedfor + data: { csv: secondclass_letter_signedfor, weights: { lowest: { weight: '100', price: "1.64" }, highest: { weight: '100', price: "1.64" } }, zones: gb } +- + model_alias: secondclasslargelettersignedfor + data: { csv: secondclass_largeletter_signedfor, weights: { lowest: { weight: '250', price: '2.36' }, highest: { weight: '750', price: '3.52' } }, zones: gb } +- + model_alias: specialdeliverynextday + data: { csv: nextday500, weights: { lowest: { weight: '500', price: '7.25' }, highest: { weight: '20000', price: '41.20' } }, zones: gb } +- + model_alias: specialdeliverynextday + data: { csv: nextday1000, weights: { lowest: { weight: '500', price: '8.25', cart_total: '999' }, highest: { weight: '20000', price: '41.20', cart_total: '999' } }, zones: gb } +- + model_alias: specialdeliverynextday + data: { csv: nextday2500, weights: { lowest: { weight: '500', price: '10.25', cart_total: '2499' }, highest: { weight: '20000', price: '44.20', cart_total: '2499' } }, zones: gb } +- + model_alias: specialdelivery9am + data: { csv: 9am50, weights: { lowest: { weight: '500', price: '20.76' }, highest: { weight: '2000', price: '26.94' } }, zones: gb } +- + model_alias: specialdelivery9am + data: { csv: 9am1000, weights: { lowest: { weight: '500', price: '22.96', cart_total: '999' }, highest: { weight: '2000', price: '29.14', cart_total: '999' } }, zones: gb } +- + model_alias: specialdelivery9am + data: { csv: 9am2500, weights: { lowest: { weight: '500', price: '26.46', cart_total: '2499' }, highest: { weight: '2000', price: '32.64', cart_total: '2499' } }, zones: gb } +- + model_alias: specialdelivery9amsaturday + data: { csv: 9am50saturday, weights: { lowest: { weight: '500', price: '23.76' }, highest: { weight: '2000', price: '29.94' } }, zones: gb } +- + model_alias: specialdelivery9amsaturday + data: { csv: 9am1000saturday, weights: { lowest: { weight: '500', price: '25.96', cart_total: '999' }, highest: { weight: '2000', price: '32.14', cart_total: '999' } }, zones: gb } +- + model_alias: specialdelivery9amsaturday + data: { csv: 9am2500saturday, weights: { lowest: { weight: '500', price: '29.46', cart_total: '2499' }, highest: { weight: '2000', price: '35.64', cart_total: '2499' } }, zones: gb } +- + model_alias: specialdeliverynextdaysaturday + data: { csv: nextday500saturday, weights: { lowest: { weight: '500', price: '11.70' }, highest: { weight: '20000', price: '52.44' } }, zones: gb } +- + model_alias: specialdeliverynextdaysaturday + data: { csv: nextday1000saturday, weights: { lowest: { weight: '500', price: '12.90', cart_total: '999' }, highest: { weight: '20000', price: '53.64', cart_total: '999' } }, zones: gb } +- + model_alias: specialdeliverynextdaysaturday + data: { csv: nextday2500saturday, weights: { lowest: { weight: '500', price: '15.18', cart_total: '2499' }, highest: { weight: '20000', price: '56.04', cart_total: '2499' } }, zones: gb } +- + model_alias: internationalstandard + data: { csv: internationalstandard_europe, weights: { lowest: { weight: '250', price: '3.95' }, highest: { weight: '2000', price: '13.46' } }, zones: eu } +- + model_alias: internationalstandard + data: { csv: internationalstandard_wz1, weights: { lowest: { weight: '250', price: '5.00' }, highest: { weight: '2000', price: '19.75' } }, zones: wz1 } +- + model_alias: internationalstandard + data: { csv: internationalstandard_wz2, weights: { lowest: { weight: '250', price: '5.45' }, highest: { weight: '2000', price: '21.50' } }, zones: wz2 } +- + model_alias: internationaltrackedsigned + data: { csv: internationaltrackedsigned_eu, weights: { lowest: { weight: '250', price: '8.7' }, highest: { weight: '2000', price: '16.96' } }, zones: eu } +- + model_alias: internationaltrackedsigned + data: { csv: internationaltrackedsigned_wz1, weights: { lowest: { weight: '250', price: '9.75' }, highest: { weight: '2000', price: '23.25' } }, zones: wz1 } +- + model_alias: internationaltrackedsigned + data: { csv: internationaltrackedsigned_wz2, weights: { lowest: { weight: '250', price: '10.05' }, highest: { weight: '2000', price: '25.00' } }, zones: wz2, country_code: NZ } +- + model_alias: internationaltracked + data: { csv: internationaltracked_eu, weights: { lowest: { weight: '250', price: '10.44' }, highest: { weight: '2000', price: '20.36' } }, zones: eu } +- + model_alias: internationaltracked + data: { csv: internationaltracked_noneu, weights: { lowest: { weight: '250', price: '8.70' }, highest: { weight: '2000', price: '16.96' } }, zones: noneu, country_code: LI } +- + model_alias: internationaltracked + data: { csv: internationaltracked_wz1, weights: { lowest: { weight: '250', price: '9.75' }, highest: { weight: '2000', price: '23.55' } }, zones: wz1 } +- + model_alias: internationaltracked + data: { csv: internationaltracked_wz2, weights: { lowest: { weight: '250', price: '10.05' }, highest: { weight: '2000', price: '25.00' } }, zones: wz2 } +- + model_alias: internationalsigned + data: { csv: internationalsigned_eu, weights: { lowest: { weight: '250', price: '8.7' }, highest: { weight: '2000', price: '16.96' } }, zones: eu, country_code: CY } +- + model_alias: internationalsigned + data: { csv: internationalsigned_wz1, weights: { lowest: { weight: '250', price: '9.75' }, highest: { weight: '2000', price: '23.25' } }, zones: wz1, country_code: AO } +- + model_alias: internationalsigned + data: { csv: internationalsigned_wz2, weights: { lowest: { weight: '250', price: '10.05' }, highest: { weight: '2000', price: '25.00' } }, zones: wz2 } +- + model_alias: internationaleconomy + data: { csv: internationaleconomy, weights: { lowest: { weight: '250', price: '3.75' }, highest: { weight: '2000', price: '13.26' } }, zones: wz1 } +- + model_alias: internationallettertracked + data: { csv: internationallettertracked_eu, weights: { lowest: { weight: '20', price: '7.20' }, highest: { weight: '100', price: '7.83' } }, zones: eu } +- + model_alias: internationallettertracked + data: { csv: internationallettertracked_noneu, weights: { lowest: { weight: '20', price: null }, highest: { weight: '100', price: null } }, zones: noneu } +- + model_alias: internationallettertracked + data: { csv: internationallettertracked_wz, weights: { lowest: { weight: '20', price: '6.33' }, highest: { weight: '100', price: '7.25' } }, zones: [wz1, wz2] } +- + model_alias: internationallettersigned + data: { csv: internationallettersigned_eu, weights: { lowest: { weight: '20', price: null }, highest: { weight: '100', price: null } }, zones: eu } +- + model_alias: internationallettersigned + data: { csv: internationallettersigned_wz, weights: { lowest: { weight: '20', price: '6.33' }, highest: { weight: '100', price: '7.25' } }, zones: [wz1, wz2], country_code: [TN, NC] } +- + model_alias: internationallettereconomy + data: { csv: internationalltettereconomy, weights: { lowest: { weight: '20', price: '1.33' }, highest: { weight: '100', price: '2.25' } }, zones: [wz1, wz2, eu] } +- + model_alias: internationalletterstandard + data: { csv: internationalletterstandard_eu, weights: { lowest: { weight: '20', price: '1.00' }, highest: { weight: '100', price: '1.52' } }, zones: eu } +- + model_alias: internationalletterstandard + data: { csv: internationalletterstandard_wz, weights: { lowest: { weight: '20', price: '1.33' }, highest: { weight: '100', price: '2.25' } }, zones: [wz1, wz2] } +- + model_alias: internationallettertrackedsigned + data: { csv: internationallettertrackedsigned_eu, weights: { lowest: { weight: '20', price: '1.00' }, highest: { weight: '100', price: '1.52' } }, zones: eu, country_code: AT } +- + model_alias: internationallettertrackedsigned + data: { csv: internationallettertrackedsigned_wz, weights: { lowest: { weight: '60', price: '7.15' }, highest: { weight: '100', price: '8.45' } }, zones: [wz1, wz2], country_code: [CA, CA] } diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php deleted file mode 100644 index 9edd295..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclass.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclass'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 2.8, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 28.55, - $this->_model->getCost( - $this->_getRateRequest( - 20000, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 20001, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargeletter.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargeletter.php deleted file mode 100644 index 1e44139..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargeletter.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclasslargeletter'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 0.73, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 2.01, - $this->_model->getCost( - $this->_getRateRequest( - 750, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 751, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php deleted file mode 100644 index 2845208..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslargelettersignedfor.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclasslargelettersignedfor'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 1.83, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 3.11, - $this->_model->getCost( - $this->_getRateRequest( - 750, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 751, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassletter.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassletter.php deleted file mode 100644 index 3ae1105..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassletter.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclassletter'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 0.53, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 0.53, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 101, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php deleted file mode 100644 index 2fd4b8c..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclasslettersignedfor.php +++ /dev/null @@ -1,61 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclasslettersignedfor'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 1.63, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 1.63, - $this->_model->getCost( - $this->_getRateRequest( - 100, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 101, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php deleted file mode 100644 index 6f51a5e..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Secondclassrecordedsignedfor.php +++ /dev/null @@ -1,64 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_secondclassrecordedsignedfor'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - - - public function testMinimalPrice() { - - $this->assertEquals( - 3.9, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 29.65, - $this->_model->getCost( - $this->_getRateRequest( - 20000, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 20001, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php deleted file mode 100644 index b4d0574..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9am.php +++ /dev/null @@ -1,83 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_specialdelivery9am'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMaximumBasketValue() { - $this->assertNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 2500.01, - 'GB' - ) - ) - ); - - $this->assertNotNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 50.00, - 'GB' - ) - ) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 18.18, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 26.94, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 2001, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php deleted file mode 100644 index 7af989d..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdelivery9amsaturday.php +++ /dev/null @@ -1,83 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_specialdeliverysaturday'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMaximumBasketValue() { - $this->assertNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 2500.01, - 'GB' - ) - ) - ); - - $this->assertNotNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 50.00, - 'GB' - ) - ) - ); - } - - public function testMinimalPrice() { - $this->assertEquals( - 21.18, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 35.64, - $this->_model->getCost( - $this->_getRateRequest( - 2000, - 2500.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 2001, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php deleted file mode 100644 index 87e6990..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextday.php +++ /dev/null @@ -1,83 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_specialdeliverynextday'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMaximumBasketValue() { - $this->assertNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 2500.01, - 'GB' - ) - ) - ); - - $this->assertNotNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 500.00, - 'GB' - ) - ) - ); - } - - public function testLowerLimit() { - $this->assertEquals( - 6.40, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 41.20, - $this->_model->getCost( - $this->_getRateRequest( - 20000, - 1.00, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 20001, - 1.00, - 'GB' - )) - ); - } -} diff --git a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php b/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php deleted file mode 100644 index b98c041..0000000 --- a/app/code/community/Meanbee/Royalmail/Test/Model/Shipping/Carrier/Royalmail/Specialdeliverynextdaysaturday.php +++ /dev/null @@ -1,83 +0,0 @@ -_model = Mage::getModel('royalmail/shipping_carrier_royalmail_specialdeliverynextdaysaturday'); - } - - public function tearDown() { - parent::tearDown(); - - $this->_model = null; - } - - public function testNotAllowedFromFrance() { - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 50, - 1.00, - 'FR' - )) - ); - } - - public function testMaximumBasketValue() { - $this->assertNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 2500.01, - 'GB' - ) - ) - ); - - $this->assertNotNull( - $this->_model->getCost( - $this->_getRateRequest( - 50, - 500.00, - 'GB' - ) - ) - ); - } - - public function testLowerLimit() { - $this->assertEquals( - 10.68, - $this->_model->getCost( - $this->_getRateRequest( - 50, - 1.00, - 'GB' - ) - ) - ); - } - - public function testUpperLimit() { - $this->assertEquals( - 56.04, - $this->_model->getCost( - $this->_getRateRequest( - 20000, - 2500, - 'GB' - ) - ) - ); - - $this->assertNull( - $this->_model->getCost($this->_getRateRequest( - 20001, - 1.00, - 'GB' - )) - ); - } -} From 1d1e4dadd7b887809490bef664cbc7ef9c201113 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Fri, 1 May 2015 12:11:05 +0100 Subject: [PATCH 10/11] MB-75: Remove space which causes test to fail --- .../Meanbee/Royalmail/data/internationaltracked_wz1.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv b/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv index 90320c8..33c8f12 100644 --- a/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv +++ b/app/code/community/Meanbee/Royalmail/data/internationaltracked_wz1.csv @@ -1,5 +1,5 @@ 100,8.80 -250,9.75 +250,9.75 500,12.45 750,14.55 1000,17.20 From 9d770e5eb281082d31817b7583e24f5f5e7c0b18 Mon Sep 17 00:00:00 2001 From: Nathan McBride Date: Wed, 13 May 2015 13:38:00 +0100 Subject: [PATCH 11/11] Bump Version Number --- app/code/community/Meanbee/Royalmail/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Meanbee/Royalmail/etc/config.xml b/app/code/community/Meanbee/Royalmail/etc/config.xml index f035291..fdf4105 100644 --- a/app/code/community/Meanbee/Royalmail/etc/config.xml +++ b/app/code/community/Meanbee/Royalmail/etc/config.xml @@ -22,7 +22,7 @@ - 2.6.3 + 2.6.5