From 8534b4fc9f5a26e378b09d091ca013a85730fc87 Mon Sep 17 00:00:00 2001 From: Mihai Ardeleanu Date: Tue, 24 Nov 2020 20:14:29 +0200 Subject: [PATCH] EAD-141: Update Romcity --- Api/Quote/Data/EstimateAddressInterface.php | 37 ----- ...GuestShippingMethodManagementInterface.php | 25 --- .../ShippingMethodManagementInterface.php | 25 --- Block/Checkout/CityUpdater.php | 14 -- Model/Quote/Cart/CartTotalManagement.php | 36 ----- Model/Quote/EstimateAddress.php | 33 ---- .../GuestShippingMethodManagement.php | 52 ------ Model/Quote/ShippingMethodManagement.php | 66 -------- Setup/InstallSchema.php | 60 ------- etc/webapi.xml | 53 ------ .../action/create-shipping-address-mixin.js | 25 --- .../action/set-billing-information-mixin.js | 20 --- .../set-shipping-information-customer.js | 81 ---------- .../action/set-shipping-information-mixin.js | 20 --- view/frontend/web/js/form/element/region.js | 97 ----------- .../shipping-rate-processor/new-address.js | 87 ---------- .../model/shipping-rates-validation-rules.js | 25 --- .../web/js/model/shipping-rates-validator.js | 27 ---- view/frontend/web/js/view/billing-address.js | 152 ----------------- .../checkout/validators/billing-validator.js | 11 -- .../checkout/validators/shipping-validator.js | 21 --- .../web/js/view/payment/default-mixin.js | 50 ------ .../view/shipping-information/list-mixin.js | 39 ----- view/frontend/web/js/view/shipping.js | 153 ------------------ .../frontend/web/js/view/urgent-validation.js | 22 --- 25 files changed, 1231 deletions(-) delete mode 100644 Api/Quote/Data/EstimateAddressInterface.php delete mode 100644 Api/Quote/GuestShippingMethodManagementInterface.php delete mode 100644 Api/Quote/ShippingMethodManagementInterface.php delete mode 100644 Block/Checkout/CityUpdater.php delete mode 100644 Model/Quote/Cart/CartTotalManagement.php delete mode 100644 Model/Quote/EstimateAddress.php delete mode 100644 Model/Quote/GuestCart/GuestShippingMethodManagement.php delete mode 100644 Model/Quote/ShippingMethodManagement.php delete mode 100644 Setup/InstallSchema.php delete mode 100644 etc/webapi.xml delete mode 100644 view/frontend/web/js/action/create-shipping-address-mixin.js delete mode 100644 view/frontend/web/js/action/set-billing-information-mixin.js delete mode 100644 view/frontend/web/js/action/set-shipping-information-customer.js delete mode 100644 view/frontend/web/js/action/set-shipping-information-mixin.js delete mode 100644 view/frontend/web/js/form/element/region.js delete mode 100644 view/frontend/web/js/model/shipping-rate-processor/new-address.js delete mode 100644 view/frontend/web/js/model/shipping-rates-validation-rules.js delete mode 100644 view/frontend/web/js/model/shipping-rates-validator.js delete mode 100644 view/frontend/web/js/view/billing-address.js delete mode 100644 view/frontend/web/js/view/checkout/validators/billing-validator.js delete mode 100644 view/frontend/web/js/view/checkout/validators/shipping-validator.js delete mode 100644 view/frontend/web/js/view/payment/default-mixin.js delete mode 100644 view/frontend/web/js/view/shipping-information/list-mixin.js delete mode 100644 view/frontend/web/js/view/shipping.js delete mode 100644 view/frontend/web/js/view/urgent-validation.js diff --git a/Api/Quote/Data/EstimateAddressInterface.php b/Api/Quote/Data/EstimateAddressInterface.php deleted file mode 100644 index 994355a..0000000 --- a/Api/Quote/Data/EstimateAddressInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -shippingMethodManagement = $shippingMethodManagement; - $this->paymentMethodManagement = $paymentMethodManagement; - $this->cartTotalsRepository = $cartTotalsRepository; - $this->dataProcessor = $dataProcessor; - } -} \ No newline at end of file diff --git a/Model/Quote/EstimateAddress.php b/Model/Quote/EstimateAddress.php deleted file mode 100644 index f666585..0000000 --- a/Model/Quote/EstimateAddress.php +++ /dev/null @@ -1,33 +0,0 @@ -getData(self::KEY_CITY); - } - - /** - * Set city - * - * @param string $city - * @return $this - */ - public function setCity($city) - { - return $this->setData(self::KEY_CITY, $city); - } -} \ No newline at end of file diff --git a/Model/Quote/GuestCart/GuestShippingMethodManagement.php b/Model/Quote/GuestCart/GuestShippingMethodManagement.php deleted file mode 100644 index 1ff9a20..0000000 --- a/Model/Quote/GuestCart/GuestShippingMethodManagement.php +++ /dev/null @@ -1,52 +0,0 @@ -shippingMethodManagement = $shippingMethodManagement; - $this->quoteIdMaskFactory = $quoteIdMaskFactory; - } - - /** - * {@inheritDoc} - */ - public function estimateRatesByAddress($cartId, EstimateAddressInterface $address) - { - /** @var $quoteIdMask QuoteIdMask */ - $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->shippingMethodManagement->estimateRatesByAddress($quoteIdMask->getQuoteId(), $address); - } -} \ No newline at end of file diff --git a/Model/Quote/ShippingMethodManagement.php b/Model/Quote/ShippingMethodManagement.php deleted file mode 100644 index a9ad9d7..0000000 --- a/Model/Quote/ShippingMethodManagement.php +++ /dev/null @@ -1,66 +0,0 @@ -quoteRepository->getActive($cartId); - - // no methods applicable for empty carts or carts with virtual products - if ($quote->isVirtual() || 0 == $quote->getItemsCount()) { - return []; - } - - $quote->getShippingAddress()->setCity($address->getCity()); - - return $this->getEstimatedRates( - $quote, - $address->getCountryId(), - $address->getPostcode(), - $address->getRegionId(), - $address->getRegion() - ); - } - - /** - * {@inheritDoc} - */ - public function estimateRatesByAddressId($cartId, $addressId) - { - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->quoteRepository->getActive($cartId); - - // no methods applicable for empty carts or carts with virtual products - if ($quote->isVirtual() || 0 == $quote->getItemsCount()) { - return []; - } - $address = $this->addressRepository->getById($addressId); - - $quote->getShippingAddress()->setCity($address->getCity()); - - return $this->getEstimatedRates( - $quote, - $address->getCountryId(), - $address->getPostcode(), - $address->getRegionId(), - $address->getRegion() - ); - } -} \ No newline at end of file diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php deleted file mode 100644 index 996ab07..0000000 --- a/Setup/InstallSchema.php +++ /dev/null @@ -1,60 +0,0 @@ -startSetup(); - - $romCityTable = $setup->getTable(self::TABLE); - - if (!$setup->tableExists($romCityTable)) { - $table = $setup->getConnection()->newTable( - $setup->getTable(self::TABLE) - )->addColumn( - RomCityInterface::ENTITY_ID, - Table::TYPE_SMALLINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'City Id' - )->addColumn( - RomCityInterface::REGION_ID, - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Region Id' - )->addColumn( - RomCityInterface::CITY_NAME, - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'City Name' - ); - $setup->getConnection()->createTable($table); - } - - $setup->endSetup(); - } -} \ No newline at end of file diff --git a/etc/webapi.xml b/etc/webapi.xml deleted file mode 100644 index 88bcd0b..0000000 --- a/etc/webapi.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/view/frontend/web/js/action/create-shipping-address-mixin.js b/view/frontend/web/js/action/create-shipping-address-mixin.js deleted file mode 100644 index bd27247..0000000 --- a/view/frontend/web/js/action/create-shipping-address-mixin.js +++ /dev/null @@ -1,25 +0,0 @@ -define([ - 'jquery', - 'mage/utils/wrapper', - 'Magento_Checkout/js/model/quote' -], function ($, wrapper, quote) { - 'use strict'; - - return function (setShippingInformationAction) { - - - return wrapper.wrap(setShippingInformationAction, function (originalAction, messageContainer) { - var address = quote.shippingAddress(); - - if (address !== null) { - var region = $("#shipping-new-address-form [name = 'region_id'] option:selected").text(), - city = $("#shipping-new-address-form [name = 'city_id'] option:selected").text(); - - address.region = region; - address.city = city; - } - - return originalAction(messageContainer); - }); - }; -}); \ No newline at end of file diff --git a/view/frontend/web/js/action/set-billing-information-mixin.js b/view/frontend/web/js/action/set-billing-information-mixin.js deleted file mode 100644 index ce08c34..0000000 --- a/view/frontend/web/js/action/set-billing-information-mixin.js +++ /dev/null @@ -1,20 +0,0 @@ -define([ - 'jquery', - 'mage/utils/wrapper', - 'Magento_Checkout/js/model/quote', -], function ($, wrapper, quote) { - 'use strict'; - - return function (setBillingAddressAction) { - return wrapper.wrap(setBillingAddressAction, function (originalAction, messageContainer) { - var billingAddress = quote.billingAddress(), - shippingAddress = quote.shippingAddress(), - shippingCityId = $("#shipping-new-address-form [name = 'city_id'] option:selected"), - shippingCityIdValue = shippingCityId.text(); - - shippingAddress.city = shippingCityIdValue; - - return originalAction(messageContainer); - }); - }; -}); \ No newline at end of file diff --git a/view/frontend/web/js/action/set-shipping-information-customer.js b/view/frontend/web/js/action/set-shipping-information-customer.js deleted file mode 100644 index 3d54c77..0000000 --- a/view/frontend/web/js/action/set-shipping-information-customer.js +++ /dev/null @@ -1,81 +0,0 @@ -define([ - 'jquery', - 'mage/utils/wrapper', - 'mage/template', - 'mage/validation', - 'underscore', - 'jquery/ui' -], function ($, wrapper) { - 'use strict'; - - return function (setShippingInformationAction) { - - - var string = JSON.stringify($eaCitiesJson), - obj = JSON.parse(string), - romanianRegions = obj.RO, - initialcity = $("[name='city']"), - initialInput = initialcity.val(''); - - $(document).on('change', "[name='region_id']", function () { - - var regionId = $(this).val(), - regions = romanianRegions[regionId], - htmlSelect = ''; - - if (regionId) { - - var city = $("[name='city']"), - cityHtml = city.parent().html(), - selectCity = cityHtml.replace("input", "select") + '', - cityObject = $(selectCity), - cityName, - cityOptions, - selectOptions; - - htmlSelect = ''; - - $.each(regions, function (index, value) { - if ($.isPlainObject(value)) { - $.each(value, function (index, cityOptionValue) { - cityName = cityOptionValue.name; - cityOptions = ''; - htmlSelect += cityOptions; - - }); - } - }); - - cityObject.empty(); - selectOptions = cityObject.append(htmlSelect); - - if (regions.cities === undefined) { - return; - } - - if (Object.keys(regions.cities).length !== 0) { - city.replaceWith(selectOptions); - } else { - city.replaceWith(initialInput,"initial input"); - } - } - $(document).on('change', "[name='city']", function () { - - var citySelectedValue= $("[name = 'city'] option:selected").val(); - var cityInputValue = $("[name= 'city']").val(); - cityInputValue= citySelectedValue; - - }); - - }); - - return wrapper.wrap(setShippingInformationAction, function (originalAction, messageContainer) { - return originalAction(messageContainer); - }); - }; -}); - - - - - diff --git a/view/frontend/web/js/action/set-shipping-information-mixin.js b/view/frontend/web/js/action/set-shipping-information-mixin.js deleted file mode 100644 index 4741ce6..0000000 --- a/view/frontend/web/js/action/set-shipping-information-mixin.js +++ /dev/null @@ -1,20 +0,0 @@ -define([ - 'jquery', - 'mage/utils/wrapper', - 'Magento_Checkout/js/model/quote', -], function ($, wrapper, quote, shippingFields) { - 'use strict'; - - return function (setShippingInformationAction) { - return wrapper.wrap(setShippingInformationAction, function (originalAction, messageContainer) { - - var shippingAddress = quote.shippingAddress(), - shippingCityId = $("#shipping-new-address-form [name = 'city_id'] option:selected"), - shippingCityIdValue = shippingCityId.text(); - - shippingAddress.city = shippingCityIdValue; - - return originalAction(messageContainer); - }); - }; -}); \ No newline at end of file diff --git a/view/frontend/web/js/form/element/region.js b/view/frontend/web/js/form/element/region.js deleted file mode 100644 index 144a81e..0000000 --- a/view/frontend/web/js/form/element/region.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * @api - */ -define([ - 'underscore', - 'uiRegistry', - 'Magento_Ui/js/form/element/select', - 'Magento_Checkout/js/model/default-post-code-resolver' -], function (_, registry, Select, defaultPostCodeResolver) { - 'use strict'; - - return Select.extend({ - defaults: { - skipValidation: false, - imports: { - update: '${ $.parentName }.country_id:value' - } - }, - - /** - * @param {String} value - */ - update: function (value) { - var country = registry.get(this.parentName + '.' + 'country_id'), - options = country.indexedOptions, - isRegionRequired, - option; - - - if (!value) { - return; - } - option = options[value]; - - if (typeof option === 'undefined') { - return; - } - - defaultPostCodeResolver.setUseDefaultPostCode(!option['is_zipcode_optional']); - - if (this.skipValidation) { - this.validation['required-entry'] = false; - this.required(false); - } else { - if (option && !option['is_region_required']) { - this.error(false); - this.validation = _.omit(this.validation, 'required-entry'); - } else { - this.validation['required-entry'] = true; - } - - if (option && !this.options().length) { - registry.get(this.customName, function (input) { - isRegionRequired = !!option['is_region_required']; - input.validation['required-entry'] = isRegionRequired; - input.required(isRegionRequired); - }); - } - - this.required(!!option['is_region_required']); - } - }, - - /** - * Filters 'initialOptions' property by 'field' and 'value' passed, - * calls 'setOptions' passing the result to it - * - * @param {*} value - * @param {String} field - */ - filter: function (value, field) { - var country = registry.get(this.parentName + '.' + 'country_id'), - option; - - if (country) { - option = country.indexedOptions[value]; - - this._super(value, field); - - if (option && option['is_region_visible'] === false) { - // hide select and corresponding text input field if region must not be shown for selected country - this.setVisible(false); - - if (this.customEntry) {// eslint-disable-line max-depth - this.toggleInput(false); - } - } - } - } - }); -}); - diff --git a/view/frontend/web/js/model/shipping-rate-processor/new-address.js b/view/frontend/web/js/model/shipping-rate-processor/new-address.js deleted file mode 100644 index cc5987d..0000000 --- a/view/frontend/web/js/model/shipping-rate-processor/new-address.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -/*global alert*/ -define([ - 'jquery', - 'Magento_Checkout/js/model/resource-url-manager', - 'Magento_Checkout/js/model/quote', - 'mage/storage', - 'Magento_Checkout/js/model/shipping-service', - 'Magento_Checkout/js/model/shipping-rate-registry', - 'Magento_Checkout/js/model/error-processor' - -], function ($, resourceUrlManager, quote, storage, shippingService, rateRegistry, errorProcessor) { - 'use strict'; - - return function () { - return { - getRates: function (address) { - var cache, serviceUrl, payload, cityValue , cityId, cityIdOptions, cityInput, - cityInputValue; - - shippingService.isLoading(true); - cache = rateRegistry.get(address.getCacheKey()); - serviceUrl = resourceUrlManager.getUrlForEstimationShippingMethodsForNewAddress(quote); - cityValue = address.city; - cityId = $("[name='city_id'] option:selected"); - cityIdOptions = cityId.text(); - cityInput = $("[name='city']"); - cityInputValue = cityInput.text(); - - - if (cityIdOptions.length > 0) { - - cityValue = cityIdOptions; - - } - else { - cityValue = cityInputValue; - } - - payload = JSON.stringify({ - address: { - 'street': address.street, - 'city': cityValue, - 'region_id': address.regionId, - 'region': address.region, - 'country_id': address.countryId, - 'postcode': address.postcode, - 'email': address.email, - 'customer_id': address.customerId, - 'firstname': address.firstname, - 'lastname': address.lastname, - 'middlename': address.middlename, - 'prefix': address.prefix, - 'suffix': address.suffix, - 'vat_id': address.vatId, - 'company': address.company, - 'telephone': address.telephone, - 'fax': address.fax, - 'custom_attributes': address.customAttributes, - 'save_in_address_book': address.saveInAddressBook - } - } - ); - - if (cache) { - shippingService.setShippingRates(cache); - shippingService.isLoading(false); - } else { - storage.post( - serviceUrl, payload, false - ).done(function (result) { - rateRegistry.set(address.getCacheKey(), result); - shippingService.setShippingRates(result); - }).fail(function (response) { - shippingService.setShippingRates([]); - errorProcessor.process(response); - }).always(function () { - shippingService.isLoading(false); - }); - } - } - }; - }; -}); \ No newline at end of file diff --git a/view/frontend/web/js/model/shipping-rates-validation-rules.js b/view/frontend/web/js/model/shipping-rates-validation-rules.js deleted file mode 100644 index a9b2c4a..0000000 --- a/view/frontend/web/js/model/shipping-rates-validation-rules.js +++ /dev/null @@ -1,25 +0,0 @@ -define(['jquery'], function ($) { - 'use strict'; - - return function (targetFunction) { - targetFunction.getObservableFields = function () { - var self = this, - observableFields = []; - - $.each(self.getRules(), function (carrier, fields) { - $.each(fields, function (field) { - if (observableFields.indexOf(field) === -1) { - observableFields.push(field); - } - }); - }); - - observableFields.push('city_id'); // Load shipping method on City_id changed - observableFields.push('city'); // Load shipping method on City changed - - return observableFields; - }; - - return targetFunction; - }; -}); \ No newline at end of file diff --git a/view/frontend/web/js/model/shipping-rates-validator.js b/view/frontend/web/js/model/shipping-rates-validator.js deleted file mode 100644 index a2fef96..0000000 --- a/view/frontend/web/js/model/shipping-rates-validator.js +++ /dev/null @@ -1,27 +0,0 @@ -define( - [ - 'jquery', - 'mageUtils', - - './shipping-rates-validation-rules', - 'mage/translate' - ], - function ($, utils, validationRules, $t) { - 'use strict'; - return { - validationErrors: [], - validate: function(address) { - // var self = this; - // this.validationErrors = []; - // $.each(validationRules.getRules(), function(field, rule) { - // if (rule.required && utils.isEmpty(address[field])) { - // var message = $t('Field ') + field + $t(' is required.'); - // self.validationErrors.push(message); - // } - // }); - - return !Boolean(this.validationErrors.length); - } - }; - } -); \ No newline at end of file diff --git a/view/frontend/web/js/view/billing-address.js b/view/frontend/web/js/view/billing-address.js deleted file mode 100644 index 9984e9b..0000000 --- a/view/frontend/web/js/view/billing-address.js +++ /dev/null @@ -1,152 +0,0 @@ -define(['jquery', - 'ko', - 'underscore', - 'Magento_Ui/js/form/form', - 'Magento_Customer/js/model/customer', - 'Magento_Customer/js/model/address-list', - 'Magento_Checkout/js/model/quote', - 'Magento_Checkout/js/action/create-billing-address', - 'Magento_Checkout/js/action/select-billing-address', - 'Magento_Checkout/js/checkout-data', - 'Magento_Customer/js/customer-data', - - ], - function ($, - ko, - _, - Component, - customer, - addressList, - quote, - createBillingAddress, - selectBillingAddress, - checkoutData, - customerData - ) { - 'use strict'; - var lastSelectedBillingAddress = null, - newAddressOption = { - /** - * Get new address label - * @returns {String} - */ - getAddressInline: function () { - return $t('New Address'); - }, - customerAddressId: null - }, - countryData = customerData.get('directory-data'), - addressOptions = addressList().filter(function (address) { - return address.getType() == 'customer-address'; //eslint-disable-line eqeqeq - }); - return function (Component) { - return Component.extend({ - initObservable: function () { - this._super() - .observe({ - selectedAddress: null, - isAddressDetailsVisible: quote.billingAddress() != null, - isAddressFormVisible: !customer.isLoggedIn() || addressOptions.length === 1, - isAddressSameAsShipping: false, - saveInAddressBook: 1 - }); - - quote.billingAddress.subscribe(function (newAddress) { - - if(newAddress) { - let shippingCityId = $("#shipping-new-address-form [name = 'city_id'] option:selected"), - shippingCityIdValue = shippingCityId.text(); - let billingAddressCity = $(".billing-address-form form [name='city_id'] option:selected"); - - - if (this.isAddressSameAsShipping()) { - newAddress.city = shippingCityIdValue; - } else if (billingAddressCity) { - newAddress.city = billingAddressCity.text(); - } - else{ - newAddress.city = shippingCityIdValue; - } - if (localStorage.getItem('city_id') && !this.isAddressSameAsShipping()) { - newAddress.city = localStorage.getItem('city_id_value'); - } - } - $(".billing-address-form form [name='city_id']").on('change',function () { - localStorage.setItem('city_id', $('option:selected',this).index()); - localStorage.setItem('city_id_value', $('option:selected',this).text()); - }); - - if (quote.isVirtual()) { - this.isAddressSameAsShipping(false); - } else { - this.isAddressSameAsShipping( - newAddress != null && - newAddress.getCacheKey() == quote.shippingAddress().getCacheKey() //eslint-disable-line eqeqeq - ); - } - - if (newAddress != null && newAddress.saveInAddressBook !== undefined) { - this.saveInAddressBook(newAddress.saveInAddressBook); - } else { - this.saveInAddressBook(1); - } - this.isAddressDetailsVisible(true); - }, this); - - return this; - }, - useShippingAddress: function () { - if (this.isAddressSameAsShipping()) { - selectBillingAddress(quote.shippingAddress()); - this.updateAddresses(); - this.isAddressDetailsVisible(true); - - } else { - lastSelectedBillingAddress = quote.billingAddress(); - quote.billingAddress(null); - this.isAddressDetailsVisible(false); - } - - checkoutData.setSelectedBillingAddress(null); - - - return true; - }, - updateAddress: function () { - var addressData, newBillingAddress, billingCityId, billingCityIdValue; - - if (this.selectedAddress() && this.selectedAddress() != newAddressOption) { //eslint-disable-line eqeqeq - selectBillingAddress(this.selectedAddress()); - checkoutData.setSelectedBillingAddress(this.selectedAddress().getKey()); - } else { - this.source.set('params.invalid', false); - this.source.trigger(this.dataScopePrefix + '.data.validate'); - - if (this.source.get(this.dataScopePrefix + '.custom_attributes')) { - this.source.trigger(this.dataScopePrefix + '.custom_attributes.data.validate'); - } - - if (!this.source.get('params.invalid')) { - addressData = this.source.get(this.dataScopePrefix); - let billingAddressCity = $(".billing-address-form form [name='city_id'] option:selected"); - addressData.city = billingAddressCity.text(); - - if (customer.isLoggedIn() && !this.customerHasAddresses) { //eslint-disable-line max-depth - this.saveInAddressBook(1); - } - addressData['save_in_address_book'] = this.saveInAddressBook() ? 1 : 0; - newBillingAddress = createBillingAddress(addressData); - - // New address must be selected as a billing address - selectBillingAddress(newBillingAddress); - checkoutData.setSelectedBillingAddress(newBillingAddress.getKey()); - checkoutData.setNewCustomerBillingAddress(addressData); - billingCityId = $("#billing-new-address-form [name = 'city_id'] option:selected"), - billingCityIdValue = billingCityId.text(); - } - } - this.updateAddresses(); - }, - }); - } - }); diff --git a/view/frontend/web/js/view/checkout/validators/billing-validator.js b/view/frontend/web/js/view/checkout/validators/billing-validator.js deleted file mode 100644 index 7652b44..0000000 --- a/view/frontend/web/js/view/checkout/validators/billing-validator.js +++ /dev/null @@ -1,11 +0,0 @@ -define( - [ - 'uiComponent', - 'Magento_Checkout/js/model/payment/additional-validators' - ], - function (Component, additionalValidators, billingValidator) { - 'use strict'; - additionalValidators.registerValidator(billingValidator); - return Component.extend({}); - } -); diff --git a/view/frontend/web/js/view/checkout/validators/shipping-validator.js b/view/frontend/web/js/view/checkout/validators/shipping-validator.js deleted file mode 100644 index 683b8be..0000000 --- a/view/frontend/web/js/view/checkout/validators/shipping-validator.js +++ /dev/null @@ -1,21 +0,0 @@ -define( - [ - 'uiComponent', - 'Magento_Checkout/js/model/shipping-rates-validator', - 'Magento_Checkout/js/model/shipping-rates-validation-rules', - '../../../model/shipping/customer-order-validator', - '../../../model/shipping/customer-order-rules' - ], - function ( - Component, - defaultShippingRatesValidator, - defaultShippingRatesValidationRules, - shippingRatesValidator, - shippingRatesValidationRules - ) { - 'use strict'; - defaultShippingRatesValidator.registerValidator('flatrate', shippingRatesValidator); - defaultShippingRatesValidationRules.registerRules('flatrate', shippingRatesValidationRules); - return Component; - } -); \ No newline at end of file diff --git a/view/frontend/web/js/view/payment/default-mixin.js b/view/frontend/web/js/view/payment/default-mixin.js deleted file mode 100644 index 9d18d92..0000000 --- a/view/frontend/web/js/view/payment/default-mixin.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -define([ - 'ko', - 'jquery', - 'uiComponent', - 'Magento_Checkout/js/action/place-order', - 'Magento_Checkout/js/action/select-payment-method', - 'Magento_Checkout/js/model/quote', - 'Magento_Customer/js/model/customer', - 'Magento_Checkout/js/model/payment-service', - 'Magento_Checkout/js/checkout-data', - 'Magento_Checkout/js/model/checkout-data-resolver', - 'uiRegistry', - 'Magento_Checkout/js/model/payment/additional-validators', - 'Magento_Ui/js/model/messages', - 'uiLayout', - 'Magento_Checkout/js/action/redirect-on-success' -], function ( - ko, - $, - Component, - placeOrderAction, - selectPaymentMethodAction, - quote, - customer, - paymentService, - checkoutData, - checkoutDataResolver, - registry, - additionalValidators, - Messages, - layout, - redirectOnSuccessAction -) { - 'use strict'; - - var mixin = { - afterPlaceOrder: function () { - localStorage.removeItem('city_id'); - localStorage.removeItem('city_id_value'); - } - }; - return function (target) { - return target.extend(mixin); - } -}); \ No newline at end of file diff --git a/view/frontend/web/js/view/shipping-information/list-mixin.js b/view/frontend/web/js/view/shipping-information/list-mixin.js deleted file mode 100644 index 594ab5a..0000000 --- a/view/frontend/web/js/view/shipping-information/list-mixin.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -define([ - 'jquery', - 'ko', - 'mageUtils', - 'uiComponent', - 'uiLayout', - 'Magento_Checkout/js/model/quote' -], function ($, ko, utils, Component, layout, quote) { - 'use strict'; - - var mixin = { - initialize: function () { - var self = this; - - this._super() - .initChildren(); - - quote.shippingAddress.subscribe(function (address) { - var shippingCityId = $("#shipping-new-address-form [name = 'city_id'] option:selected"), - shippingCityIdValue = shippingCityId.text(); - if (shippingCityIdValue){ - address.city = shippingCityIdValue; - } - self.createRendererComponent(address); - }); - - return this; - } - } - return function (target) { - return target.extend(mixin); - } - -}); \ No newline at end of file diff --git a/view/frontend/web/js/view/shipping.js b/view/frontend/web/js/view/shipping.js deleted file mode 100644 index 726ea14..0000000 --- a/view/frontend/web/js/view/shipping.js +++ /dev/null @@ -1,153 +0,0 @@ -define(['jquery', - 'underscore', - 'Magento_Ui/js/form/form', - 'ko', - 'Magento_Customer/js/model/customer', - 'Magento_Customer/js/model/address-list', - 'Magento_Checkout/js/model/address-converter', - 'Magento_Checkout/js/model/quote', - 'Magento_Checkout/js/action/create-shipping-address', - 'Magento_Checkout/js/action/select-shipping-address', - 'Magento_Checkout/js/model/shipping-rates-validator', - 'Magento_Checkout/js/model/shipping-address/form-popup-state', - 'Magento_Checkout/js/model/shipping-service', - 'Magento_Checkout/js/action/select-shipping-method', - 'Magento_Checkout/js/model/shipping-rate-registry', - 'Magento_Checkout/js/action/set-shipping-information', - 'Magento_Checkout/js/model/step-navigator', - 'Magento_Ui/js/modal/modal', - 'Magento_Checkout/js/model/checkout-data-resolver', - 'Magento_Checkout/js/checkout-data', - 'uiRegistry', - 'mage/translate', - 'Magento_Checkout/js/model/shipping-rate-service' - - ], - function ($, _, - Component, - ko, - customer, - addressList, - addressConverter, - quote, - createShippingAddress, - selectShippingAddress, - shippingRatesValidator, - formPopUpState, - shippingService, - selectShippingMethodAction, - rateRegistry, - setShippingInformationAction, - stepNavigator, - modal, - checkoutDataResolver, - checkoutData, - registry, - $t) { - 'use strict'; - - return function (Component) { - return Component.extend({ - validateShippingInformation: function () { - var shippingAddress, - addressData, - loginFormSelector = 'form[data-role=email-with-possible-login]', - emailValidationResult = customer.isLoggedIn(), - field; - - if (!quote.shippingMethod()) { - this.errorValidationMessage($t('Please specify a shipping method.')); - - return false; - } - - if (!customer.isLoggedIn()) { - $(loginFormSelector).validation(); - emailValidationResult = Boolean($(loginFormSelector + ' input[name=username]').valid()); - } - - if (this.isFormInline) { - this.source.set('params.invalid', false); - this.triggerShippingDataValidateEvent(); - - if (emailValidationResult && - this.source.get('params.invalid') || - !quote.shippingMethod()['method_code'] || - !quote.shippingMethod()['carrier_code'] - ) { - this.focusInvalid(); - - return false; - } - - shippingAddress = quote.shippingAddress(); - - var shippingCityId = $("#shipping-new-address-form [name = 'city_id'] option:selected"), - shippingCityIdValue = shippingCityId.text(); - - shippingAddress.city = shippingCityIdValue; - - addressData = addressConverter.formAddressDataToQuoteAddress( - this.source.get('shippingAddress') - ); - //Copy form data to quote shipping address object - for (field in addressData) { - if (addressData.hasOwnProperty(field) && //eslint-disable-line max-depth - shippingAddress.hasOwnProperty(field) && - typeof addressData[field] != 'function' && - _.isEqual(shippingAddress[field], addressData[field]) - ) { - shippingAddress[field] = addressData[field]; - } else if (typeof addressData[field] != 'function' && - !_.isEqual(shippingAddress[field], addressData[field])) { - shippingAddress = addressData; - break; - } - } - - if (customer.isLoggedIn()) { - shippingAddress['save_in_address_book'] = 1; - } - selectShippingAddress(shippingAddress); - } - - if (!emailValidationResult) { - $(loginFormSelector + ' input[name=username]').focus(); - - return false; - } - - return true; - }, - saveNewAddress: function () { - var addressData, - newShippingAddress; - - - this.source.set('params.invalid', false); - this.triggerShippingDataValidateEvent(); - - var address = quote.shippingAddress(), - shippingCityId = $("[name = 'city_id'] option:selected"), - shippingCityIdValue = shippingCityId.text(); - - address.city = shippingCityIdValue; - - if (!this.source.get('params.invalid')) { - addressData = this.source.get('shippingAddress'); - // if user clicked the checkbox, its value is true or false. Need to convert. - addressData['save_in_address_book'] = this.saveInAddressBook ? 1 : 0; - - // New address must be selected as a shipping address - newShippingAddress = createShippingAddress(addressData); - selectShippingAddress(newShippingAddress); - checkoutData.setSelectedShippingAddress(newShippingAddress.getKey()); - checkoutData.setNewCustomerShippingAddress($.extend(true, {}, addressData)); - this.getPopUp().closeModal(); - this.isNewAddressAdded(true); - - } - }, - }); - } - }); diff --git a/view/frontend/web/js/view/urgent-validation.js b/view/frontend/web/js/view/urgent-validation.js deleted file mode 100644 index 527b995..0000000 --- a/view/frontend/web/js/view/urgent-validation.js +++ /dev/null @@ -1,22 +0,0 @@ -define( - [ - 'uiComponent', - 'Magento_Checkout/js/model/shipping-rates-validator', - 'Magento_Checkout/js/model/shipping-rates-validation-rules', - '../model/shipping-rates-validator', - '../model/shipping-rates-validation-rules' - ], - function ( - Component, - defaultShippingRatesValidator, - defaultShippingRatesValidationRules, - eadesigndevurgentShippingRatesValidator, - eadesigndevurgentShippingRatesValidationRules - ) { - 'use strict'; - defaultShippingRatesValidator.registerValidator('eadesigndevurgent', eadesigndevurgentShippingRatesValidator); - defaultShippingRatesValidationRules.registerRules('eadesigndevurgent', eadesigndevurgentShippingRatesValidationRules); - return Component; - - } -); \ No newline at end of file