-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
134 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* | ||
* ..::.. | ||
* ..::::::::::::.. | ||
* ::'''''':''::''''':: | ||
* ::.. ..: : ....:: | ||
* :::: ::: : : :: | ||
* :::: ::: : ''' :: | ||
* ::::..:::..::.....:: | ||
* ''::::::::::::'' | ||
* ''::'' | ||
* | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Creative Commons License. | ||
* It is available through the world-wide-web at this URL: | ||
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
* If you are unable to obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. If you wish to customize this module for your | ||
* needs please contact [email protected] for more information. | ||
* | ||
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright | ||
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
*/ | ||
namespace TIG\PostNL\Plugin\Quote\Address; | ||
|
||
class RateRequestPlugin | ||
{ | ||
/** | ||
* When a customer is logged-in and try's to checkout the error is thrown saying 'Please select a shippingmethod' | ||
* This is because of the limitCarrier that is set with 'tig' as value. Later on in the process of the checkout the | ||
* carrier config is requested. Magento will request this like carrier/[carrier_code]. | ||
* | ||
* @param $subject | ||
* @param $key | ||
* @param $value | ||
* | ||
* @return array | ||
*/ | ||
// @codingStandardsIgnoreLine | ||
public function beforeSetData($subject, $key, $value) | ||
{ | ||
if ($key == 'limit_carrier' && $value == 'tig') { | ||
return [$key, 'tig_postnl']; | ||
} | ||
|
||
return [$key, $value]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* ..::.. | ||
* ..::::::::::::.. | ||
* ::'''''':''::''''':: | ||
* ::.. ..: : ....:: | ||
* :::: ::: : : :: | ||
* :::: ::: : ''' :: | ||
* ::::..:::..::.....:: | ||
* ''::::::::::::'' | ||
* ''::'' | ||
* | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Creative Commons License. | ||
* It is available through the world-wide-web at this URL: | ||
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
* If you are unable to obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. If you wish to customize this module for your | ||
* needs please contact [email protected] for more information. | ||
* | ||
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright | ||
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
*/ | ||
namespace TIG\PostNL\Test\Unit\Plugin\Quote\Address; | ||
|
||
use TIG\PostNL\Plugin\Quote\Address\RateRequestPlugin; | ||
use TIG\PostNL\Test\TestCase; | ||
|
||
class RateRequestPluginTest extends TestCase | ||
{ | ||
public $instanceClass = RateRequestPlugin::class; | ||
|
||
public function dataProvider() | ||
{ | ||
return [ | ||
'TIG PostNL Limit Carrier' => [ | ||
'limit_carrier', | ||
'tig', | ||
['limit_carrier','tig_postnl'] | ||
], | ||
'FlatRate Limit Carrier' => [ | ||
'limit_carrier', | ||
'flatrate', | ||
['limit_carrier','flatrate'] | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @param $key | ||
* @param $value | ||
* @param $expected | ||
* | ||
* @dataProvider dataProvider | ||
*/ | ||
public function testBeforeSetData($key, $value, $expected) | ||
{ | ||
$instance = $this->getInstance(); | ||
$result = $instance->beforeSetData(null, $key, $value); | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters