diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php index 59657f38465d7..3d7154eb20f92 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php @@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row) $this->getUrl('adminhtml/*/editGroup', ['group_id' => $row->getGroupId()]) . '">' . $this->escapeHtml($row->getData($this->getColumn()->getIndex())) . - ''; + '
' + . '(' . __('Code') . ': ' . $row->getGroupCode() . ')'; } } diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php index 23b2de683a958..9cfc8bfc52691 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php @@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row) $this->getUrl('adminhtml/*/editStore', ['store_id' => $row->getStoreId()]) . '">' . $this->escapeHtml($row->getData($this->getColumn()->getIndex())) . - ''; + '
' . + '(' . __('Code') . ': ' . $row->getStoreCode() . ')'; } } diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php index 913e2c903d20c..487eb4f8acfda 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php @@ -24,6 +24,7 @@ public function render(\Magento\Framework\DataObject $row) $this->getUrl('adminhtml/*/editWebsite', ['website_id' => $row->getWebsiteId()]) . '">' . $this->escapeHtml($row->getData($this->getColumn()->getIndex())) . - ''; + '
' . + '(' . __('Code') . ': ' . $row->getCode() . ')'; } } diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php index 366cb1c3902a3..317d055d3e481 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php @@ -288,6 +288,7 @@ protected function _prepareIndexTable($entityIds = null) */ protected function _updateIndex($entityIds) { + $this->deleteOldRecords($entityIds); $connection = $this->getConnection(); $select = $this->_getStockStatusSelect($entityIds, true); $select = $this->getQueryProcessorComposite()->processQuery($select, $entityIds, true); @@ -310,7 +311,6 @@ protected function _updateIndex($entityIds) } } - $this->deleteOldRecords($entityIds); $this->_updateIndexTable($data); return $this; diff --git a/app/code/Magento/Store/Model/ResourceModel/Website/Collection.php b/app/code/Magento/Store/Model/ResourceModel/Website/Collection.php index 5b3a74d5d8d39..fb23e842a38e3 100644 --- a/app/code/Magento/Store/Model/ResourceModel/Website/Collection.php +++ b/app/code/Magento/Store/Model/ResourceModel/Website/Collection.php @@ -138,11 +138,11 @@ public function joinGroupAndStore() $this->getSelect()->joinLeft( ['group_table' => $this->getTable('store_group')], 'main_table.website_id = group_table.website_id', - ['group_id' => 'group_id', 'group_title' => 'name'] + ['group_id' => 'group_id', 'group_title' => 'name', 'group_code' => 'code'] )->joinLeft( ['store_table' => $this->getTable('store')], 'group_table.group_id = store_table.group_id', - ['store_id' => 'store_id', 'store_title' => 'name'] + ['store_id' => 'store_id', 'store_title' => 'name', 'store_code' => 'code'] ); $this->addOrder('group_table.name', \Magento\Framework\DB\Select::SQL_ASC) // store name ->addOrder( diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index 3ef39eeab0620..3fed1210e0c8e 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -727,6 +727,9 @@ protected function _getXmlQuotes() if ($this->getConfigFlag('negotiated_active')) { $xmlParams .= ""; } + if ($this->getConfigFlag('include_taxes')) { + $xmlParams .= ""; + } $xmlParams .= << @@ -795,6 +798,8 @@ private function mapCurrencyCode($code) * @param mixed $xmlResponse * @return Result * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @SuppressWarnings(PHPMD.ElseExpression) */ protected function _parseXmlResponse($xmlResponse) { @@ -821,17 +826,45 @@ protected function _parseXmlResponse($xmlResponse) foreach ($arr as $shipElement) { $code = (string)$shipElement->Service->Code; if (in_array($code, $allowedMethods)) { + //The location of tax information is in a different place depending on whether we are using negotiated rates or not if ($negotiatedActive) { - $cost = $shipElement->NegotiatedRates->NetSummaryCharges->GrandTotal->MonetaryValue; + $includeTaxesArr = $xml->getXpath("//RatingServiceSelectionResponse/RatedShipment/NegotiatedRates/NetSummaryCharges/TotalChargesWithTaxes"); + $includeTaxesActive = $this->getConfigFlag( + 'include_taxes' + ) && !empty($includeTaxesArr); + if ($includeTaxesActive) { + $cost = $shipElement->NegotiatedRates->NetSummaryCharges->TotalChargesWithTaxes->MonetaryValue; + $responseCurrencyCode = $this->mapCurrencyCode( + (string)$shipElement->NegotiatedRates->NetSummaryCharges->TotalChargesWithTaxes->CurrencyCode + ); + } + else { + $cost = $shipElement->NegotiatedRates->NetSummaryCharges->GrandTotal->MonetaryValue; + $responseCurrencyCode = $this->mapCurrencyCode( + (string)$shipElement->NegotiatedRates->NetSummaryCharges->GrandTotal->CurrencyCode + ); + } } else { - $cost = $shipElement->TotalCharges->MonetaryValue; + $includeTaxesArr = $xml->getXpath("//RatingServiceSelectionResponse/RatedShipment/TotalChargesWithTaxes"); + $includeTaxesActive = $this->getConfigFlag( + 'include_taxes' + ) && !empty($includeTaxesArr); + if ($includeTaxesActive) { + $cost = $shipElement->TotalChargesWithTaxes->MonetaryValue; + $responseCurrencyCode = $this->mapCurrencyCode( + (string)$shipElement->TotalChargesWithTaxes->CurrencyCode + ); + } + else { + $cost = $shipElement->TotalCharges->MonetaryValue; + $responseCurrencyCode = $this->mapCurrencyCode( + (string)$shipElement->TotalCharges->CurrencyCode + ); + } } //convert price with Origin country currency code to base currency code $successConversion = true; - $responseCurrencyCode = $this->mapCurrencyCode( - (string)$shipElement->TotalCharges->CurrencyCode - ); if ($responseCurrencyCode) { if (in_array($responseCurrencyCode, $allowedCurrencies)) { $cost = (double)$cost * $this->_getBaseCurrencyRate($responseCurrencyCode); diff --git a/app/code/Magento/Ups/Test/Unit/Model/CarrierCollectRatesOptionsTest.php b/app/code/Magento/Ups/Test/Unit/Model/CarrierCollectRatesOptionsTest.php new file mode 100644 index 0000000000000..b184cb2bf4222 --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/CarrierCollectRatesOptionsTest.php @@ -0,0 +1,324 @@ +objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $scopeMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $scopeMock->expects($this->any()) + ->method('getValue') + ->willReturnCallback([$this, 'scopeConfigGetValue']); + $scopeMock->expects($this->any()) + ->method('isSetFlag') + ->willReturnCallback([$this, 'scopeConfigisSetFlag']); + + $errorFactoryMock = $this->getMockBuilder(RateResultErrorFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $loggerInterfaceMock = $this->getMockBuilder(LoggerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $securityMock = $this->getMockBuilder(Security::class) + ->disableOriginalConstructor() + ->getMock(); + + $elementFactoryMock = $this->getMockBuilder(ElementFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $rateResultMock = $this->getMockBuilder(RateResult::class) + ->disableOriginalConstructor() + ->setMethods(['getError']) + ->getMock(); + + $rateFactoryMock = $this->getMockBuilder(RateResultFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $rateFactoryMock->expects($this->any()) + ->method('create') + ->willReturn($rateResultMock); + + $priceInterfaceMock = $this->getMockBuilder(PriceCurrencyInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $rateMethodMock = $this->getMockBuilder(Method::class) + ->setConstructorArgs(['priceCurrency' => $priceInterfaceMock]) + ->setMethods(null) + ->getMock(); + + $methodFactoryMock = $this->getMockBuilder(MethodFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $methodFactoryMock->expects($this->any()) + ->method('create') + ->willReturn($rateMethodMock); + + $resultFactoryMock = $this->getMockBuilder(TrackResultFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $trErrorFactoryMock = $this->getMockBuilder(TrackingResultErrorFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $statusFactoryMock = $this->getMockBuilder(StatusFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $regionFactoryMock = $this->getMockBuilder(RegionFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $countryMock = $this->getMockBuilder(Country::class) + ->disableOriginalConstructor() + ->setMethods(['load', 'getData']) + ->getMock(); + + $countryMock->expects($this->any()) + ->method('load') + ->willReturnSelf(); + + $countryFactoryMock = $this->getMockBuilder(CountryFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $countryFactoryMock->expects($this->any()) + ->method('create') + ->willReturn($countryMock); + + $allowCurrencies = ['GBP']; + $baseCurrencies = ['GBP']; + $currencyRates = ['GBP' => ['GBP' => 1]]; + $currencyFactoryMock = $this->getMockBuilder(CurrencyFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $currencyMock = $this->getMockBuilder(Currency::class) + ->disableOriginalConstructor() + ->setMethods(['getConfigAllowCurrencies', 'getConfigBaseCurrencies', 'getCurrencyRates']) + ->getMock(); + $currencyFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($currencyMock); + $currencyMock->expects($this->any()) + ->method('getConfigAllowCurrencies') + ->willReturn($allowCurrencies); + $currencyMock->expects($this->any()) + ->method('getConfigBaseCurrencies') + ->willReturn($baseCurrencies); + $currencyMock->expects($this->any()) + ->method('getCurrencyRates') + ->with($baseCurrencies, $allowCurrencies) + ->willReturn($currencyRates); + + $dataMock = $this->getMockBuilder(Data::class) + ->disableOriginalConstructor() + ->getMock(); + + $stockRegistryMock = $this->getMockBuilder(StockRegistry::class) + ->disableOriginalConstructor() + ->getMock(); + + $formatInterfaceMock = $this->getMockBuilder(FormatInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $configHelperMock = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->model = $this->getMockBuilder(Carrier::class) + ->setMethods(['_getCachedQuotes', 'canCollectRates', '_updateFreeMethodQuote', '_getBaseCurrencyRate']) + ->setConstructorArgs( + [ + 'scopeConfig' => $scopeMock, + 'rateErrorFactory' => $errorFactoryMock, + 'logger' => $loggerInterfaceMock, + 'xmlSecurity' => $securityMock, + 'xmlElFactory' => $elementFactoryMock, + 'rateFactory' => $rateFactoryMock, + 'rateMethodFactory' => $methodFactoryMock, + 'trackFactory' => $resultFactoryMock, + 'trackErrorFactory' => $trErrorFactoryMock, + 'trackStatusFactory' => $statusFactoryMock, + 'regionFactory' => $regionFactoryMock, + 'countryFactory' => $countryFactoryMock, + 'currencyFactory' => $currencyFactoryMock, + 'directoryData' => $dataMock, + 'stockRegistry' => $stockRegistryMock, + 'localeFormat' => $formatInterfaceMock, + 'configHelper' => $configHelperMock, + 'httpClientFactory' => $this->createMock(\Magento\Framework\HTTP\ClientFactory::class), + 'data' => [], + ] + ) + ->getMock(); + + $this->model->expects($this->any()) + ->method('canCollectRates') + ->willReturn(true); + + $this->model->expects($this->any()) + ->method('_getBaseCurrencyRate') + ->willReturn(1.00); + + $this->rateRequest = $this->objectManager->getObject(RateRequest::class); + } + + /** + * Callback function, emulates getValue function + * @param $path + * @return null|string + */ + public function scopeConfigGetValue($path) + { + $pathMap = [ + 'carriers/ups/type' => 'UPS_XML', + 'carriers/ups/shipper_number' => '12345', + 'carriers/ups/allowed_methods' => $this->allowed_methods, + ]; + + return isset($pathMap[$path]) ? $pathMap[$path] : null; + } + + /** + * Callback function, emulates isSetFlag function + * @param $path + * @return bool + */ + public function scopeConfigisSetFlag($path) + { + $pathMap = [ + 'carriers/ups/negotiated_active' => $this->negotiatedactive, + 'carriers/ups/include_taxes' => $this->include_taxes, + ]; + + if (isset($pathMap[$path])) { + if ($pathMap[$path]) { + return(true); + } + } + return(false); + } + + /** + * @param int $neg + * @param int $tax + * @param string $file + * @param string $method + * @param float $expectedprice + * @dataProvider collectRatesDataProvider + */ + public function testCollectRates($neg, $tax, $file, $method, $expectedprice) + { + $this->negotiatedactive = $neg; + $this->include_taxes = $tax; + $this->allowed_methods = $method; + + $response = file_get_contents(__DIR__ . $file); + $this->model->expects($this->any()) + ->method('_getCachedQuotes') + ->willReturn($response); + + $rates = $this->model->collectRates($this->rateRequest)->getAllRates(); + $this->assertEquals($expectedprice, $rates[0]->getData('cost')); + $this->assertEquals($method, $rates[0]->getData('method')); + } + + /** + * Get list of rates variations + * @return array + */ + public function collectRatesDataProvider() + { + return [ + [0, 0, '/_files/ups_rates_response_option1.xml', '11', 6.45 ], + [0, 0, '/_files/ups_rates_response_option2.xml', '65', 29.59 ], + [0, 1, '/_files/ups_rates_response_option3.xml', '11', 7.74 ], + [0, 1, '/_files/ups_rates_response_option4.xml', '65', 29.59 ], + [1, 0, '/_files/ups_rates_response_option5.xml', '11', 9.35 ], + [1, 0, '/_files/ups_rates_response_option6.xml', '65', 41.61 ], + [1, 1, '/_files/ups_rates_response_option7.xml', '11', 11.22 ], + [1, 1, '/_files/ups_rates_response_option8.xml', '65', 41.61 ], + ]; + } +} diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option1.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option1.xml new file mode 100644 index 0000000000000..658bf756aacfb --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option1.xml @@ -0,0 +1,164 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 11 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 6.45 + + + GBP + 0.00 + + + GBP + 6.45 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 10.25 + + + GBP + 0.00 + + + GBP + 10.25 + + 1 + 12:00 Noon + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 15.02 + + + GBP + 0.00 + + + GBP + 15.02 + + 1 + 9:00 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option2.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option2.xml new file mode 100644 index 0000000000000..88fe2de81a3de --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option2.xml @@ -0,0 +1,213 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 07 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 35.16 + + + GBP + 0.00 + + + GBP + 35.16 + + 1 + 10:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 08 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 34.15 + + + GBP + 0.00 + + + GBP + 34.15 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 29.59 + + + GBP + 0.00 + + + GBP + 29.59 + + 1 + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 45.18 + + + GBP + 0.00 + + + GBP + 45.18 + + 1 + 8:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option3.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option3.xml new file mode 100644 index 0000000000000..1732594c57ea6 --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option3.xml @@ -0,0 +1,209 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 01 + Taxes are included in the shipping cost and apply to the transportation charges + but additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 11 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 6.45 + + + GBP + 0.00 + + + VAT + 1.29 + + + GBP + 6.45 + + + GBP + 7.74 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 01 + Taxes are included in the shipping cost and apply to the transportation charges + but additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 10.25 + + + GBP + 0.00 + + + VAT + 2.05 + + + GBP + 10.25 + + + GBP + 12.30 + + 1 + 12:00 Noon + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 01 + Taxes are included in the shipping cost and apply to the transportation charges + but additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 15.02 + + + GBP + 0.00 + + + VAT + 3.00 + + + GBP + 15.02 + + + GBP + 18.02 + + 1 + 9:00 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option4.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option4.xml new file mode 100644 index 0000000000000..8de6b45982767 --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option4.xml @@ -0,0 +1,237 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 07 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 35.16 + + + GBP + 0.00 + + + GBP + 35.16 + + 1 + 10:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 08 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 34.15 + + + GBP + 0.00 + + + GBP + 34.15 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 29.59 + + + GBP + 0.00 + + + GBP + 29.59 + + 1 + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 45.18 + + + GBP + 0.00 + + + GBP + 45.18 + + 1 + 8:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option5.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option5.xml new file mode 100644 index 0000000000000..7b8b3a906781f --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option5.xml @@ -0,0 +1,188 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 11 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 6.45 + + + GBP + 0.00 + + + GBP + 6.45 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 9.35 + + + + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 10.25 + + + GBP + 0.00 + + + GBP + 10.25 + + 1 + 12:00 Noon + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 13.33 + + + + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 15.02 + + + GBP + 0.00 + + + GBP + 15.02 + + 1 + 9:00 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 74.83 + + + + + diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option6.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option6.xml new file mode 100644 index 0000000000000..97a19e5086d7a --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option6.xml @@ -0,0 +1,245 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 07 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 35.16 + + + GBP + 0.00 + + + GBP + 35.16 + + 1 + 10:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 44.37 + + + + + + + 08 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 34.15 + + + GBP + 0.00 + + + GBP + 34.15 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 60.57 + + + + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 29.59 + + + GBP + 0.00 + + + GBP + 29.59 + + 1 + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 41.61 + + + + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 45.18 + + + GBP + 0.00 + + + GBP + 45.18 + + 1 + 8:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 157.47 + + + + + diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option7.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option7.xml new file mode 100644 index 0000000000000..e84e3aa7aefb0 --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option7.xml @@ -0,0 +1,233 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 01 + Taxes are included in the shipping cost and apply to the transportation charges + but additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 11 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 6.45 + + + GBP + 0.00 + + + GBP + 6.45 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + VAT + 1.87 + + + + GBP + 9.35 + + + GBP + 11.22 + + + + + + + 01 + Taxes are included in the shipping cost and apply to the transportation charges + but additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 10.25 + + + GBP + 0.00 + + + GBP + 10.25 + + 1 + 12:00 Noon + + + + + + + + + + + + + + 2.0 + + + + + + + + + + VAT + 2.66 + + + + GBP + 13.33 + + + GBP + 15.99 + + + + + + + 01 + Taxes are included in the shipping cost and apply to the transportation charges + but additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 15.02 + + + GBP + 0.00 + + + GBP + 15.02 + + 1 + 9:00 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + VAT + 14.97 + + + + GBP + 74.83 + + + GBP + 89.80 + + + + + diff --git a/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option8.xml b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option8.xml new file mode 100644 index 0000000000000..b5711f9f12bfa --- /dev/null +++ b/app/code/Magento/Ups/Test/Unit/Model/_files/ups_rates_response_option8.xml @@ -0,0 +1,269 @@ + + + + + + Rating and Service + 1.0 + + 1 + Success + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 07 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 35.16 + + + GBP + 0.00 + + + GBP + 35.16 + + 1 + 10:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 44.37 + + + + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 08 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 34.15 + + + GBP + 0.00 + + + GBP + 34.15 + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 60.57 + + + + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 65 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 29.59 + + + GBP + 0.00 + + + GBP + 29.59 + + 1 + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 41.61 + + + + + + + 03 + Additional duties/taxes may apply and are not reflected in the total amount + due. + + + + 54 + + Your invoice may vary from the displayed reference + rates + + + + KGS + + 2.0 + + + GBP + 45.18 + + + GBP + 0.00 + + + GBP + 45.18 + + 1 + 8:30 A.M. + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + GBP + 157.47 + + + + + diff --git a/app/code/Magento/Ups/etc/adminhtml/system.xml b/app/code/Magento/Ups/etc/adminhtml/system.xml index 255039e6499cc..07bfaeea6337a 100644 --- a/app/code/Magento/Ups/etc/adminhtml/system.xml +++ b/app/code/Magento/Ups/etc/adminhtml/system.xml @@ -118,6 +118,11 @@ Magento\Config\Model\Config\Source\Yesno + + + Magento\Config\Model\Config\Source\Yesno + When applicable, taxes (sales tax, VAT etc.) are included in the rate + Required for negotiated rates; 6-character UPS diff --git a/app/code/Magento/Ups/etc/config.xml b/app/code/Magento/Ups/etc/config.xml index 7dd47b6bf673b..0f92ae4dad195 100644 --- a/app/code/Magento/Ups/etc/config.xml +++ b/app/code/Magento/Ups/etc/config.xml @@ -35,6 +35,7 @@ F O 0 + 0 1 UPS 0 diff --git a/app/code/Magento/Ups/i18n/en_US.csv b/app/code/Magento/Ups/i18n/en_US.csv index 0412a993b00ef..baf8ecc855440 100644 --- a/app/code/Magento/Ups/i18n/en_US.csv +++ b/app/code/Magento/Ups/i18n/en_US.csv @@ -103,6 +103,8 @@ Title,Title "Weight Unit","Weight Unit" "User ID","User ID" "Enable Negotiated Rates","Enable Negotiated Rates" +"Request Tax-Inclusive Rate","Request Tax-Inclusive Rate" +"When applicable, taxes (sales tax, VAT etc.) are included in the rate","When applicable, taxes (sales tax, VAT etc.) are included in the rate" "Shipper Number","Shipper Number" "Required for negotiated rates; 6-character UPS","Required for negotiated rates; 6-character UPS" "Ship to Applicable Countries","Ship to Applicable Countries" diff --git a/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml b/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml index 388727f1e0d65..411bec20cde57 100644 --- a/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml +++ b/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml @@ -81,7 +81,7 @@ require(["prototype"], function(){ this.onlyUpsXmlElements = ['carriers_ups_gateway_xml_url','carriers_ups_tracking_xml_url', 'carriers_ups_username','carriers_ups_password','carriers_ups_access_license_number', 'carriers_ups_origin_shipment','carriers_ups_negotiated_active','carriers_ups_shipper_number', - 'carriers_ups_mode_xml']; + 'carriers_ups_mode_xml','carriers_ups_include_taxes']; this.onlyUpsElements = ['carriers_ups_gateway_url']; this.storedOriginShipment = '';