From 623d88f1771ca93cc139517a2fed12ecc9d97735 Mon Sep 17 00:00:00 2001 From: mage2-team Date: Tue, 12 Aug 2014 09:08:14 -0700 Subject: [PATCH] 0.1.0-alpha90 * Service layer implementation: * Created the Admin Shopping Cart Service * Created the Create Shopping Cart Items Service * Created the Create Shopping Cart Shipping Address Service * Created the Create Shopping Cart Billing Address Service * Created the Service Layer for Orders * Created CRUD service & APIs to manage options for configurable products * Created CRUD service & APIs to manage options for bundle products * Fixed bugs: * Fixed an issue where adding a customer address with an invalid value of the custom address attribute caused a fatal error in SOAP * Fixed an issue where the wrong FedEx rates were displayed * Fixed an issue where the Bill Me Later option did not work in Payflow payment methods * Fixed an issue where order comments were broken for orders placed with Authorize.net * Fixed the naming of the My Account -> Recurring Payment page * Fixed a UI elements issue in the disabled Magento_PayPalRecurringPayment and Magento_RecurringPayment modules * Fixed an issue where it was impossible to save configuration of a configurable product when adding it to an order in the Admin panel * Fixed an issue where the Select a store page was displayed during admin order creation when the Single Store mode was enabled * Fixed an issue when an exception was thrown when attempting to open the Customer Account page if the Recently Viewed widget was configured for the store * Updated the content of the Privacy Policy page * Fixed an issue where it was possible to update a tax rate using the POST http method * Fixed an issue where it was impossible to update Inventory Qty for a SKU using API * Fixed a JavaScript syntax error on the Create New Customer page * Fixed an issue where it was impossible to add new sample while creating a downloadable product * Fixed a JavaScript which appeared when clicking the Add New Address button in the Address Book on the storefront * Fixed an issue where it was possible to update Tax Rules using the PUT http method which is supposed to be used for create operation only * Fixed an issue where it was possible to create a Tax Rule specifying a product tax class instead of a customer tax class and vice versa * Fixed an issue with making websiteId a mandatory field when updating a customer using REST * Fixed an issue where the default value was not applied after clicking the 'Use default' link for a product price field in the catalog in the Admin panel * Fixed an issue where the price update mass action could not be performed * Fixed a JS error in the cross-sells product settings in the Admin panel * Added the following functional tests: * Mass Delete Backend Customer * Moderate Product Review * Framework improvements: * Added the ability to access admin functionality using admin user login for mobile * Refactored and unified Access Control List (ACL) to make it more consistent * Created a Cookie Manager (a cookie management class) * Changes in functional tests: * Enabled the CustomerMetadataService tests for SOAP * Themes update: * Fixed issues in the Blank theme * Implemented improvements for the Blank theme, core templates and Storefront UI Library * Modularity: * Created the Notification library component and made it possible to disable the AdminNotification module * Made it possible to disable the SendToFriend module * Created an optional ConfigurableImportExport module to remove dependency between the CatalogImportExport and ConfigurableProduct modules * Created an optional GroupedImportExport module to remove dependency between the CatalogImportExport and GroupedProduct modules * Introduce search library: * Created a Search request configuration * Created a Query object structure from the XML declaration * Composer Integration: * Added support for using 3rd-party components as Composer packages --- .gitignore | 1 + CHANGELOG.md | 55 + README.md | 1 + app/autoload.php | 5 + app/bootstrap.php | 7 +- .../Block/Grid/Renderer/Severity.php | 18 +- .../Block/System/Messages.php | 8 +- .../System/Messages/UnreadMessagePopup.php | 4 +- .../Magento/AdminNotification/Model/Inbox.php | 32 +- .../Resource/Inbox/Collection/Critical.php | 2 +- .../Resource/System/Message/Collection.php | 8 +- .../Message/Collection/Synchronized.php | 6 +- .../Model/System/Message.php | 4 +- .../Model/System/Message/Baseurl.php | 2 +- .../Model/System/Message/CacheOutdated.php | 4 +- .../Message/Media/AbstractSynchronization.php | 4 +- .../Model/System/Message/Security.php | 4 +- .../Magento/AdminNotification/composer.json | 14 +- .../etc/{adminhtml => }/acl.xml | 2 +- .../AdminNotification/etc/adminhtml/di.xml | 3 +- app/code/Magento/AdminNotification/etc/di.xml | 34 + .../view/adminhtml/web/system/notification.js | 14 +- .../Authorization/Model/Acl/AclRetriever.php | 165 ++ .../Model/Acl/Loader/Role.php | 20 +- .../Model/Acl/Loader/Rule.php | 4 +- .../Model/Acl/Role/Generic.php | 4 +- .../Model/Acl/Role/Group.php | 4 +- .../Model/Acl/Role/User.php | 4 +- .../Model/CompositeUserContext.php | 129 + .../Model/Resource/Permissions/Collection.php | 4 +- .../Model/Resource/Role.php | 58 +- .../Model/Resource/Role/Collection.php | 6 +- .../Model/Resource/Role/Grid/Collection.php | 6 +- .../Model/Resource/Rules.php | 8 +- .../Model/Resource/Rules/Collection.php | 4 +- .../Model/Resource/Setup.php | 38 +- .../{User => Authorization}/Model/Role.php | 57 +- .../{User => Authorization}/Model/Rules.php | 27 +- .../Model/UserContextInterface.php} | 20 +- app/code/Magento/Authorization/composer.json | 20 + .../data-install-1.0.0.0.php} | 41 +- app/code/Magento/Authorization/etc/di.xml | 47 + .../di.xml => Authorization/etc/module.xml} | 9 +- .../authorization_setup/install-1.0.0.0.php | 171 ++ app/code/Magento/Authorizenet/Helper/Data.php | 68 +- .../Authorizenet/Model/Authorizenet.php | 4 +- .../Magento/Authorizenet/Model/Directpost.php | 12 +- app/code/Magento/Authorizenet/composer.json | 22 +- .../Magento/Authz/Model/UserIdentifier.php | 135 - .../Magento/Authz/Service/AuthorizationV1.php | 377 --- .../Service/AuthorizationV1Interface.php | 88 - app/code/Magento/Authz/composer.json | 21 - app/code/Magento/Authz/i18n/de_DE.csv | 5 - app/code/Magento/Authz/i18n/en_US.csv | 5 - app/code/Magento/Authz/i18n/es_ES.csv | 5 - app/code/Magento/Authz/i18n/fr_FR.csv | 5 - app/code/Magento/Authz/i18n/nl_NL.csv | 5 - app/code/Magento/Authz/i18n/pt_BR.csv | 5 - app/code/Magento/Authz/i18n/zh_CN.csv | 5 - .../Magento/Backend/Model/Auth/Session.php | 2 +- app/code/Magento/Backend/Model/Observer.php | 23 - app/code/Magento/Backend/composer.json | 49 +- .../Backend/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Backend/etc/module.xml | 1 - app/code/Magento/Backup/composer.json | 16 +- .../Backup/etc/{adminhtml => }/acl.xml | 2 +- .../Bundle/Model/Plugin/PriceBackend.php | 11 +- .../Bundle/Service/V1/Data/Product/Option.php | 104 + .../Service/V1/Data/Product/Option/Type.php | 56 + .../V1/Data/Product/Option/TypeBuilder.php | 54 + .../V1/Data/Product/Option/TypeConverter.php | 53 + .../Service/V1/Data/Product/OptionBuilder.php | 98 + .../V1/Data/Product/OptionConverter.php | 99 + .../Service/V1/Product/Link/WriteService.php | 2 +- .../Service/V1/Product/Option/ReadService.php | 113 + .../Product/Option/ReadServiceInterface.php | 48 + .../V1/Product/Option/Type/ReadService.php | 66 + .../Option/Type/ReadServiceInterface.php | 34 + .../V1/Product/Option/WriteService.php | 159 ++ .../Product/Option/WriteServiceInterface.php | 61 + app/code/Magento/Bundle/composer.json | 36 +- app/code/Magento/Bundle/etc/di.xml | 3 + app/code/Magento/Bundle/etc/webapi.xml | 36 + .../order/creditmemo/items/renderer.phtml | 6 +- .../sales/order/invoice/items/renderer.phtml | 6 +- .../sales/order/items/renderer.phtml | 10 +- .../sales/order/shipment/items/renderer.phtml | 6 +- app/code/Magento/Captcha/composer.json | 16 +- .../view/frontend/templates/default.phtml | 2 +- .../Adminhtml/Product/Edit/Tab/Crosssell.php | 16 +- .../Product/Edit/Tab/Options/Option.php | 28 +- .../Product/Edit/Tab/Options/Type/Select.php | 7 +- .../Adminhtml/Product/Edit/Tab/Upsell.php | 16 +- .../Block/Adminhtml/Product/Edit/Tabs.php | 19 +- .../Catalog/Block/Product/AbstractProduct.php | 30 - .../Product/Initialization/Helper.php | 33 +- .../Magento/Catalog/Model/Product/Link.php | 8 +- .../Option/Validator/DefaultValidator.php | 28 +- .../Model/Product/Option/Validator/Select.php | 35 +- .../Product/Link/Product/Collection.php | 34 +- .../Catalog/Model/Resource/Product/Option.php | 146 +- .../Model/Resource/Product/Option/Value.php | 144 +- .../V1/Category/ProductLinks/ReadService.php | 5 +- .../ProductLinks/ReadServiceInterface.php | 2 +- .../V1/Category/ProductLinks/WriteService.php | 2 +- .../ProductLinks/WriteServiceInterface.php | 6 +- .../Service/V1/Category/WriteService.php | 12 +- .../V1/Category/WriteServiceInterface.php | 3 +- .../Data/{Eav => }/Category/ProductLink.php | 2 +- .../{Eav => }/Category/ProductLinkBuilder.php | 2 +- .../Catalog/Service/V1/Data/Category/Tree.php | 1 + .../Service/V1/Data/Eav/Category/Tree.php | 11 + .../V1/Data/Eav/Category/TreeBuilder.php | 11 + app/code/Magento/Catalog/composer.json | 52 +- .../Catalog/etc/{adminhtml => }/acl.xml | 2 +- .../catalog/product/edit/options/option.phtml | 6 +- .../product/edit/options/type/select.phtml | 5 +- .../templates/product/compare/list.phtml | 12 +- .../templates/product/list/toolbar.phtml | 22 +- .../frontend/templates/product/listing.phtml | 2 +- .../templates/product/view/details.phtml | 2 +- .../Model/Export/Product.php | 5 +- .../Magento/CatalogImportExport/composer.json | 24 +- .../Magento/CatalogImportExport/etc/di.xml | 7 - .../CatalogImportExport/etc/export.xml | 2 - .../CatalogImportExport/etc/import.xml | 2 - .../CatalogImportExport/etc/module.xml | 2 - .../Service/V1/Data/StockItemDetails.php | 28 +- .../Magento/CatalogInventory/composer.json | 22 +- .../etc/{adminhtml => }/acl.xml | 2 +- .../Magento/CatalogInventory/etc/webapi.xml | 4 +- app/code/Magento/CatalogRule/composer.json | 20 +- .../CatalogRule/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/CatalogSearch/composer.json | 24 +- .../CatalogSearch/etc/{adminhtml => }/acl.xml | 2 +- .../view/frontend/templates/form.mini.phtml | 8 +- .../Magento/CatalogUrlRewrite/composer.json | 14 +- app/code/Magento/Centinel/composer.json | 16 +- .../Magento/Checkout/Model/Type/Onepage.php | 13 +- .../V1/Address/Billing/ReadService.php | 72 + .../Address/Billing/ReadServiceInterface.php | 38 + .../V1/Address/Billing/WriteService.php | 115 + .../Address/Billing/WriteServiceInterface.php | 40 + .../Checkout/Service/V1/Address/Converter.php | 111 + .../V1/Address/Shipping/ReadService.php | 81 + .../Address/Shipping/ReadServiceInterface.php | 38 + .../V1/Address/Shipping/WriteService.php | 117 + .../Shipping/WriteServiceInterface.php | 40 + .../Checkout/Service/V1/Address/Validator.php | 93 + .../Checkout/Service/V1/Cart/ReadService.php | 278 ++ .../Service/V1/Cart/ReadServiceInterface.php | 46 + .../Checkout/Service/V1/Cart/WriteService.php | 108 + .../Service/V1/Cart/WriteServiceInterface.php | 44 + .../Magento/Checkout/Service/V1/Data/Cart.php | 252 ++ .../Checkout/Service/V1/Data/Cart/Address.php | 241 ++ .../Service/V1/Data/Cart/Address/Region.php | 71 + .../V1/Data/Cart/Address/RegionBuilder.php | 68 + .../Service/V1/Data/Cart/AddressBuilder.php | 296 +++ .../Service/V1/Data/Cart/Currency.php | 128 + .../Service/V1/Data/Cart/CurrencyBuilder.php | 120 + .../Service/V1/Data/Cart/Customer.php | 213 ++ .../Service/V1/Data/Cart/CustomerBuilder.php | 197 ++ .../Checkout/Service/V1/Data/Cart/Item.php | 60 +- .../Service/V1/Data/Cart/ItemBuilder.php | 81 + .../Checkout/Service/V1/Data/Cart/Totals.php | 104 + .../Service/V1/Data/Cart/TotalsBuilder.php | 98 + .../Checkout/Service/V1/Data/CartBuilder.php | 228 ++ .../Service/V1/Data/CartSearchResults.php | 37 + .../V1/Data/CartSearchResultsBuilder.php | 55 + .../Checkout/Service/V1/Item/ReadService.php | 87 + .../Service/V1/Item/ReadServiceInterface.php | 34 + .../Checkout/Service/V1/Item/WriteService.php | 144 ++ .../Service/V1/Item/WriteServiceInterface.php | 57 + .../Checkout/Service/V1/QuoteLoader.php | 59 + app/code/Magento/Checkout/composer.json | 36 +- app/code/Magento/Checkout/etc/di.xml | 8 + app/code/Magento/Checkout/etc/webapi.xml | 100 + .../frontend/templates/cart/minicart.phtml | 2 +- .../frontend/templates/onepage/billing.phtml | 2 +- .../frontend/templates/onepage/payment.phtml | 2 +- .../templates/onepage/review/item.phtml | 8 +- .../frontend/web/js/opc-checkout-method.js | 5 +- .../Magento/CheckoutAgreements/composer.json | 12 +- .../etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Cms/composer.json | 22 +- .../data-upgrade-1.6.0.0.0-1.6.0.0.1.php | 8 - .../Magento/Cms/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/CmsUrlRewrite/composer.json | 10 +- .../Export/Product/Type/Configurable.php | 2 +- .../Model/Export/RowCustomizer.php | 4 +- .../Import/Product/Type/Configurable.php | 4 +- .../ConfigurableImportExport/composer.json | 23 + .../ConfigurableImportExport/etc/di.xml | 34 + .../ConfigurableImportExport/etc/export.xml | 28 + .../ConfigurableImportExport/etc/import.xml | 28 + .../etc/module.xml | 13 +- .../Model/Product/Type/Configurable.php | 32 +- .../Product/Type/Configurable/Attribute.php | 2 + .../Product/Type/Configurable/Attribute.php | 72 + .../{ConfigurableAttribute.php => Option.php} | 33 +- .../Value.php | 15 +- .../ValueBuilder.php | 6 +- .../Service/V1/Data/Option/ValueConverter.php | 40 + ...AttributeBuilder.php => OptionBuilder.php} | 46 +- .../Service/V1/Data/OptionConverter.php | 152 ++ .../Service/V1/Product/Option/ReadService.php | 144 ++ .../Product/Option/ReadServiceInterface.php | 58 + .../V1/Product/Option/WriteService.php | 202 ++ .../Product/Option/WriteServiceInterface.php | 61 + .../Service/V1/ReadService.php | 18 +- .../Service/V1/ReadServiceInterface.php | 4 +- .../Magento/ConfigurableProduct/composer.json | 34 +- .../Magento/ConfigurableProduct/etc/di.xml | 3 + .../ConfigurableProduct/etc/webapi.xml | 36 + app/code/Magento/Contact/composer.json | 14 +- .../Contact/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Core/composer.json | 18 +- .../data-upgrade-1.6.0.4-1.6.0.5.php | 2 +- app/code/Magento/Cron/composer.json | 10 +- app/code/Magento/CurrencySymbol/composer.json | 16 +- .../etc/{adminhtml => }/acl.xml | 2 +- .../CustomerSessionUserContext.php | 66 + .../Model/Plugin/CustomerAuthorization.php | 79 + .../Customer/Model/Resource/Address.php | 9 +- .../Customer/Model/Resource/Customer.php | 9 +- app/code/Magento/Customer/Model/Session.php | 5 +- .../Service/V1/CustomerAccountService.php | 6 +- .../Service/V1/CustomerMetadataService.php | 3 +- .../Service/V1/Data/Eav/AttributeMetadata.php | 8 +- .../V1/Data/Eav/AttributeMetadataBuilder.php | 4 +- app/code/Magento/Customer/composer.json | 40 +- .../Customer/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Customer/etc/di.xml | 2 +- app/code/Magento/Customer/etc/module.xml | 2 + app/code/Magento/Customer/etc/webapi.xml | 2 +- .../Magento/Customer/etc/webapi_rest/di.xml | 45 + .../etc/webapi_soap}/di.xml | 4 +- .../frontend/templates/account/customer.phtml | 4 +- .../Customer/view/frontend/web/address.js | 7 +- .../CustomerImportExport/composer.json | 20 +- app/code/Magento/DesignEditor/composer.json | 18 +- .../DesignEditor/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Dhl/composer.json | 24 +- app/code/Magento/Directory/composer.json | 12 +- .../view/frontend/templates/currency.phtml | 19 +- app/code/Magento/Downloadable/composer.json | 36 +- .../Downloadable/etc/{adminhtml => }/acl.xml | 2 +- .../product/edit/downloadable/samples.phtml | 8 + .../templates/customer/products/list.phtml | 5 - app/code/Magento/Eav/composer.json | 14 +- app/code/Magento/Email/composer.json | 16 +- .../Magento/Email/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Fedex/Model/Carrier.php | 19 +- app/code/Magento/Fedex/composer.json | 20 +- app/code/Magento/GiftMessage/composer.json | 24 +- app/code/Magento/GoogleAdwords/composer.json | 10 +- .../Magento/GoogleAnalytics/composer.json | 10 +- .../etc/{adminhtml => }/acl.xml | 2 +- .../Magento/GoogleOptimizer/composer.json | 16 +- .../Adminhtml/Googleshopping/Items.php | 17 + .../Googleshopping/Items/MassAdd.php | 3 +- .../Googleshopping/Items/Refresh.php | 4 +- .../GoogleShopping/Model/MassOperations.php | 38 +- .../Magento/GoogleShopping/Model/Observer.php | 21 +- app/code/Magento/GoogleShopping/composer.json | 25 +- .../etc/{adminhtml => }/acl.xml | 2 +- .../Magento/GoogleShopping/etc/module.xml | 1 - .../Model/Export/Product/Type/Grouped.php | 30 + .../Model/Export/RowCustomizer.php | 69 + .../Model/Import/Product/Type/Grouped.php | 4 +- .../Magento/GroupedImportExport/composer.json | 23 + .../Magento/GroupedImportExport/etc/di.xml | 34 + .../GroupedImportExport/etc/export.xml | 28 + .../GroupedImportExport/etc/import.xml | 28 + .../GroupedImportExport/etc/module.xml | 36 + app/code/Magento/GroupedProduct/composer.json | 28 +- app/code/Magento/ImportExport/composer.json | 16 +- .../ImportExport/etc/{adminhtml => }/acl.xml | 2 +- .../Model/System/Message/IndexOutdated.php | 4 +- app/code/Magento/Index/composer.json | 11 +- .../Magento/Index/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Index/etc/adminhtml/di.xml | 2 +- app/code/Magento/Index/etc/module.xml | 1 - app/code/Magento/Indexer/composer.json | 10 +- .../Indexer/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Install/Block/End.php | 8 +- .../Controller/Adminhtml/Survey.php | 4 +- .../Controller/Adminhtml/Survey/Index.php | 6 +- .../Magento/Install/Controller/Wizard/End.php | 2 +- .../Model/Survey.php | 8 +- .../Model/System/Message/Survey.php | 14 +- app/code/Magento/Install/composer.json | 17 +- .../Magento/Install/etc/adminhtml/routes.xml | 32 + app/code/Magento/Install/etc/di.xml | 7 + app/code/Magento/Install/etc/module.xml | 1 - .../Install/view/adminhtml/layout/default.xml | 34 + .../view/adminhtml/web/survey_notification.js | 41 + .../Block/Adminhtml/Integration/Tokens.php | 6 +- .../Adminhtml/Integration/TokensExchange.php | 2 +- .../Magento/Integration/Model/Integration.php | 14 + .../Magento/Integration/Model/Oauth/Token.php | 164 +- .../Model/Oauth/Token/Provider.php | 37 +- .../Model/Resource/Integration.php | 17 + .../Model/Resource/Oauth/Token.php | 64 +- .../Service/V1/AuthorizationService.php | 214 ++ .../V1/AuthorizationServiceInterface.php | 68 + .../Integration/Service/V1/Integration.php | 9 + .../Service/V1/IntegrationInterface.php | 8 + .../Magento/Integration/Service/V1/Oauth.php | 12 +- .../Integration/Service/V1/OauthInterface.php | 6 +- .../Integration/Service/V1/TokenService.php | 132 + .../Service/V1/TokenServiceInterface.php | 58 + app/code/Magento/Integration/composer.json | 18 +- app/code/Magento/Integration/etc/di.xml | 2 + app/code/Magento/Integration/etc/module.xml | 5 +- app/code/Magento/Integration/etc/webapi.xml | 40 + .../upgrade-1.0.0.2-1.0.0.3.php | 68 + .../Magento/LayeredNavigation/composer.json | 10 +- .../view/frontend/layout/page_one_column.xml | 2 +- .../view/frontend/templates/layer/state.phtml | 4 +- .../view/frontend/templates/layer/view.phtml | 18 +- app/code/Magento/Log/composer.json | 18 +- .../Model/Checkout/Type/Multishipping.php | 11 +- app/code/Magento/Multishipping/composer.json | 24 +- .../Multishipping/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Newsletter/composer.json | 26 +- .../Newsletter/etc/{adminhtml => }/acl.xml | 2 +- .../Magento/OfflinePayments/composer.json | 8 +- .../Magento/OfflineShipping/composer.json | 22 +- app/code/Magento/Ogone/Controller/Api.php | 17 +- app/code/Magento/Ogone/composer.json | 14 +- app/code/Magento/PageCache/composer.json | 10 +- .../PayPalRecurringPayment/Model/Ipn.php | 13 +- .../PayPalRecurringPayment/composer.json | 17 +- .../PayPalRecurringPayment/etc/module.xml | 1 + app/code/Magento/Payment/composer.json | 16 +- .../Payment/etc/{adminhtml => }/acl.xml | 2 +- .../Magento/Paypal/Model/Express/Checkout.php | 11 +- app/code/Magento/Paypal/Model/Ipn.php | 25 +- app/code/Magento/Paypal/Model/Payflowlink.php | 12 +- app/code/Magento/Paypal/composer.json | 32 +- .../Paypal/etc/{adminhtml => }/acl.xml | 2 +- .../Magento/Paypal/etc/adminhtml/system.xml | 2 +- app/code/Magento/Persistent/composer.json | 18 +- .../Persistent/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/ProductAlert/composer.json | 16 +- .../Controller/RecurringPayment.php | 6 +- .../RecurringPayment/Model/Plugin/Tabs.php | 60 + .../Magento/RecurringPayment/composer.json | 26 +- .../data-install-1.0.0.0.php | 2 +- .../etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/RecurringPayment/etc/di.xml | 4 +- .../product/view/payment/schedule.phtml | 6 +- .../frontend/templates/recurring/grid.phtml | 3 - app/code/Magento/Reports/composer.json | 38 +- .../Reports/etc/{adminhtml => }/acl.xml | 2 +- .../product/widget/viewed/item.phtml | 9 +- .../column/compared_default_list.phtml | 9 +- .../compared/content/compared_grid.phtml | 9 +- .../compared/content/compared_list.phtml | 9 +- .../viewed/column/viewed_default_list.phtml | 15 +- .../widget/viewed/content/viewed_grid.phtml | 9 +- .../widget/viewed/content/viewed_list.phtml | 9 +- app/code/Magento/RequireJs/composer.json | 8 +- app/code/Magento/Review/composer.json | 24 +- .../Review/etc/{adminhtml => }/acl.xml | 2 +- .../frontend/templates/customer/list.phtml | 5 - app/code/Magento/Rss/composer.json | 28 +- .../Magento/Rss/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Rule/composer.json | 14 +- .../Creditmemo/AbstractCreditmemo/Email.php | 8 +- .../Invoice/AbstractInvoice/Email.php | 48 +- .../Controller/Adminhtml/Order/AddComment.php | 7 +- .../Adminhtml/Order/Creditmemo/AddComment.php | 14 +- .../Adminhtml/Order/Creditmemo/Save.php | 14 +- .../Controller/Adminhtml/Order/Email.php | 7 +- .../Adminhtml/Order/Invoice/AddComment.php | 16 +- .../Adminhtml/Order/Invoice/Save.php | 26 +- app/code/Magento/Sales/Helper/Data.php | 16 +- .../Magento/Sales/Model/AdminOrder/Create.php | 15 +- .../Sales/Model/AdminOrder/EmailSender.php | 16 +- app/code/Magento/Sales/Model/Notifier.php | 96 + app/code/Magento/Sales/Model/Order.php | 301 +-- .../Sales/Model/Order/Address/Validator.php | 70 + .../Magento/Sales/Model/Order/Creditmemo.php | 309 --- .../Model/Order/Email/Container/Container.php | 152 ++ .../Container/CreditmemoCommentIdentity.php | 90 + .../Email/Container/CreditmemoIdentity.php | 90 + .../Email/Container/IdentityInterface.php | 92 + .../Container/InvoiceCommentIdentity.php | 91 + .../Order/Email/Container/InvoiceIdentity.php | 90 + .../Email/Container/OrderCommentIdentity.php | 91 + .../Order/Email/Container/OrderIdentity.php | 103 + .../Container/ShipmentCommentIdentity.php | 90 + .../Email/Container/ShipmentIdentity.php | 106 + .../Model/Order/Email/Container/Template.php | 110 + .../Sales/Model/Order/Email/NotifySender.php | 57 + .../Sales/Model/Order/Email/Sender.php | 127 + .../Email/Sender/CreditmemoCommentSender.php | 70 + .../Order/Email/Sender/CreditmemoSender.php | 108 + .../Email/Sender/InvoiceCommentSender.php | 69 + .../Order/Email/Sender/InvoiceSender.php | 107 + .../Order/Email/Sender/OrderCommentSender.php | 66 + .../Model/Order/Email/Sender/OrderSender.php | 112 + .../Email/Sender/ShipmentCommentSender.php | 69 + .../Order/Email/Sender/ShipmentSender.php | 107 + .../Sales/Model/Order/Email/SenderBuilder.php | 122 + .../Magento/Sales/Model/Order/Invoice.php | 310 --- .../Magento/Sales/Model/Order/Shipment.php | 302 --- .../Model/Order/Status/History/Validator.php | 53 + .../Magento/Sales/Model/Quote/Address.php | 30 +- .../Sales/Model/Quote/Address/Validator.php | 76 + .../Sales/Model/Resource/Order/Address.php | 30 +- .../Model/Resource/Order/Status/History.php | 44 + .../Magento/Sales/Service/V1/Data/Comment.php | 99 + .../Sales/Service/V1/Data/Creditmemo.php | 753 ++++++ .../Service/V1/Data/CreditmemoComment.php | 122 + .../Sales/Service/V1/Data/CreditmemoItem.php | 527 ++++ .../Magento/Sales/Service/V1/Data/Invoice.php | 539 ++++ .../Sales/Service/V1/Data/InvoiceItem.php | 392 +++ .../Magento/Sales/Service/V1/Data/Order.php | 1542 ++++++++++++ .../Sales/Service/V1/Data/OrderAddress.php | 422 ++++ .../Sales/Service/V1/Data/OrderItem.php | 1167 +++++++++ .../Sales/Service/V1/Data/OrderMapper.php | 144 ++ .../Sales/Service/V1/Data/OrderPayment.php | 842 +++++++ .../Service/V1/Data/OrderStatusHistory.php | 121 + .../Sales/Service/V1/Data/Shipment.php | 257 ++ .../Sales/Service/V1/Data/ShipmentItem.php | 213 ++ .../Sales/Service/V1/Data/ShipmentTrack.php | 198 ++ .../Sales/Service/V1/OrderAddressUpdate.php | 59 + .../V1/OrderAddressUpdateInterface.php | 40 + .../Magento/Sales/Service/V1/OrderCancel.php | 58 + .../Sales/Service/V1/OrderCancelInterface.php | 39 + .../Sales/Service/V1/OrderCommentsList.php | 104 + .../Service/V1/OrderCommentsListInterface.php | 38 + .../Magento/Sales/Service/V1/OrderGet.php | 68 + .../Sales/Service/V1/OrderGetInterface.php | 39 + .../Sales/Service/V1/OrderGetStatus.php | 35 +- .../Service/V1/OrderGetStatusInterface.php | 40 + .../Magento/Sales/Service/V1/OrderHold.php | 57 + .../Sales/Service/V1/OrderHoldInterface.php | 39 + .../Magento/Sales/Service/V1/OrderList.php | 83 + .../Sales/Service/V1/OrderListInterface.php | 40 + .../Service/V1/OrderNotifyUser.php} | 47 +- .../Service/V1/OrderNotifyUserInterface.php | 38 + .../Service/V1/OrderStatusHistoryAdd.php | 72 + .../V1/OrderStatusHistoryAddInterface.php | 42 + .../Magento/Sales/Service/V1/OrderUnHold.php | 57 + .../Sales/Service/V1/OrderUnHoldInterface.php | 39 + app/code/Magento/Sales/composer.json | 46 +- .../Magento/Sales/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Sales/etc/di.xml | 12 +- app/code/Magento/Sales/etc/webapi.xml | 88 + .../templates/order/create/form.phtml | 3 +- .../view/adminhtml/web/order/create/form.js | 2 +- .../frontend/templates/order/history.phtml | 3 - app/code/Magento/SalesRule/composer.json | 38 +- .../SalesRule/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Sendfriend/composer.json | 16 +- .../Adminhtml/Order/Shipment/AddComment.php | 14 +- .../Adminhtml/Order/Shipment/Email.php | 15 +- .../Adminhtml/Order/Shipment/Save.php | 13 +- app/code/Magento/Shipping/composer.json | 28 +- .../Shipping/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Sitemap/composer.json | 18 +- .../Sitemap/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Store/composer.json | 12 +- .../frontend/templates/switch/languages.phtml | 21 +- .../Model/System/Message/Notifications.php | 6 +- .../V1/Data/TaxClassSearchResultsBuilder.php | 6 +- .../V1/Data/TaxRateSearchResultsBuilder.php | 6 +- .../Magento/Tax/Service/V1/TaxRateService.php | 5 + .../Magento/Tax/Service/V1/TaxRuleService.php | 61 +- app/code/Magento/Tax/composer.json | 33 +- .../Magento/Tax/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Tax/etc/adminhtml/di.xml | 4 +- app/code/Magento/Tax/etc/module.xml | 1 - .../sql/tax_setup/upgrade-1.6.0.4-1.6.0.5.php | 2 +- .../sql/tax_setup/upgrade-1.6.0.5-1.6.0.6.php | 2 +- app/code/Magento/Theme/composer.json | 18 +- .../Magento/Theme/etc/{adminhtml => }/acl.xml | 2 +- .../view/frontend/templates/html/block.phtml | 4 +- .../frontend/templates/html/collapsible.phtml | 33 + .../frontend/templates/html/container.phtml | 25 + .../view/frontend/templates/html/header.phtml | 2 +- .../frontend/templates/html/sections.phtml | 53 + app/code/Magento/Translation/composer.json | 12 +- app/code/Magento/Ups/composer.json | 20 +- app/code/Magento/UrlRedirect/composer.json | 18 +- .../UrlRedirect/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/UrlRewrite/composer.json | 12 +- .../Magento/User/Block/Role/Grid/User.php | 16 +- app/code/Magento/User/Block/Role/Tab/Edit.php | 32 +- .../User/Block/User/Edit/Tab/Roles.php | 6 +- .../User/Controller/Adminhtml/User/Role.php | 16 +- .../Adminhtml/User/Role/SaveRole.php | 14 +- .../AdminSessionUserContext.php} | 14 +- .../Model/Plugin/AuthorizationRole.php} | 39 +- app/code/Magento/User/Model/Resource/User.php | 59 +- app/code/Magento/User/Model/User.php | 17 +- app/code/Magento/User/composer.json | 48 +- .../data-upgrade-1.6.1.1-1.6.1.2.php | 241 -- .../Magento/User/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/User/etc/di.xml | 16 +- app/code/Magento/User/etc/module.xml | 32 +- app/code/Magento/User/etc/webapi_rest/di.xml | 37 + .../User/sql/user_setup/install-1.6.0.0.php | 126 - .../user_setup/upgrade-1.6.1.0-1.6.1.1.php | 2 - .../user_setup/upgrade-1.6.1.2-1.6.1.3.php | 49 - .../layout/adminhtml_user_role_grid_block.xml | 2 +- app/code/Magento/Usps/composer.json | 20 +- .../Adminhtml/Integration/Edit/Tab/Webapi.php | 6 +- .../Magento/Webapi/Controller/Login/Index.php | 129 - .../Magento/Webapi/Controller/Request.php | 21 - app/code/Magento/Webapi/Controller/Rest.php | 113 +- app/code/Magento/Webapi/Controller/Soap.php | 10 - .../Controller/Soap/Request/Handler.php | 16 +- .../Model/Authorization/GuestUserContext.php} | 12 +- .../Model/Authorization/OauthUserContext.php | 112 + .../Model/Authorization/TokenUserContext.php | 169 ++ .../Webapi/Model/Authz/UserLocator.php | 71 - .../Model/Plugin/AuthorizationServiceV1.php | 100 - .../Model/Plugin/GuestAuthorization.php | 59 + .../V1/Integration.php} | 72 +- .../Magento/Webapi/Model/Plugin/Setup.php | 33 +- .../Webapi/Model/WebapiRoleLocator.php | 76 + app/code/Magento/Webapi/composer.json | 19 +- app/code/Magento/Webapi/etc/di.xml | 2 +- app/code/Magento/Webapi/etc/module.xml | 5 +- app/code/Magento/Webapi/etc/webapi.xsd | 2 - .../Magento/Webapi/etc/webapi_rest/di.xml | 38 +- .../Magento/Webapi/etc/webapi_soap/di.xml | 28 +- .../Magento/Weee/Block/Sales/Order/Totals.php | 10 +- app/code/Magento/Weee/composer.json | 26 +- app/code/Magento/Widget/composer.json | 18 +- .../Widget/etc/{adminhtml => }/acl.xml | 2 +- app/code/Magento/Wishlist/composer.json | 34 +- .../Wishlist/etc/{adminhtml => }/acl.xml | 2 +- .../wishlist_index_configure_type_bundle.xml | 2 +- .../view/frontend/web/js/add-to-wishlist.js | 5 +- .../Magento_Theme/web/css/source/module.less | 3 + .../adminhtml/Magento/backend/composer.json | 6 +- .../adminhtml/Magento/backend/theme.xml | 2 +- .../Magento/backend/web/css/source/theme.less | 10 +- .../Magento_Bundle/web/css/source/module.less | 5 +- .../layout/catalog_product_view.xml | 1 + .../web/css/source/module.less | 283 +-- .../web/css/source/toolbar.less | 161 ++ .../web/css/source/widgets.less | 2 +- .../web/css/source/module.less | 21 +- .../Magento_Checkout/web/css/source/cart.less | 32 +- .../web/css/source/minicart.less | 37 +- .../web/css/source/module.less | 120 +- .../layout/customer_account.xml | 64 + .../web/css/source/module.less | 131 +- .../web/css/source/module.less | 27 +- .../web/css/source/module.less | 2 +- .../web/css/source/module.less | 2 +- .../Magento_Paypal/web/css/source/module.less | 13 +- .../web/css/source/module.less | 30 + .../Magento_Review/web/css/source/module.less | 169 +- .../Magento_Sales/web/css/source/module.less | 108 +- .../web/css/source/module.less | 3 +- .../blank/Magento_Theme/layout/default.xml | 40 +- .../Magento_Theme/web/css/source/module.less | 13 +- .../web/css/source/module.less | 14 +- .../frontend/Magento/blank/composer.json | 6 +- app/design/frontend/Magento/blank/theme.xml | 2 +- .../blank/web/css/source/abstract.less | 50 +- .../blank/web/css/source/actions-toolbar.less | 2 +- .../Magento/blank/web/css/source/forms.less | 16 +- .../Magento/blank/web/css/source/layout.less | 53 +- .../blank/web/css/source/navigation.less | 334 +-- .../blank/web/css/source/sections.less | 7 +- .../Magento/blank/web/css/source/tables.less | 16 +- .../blank/web/css/source/typography.less | 2 +- .../Magento/blank/web/js/navigation-menu.js | 3 +- .../frontend/Magento/blank/web/js/theme.js | 3 + .../frontend/Magento/plushe/composer.json | 8 +- app/design/frontend/Magento/plushe/theme.xml | 2 +- app/design/install/Magento/basic/theme.xml | 2 +- app/etc/di.xml | 22 + app/etc/vendor_path.php | 28 + app/i18n/magento/de_de/composer.json | 4 +- app/i18n/magento/en_us/composer.json | 4 +- app/i18n/magento/es_es/composer.json | 4 +- app/i18n/magento/fr_fr/composer.json | 4 +- app/i18n/magento/nl_nl/composer.json | 4 +- app/i18n/magento/pt_br/composer.json | 4 +- app/i18n/magento/zh_cn/composer.json | 4 +- composer.json | 183 +- .../Backend/Test/Block/Widget/Grid.php | 2 +- .../Test/Page/Product/CatalogProductView.php | 17 +- .../Catalog/Test/Block/Product/View.php | 37 +- .../AssertProductCompareItemsLinkIsAbsent.php | 2 +- .../Fixture/CatalogProductSimple/TaxClass.php | 74 +- .../Test/Handler/CatalogAttributeSet/Curl.php | 17 +- .../Handler/CatalogProductSimple/Curl.php | 9 +- .../Test/Repository/CatalogProductSimple.php | 5 + .../CreateCategoryEntityTest/test.csv | 2 +- .../CreateProductAttributeEntityTest.php | 3 +- .../AssertAdvancedSearchProductsResult.php | 3 - .../AdvancedSearchEntityTest/testSearch.csv | 27 +- .../app/Magento/Checkout/Test/Block/Cart.php | 6 +- .../Checkout/Test/Page/CheckoutCart.php | 3 - .../Magento/Cms/Test/Handler/CmsPage/Curl.php | 2 +- .../System/Variable/FormPageActions.php | 15 +- .../UpdateCustomVariableEntityTest.php | 4 +- .../Test/Block/Account/Dashboard/Address.php | 4 +- .../Test/Block/Account/Dashboard/Info.php | 2 +- .../AssertCustomerDefaultAddresses.php | 11 +- .../AssertCustomerGroupOnCustomerForm.php | 2 +- .../AssertCustomerMassDeleteInGrid.php | 74 + .../AssertCustomerMassDeleteNotInGrid.php | 73 + ...AssertCustomerMassDeleteSuccessMessage.php | 73 + .../Constraint/AssertCustomerNotInGrid.php | 19 +- .../Test/Fixture/AddressInjectable.php | 13 + .../Test/Fixture/CustomerInjectable.php | 12 + .../Test/Fixture/CustomerInjectable.xml | 6 + .../Fixture/CustomerInjectable/Address.php | 126 + .../Fixture/CustomerInjectable/GroupId.php | 124 + .../Test/Handler/CustomerInjectable/Curl.php | 138 +- .../Test/Repository/AddressInjectable.php | 61 +- .../Test/Repository/CustomerInjectable.php | 15 +- .../testCreateCustomerBackendEntity.csv | 2 +- .../testCreateCustomerGroup.csv | 2 +- .../DeleteCustomerBackendEntityTest.php | 10 +- .../MassDeleteCustomerBackendEntityTest.php | 131 + .../test.csv | 2 + .../testUpdateCustomerBackendEntity.csv | 2 +- .../Customer/Test/etc/global/constraint.xml | 12 + .../Review/Test/Block/Product/View.php | 64 +- .../AssertProductReviewNotOnProductPage.php | 76 + .../AssertProductReviewOnProductPage.php | 88 + .../Test/Handler/ReviewInjectable/Curl.php | 52 +- .../Test/Repository/ReviewInjectable.php | 12 +- .../ModerateProductReviewEntityTest.php | 99 + .../ModerateProductReviewEntityTest/test.csv | 3 + .../Review/Test/TestCase/ReviewTest.php | 17 +- .../Review/Test/etc/global/constraint.xml | 6 + .../app/Magento/Store/Test/Block/Switcher.php | 2 +- .../Test/Block/Adminhtml/Rule/Edit/Form.php | 29 +- .../Test/Block/Adminhtml/Rule/Edit/Form.xml | 6 +- .../Tax/Test/Constraint/AssertTaxRateForm.php | 1 - .../Constraint/AssertTaxRuleIsApplied.php | 1 + .../testUpdateTaxRate.csv | 2 +- .../Test/TestCase/UpdateTaxRuleEntityTest.php | 15 +- .../app/Magento/Theme/Test/Block/Links.php | 11 +- .../Test/Handler/UrlRewrite/Curl.php | 5 +- .../UrlRewrite/Test/Repository/UrlRewrite.php | 6 + .../CreateCustomUrlRewriteEntityTest.php | 2 +- .../testDeleteProductUrlRewrite.csv | 2 +- .../User/Test/Fixture/AdminUserRole.xml | 2 +- .../TestCase/CreateAdminUserEntityTest.php | 2 +- .../Magento/User/Test/etc/global/fixture.xml | 2 +- .../Wishlist/Test/Page/WishlistIndex.php | 52 + .../Wishlist/Test/Page/WishlistIndex.xml | 33 + .../Magento/Wishlist/Test/etc/global/page.xml | 31 + .../Magento/TestFramework/Application.php | 14 +- .../_files/notifications.php | 20 +- .../Model/Resource/Role/CollectionTest.php | 9 +- .../Resource/Role/Grid/CollectionTest.php | 8 +- .../Model/Resource/RoleTest.php | 6 +- .../Model/Resource/Rules/CollectionTest.php | 6 +- .../Model/RoleTest.php | 15 +- .../Model/RulesTest.php | 8 +- .../Authz/Service/AuthorizationV1Test.php | 236 -- .../Magento/Bundle/_files/product.php | 13 +- .../Product/Link/Product/CollectionTest.php | 78 + .../Model/Resource/Product/OptionTest.php | 214 ++ .../Checkout/Model/Type/OnepageTest.php | 3 +- .../Checkout/_files/quote_with_address.php | 6 +- .../quote_with_address_saved_rollback.php | 30 + ...quote_with_virtual_product_and_address.php | 65 + ...h_virtual_product_and_address_rollback.php | 29 + .../Controller/Adminhtml/IndexTest.php | 3 - ...stomer_non_default_website_id_rollback.php | 39 + .../Customer/_files/customer_rollback.php | 21 +- .../order_with_downloadable_product.php | 3 +- .../SourceClassWithNamespaceInterceptor.php | 2 +- .../Search/Request/Config/ConverterTest.php | 45 + .../Framework/Search/Request/MapperTest.php | 45 + .../Search/_files/search_request.xml | 58 + .../Search/_files/search_request_config.php | 111 + .../Framework/Session/SessionManagerTest.php | 9 + .../Stdlib/Cookie/CookieScopeTest.php | 232 ++ .../Stdlib/Cookie/PhpCookieManagerTest.php | 98 + .../Magento/Install/Model/InstallerTest.php | 2 +- .../Controller/Adminhtml/IntegrationTest.php | 12 +- .../Service/V1/AuthorizationServiceTest.php | 173 ++ .../Service/V1/TokenServiceTest.php | 176 ++ .../_files/recurring_payment.php | 23 +- .../Magento/Paypal/Controller/ExpressTest.php | 3 +- .../Magento/Paypal/Controller/PayflowTest.php | 3 +- .../Paypal/Controller/PayflowadvancedTest.php | 2 +- .../Magento/Paypal/_files/order_express.php | 5 +- .../Paypal/_files/order_payflowpro.php | 3 +- .../Magento/Paypal/_files/order_standard.php | 4 +- .../Paypal/_files/quote_payment_express.php | 2 + .../Paypal/_files/quote_payment_standard.php | 1 + .../Adminhtml/Order/AuthorizationMock.php | 39 + .../Controller/Adminhtml/Order/CreateTest.php | 15 - .../Magento/Sales/Model/Order/AddressTest.php | 6 +- .../Sender/CreditmemoSenderTest.php} | 27 +- .../Sender/InvoiceSenderTest.php} | 15 +- .../Sender/OrderSenderTest.php} | 18 +- .../Order/Email/Sender/ShipmentSenderTest.php | 99 + .../Sales/Model/Order/ShipmentTest.php | 30 - .../Magento/Sales/Model/Service/QuoteTest.php | 1 + .../Magento/Sales/_files/order_info.php | 2 + .../_files/order_paid_with_payflowpro.php | 2 + .../testsuite/Magento/Sales/_files/quote.php | 1 + .../Magento/Sales/_files/quote_rollback.php | 34 +- .../Sales/_files/quote_with_customer.php | 9 +- .../_files/quote_with_customer_rollback.php | 25 + .../Magento/Store/_files/second_store.php | 41 +- .../Store/_files/second_store_rollback.php | 40 + .../Tax/Service/V1/TaxRateServiceTest.php | 19 + .../Tax/Service/V1/TaxRuleServiceTest.php | 65 +- .../Integrity/Modular/AclConfigFilesTest.php | 2 +- .../Magento/User/Block/Role/Tab/EditTest.php | 3 +- .../Controller/Adminhtml/User/RoleTest.php | 3 +- .../testsuite/Magento/User/Model/UserTest.php | 6 +- .../Magento/User/_files/user_with_role.php | 42 + .../TestFramework/Inspection/WordsFinder.php | 4 +- .../Magento/TestFramework/Utility/Classes.php | 2 +- .../Test/Integrity/Di/CompilerTest.php | 15 +- .../Magento/Framework/Search/ConfigTest.php | 148 ++ .../Framework/Search/_files/invalid.xml | 36 + .../Search/_files/invalid_partial.xml | 72 + .../Magento/Framework/Search/_files/valid.xml | 116 + .../Framework/Search/_files/valid_partial.xml | 88 + .../Integrity/_files/blacklist/namespace.txt | 1 + .../_files/dependency_test/tables_ce.php | 4 +- .../Test/Legacy/_files/obsolete_classes.php | 87 +- .../Test/Legacy/_files/obsolete_methods.php | 14 +- .../Legacy/_files/obsolete_namespaces.php | 1 - .../Test/Legacy/_files/obsolete_paths.php | 5 - .../Magento/Test/Legacy/_files/words_ce.xml | 2 +- .../Test/Php/_files/blacklist/common.txt | 2 - .../Php/_files/phpcpd/blacklist/common.txt | 4 +- .../Test/Php/_files/whitelist/common.txt | 3 + .../TestFramework/Helper/ObjectManager.php | 2 +- .../Model/System/Message/BaseurlTest.php | 2 +- .../Media/Synchronization/ErrorTest.php | 2 +- .../Media/Synchronization/SuccessTest.php | 2 +- .../Model/Acl/AclRetrieverTest.php | 191 ++ .../Model/Acl/Loader/RoleTest.php | 12 +- .../Model/Acl/Loader/RuleTest.php | 9 +- .../Model/CompositeUserContextTest.php | 199 ++ .../Magento/Authorizenet/Helper/DataTest.php | 119 + .../Authz/Model/UserIdentifierTest.php | 92 - .../Authz/Service/AuthorizationV1Test.php | 91 - .../Magento/Backend/Model/SessionTest.php | 2 +- .../Bundle/Model/Plugin/PriceBackendTest.php | 1 - .../V1/Product/Link/WriteServiceTest.php | 1 + .../V1/Product/Option/ReadServiceTest.php | 217 ++ .../Product/Option/Type/ReadServiceTest.php | 87 + .../V1/Product/Option/WriteServiceTest.php | 393 +++ .../Product/Initialization/HelperTest.php | 232 +- .../Option/Validator/DefaultValidatorTest.php | 111 +- .../Resource/Product/Option/ValueTest.php | 71 - .../Category/ProductLinks/ReadServiceTest.php | 11 +- .../ProductLinks/WriteServiceTest.php | 4 +- .../Service/V1/Category/WriteServiceTest.php | 4 +- .../Service/V1/Data/Category/TreeTest.php | 6 +- .../V1/Address/Billing/ReadServiceTest.php | 77 + .../V1/Address/Billing/WriteServiceTest.php | 170 ++ .../Service/V1/Address/ConverterTest.php | 154 ++ .../V1/Address/Shipping/ReadServiceTest.php | 96 + .../V1/Address/Shipping/WriteServiceTest.php | 205 ++ .../Service/V1/Address/ValidatorTest.php | 224 ++ .../Service/V1/Cart/ReadServiceTest.php | 380 +++ .../Service/V1/Cart/WriteServiceTest.php | 268 ++ .../Service/V1/Item/ReaderServiceTest.php | 93 + .../Service/V1/Item/WriteServiceTest.php | 332 +++ .../Checkout/Service/V1/QuoteLoaderTest.php | 81 + .../Model/Export/RowCustomizerTest.php | 6 +- .../Service/V1/Data/OptionConverterTest.php | 185 ++ .../V1/Product/Option/ReadServiceTest.php | 307 +++ .../V1/Product/Option/WriteServiceTest.php | 426 ++++ .../Service/V1/ReadServiceTest.php | 6 +- .../CustomerSessionUserContextTest.php | 93 + .../Magento/Fedex/Model/CarrierTest.php | 184 ++ .../Event/Config/_files/valid_events.xml | 4 +- .../Notification/NotifierListTest.php | 74 + .../Notification/NotifierPoolTest.php | 111 + .../Code/Generator/ConverterTest.php | 152 ++ .../Code/Generator/GenerateRepositoryTest.php | 113 + .../Code/Generator/RepositoryTest.php | 155 ++ .../Generator/_files/SampleRepository.txt | 98 + .../Framework/Search/RequestFactoryTest.php | 138 + .../Service/Code/Generator/BuilderTest.php | 156 ++ .../Code/Generator/GenerateBuilderTest.php | 83 + .../Code/Generator/GenerateMapperTest.php | 83 + .../GenerateSearchResultsBuilderTest.php | 85 + .../Generator/GenerateSearchResultsTest.php | 85 + .../Service/Code/Generator/MapperTest.php | 155 ++ .../Generator/SearchResultsBuilderTest.php | 157 ++ .../Code/Generator/SearchResultsTest.php | 155 ++ .../Service/Code/Generator/_files/Sample.php | 44 + .../Code/Generator/_files/SampleBuilder.txt | 15 + .../Code/Generator/_files/SampleMapper.txt | 43 + .../Generator/_files/SampleSearchResults.txt | 14 + .../_files/SampleSearchResultsBuilder.txt | 17 + .../Framework/Session/SessionManagerTest.php | 133 + .../Stdlib/Cookie/CookieScopeTest.php | 309 +++ .../Stdlib/Cookie/PhpCookieManagerTest.php | 782 ++++++ .../Cookie/PublicCookieMetadataTest.php | 72 + .../Cookie/SensitiveCookieMetadataTest.php | 68 + .../Framework/Validator/ExceptionTest.php | 9 +- .../View/Element/AbstractBlockTest.php | 7 +- .../Googleshopping/Items/MassAddTest.php | 117 + .../Googleshopping/Items/RefreshTest.php | 111 + .../Model/MassOperationsTest.php | 193 ++ .../GoogleShopping/Model/ObserverTest.php | 92 + .../Integration/TokensDialogTest.php | 2 +- .../Magento/Integration/Oauth/OauthTest.php | 6 +- .../Service/V1/AuthorizationServiceTest.php | 77 + .../Service/V1/IntegrationTest.php | 7 - .../Integration/Service/V1/OauthTest.php | 18 +- .../Model/Plugin/TabsTest.php | 73 + .../Magento/Sales/Helper/DataTest.php | 27 +- .../Sales/Model/AdminOrder/CreateTest.php | 20 +- .../Model/AdminOrder/EmailSenderTest.php | 23 +- .../Magento/Sales/Model/NotifierTest.php | 165 ++ .../Model/Order/Address/ValidatorTest.php | 124 + .../CreditmemoCommentIdentityTest.php | 222 ++ .../Container/CreditmemoIdentityTest.php | 222 ++ .../Container/InvoiceCommentIdentityTest.php | 222 ++ .../Email/Container/InvoiceIdentityTest.php | 222 ++ .../Container/OrderCommentIdentityTest.php | 222 ++ .../Email/Container/OrderIdentityTest.php | 222 ++ .../Container/ShipmentCommentIdentityTest.php | 222 ++ .../Email/Container/ShipmentIdentityTest.php | 222 ++ .../Stub/ScopeConfigInterfaceMock.php | 39 + .../Order/Email/Container/TemplateTest.php | 61 + .../Sender/CreditmemoCommentSenderTest.php | 238 ++ .../Email/Sender/CreditmemoSenderTest.php | 283 +++ .../Email/Sender/InvoiceCommentSenderTest.php | 254 ++ .../Order/Email/Sender/InvoiceSenderTest.php | 284 +++ .../Email/Sender/OrderCommentSenderTest.php | 169 ++ .../Order/Email/Sender/OrderSenderTest.php | 275 ++ .../Sender/ShipmentCommentSenderTest.php | 237 ++ .../Order/Email/Sender/ShipmentSenderTest.php | 284 +++ .../Model/Order/Email/SenderBuilderTest.php | 194 ++ .../Email/Stub/TransportInterfaceMock.php | 39 + .../Order/Status/History/ValidatorTest.php | 48 + .../Model/Quote/Address/ValidatorTest.php | 121 + .../Model/Resource/Order/AddressTest.php | 137 + .../Resource/Order/Status/HistoryTest.php | 141 ++ .../Sales/Service/V1/Data/CommentTest.php | 123 + .../Service/V1/Data/CreditmemoCommentTest.php | 123 + .../Service/V1/Data/CreditmemoItemTest.php | 555 ++++ .../Sales/Service/V1/Data/CreditmemoTest.php | 801 ++++++ .../Sales/Service/V1/Data/InvoiceItemTest.php | 411 +++ .../Sales/Service/V1/Data/InvoiceTest.php | 769 ++++++ .../Service/V1/Data/OrderAddressTest.php | 443 ++++ .../Sales/Service/V1/Data/OrderItemTest.php | 1537 +++++++++++ .../Sales/Service/V1/Data/OrderMapperTest.php | 198 ++ .../Service/V1/Data/OrderPaymentTest.php | 897 +++++++ .../V1/Data/OrderStatusHistoryTest.php | 155 ++ .../Sales/Service/V1/Data/OrderTest.php | 2242 +++++++++++++++++ .../Service/V1/Data/ShipmentItemTest.php | 219 ++ .../Sales/Service/V1/Data/ShipmentTest.php | 267 ++ .../Service/V1/Data/ShipmentTrackTest.php | 203 ++ .../Service/V1/OrderAddressUpdateTest.php | 85 + .../Sales/Service/V1/OrderCancelTest.php | 82 + .../Service/V1/OrderCommentsListTest.php | 189 ++ .../Sales/Service/V1/OrderGetStatusTest.php | 80 + .../Magento/Sales/Service/V1/OrderGetTest.php | 120 + .../Sales/Service/V1/OrderHoldTest.php | 81 + .../Sales/Service/V1/OrderListTest.php | 144 ++ .../Sales/Service/V1/OrderNotifyUserTest.php | 65 + .../Service/V1/OrderStatusHistoryAddTest.php | 96 + .../Sales/Service/V1/OrderUnHoldTest.php | 81 + .../Tax/Service/V1/TaxRateServiceTest.php | 18 + .../Tax/Service/V1/TaxRuleServiceTest.php | 98 +- .../AdminSessionUserContextTest.php | 108 + .../testsuite/Magento/User/Model/UserTest.php | 2 +- .../Magento/Webapi/Controller/RestTest.php | 62 +- .../Controller/Soap/Request/HandlerTest.php | 8 +- .../Magento/Webapi/Controller/SoapTest.php | 25 - .../Authorization/GuestUserContextTest.php | 62 + .../Authorization/OauthUserContextTest.php | 159 ++ .../Authorization/TokenUserContextTest.php | 239 ++ .../Webapi/Model/Config/_files/webapi.php | 4 +- .../Webapi/Model/Config/_files/webapi.xml | 2 +- .../V1/IntegrationTest.php} | 74 +- .../Magento/Webapi/Model/Plugin/SetupTest.php | 80 +- .../Webapi/Model/WebapiRoleLocatorTest.php | 135 + .../_files/session_backend_mock.php | 0 dev/tools/Magento/Tools/Di/compiler.php | 16 +- .../Magento/Tools/Di/entity_generator.php | 20 +- .../factory_table_names/replace_ce.php | 4 +- .../Framework/Acl/Resource/Provider.php | 3 +- .../Magento/Framework/AppInterface.php | 2 +- .../Framework/Authorization/RoleLocator.php | 2 +- .../Code/Generator/EntityAbstract.php | 6 +- .../Code/Generator/Interceptor.php | 4 +- .../Notification}/MessageInterface.php | 14 +- .../Framework/Notification}/MessageList.php | 33 +- .../Notification/NotifierInterface.php | 90 + .../Framework/Notification/NotifierList.php | 90 + .../Framework/Notification/NotifierPool.php | 133 + .../Framework/Oauth/Helper/Request.php | 8 +- .../Code/Generator/Converter.php | 171 ++ .../Code/Generator/Repository.php | 336 +++ .../ObjectManager/DefinitionFactory.php | 26 +- .../Magento/Framework/Search/Request.php | 138 + .../Search/Request/Aggregation/Range.php | 72 + .../Request/Aggregation/RangeBucket.php | 111 + .../Search/Request/Aggregation/TermBucket.php | 94 + .../Search/Request/BucketInterface.php | 52 + .../Framework/Search/Request/Config.php | 40 + .../Search/Request/Config/Converter.php | 106 + .../Search/Request/Config/SchemaLocator.php | 49 + .../Framework/Search/Request/Filter/Bool.php | 116 + .../Framework/Search/Request/Filter/Range.php | 114 + .../Framework/Search/Request/Filter/Term.php | 94 + .../Search/Request/FilterInterface.php | 54 + .../Framework/Search/Request/Mapper.php | 212 ++ .../Framework/Search/Request/Query/Bool.php | 135 + .../Framework/Search/Request/Query/Filter.php | 124 + .../Framework/Search/Request/Query/Match.php | 101 + .../Search/Request/QueryInterface.php | 61 + .../Framework/Search/RequestFactory.php | 119 + .../Framework/Search/RequestInterface.php | 75 + .../Magento/Framework/Search/Response.php | 6 +- .../Framework/Search/ResponseInterface.php | 6 +- .../Magento/Framework/Search/SearchEngine.php | 20 +- .../Search/SearchEngineInterface.php | 37 + .../Magento/Framework/Search/etc/requests.xsd | 276 ++ .../Framework/Search/etc/search_request.xsd | 46 + .../Search/etc/search_request_merged.xsd | 48 + .../Service/Code/Generator/Builder.php | 156 ++ .../Service/Code/Generator/Mapper.php | 169 ++ .../Service/Code/Generator/SearchResults.php | 102 + .../Code/Generator/SearchResultsBuilder.php | 139 + .../Framework/Session/SessionManager.php | 8 +- .../Session/SessionManagerInterface.php | 3 +- .../Stdlib/Cookie/CookieMetadata.php | 137 + .../Stdlib/Cookie/CookieMetadataFactory.php | 88 + .../Framework/Stdlib/Cookie/CookieScope.php | 133 + .../CookieSizeLimitReachedException.php | 39 + .../Stdlib/Cookie/FailureToSendException.php | 36 + .../Stdlib/Cookie/PhpCookieManager.php | 288 +++ .../Stdlib/Cookie/PublicCookieMetadata.php | 107 + .../Stdlib/Cookie/SensitiveCookieMetadata.php | 36 + .../Framework/Stdlib/CookieManager.php | 97 + .../Validator/ValidatorException.php | 35 +- .../Framework/View/Element/AbstractBlock.php | 34 +- lib/internal/Magento/Framework/composer.json | 7 +- .../Zend/Code/Generator/DocBlockGenerator.php | 4 +- lib/internal/Zend/Escaper/composer.json | 2 +- .../I18n/Exception/ExceptionInterface.php | 2 +- .../Exception/InvalidArgumentException.php | 2 +- .../I18n/Exception/OutOfBoundsException.php | 2 +- .../Zend/I18n/Exception/ParseException.php | 2 +- .../Zend/I18n/Exception/RangeException.php | 2 +- .../Zend/I18n/Exception/RuntimeException.php | 2 +- .../Zend/I18n/Filter/AbstractLocale.php | 3 +- lib/internal/Zend/I18n/Filter/Alnum.php | 4 +- lib/internal/Zend/I18n/Filter/Alpha.php | 3 +- .../Zend/I18n/Filter/NumberFormat.php | 5 + .../Translator/TranslatorServiceFactory.php | 2 +- lib/internal/Zend/I18n/Validator/Alnum.php | 3 +- lib/internal/Zend/I18n/Validator/Alpha.php | 4 +- lib/internal/Zend/I18n/Validator/Float.php | 3 +- lib/internal/Zend/I18n/Validator/Int.php | 3 +- lib/internal/Zend/I18n/Validator/PostCode.php | 3 +- .../View/Helper/AbstractTranslatorHelper.php | 4 +- .../Zend/I18n/View/Helper/CurrencyFormat.php | 42 +- lib/internal/Zend/I18n/composer.json | 3 +- lib/internal/Zend/Server/composer.json | 2 +- .../AbstractFactoryInterface.php | 38 + .../ServiceManager/AbstractPluginManager.php | 222 ++ lib/internal/Zend/ServiceManager/Config.php | 155 ++ .../Zend/ServiceManager/ConfigInterface.php | 26 + .../Di/DiAbstractServiceFactory.php | 62 + .../Di/DiInstanceManagerProxy.php | 72 + .../ServiceManager/Di/DiServiceFactory.php | 124 + .../Di/DiServiceInitializer.php | 69 + .../CircularDependencyFoundException.php | 20 + .../Exception/ExceptionInterface.php | 20 + .../Exception/InvalidArgumentException.php | 20 + .../Exception/InvalidServiceNameException.php | 20 + .../Exception/RuntimeException.php | 20 + .../Exception/ServiceNotCreatedException.php | 20 + .../Exception/ServiceNotFoundException.php | 20 + .../Zend/ServiceManager/FactoryInterface.php | 26 + .../ServiceManager/InitializerInterface.php | 29 + .../ServiceLocatorAwareInterface.php | 32 + .../ServiceLocatorInterface.php | 37 + .../Zend/ServiceManager/ServiceManager.php | 960 +++++++ .../ServiceManagerAwareInterface.php | 25 + .../Zend/ServiceManager/composer.json | 21 + lib/internal/Zend/Soap/AutoDiscover.php | 5 +- lib/internal/Zend/Soap/Client.php | 2 +- .../Soap/Server/DocumentLiteralWrapper.php | 1 - lib/internal/Zend/Soap/composer.json | 2 +- lib/internal/Zend/Uri/composer.json | 2 +- .../Zend/Validator/AbstractValidator.php | 2 +- lib/internal/Zend/Validator/Barcode.php | 2 +- .../Validator/Barcode/AbstractAdapter.php | 2 +- .../Validator/Barcode/AdapterInterface.php | 2 +- .../Zend/Validator/Barcode/Codabar.php | 2 +- .../Zend/Validator/Barcode/Code128.php | 2 +- .../Zend/Validator/Barcode/Code25.php | 2 +- .../Validator/Barcode/Code25interleaved.php | 2 +- .../Zend/Validator/Barcode/Code39.php | 2 +- .../Zend/Validator/Barcode/Code39ext.php | 2 +- .../Zend/Validator/Barcode/Code93.php | 2 +- .../Zend/Validator/Barcode/Code93ext.php | 2 +- lib/internal/Zend/Validator/Barcode/Ean12.php | 2 +- lib/internal/Zend/Validator/Barcode/Ean13.php | 2 +- lib/internal/Zend/Validator/Barcode/Ean14.php | 2 +- lib/internal/Zend/Validator/Barcode/Ean18.php | 2 +- lib/internal/Zend/Validator/Barcode/Ean2.php | 2 +- lib/internal/Zend/Validator/Barcode/Ean5.php | 2 +- lib/internal/Zend/Validator/Barcode/Ean8.php | 2 +- .../Zend/Validator/Barcode/Gtin12.php | 2 +- .../Zend/Validator/Barcode/Gtin13.php | 2 +- .../Zend/Validator/Barcode/Gtin14.php | 2 +- .../Zend/Validator/Barcode/Identcode.php | 2 +- .../Validator/Barcode/Intelligentmail.php | 2 +- lib/internal/Zend/Validator/Barcode/Issn.php | 2 +- lib/internal/Zend/Validator/Barcode/Itf14.php | 2 +- .../Zend/Validator/Barcode/Leitcode.php | 2 +- .../Zend/Validator/Barcode/Planet.php | 2 +- .../Zend/Validator/Barcode/Postnet.php | 2 +- .../Zend/Validator/Barcode/Royalmail.php | 2 +- lib/internal/Zend/Validator/Barcode/Sscc.php | 2 +- lib/internal/Zend/Validator/Barcode/Upca.php | 2 +- lib/internal/Zend/Validator/Barcode/Upce.php | 2 +- lib/internal/Zend/Validator/Between.php | 2 +- lib/internal/Zend/Validator/Callback.php | 2 +- lib/internal/Zend/Validator/CreditCard.php | 2 +- lib/internal/Zend/Validator/Date.php | 8 +- lib/internal/Zend/Validator/DateStep.php | 41 +- lib/internal/Zend/Validator/Db/AbstractDb.php | 2 +- .../Zend/Validator/Db/NoRecordExists.php | 2 +- .../Zend/Validator/Db/RecordExists.php | 2 +- lib/internal/Zend/Validator/Digits.php | 2 +- lib/internal/Zend/Validator/EmailAddress.php | 4 +- .../Exception/ExceptionInterface.php | 2 +- lib/internal/Zend/Validator/Explode.php | 4 +- lib/internal/Zend/Validator/File/Count.php | 2 +- lib/internal/Zend/Validator/File/Crc32.php | 2 +- .../Zend/Validator/File/ExcludeExtension.php | 2 +- .../Zend/Validator/File/ExcludeMimeType.php | 2 +- lib/internal/Zend/Validator/File/Exists.php | 2 +- .../Zend/Validator/File/Extension.php | 2 +- .../Zend/Validator/File/FilesSize.php | 2 +- lib/internal/Zend/Validator/File/Hash.php | 2 +- .../Zend/Validator/File/ImageSize.php | 2 +- .../Zend/Validator/File/IsCompressed.php | 2 +- lib/internal/Zend/Validator/File/IsImage.php | 2 +- lib/internal/Zend/Validator/File/Md5.php | 2 +- lib/internal/Zend/Validator/File/MimeType.php | 4 +- .../Zend/Validator/File/NotExists.php | 2 +- lib/internal/Zend/Validator/File/Sha1.php | 3 +- lib/internal/Zend/Validator/File/Size.php | 2 +- lib/internal/Zend/Validator/File/Upload.php | 2 +- .../Zend/Validator/File/WordCount.php | 2 +- lib/internal/Zend/Validator/GreaterThan.php | 2 +- lib/internal/Zend/Validator/Hex.php | 2 +- lib/internal/Zend/Validator/Hostname/Biz.php | 2 +- lib/internal/Zend/Validator/Hostname/Cn.php | 2 +- lib/internal/Zend/Validator/Hostname/Com.php | 2 +- lib/internal/Zend/Validator/Hostname/Jp.php | 2 +- lib/internal/Zend/Validator/Iban.php | 4 +- lib/internal/Zend/Validator/Identical.php | 2 +- lib/internal/Zend/Validator/InArray.php | 2 +- lib/internal/Zend/Validator/Ip.php | 5 +- lib/internal/Zend/Validator/Isbn.php | 2 +- lib/internal/Zend/Validator/LessThan.php | 2 +- lib/internal/Zend/Validator/NotEmpty.php | 2 +- lib/internal/Zend/Validator/Regex.php | 2 +- .../Zend/Validator/Sitemap/Changefreq.php | 2 +- .../Zend/Validator/Sitemap/Lastmod.php | 2 +- lib/internal/Zend/Validator/Sitemap/Loc.php | 2 +- .../Zend/Validator/Sitemap/Priority.php | 2 +- .../Zend/Validator/StaticValidator.php | 2 +- lib/internal/Zend/Validator/Step.php | 2 +- lib/internal/Zend/Validator/StringLength.php | 2 +- lib/internal/Zend/Validator/Uri.php | 2 +- .../Zend/Validator/ValidatorInterface.php | 2 +- .../Zend/Validator/ValidatorPluginManager.php | 2 +- lib/internal/Zend/Validator/composer.json | 3 +- lib/web/app-config.js | 1 + lib/web/css/docs/source/actions-toolbar.less | 2 +- lib/web/css/docs/source/sections.less | 2 +- lib/web/css/docs/source/tables.less | 4 +- lib/web/css/source/lib/abstract.less | 4 +- lib/web/css/source/lib/buttons.less | 47 +- lib/web/css/source/lib/forms.less | 12 +- lib/web/css/source/lib/icons.less | 4 +- lib/web/css/source/lib/messages.less | 63 +- lib/web/css/source/lib/navigation.less | 242 +- lib/web/css/source/lib/rating.less | 1 + lib/web/css/source/lib/resets.less | 78 +- lib/web/css/source/lib/responsive.less | 26 +- lib/web/css/source/lib/typography.less | 14 +- lib/web/css/source/lib/variables.less | 148 +- lib/web/mage/adminhtml/tools.js | 16 +- lib/web/mage/menu.js | 19 +- 1107 files changed, 59413 insertions(+), 7369 deletions(-) rename app/code/Magento/AdminNotification/etc/{adminhtml => }/acl.xml (95%) create mode 100644 app/code/Magento/AdminNotification/etc/di.xml create mode 100644 app/code/Magento/Authorization/Model/Acl/AclRetriever.php rename app/code/Magento/{User => Authorization}/Model/Acl/Loader/Role.php (79%) rename app/code/Magento/{User => Authorization}/Model/Acl/Loader/Rule.php (95%) rename app/code/Magento/{User => Authorization}/Model/Acl/Role/Generic.php (93%) rename app/code/Magento/{User => Authorization}/Model/Acl/Role/Group.php (90%) rename app/code/Magento/{User => Authorization}/Model/Acl/Role/User.php (90%) create mode 100644 app/code/Magento/Authorization/Model/CompositeUserContext.php rename app/code/Magento/{User => Authorization}/Model/Resource/Permissions/Collection.php (88%) rename app/code/Magento/{User => Authorization}/Model/Resource/Role.php (76%) rename app/code/Magento/{User => Authorization}/Model/Resource/Role/Collection.php (89%) rename app/code/Magento/{User => Authorization}/Model/Resource/Role/Grid/Collection.php (85%) rename app/code/Magento/{User => Authorization}/Model/Resource/Rules.php (95%) rename app/code/Magento/{User => Authorization}/Model/Resource/Rules/Collection.php (91%) rename app/code/Magento/{User => Authorization}/Model/Resource/Setup.php (69%) rename app/code/Magento/{User => Authorization}/Model/Role.php (58%) rename app/code/Magento/{User => Authorization}/Model/Rules.php (68%) rename app/code/Magento/{Authz/Model/UserLocatorInterface.php => Authorization/Model/UserContextInterface.php} (76%) create mode 100644 app/code/Magento/Authorization/composer.json rename app/code/Magento/{User/data/user_setup/data-install-1.6.0.0.php => Authorization/data/authorization_setup/data-install-1.0.0.0.php} (69%) create mode 100644 app/code/Magento/Authorization/etc/di.xml rename app/code/Magento/{Authz/etc/di.xml => Authorization/etc/module.xml} (80%) create mode 100644 app/code/Magento/Authorization/sql/authorization_setup/install-1.0.0.0.php delete mode 100644 app/code/Magento/Authz/Model/UserIdentifier.php delete mode 100644 app/code/Magento/Authz/Service/AuthorizationV1.php delete mode 100644 app/code/Magento/Authz/Service/AuthorizationV1Interface.php delete mode 100644 app/code/Magento/Authz/composer.json delete mode 100644 app/code/Magento/Authz/i18n/de_DE.csv delete mode 100644 app/code/Magento/Authz/i18n/en_US.csv delete mode 100644 app/code/Magento/Authz/i18n/es_ES.csv delete mode 100644 app/code/Magento/Authz/i18n/fr_FR.csv delete mode 100644 app/code/Magento/Authz/i18n/nl_NL.csv delete mode 100644 app/code/Magento/Authz/i18n/pt_BR.csv delete mode 100644 app/code/Magento/Authz/i18n/zh_CN.csv rename app/code/Magento/Backend/etc/{adminhtml => }/acl.xml (98%) rename app/code/Magento/Backup/etc/{adminhtml => }/acl.xml (94%) create mode 100644 app/code/Magento/Bundle/Service/V1/Data/Product/Option.php create mode 100644 app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php create mode 100644 app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php create mode 100644 app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeConverter.php create mode 100644 app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php create mode 100644 app/code/Magento/Bundle/Service/V1/Data/Product/OptionConverter.php create mode 100644 app/code/Magento/Bundle/Service/V1/Product/Option/ReadService.php create mode 100644 app/code/Magento/Bundle/Service/V1/Product/Option/ReadServiceInterface.php create mode 100644 app/code/Magento/Bundle/Service/V1/Product/Option/Type/ReadService.php create mode 100644 app/code/Magento/Bundle/Service/V1/Product/Option/Type/ReadServiceInterface.php create mode 100644 app/code/Magento/Bundle/Service/V1/Product/Option/WriteService.php create mode 100644 app/code/Magento/Bundle/Service/V1/Product/Option/WriteServiceInterface.php rename app/code/Magento/Catalog/Service/V1/Data/{Eav => }/Category/ProductLink.php (96%) rename app/code/Magento/Catalog/Service/V1/Data/{Eav => }/Category/ProductLinkBuilder.php (96%) rename app/code/Magento/Catalog/etc/{adminhtml => }/acl.xml (96%) rename app/code/Magento/CatalogInventory/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/CatalogRule/etc/{adminhtml => }/acl.xml (93%) rename app/code/Magento/CatalogSearch/etc/{adminhtml => }/acl.xml (93%) create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Billing/ReadService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Billing/ReadServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Billing/WriteService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Billing/WriteServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Converter.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Shipping/ReadService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Shipping/ReadServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Shipping/WriteService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Shipping/WriteServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/Address/Validator.php create mode 100644 app/code/Magento/Checkout/Service/V1/Cart/ReadService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Cart/ReadServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/Cart/WriteService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Cart/WriteServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/Address.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/Address/Region.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/Address/RegionBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/Currency.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/CurrencyBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/Customer.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerBuilder.php rename dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/MysqlStub.php => app/code/Magento/Checkout/Service/V1/Data/Cart/Item.php (53%) create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/ItemBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/Totals.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/CartBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/CartSearchResults.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Item/ReadService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Item/ReadServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/Item/WriteService.php create mode 100644 app/code/Magento/Checkout/Service/V1/Item/WriteServiceInterface.php create mode 100644 app/code/Magento/Checkout/Service/V1/QuoteLoader.php create mode 100644 app/code/Magento/Checkout/etc/webapi.xml rename app/code/Magento/CheckoutAgreements/etc/{adminhtml => }/acl.xml (93%) rename app/code/Magento/Cms/etc/{adminhtml => }/acl.xml (95%) rename app/code/Magento/{CatalogImportExport => ConfigurableImportExport}/Model/Export/Product/Type/Configurable.php (93%) rename app/code/Magento/{CatalogImportExport => ConfigurableImportExport}/Model/Export/RowCustomizer.php (96%) rename app/code/Magento/{CatalogImportExport => ConfigurableImportExport}/Model/Import/Product/Type/Configurable.php (99%) create mode 100644 app/code/Magento/ConfigurableImportExport/composer.json create mode 100644 app/code/Magento/ConfigurableImportExport/etc/di.xml create mode 100644 app/code/Magento/ConfigurableImportExport/etc/export.xml create mode 100644 app/code/Magento/ConfigurableImportExport/etc/import.xml rename app/code/Magento/{Authz => ConfigurableImportExport}/etc/module.xml (76%) rename app/code/Magento/ConfigurableProduct/Service/V1/Data/{ConfigurableAttribute.php => Option.php} (76%) rename app/code/Magento/ConfigurableProduct/Service/V1/Data/{ConfigurableAttribute => Option}/Value.php (82%) rename app/code/Magento/ConfigurableProduct/Service/V1/Data/{ConfigurableAttribute => Option}/ValueBuilder.php (88%) create mode 100644 app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueConverter.php rename app/code/Magento/ConfigurableProduct/Service/V1/Data/{ConfigurableAttributeBuilder.php => OptionBuilder.php} (58%) create mode 100644 app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionConverter.php create mode 100644 app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadService.php create mode 100644 app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadServiceInterface.php create mode 100644 app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteService.php create mode 100644 app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceInterface.php rename app/code/Magento/Contact/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/CurrencySymbol/etc/{adminhtml => }/acl.xml (94%) create mode 100644 app/code/Magento/Customer/Model/Authorization/CustomerSessionUserContext.php create mode 100644 app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php rename app/code/Magento/Customer/etc/{adminhtml => }/acl.xml (95%) create mode 100644 app/code/Magento/Customer/etc/webapi_rest/di.xml rename app/code/Magento/{Authz/etc/adminhtml => Customer/etc/webapi_soap}/di.xml (86%) rename app/code/Magento/DesignEditor/etc/{adminhtml => }/acl.xml (93%) rename app/code/Magento/Downloadable/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/Email/etc/{adminhtml => }/acl.xml (93%) rename app/code/Magento/GoogleAnalytics/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/GoogleShopping/etc/{adminhtml => }/acl.xml (94%) create mode 100644 app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php create mode 100644 app/code/Magento/GroupedImportExport/Model/Export/RowCustomizer.php rename app/code/Magento/{CatalogImportExport => GroupedImportExport}/Model/Import/Product/Type/Grouped.php (98%) create mode 100644 app/code/Magento/GroupedImportExport/composer.json create mode 100644 app/code/Magento/GroupedImportExport/etc/di.xml create mode 100644 app/code/Magento/GroupedImportExport/etc/export.xml create mode 100644 app/code/Magento/GroupedImportExport/etc/import.xml create mode 100644 app/code/Magento/GroupedImportExport/etc/module.xml rename app/code/Magento/ImportExport/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/Index/etc/{adminhtml => }/acl.xml (93%) rename app/code/Magento/Indexer/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/{AdminNotification => Install}/Controller/Adminhtml/Survey.php (90%) rename app/code/Magento/{AdminNotification => Install}/Controller/Adminhtml/Survey/Index.php (83%) rename app/code/Magento/{AdminNotification => Install}/Model/Survey.php (94%) rename app/code/Magento/{AdminNotification => Install}/Model/System/Message/Survey.php (87%) create mode 100644 app/code/Magento/Install/etc/adminhtml/routes.xml create mode 100644 app/code/Magento/Install/view/adminhtml/layout/default.xml create mode 100644 app/code/Magento/Install/view/adminhtml/web/survey_notification.js create mode 100644 app/code/Magento/Integration/Service/V1/AuthorizationService.php create mode 100644 app/code/Magento/Integration/Service/V1/AuthorizationServiceInterface.php create mode 100644 app/code/Magento/Integration/Service/V1/TokenService.php create mode 100644 app/code/Magento/Integration/Service/V1/TokenServiceInterface.php create mode 100644 app/code/Magento/Integration/etc/webapi.xml create mode 100644 app/code/Magento/Integration/sql/integration_setup/upgrade-1.0.0.2-1.0.0.3.php rename app/code/Magento/Multishipping/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/Newsletter/etc/{adminhtml => }/acl.xml (96%) rename app/code/Magento/Payment/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/Paypal/etc/{adminhtml => }/acl.xml (96%) rename app/code/Magento/Persistent/etc/{adminhtml => }/acl.xml (94%) create mode 100644 app/code/Magento/RecurringPayment/Model/Plugin/Tabs.php rename app/code/Magento/RecurringPayment/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/Reports/etc/{adminhtml => }/acl.xml (97%) rename app/code/Magento/Review/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/Rss/etc/{adminhtml => }/acl.xml (94%) create mode 100644 app/code/Magento/Sales/Model/Notifier.php create mode 100644 app/code/Magento/Sales/Model/Order/Address/Validator.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/Container.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoCommentIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/IdentityInterface.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/InvoiceCommentIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/InvoiceIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/OrderCommentIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/OrderIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/ShipmentCommentIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/ShipmentIdentity.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Container/Template.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/NotifySender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php create mode 100644 app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php create mode 100644 app/code/Magento/Sales/Model/Order/Status/History/Validator.php create mode 100644 app/code/Magento/Sales/Model/Quote/Address/Validator.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/Comment.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/Creditmemo.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/CreditmemoComment.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/Invoice.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/Order.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/OrderAddress.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/OrderItem.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/OrderMapper.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/OrderPayment.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/Shipment.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderAddressUpdate.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderAddressUpdateInterface.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderCancel.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderCancelInterface.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderCommentsList.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderCommentsListInterface.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderGet.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderGetInterface.php rename dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php => app/code/Magento/Sales/Service/V1/OrderGetStatus.php (60%) create mode 100644 app/code/Magento/Sales/Service/V1/OrderGetStatusInterface.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderHold.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderHoldInterface.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderList.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderListInterface.php rename app/code/Magento/{Webapi/Controller/Login/Anonymous.php => Sales/Service/V1/OrderNotifyUser.php} (54%) create mode 100644 app/code/Magento/Sales/Service/V1/OrderNotifyUserInterface.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderStatusHistoryAdd.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderStatusHistoryAddInterface.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderUnHold.php create mode 100644 app/code/Magento/Sales/Service/V1/OrderUnHoldInterface.php rename app/code/Magento/Sales/etc/{adminhtml => }/acl.xml (97%) create mode 100644 app/code/Magento/Sales/etc/webapi.xml rename app/code/Magento/SalesRule/etc/{adminhtml => }/acl.xml (95%) rename app/code/Magento/Shipping/etc/{adminhtml => }/acl.xml (94%) rename app/code/Magento/Sitemap/etc/{adminhtml => }/acl.xml (95%) rename app/code/Magento/Tax/etc/{adminhtml => }/acl.xml (95%) rename app/code/Magento/Theme/etc/{adminhtml => }/acl.xml (93%) create mode 100644 app/code/Magento/Theme/view/frontend/templates/html/collapsible.phtml create mode 100644 app/code/Magento/Theme/view/frontend/templates/html/container.phtml create mode 100644 app/code/Magento/Theme/view/frontend/templates/html/sections.phtml rename app/code/Magento/UrlRedirect/etc/{adminhtml => }/acl.xml (93%) rename app/code/Magento/{Authz/Model/UserLocator/Admin.php => User/Model/Authorization/AdminSessionUserContext.php} (83%) rename app/code/Magento/{Authz/Model/UserIdentifier/Factory.php => User/Model/Plugin/AuthorizationRole.php} (57%) delete mode 100644 app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php rename app/code/Magento/User/etc/{adminhtml => }/acl.xml (94%) create mode 100644 app/code/Magento/User/etc/webapi_rest/di.xml delete mode 100644 app/code/Magento/User/sql/user_setup/upgrade-1.6.1.2-1.6.1.3.php delete mode 100644 app/code/Magento/Webapi/Controller/Login/Index.php rename app/code/Magento/{Authz/Model/UserLocator/Guest.php => Webapi/Model/Authorization/GuestUserContext.php} (82%) create mode 100644 app/code/Magento/Webapi/Model/Authorization/OauthUserContext.php create mode 100644 app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php delete mode 100644 app/code/Magento/Webapi/Model/Authz/UserLocator.php delete mode 100644 app/code/Magento/Webapi/Model/Plugin/AuthorizationServiceV1.php create mode 100644 app/code/Magento/Webapi/Model/Plugin/GuestAuthorization.php rename app/code/Magento/Webapi/Model/Plugin/{IntegrationServiceV1.php => Service/V1/Integration.php} (67%) create mode 100644 app/code/Magento/Webapi/Model/WebapiRoleLocator.php rename app/code/Magento/Widget/etc/{adminhtml => }/acl.xml (93%) rename app/code/Magento/Wishlist/etc/{adminhtml => }/acl.xml (94%) create mode 100644 app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/toolbar.less create mode 100644 app/design/frontend/Magento/blank/Magento_Customer/layout/customer_account.xml create mode 100644 app/design/frontend/Magento/blank/Magento_RecurringPayment/web/css/source/module.less create mode 100644 app/etc/vendor_path.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerMassDeleteInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerMassDeleteNotInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerMassDeleteSuccessMessage.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable/Address.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable/GroupId.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotOnProductPage.php create mode 100644 dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewOnProductPage.php create mode 100644 dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ModerateProductReviewEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ModerateProductReviewEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.php create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/global/page.xml rename dev/tests/integration/testsuite/Magento/{User => Authorization}/Model/Resource/Role/CollectionTest.php (86%) rename dev/tests/integration/testsuite/Magento/{User => Authorization}/Model/Resource/Role/Grid/CollectionTest.php (85%) rename dev/tests/integration/testsuite/Magento/{User => Authorization}/Model/Resource/RoleTest.php (90%) rename dev/tests/integration/testsuite/Magento/{User => Authorization}/Model/Resource/Rules/CollectionTest.php (91%) rename dev/tests/integration/testsuite/Magento/{User => Authorization}/Model/RoleTest.php (80%) rename dev/tests/integration/testsuite/Magento/{User => Authorization}/Model/RulesTest.php (94%) delete mode 100644 dev/tests/integration/testsuite/Magento/Authz/Service/AuthorizationV1Test.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/Link/Product/CollectionTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/OptionTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_address_saved_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_and_address.php create mode 100644 dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_and_address_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_non_default_website_id_rollback.php rename app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.4-1.6.1.5.php => dev/tests/integration/testsuite/Magento/Customer/_files/customer_rollback.php (62%) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/ConverterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Search/Request/MapperTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Search/_files/search_request.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Search/_files/search_request_config.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/CookieScopeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieManagerTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Integration/Service/V1/AuthorizationServiceTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Integration/Service/V1/TokenServiceTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/AuthorizationMock.php rename dev/tests/integration/testsuite/Magento/Sales/Model/Order/{CreditmemoTest.php => Email/Sender/CreditmemoSenderTest.php} (72%) rename dev/tests/integration/testsuite/Magento/Sales/Model/Order/{InvoiceTest.php => Email/Sender/InvoiceSenderTest.php} (82%) rename dev/tests/integration/testsuite/Magento/Sales/Model/Order/{OrderTest.php => Email/Sender/OrderSenderTest.php} (82%) create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/ShipmentSenderTest.php rename app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.3-1.6.1.4.php => dev/tests/integration/testsuite/Magento/Sales/_files/quote_rollback.php (53%) create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer_rollback.php rename app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php => dev/tests/integration/testsuite/Magento/Store/_files/second_store.php (53%) create mode 100644 dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/User/_files/user_with_role.php create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/ConfigTest.php create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/invalid.xml create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/invalid_partial.xml create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/valid.xml create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/valid_partial.xml create mode 100644 dev/tests/unit/testsuite/Magento/Authorization/Model/Acl/AclRetrieverTest.php rename dev/tests/unit/testsuite/Magento/{User => Authorization}/Model/Acl/Loader/RoleTest.php (92%) rename dev/tests/unit/testsuite/Magento/{User => Authorization}/Model/Acl/Loader/RuleTest.php (92%) create mode 100644 dev/tests/unit/testsuite/Magento/Authorization/Model/CompositeUserContextTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Authorizenet/Helper/DataTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Authz/Model/UserIdentifierTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Service/V1/Product/Option/ReadServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Service/V1/Product/Option/Type/ReadServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Service/V1/Product/Option/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/Billing/ReadServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/Billing/WriteServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/ConverterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/Shipping/ReadServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/Shipping/WriteServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/ValidatorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Cart/WriteServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/ReaderServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/WriteServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/QuoteLoaderTest.php rename dev/tests/unit/testsuite/Magento/{ConfigurableProduct => ConfigurableImportExport}/Model/Export/RowCustomizerTest.php (97%) create mode 100644 dev/tests/unit/testsuite/Magento/ConfigurableProduct/Service/V1/Data/OptionConverterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Customer/Model/Authorization/CustomerSessionUserContextTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Fedex/Model/CarrierTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Notification/NotifierListTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Notification/NotifierPoolTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/ConverterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/GenerateRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/RepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/_files/SampleRepository.txt create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/RequestFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/BuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/GenerateBuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/GenerateMapperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/GenerateSearchResultsBuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/GenerateSearchResultsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/MapperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/SearchResultsBuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/SearchResultsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/Sample.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleBuilder.txt create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleMapper.txt create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleSearchResults.txt create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleSearchResultsBuilder.txt create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Session/SessionManagerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Stdlib/Cookie/CookieScopeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieManagerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Stdlib/Cookie/PublicCookieMetadataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Stdlib/Cookie/SensitiveCookieMetadataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/MassAddTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/RefreshTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GoogleShopping/Model/MassOperationsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ObserverTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Integration/Service/V1/AuthorizationServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/RecurringPayment/Model/Plugin/TabsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/NotifierTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Address/ValidatorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/CreditmemoCommentIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/CreditmemoIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/InvoiceCommentIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/InvoiceIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/OrderCommentIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/OrderIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/ShipmentCommentIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/ShipmentIdentityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/Stub/ScopeConfigInterfaceMock.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Container/TemplateTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/CreditmemoSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/InvoiceSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/OrderCommentSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/OrderSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Sender/ShipmentSenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/SenderBuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Email/Stub/TransportInterfaceMock.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Status/History/ValidatorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Quote/Address/ValidatorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/AddressTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Status/HistoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CommentTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoCommentTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoItemTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceItemTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderAddressTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderItemTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderMapperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderPaymentTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderStatusHistoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentItemTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTrackTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderAddressUpdateTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderCancelTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderCommentsListTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderGetStatusTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderGetTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderHoldTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderListTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderNotifyUserTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderStatusHistoryAddTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderUnHoldTest.php create mode 100644 dev/tests/unit/testsuite/Magento/User/Model/Authorization/AdminSessionUserContextTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/GuestUserContextTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/OauthUserContextTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/TokenUserContextTest.php rename dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/{IntegrationServiceV1Test.php => Service/V1/IntegrationTest.php} (52%) create mode 100644 dev/tests/unit/testsuite/Magento/Webapi/Model/WebapiRoleLocatorTest.php rename dev/tests/unit/testsuite/Magento/{Backend/Model => }/_files/session_backend_mock.php (100%) rename {app/code/Magento/AdminNotification/Model/System => lib/internal/Magento/Framework/Notification}/MessageInterface.php (88%) rename {app/code/Magento/AdminNotification/Model/System => lib/internal/Magento/Framework/Notification}/MessageList.php (70%) create mode 100644 lib/internal/Magento/Framework/Notification/NotifierInterface.php create mode 100644 lib/internal/Magento/Framework/Notification/NotifierList.php create mode 100644 lib/internal/Magento/Framework/Notification/NotifierPool.php create mode 100644 lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php create mode 100644 lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php create mode 100644 lib/internal/Magento/Framework/Search/Request.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Aggregation/Range.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Aggregation/RangeBucket.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Aggregation/TermBucket.php create mode 100644 lib/internal/Magento/Framework/Search/Request/BucketInterface.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Config.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Config/Converter.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Config/SchemaLocator.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Filter/Bool.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Filter/Range.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Filter/Term.php create mode 100644 lib/internal/Magento/Framework/Search/Request/FilterInterface.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Mapper.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Query/Bool.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Query/Filter.php create mode 100644 lib/internal/Magento/Framework/Search/Request/Query/Match.php create mode 100644 lib/internal/Magento/Framework/Search/Request/QueryInterface.php create mode 100644 lib/internal/Magento/Framework/Search/RequestFactory.php create mode 100644 lib/internal/Magento/Framework/Search/RequestInterface.php rename dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php => lib/internal/Magento/Framework/Search/Response.php (88%) rename app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Grouped.php => lib/internal/Magento/Framework/Search/ResponseInterface.php (86%) rename dev/tests/integration/testsuite/Magento/Authz/Service/AuthorizationV1Test/UserLocatorStub.php => lib/internal/Magento/Framework/Search/SearchEngine.php (75%) create mode 100644 lib/internal/Magento/Framework/Search/SearchEngineInterface.php create mode 100644 lib/internal/Magento/Framework/Search/etc/requests.xsd create mode 100644 lib/internal/Magento/Framework/Search/etc/search_request.xsd create mode 100644 lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd create mode 100644 lib/internal/Magento/Framework/Service/Code/Generator/Builder.php create mode 100644 lib/internal/Magento/Framework/Service/Code/Generator/Mapper.php create mode 100644 lib/internal/Magento/Framework/Service/Code/Generator/SearchResults.php create mode 100644 lib/internal/Magento/Framework/Service/Code/Generator/SearchResultsBuilder.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/CookieMetadata.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/CookieMetadataFactory.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/CookieScope.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/CookieSizeLimitReachedException.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/FailureToSendException.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/PublicCookieMetadata.php create mode 100644 lib/internal/Magento/Framework/Stdlib/Cookie/SensitiveCookieMetadata.php create mode 100644 lib/internal/Magento/Framework/Stdlib/CookieManager.php create mode 100644 lib/internal/Zend/ServiceManager/AbstractFactoryInterface.php create mode 100644 lib/internal/Zend/ServiceManager/AbstractPluginManager.php create mode 100644 lib/internal/Zend/ServiceManager/Config.php create mode 100644 lib/internal/Zend/ServiceManager/ConfigInterface.php create mode 100644 lib/internal/Zend/ServiceManager/Di/DiAbstractServiceFactory.php create mode 100644 lib/internal/Zend/ServiceManager/Di/DiInstanceManagerProxy.php create mode 100644 lib/internal/Zend/ServiceManager/Di/DiServiceFactory.php create mode 100644 lib/internal/Zend/ServiceManager/Di/DiServiceInitializer.php create mode 100644 lib/internal/Zend/ServiceManager/Exception/CircularDependencyFoundException.php create mode 100644 lib/internal/Zend/ServiceManager/Exception/ExceptionInterface.php create mode 100644 lib/internal/Zend/ServiceManager/Exception/InvalidArgumentException.php create mode 100644 lib/internal/Zend/ServiceManager/Exception/InvalidServiceNameException.php create mode 100644 lib/internal/Zend/ServiceManager/Exception/RuntimeException.php create mode 100644 lib/internal/Zend/ServiceManager/Exception/ServiceNotCreatedException.php create mode 100644 lib/internal/Zend/ServiceManager/Exception/ServiceNotFoundException.php create mode 100644 lib/internal/Zend/ServiceManager/FactoryInterface.php create mode 100644 lib/internal/Zend/ServiceManager/InitializerInterface.php create mode 100644 lib/internal/Zend/ServiceManager/ServiceLocatorAwareInterface.php create mode 100644 lib/internal/Zend/ServiceManager/ServiceLocatorInterface.php create mode 100644 lib/internal/Zend/ServiceManager/ServiceManager.php create mode 100644 lib/internal/Zend/ServiceManager/ServiceManagerAwareInterface.php create mode 100644 lib/internal/Zend/ServiceManager/composer.json diff --git a/.gitignore b/.gitignore index 7a2f12aac254..90b240f3af0e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ atlassian* /var/* !/var/.htaccess +/vendor diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a4d7ccf5c67..a00a72467d32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,58 @@ +0.1.0-alpha90 +============= + * Service layer implementation: + * Created the Admin Shopping Cart Service + * Created the Create Shopping Cart Items Service + * Created the Create Shopping Cart Shipping Address Service + * Created the Create Shopping Cart Billing Address Service + * Created the Service Layer for Orders + * Created CRUD service & APIs to manage options for configurable products + * Created CRUD service & APIs to manage options for bundle products + * Fixed bugs: + * Fixed an issue where adding a customer address with an invalid value of the custom address attribute caused a fatal error in SOAP + * Fixed an issue where the wrong FedEx rates were displayed + * Fixed an issue where the Bill Me Later option did not work in Payflow payment methods + * Fixed an issue where order comments were broken for orders placed with Authorize.net + * Fixed the naming of the My Account -> Recurring Payment page + * Fixed a UI elements issue in the disabled Magento_PayPalRecurringPayment and Magento_RecurringPayment modules + * Fixed an issue where it was impossible to save configuration of a configurable product when adding it to an order in the Admin panel + * Fixed an issue where the Select a store page was displayed during admin order creation when the Single Store mode was enabled + * Fixed an issue when an exception was thrown when attempting to open the Customer Account page if the Recently Viewed widget was configured for the store + * Updated the content of the Privacy Policy page + * Fixed an issue where it was possible to update a tax rate using the POST http method + * Fixed an issue where it was impossible to update Inventory Qty for a SKU using API + * Fixed a JavaScript syntax error on the Create New Customer page + * Fixed an issue where it was impossible to add new sample while creating a downloadable product + * Fixed a JavaScript which appeared when clicking the Add New Address button in the Address Book on the storefront + * Fixed an issue where it was possible to update Tax Rules using the PUT http method which is supposed to be used for create operation only + * Fixed an issue where it was possible to create a Tax Rule specifying a product tax class instead of a customer tax class and vice versa + * Fixed an issue with making websiteId a mandatory field when updating a customer using REST + * Fixed an issue where the default value was not applied after clicking the 'Use default' link for a product price field in the catalog in the Admin panel + * Fixed an issue where the price update mass action could not be performed + * Fixed a JS error in the cross-sells product settings in the Admin panel + * Added the following functional tests: + * Mass Delete Backend Customer + * Moderate Product Review + * Framework improvements: + * Added the ability to access admin functionality using admin user login for mobile + * Refactored and unified Access Control List (ACL) to make it more consistent + * Created a Cookie Manager (a cookie management class) + * Changes in functional tests: + * Enabled the CustomerMetadataService tests for SOAP + * Themes update: + * Fixed issues in the Blank theme + * Implemented improvements for the Blank theme, core templates and Storefront UI Library + * Modularity: + * Created the Notification library component and made it possible to disable the AdminNotification module + * Made it possible to disable the SendToFriend module + * Created an optional ConfigurableImportExport module to remove dependency between the CatalogImportExport and ConfigurableProduct modules + * Created an optional GroupedImportExport module to remove dependency between the CatalogImportExport and GroupedProduct modules + * Introduce search library: + * Created a Search request configuration + * Created a Query object structure from the XML declaration + * Composer Integration: + * Added support for using 3rd-party components as Composer packages + 0.1.0-alpha89 ============= * Fixed bugs: diff --git a/README.md b/README.md index fe79310ea4cc..2b7d837ea174 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,4 @@ All Submissions you make to Magento, an eBay Inc. company (“Magento”) throug 1. You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission”) you submit through GitHub. 2. Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. +3. You agree to the X.commerce Agreement found here: https://www.x.com/developers/x.commerce/x.commerce-user-agreement. diff --git a/app/autoload.php b/app/autoload.php index f2ab699eefe5..073340091ce7 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -23,5 +23,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +$vendorDir = require __DIR__ . '/etc/vendor_path.php'; +$vendorAutoload = __DIR__ . '/../' . $vendorDir . '/autoload.php'; +if (file_exists($vendorAutoload)) { + require_once $vendorAutoload; +} require_once __DIR__ . '/../lib/internal/Magento/Framework/Autoload/IncludePath.php'; spl_autoload_register([new \Magento\Framework\Autoload\IncludePath(), 'load']); diff --git a/app/bootstrap.php b/app/bootstrap.php index f9b998c6bce1..31abb9bdfa5c 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -30,9 +30,9 @@ umask(0); /* PHP version validation */ -if (version_compare(phpversion(), '5.4.0', '<') === true) { +if (version_compare(phpversion(), '5.4.11', '<') === true) { if (PHP_SAPI == 'cli') { - echo 'Magento supports PHP 5.4.0 or newer. Please read http://www.magento.com/install.'; + echo 'Magento supports PHP 5.4.11 or newer. Please read http://www.magento.com/install.'; } else { echo << @@ -40,7 +40,7 @@

Whoops, it looks like you have an invalid PHP version.

-

Magento supports PHP 5.4.0 or newer. +

Magento supports PHP 5.4.11 or newer. Find out how to install Magento using PHP-CGI as a work-around.

@@ -60,7 +60,6 @@ * Require necessary files */ require_once BP . '/app/functions.php'; - require_once __DIR__ . '/autoload.php'; (new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array(BP . '/app/code', BP . '/lib/internal')); $classMapPath = BP . '/var/classmap.ser'; diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php index e227a878d8c2..a3be2bc9ccef 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php @@ -25,6 +25,8 @@ */ namespace Magento\AdminNotification\Block\Grid\Renderer; +use \Magento\Framework\Notification\MessageInterface; + class Severity extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** @@ -58,21 +60,21 @@ public function render(\Magento\Framework\Object $row) $value = ''; switch ($row->getData($this->getColumn()->getIndex())) { - case \Magento\AdminNotification\Model\Inbox::SEVERITY_CRITICAL: + case MessageInterface::SEVERITY_CRITICAL: $class = 'critical'; - $value = $this->_notice->getSeverities(\Magento\AdminNotification\Model\Inbox::SEVERITY_CRITICAL); + $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_CRITICAL); break; - case \Magento\AdminNotification\Model\Inbox::SEVERITY_MAJOR: + case MessageInterface::SEVERITY_MAJOR: $class = 'major'; - $value = $this->_notice->getSeverities(\Magento\AdminNotification\Model\Inbox::SEVERITY_MAJOR); + $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_MAJOR); break; - case \Magento\AdminNotification\Model\Inbox::SEVERITY_MINOR: + case MessageInterface::SEVERITY_MINOR: $class = 'minor'; - $value = $this->_notice->getSeverities(\Magento\AdminNotification\Model\Inbox::SEVERITY_MINOR); + $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_MINOR); break; - case \Magento\AdminNotification\Model\Inbox::SEVERITY_NOTICE: + case MessageInterface::SEVERITY_NOTICE: $class = 'notice'; - $value = $this->_notice->getSeverities(\Magento\AdminNotification\Model\Inbox::SEVERITY_NOTICE); + $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_NOTICE); break; } return '' . $value . ''; diff --git a/app/code/Magento/AdminNotification/Block/System/Messages.php b/app/code/Magento/AdminNotification/Block/System/Messages.php index 19695d3a9e4b..9af0a88bfcc2 100644 --- a/app/code/Magento/AdminNotification/Block/System/Messages.php +++ b/app/code/Magento/AdminNotification/Block/System/Messages.php @@ -70,14 +70,14 @@ protected function _toHtml() /** * Retrieve message list * - * @return \Magento\AdminNotification\Model\System\MessageInterface[] + * @return \Magento\Framework\Notification\MessageInterface[] */ public function getLastCritical() { $items = array_values($this->_messages->getItems()); if (isset( $items[0] - ) && $items[0]->getSeverity() == \Magento\AdminNotification\Model\System\MessageInterface::SEVERITY_CRITICAL + ) && $items[0]->getSeverity() == \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL ) { return $items[0]; } @@ -92,7 +92,7 @@ public function getLastCritical() public function getCriticalCount() { return $this->_messages->getCountBySeverity( - \Magento\AdminNotification\Model\System\MessageInterface::SEVERITY_CRITICAL + \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL ); } @@ -104,7 +104,7 @@ public function getCriticalCount() public function getMajorCount() { return $this->_messages->getCountBySeverity( - \Magento\AdminNotification\Model\System\MessageInterface::SEVERITY_MAJOR + \Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR ); } diff --git a/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php b/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php index fbc13f175526..e5e88769696b 100644 --- a/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php +++ b/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php @@ -17,13 +17,13 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\AdminNotification\Block\System\Messages; -use Magento\AdminNotification\Model\System\MessageInterface; +use Magento\Framework\Notification\MessageInterface; class UnreadMessagePopup extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/AdminNotification/Model/Inbox.php b/app/code/Magento/AdminNotification/Model/Inbox.php index 7e762b79a6e0..e620d1472a61 100644 --- a/app/code/Magento/AdminNotification/Model/Inbox.php +++ b/app/code/Magento/AdminNotification/Model/Inbox.php @@ -23,6 +23,9 @@ */ namespace Magento\AdminNotification\Model; +use \Magento\Framework\Notification\MessageInterface; +use \Magento\Framework\Notification\NotifierInterface; + /** * AdminNotification Inbox model * @@ -45,16 +48,8 @@ * * @author Magento Core Team */ -class Inbox extends \Magento\Framework\Model\AbstractModel +class Inbox extends \Magento\Framework\Model\AbstractModel implements NotifierInterface { - const SEVERITY_CRITICAL = 1; - - const SEVERITY_MAJOR = 2; - - const SEVERITY_MINOR = 3; - - const SEVERITY_NOTICE = 4; - /** * @return void */ @@ -72,10 +67,10 @@ protected function _construct() public function getSeverities($severity = null) { $severities = array( - self::SEVERITY_CRITICAL => __('critical'), - self::SEVERITY_MAJOR => __('major'), - self::SEVERITY_MINOR => __('minor'), - self::SEVERITY_NOTICE => __('notice') + MessageInterface::SEVERITY_CRITICAL => __('critical'), + MessageInterface::SEVERITY_MAJOR => __('major'), + MessageInterface::SEVERITY_MINOR => __('minor'), + MessageInterface::SEVERITY_NOTICE => __('notice') ); if (!is_null($severity)) { @@ -118,7 +113,8 @@ public function getNoticeStatus() */ public function parse(array $data) { - return $this->getResource()->parse($this, $data); + $this->getResource()->parse($this, $data); + return $this; } /** @@ -167,7 +163,7 @@ public function add($severity, $title, $description, $url = '', $isInternal = tr */ public function addCritical($title, $description, $url = '', $isInternal = true) { - $this->add(self::SEVERITY_CRITICAL, $title, $description, $url, $isInternal); + $this->add(MessageInterface::SEVERITY_CRITICAL, $title, $description, $url, $isInternal); return $this; } @@ -182,7 +178,7 @@ public function addCritical($title, $description, $url = '', $isInternal = true) */ public function addMajor($title, $description, $url = '', $isInternal = true) { - $this->add(self::SEVERITY_MAJOR, $title, $description, $url, $isInternal); + $this->add(MessageInterface::SEVERITY_MAJOR, $title, $description, $url, $isInternal); return $this; } @@ -197,7 +193,7 @@ public function addMajor($title, $description, $url = '', $isInternal = true) */ public function addMinor($title, $description, $url = '', $isInternal = true) { - $this->add(self::SEVERITY_MINOR, $title, $description, $url, $isInternal); + $this->add(MessageInterface::SEVERITY_MINOR, $title, $description, $url, $isInternal); return $this; } @@ -212,7 +208,7 @@ public function addMinor($title, $description, $url = '', $isInternal = true) */ public function addNotice($title, $description, $url = '', $isInternal = true) { - $this->add(self::SEVERITY_NOTICE, $title, $description, $url, $isInternal); + $this->add(MessageInterface::SEVERITY_NOTICE, $title, $description, $url, $isInternal); return $this; } } diff --git a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php index 870c60a0c1a0..48086ca6ec03 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php @@ -54,7 +54,7 @@ protected function _initSelect() array('neq' => 1) )->addFieldToFilter( 'severity', - \Magento\AdminNotification\Model\Inbox::SEVERITY_CRITICAL + \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL )->setPageSize( 1 ); diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php index 8e44afd3851e..bea61d7a1c42 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php @@ -17,7 +17,7 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac /** * System message list * - * @var \Magento\AdminNotification\Model\System\MessageList + * @var \Magento\Framework\Notification\MessageList */ protected $_messageList; @@ -44,7 +44,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac * @param \Magento\Framework\Logger $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\AdminNotification\Model\System\MessageList $messageList + * @param \Magento\Framework\Notification\MessageList $messageList * @param mixed $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ @@ -53,7 +53,7 @@ public function __construct( \Magento\Framework\Logger $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\AdminNotification\Model\System\MessageList $messageList, + \Magento\Framework\Notification\MessageList $messageList, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php index c848602c9de0..444e85dfa2e7 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php @@ -17,7 +17,7 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ class Synchronized extends \Magento\AdminNotification\Model\Resource\System\Mess /** * Unread message list * - * @var \Magento\AdminNotification\Model\System\MessageInterface[] + * @var \Magento\Framework\Notification\MessageInterface[] */ protected $_unreadMessages = array(); @@ -74,7 +74,7 @@ public function _afterLoad() /** * Retrieve list of unread messages * - * @return \Magento\AdminNotification\Model\System\MessageInterface[] + * @return \Magento\Framework\Notification\MessageInterface[] */ public function getUnread() { diff --git a/app/code/Magento/AdminNotification/Model/System/Message.php b/app/code/Magento/AdminNotification/Model/System/Message.php index d4588cf27e11..470140478480 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/System/Message.php @@ -17,13 +17,13 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\AdminNotification\Model\System; -class Message extends \Magento\Framework\Model\AbstractModel implements \Magento\AdminNotification\Model\System\MessageInterface +class Message extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Notification\MessageInterface { /** * @return void diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php b/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php index 2ede00eb20d1..92cc992a3b3a 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\System\Message; -class Baseurl implements \Magento\AdminNotification\Model\System\MessageInterface +class Baseurl implements \Magento\Framework\Notification\MessageInterface { /** * @var \Magento\Framework\UrlInterface diff --git a/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php b/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php index a7f57b85e212..75154b6ad9c5 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\System\Message; -class CacheOutdated implements \Magento\AdminNotification\Model\System\MessageInterface +class CacheOutdated implements \Magento\Framework\Notification\MessageInterface { /** * @var \Magento\Framework\UrlInterface @@ -124,6 +124,6 @@ public function getLink() */ public function getSeverity() { - return \Magento\AdminNotification\Model\System\MessageInterface::SEVERITY_CRITICAL; + return \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL; } } diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php index 5e1c628a00dc..515b60a1229b 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\System\Message\Media; -abstract class AbstractSynchronization implements \Magento\AdminNotification\Model\System\MessageInterface +abstract class AbstractSynchronization implements \Magento\Framework\Notification\MessageInterface { /** * @var \Magento\Core\Model\File\Storage\Flag @@ -94,6 +94,6 @@ public function isDisplayed() */ public function getSeverity() { - return \Magento\AdminNotification\Model\System\MessageInterface::SEVERITY_MAJOR; + return \Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR; } } diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Security.php b/app/code/Magento/AdminNotification/Model/System/Message/Security.php index 6a67afb6d0ff..be4632352156 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Security.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Security.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\System\Message; -class Security implements \Magento\AdminNotification\Model\System\MessageInterface +class Security implements \Magento\Framework\Notification\MessageInterface { /** * Cache key for saving verification result @@ -160,6 +160,6 @@ public function getText() */ public function getSeverity() { - return \Magento\AdminNotification\Model\System\MessageInterface::SEVERITY_CRITICAL; + return \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL; } } diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index d6f84501f547..ebd21d9c35d9 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-admin-notification", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/acl.xml b/app/code/Magento/AdminNotification/etc/acl.xml similarity index 95% rename from app/code/Magento/AdminNotification/etc/adminhtml/acl.xml rename to app/code/Magento/AdminNotification/etc/acl.xml index 86839ec9013d..46059d5147d9 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/acl.xml +++ b/app/code/Magento/AdminNotification/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/di.xml b/app/code/Magento/AdminNotification/etc/adminhtml/di.xml index 3c16d79e9a5e..9c8ba85f63df 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/di.xml +++ b/app/code/Magento/AdminNotification/etc/adminhtml/di.xml @@ -24,13 +24,12 @@ */ --> - + Magento\AdminNotification\Model\System\Message\Baseurl Magento\AdminNotification\Model\System\Message\Security Magento\AdminNotification\Model\System\Message\CacheOutdated - Magento\AdminNotification\Model\System\Message\Survey Magento\AdminNotification\Model\System\Message\Media\Synchronization\Error Magento\AdminNotification\Model\System\Message\Media\Synchronization\Success diff --git a/app/code/Magento/AdminNotification/etc/di.xml b/app/code/Magento/AdminNotification/etc/di.xml new file mode 100644 index 000000000000..a6372146ba8f --- /dev/null +++ b/app/code/Magento/AdminNotification/etc/di.xml @@ -0,0 +1,34 @@ + + + + + + + Magento\AdminNotification\Model\Inbox + + + + diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js index 710f9b6561af..b5710b6b0286 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js +++ b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js @@ -55,18 +55,6 @@ define([ }); $(document).ready(function(){ - $('body').on('surveyYes surveyNo', function(e, data) { - if (e.type == 'surveyYes') { - var win = window.open(data.surveyUrl, '', 'width=900,height=600,resizable=1,scrollbars=1'); - win.focus(); - } - $.ajax({ - url: data.surveyAction, - type: 'post', - data: {decision: data.decision} - }) - }); - $('#system_messages .message-system-short .error').on('click', function() { $('#message-system-all').systemMessageDialog('open', 1); }); @@ -75,4 +63,4 @@ define([ }); }); -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Authorization/Model/Acl/AclRetriever.php b/app/code/Magento/Authorization/Model/Acl/AclRetriever.php new file mode 100644 index 000000000000..2e131fb3e149 --- /dev/null +++ b/app/code/Magento/Authorization/Model/Acl/AclRetriever.php @@ -0,0 +1,165 @@ +logger = $logger; + $this->rulesCollectionFactory = $rulesCollectionFactory; + $this->aclBuilder = $aclBuilder; + $this->roleCollectionFactory = $roleCollectionFactory; + } + + /** + * Get a list of available resources using user details + * + * @param string $userType + * @param int $userId + * @return string[] + * @throws AuthorizationException + * @throws LocalizedException + */ + public function getAllowedResourcesByUser($userType, $userId) + { + if ($userType == UserContextInterface::USER_TYPE_GUEST) { + return [self::PERMISSION_ANONYMOUS]; + } elseif ($userType == UserContextInterface::USER_TYPE_CUSTOMER) { + return [self::PERMISSION_SELF]; + } + try { + $role = $this->_getUserRole($userType, $userId); + if (!$role) { + throw new AuthorizationException('The role associated with the specified user cannot be found.'); + } + $allowedResources = $this->getAllowedResourcesByRole($role->getId()); + } catch (AuthorizationException $e) { + throw $e; + } catch (\Exception $e) { + $this->logger->logException($e); + throw new LocalizedException( + 'Error happened while getting a list of allowed resources. Check exception log for details.' + ); + } + return $allowedResources; + } + + /** + * Get a list of available resource using user role id + * + * @param string $roleId + * @return string[] + */ + public function getAllowedResourcesByRole($roleId) + { + $allowedResources = []; + $rulesCollection = $this->rulesCollectionFactory->create(); + $rulesCollection->getByRoles($roleId)->load(); + $acl = $this->aclBuilder->getAcl(); + /** @var \Magento\Authorization\Model\Rules $ruleItem */ + foreach ($rulesCollection->getItems() as $ruleItem) { + $resourceId = $ruleItem->getResourceId(); + if ($acl->has($resourceId) && $acl->isAllowed($roleId, $resourceId)) { + $allowedResources[] = $resourceId; + } + } + return $allowedResources; + } + + /** + * Identify user role from user identifier. + * + * @param string $userType + * @param int $userId + * @return \Magento\Authorization\Model\Role|bool False if no role associated with provided user was found. + * @throws \LogicException + */ + protected function _getUserRole($userType, $userId) + { + if (!$this->_canRoleBeCreatedForUserType($userType)) { + throw new \LogicException( + "The role with user type '{$userType}' does not exist and cannot be created" + ); + } + $roleCollection = $this->roleCollectionFactory->create(); + /** @var Role $role */ + $role = $roleCollection->setUserFilter($userId, $userType)->getFirstItem(); + return $role->getId() ? $role : false; + } + + /** + * Check if the role can be associated with user having provided user type. + * + * Roles can be created for integrations and admin users only. + * + * @param int $userType + * @return bool + */ + protected function _canRoleBeCreatedForUserType($userType) + { + return ($userType == UserContextInterface::USER_TYPE_INTEGRATION) + || ($userType == UserContextInterface::USER_TYPE_ADMIN); + } +} diff --git a/app/code/Magento/User/Model/Acl/Loader/Role.php b/app/code/Magento/Authorization/Model/Acl/Loader/Role.php similarity index 79% rename from app/code/Magento/User/Model/Acl/Loader/Role.php rename to app/code/Magento/Authorization/Model/Acl/Loader/Role.php index 4054deab3250..dc82131a87f3 100644 --- a/app/code/Magento/User/Model/Acl/Loader/Role.php +++ b/app/code/Magento/Authorization/Model/Acl/Loader/Role.php @@ -21,10 +21,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Acl\Loader; +namespace Magento\Authorization\Model\Acl\Loader; -use Magento\User\Model\Acl\Role\Group as RoleGroup; -use Magento\User\Model\Acl\Role\User as RoleUser; +use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; +use Magento\Authorization\Model\Acl\Role\User as RoleUser; class Role implements \Magento\Framework\Acl\LoaderInterface { @@ -34,23 +34,23 @@ class Role implements \Magento\Framework\Acl\LoaderInterface protected $_resource; /** - * @var \Magento\User\Model\Acl\Role\GroupFactory + * @var \Magento\Authorization\Model\Acl\Role\GroupFactory */ protected $_groupFactory; /** - * @var \Magento\User\Model\Acl\Role\UserFactory + * @var \Magento\Authorization\Model\Acl\Role\UserFactory */ protected $_roleFactory; /** - * @param \Magento\User\Model\Acl\Role\GroupFactory $groupFactory - * @param \Magento\User\Model\Acl\Role\UserFactory $roleFactory + * @param \Magento\Authorization\Model\Acl\Role\GroupFactory $groupFactory + * @param \Magento\Authorization\Model\Acl\Role\UserFactory $roleFactory * @param \Magento\Framework\App\Resource $resource */ public function __construct( - \Magento\User\Model\Acl\Role\GroupFactory $groupFactory, - \Magento\User\Model\Acl\Role\UserFactory $roleFactory, + \Magento\Authorization\Model\Acl\Role\GroupFactory $groupFactory, + \Magento\Authorization\Model\Acl\Role\UserFactory $roleFactory, \Magento\Framework\App\Resource $resource ) { $this->_resource = $resource; @@ -66,7 +66,7 @@ public function __construct( */ public function populateAcl(\Magento\Framework\Acl $acl) { - $roleTableName = $this->_resource->getTableName('admin_role'); + $roleTableName = $this->_resource->getTableName('authorization_role'); $adapter = $this->_resource->getConnection('core_read'); $select = $adapter->select()->from($roleTableName)->order('tree_level'); diff --git a/app/code/Magento/User/Model/Acl/Loader/Rule.php b/app/code/Magento/Authorization/Model/Acl/Loader/Rule.php similarity index 95% rename from app/code/Magento/User/Model/Acl/Loader/Rule.php rename to app/code/Magento/Authorization/Model/Acl/Loader/Rule.php index 25230c259ff8..8a2953d65d1f 100644 --- a/app/code/Magento/User/Model/Acl/Loader/Rule.php +++ b/app/code/Magento/Authorization/Model/Acl/Loader/Rule.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Acl\Loader; +namespace Magento\Authorization\Model\Acl\Loader; class Rule implements \Magento\Framework\Acl\LoaderInterface { @@ -53,7 +53,7 @@ public function __construct( */ public function populateAcl(\Magento\Framework\Acl $acl) { - $ruleTable = $this->_resource->getTableName("admin_rule"); + $ruleTable = $this->_resource->getTableName("authorization_rule"); $adapter = $this->_resource->getConnection('core_read'); diff --git a/app/code/Magento/User/Model/Acl/Role/Generic.php b/app/code/Magento/Authorization/Model/Acl/Role/Generic.php similarity index 93% rename from app/code/Magento/User/Model/Acl/Role/Generic.php rename to app/code/Magento/Authorization/Model/Acl/Role/Generic.php index 80a8b3f6cdee..3b39cf76eaac 100644 --- a/app/code/Magento/User/Model/Acl/Role/Generic.php +++ b/app/code/Magento/Authorization/Model/Acl/Role/Generic.php @@ -21,10 +21,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Acl\Role; +namespace Magento\Authorization\Model\Acl\Role; /** - * User acl role + * Generic acl role */ class Generic extends \Zend_Acl_Role { diff --git a/app/code/Magento/User/Model/Acl/Role/Group.php b/app/code/Magento/Authorization/Model/Acl/Role/Group.php similarity index 90% rename from app/code/Magento/User/Model/Acl/Role/Group.php rename to app/code/Magento/Authorization/Model/Acl/Role/Group.php index 08b5df206884..7c2346d4f59d 100644 --- a/app/code/Magento/User/Model/Acl/Role/Group.php +++ b/app/code/Magento/Authorization/Model/Acl/Role/Group.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Acl\Role; +namespace Magento\Authorization\Model\Acl\Role; /** * Acl Group model */ -class Group extends \Magento\User\Model\Acl\Role\Generic +class Group extends \Magento\Authorization\Model\Acl\Role\Generic { /** * All the group roles are prepended by G diff --git a/app/code/Magento/User/Model/Acl/Role/User.php b/app/code/Magento/Authorization/Model/Acl/Role/User.php similarity index 90% rename from app/code/Magento/User/Model/Acl/Role/User.php rename to app/code/Magento/Authorization/Model/Acl/Role/User.php index 4d37e7ca89ad..69383609782c 100644 --- a/app/code/Magento/User/Model/Acl/Role/User.php +++ b/app/code/Magento/Authorization/Model/Acl/Role/User.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Acl\Role; +namespace Magento\Authorization\Model\Acl\Role; /** * User acl role */ -class User extends \Magento\User\Model\Acl\Role\Generic +class User extends \Magento\Authorization\Model\Acl\Role\Generic { /** * All the user roles are prepended by U diff --git a/app/code/Magento/Authorization/Model/CompositeUserContext.php b/app/code/Magento/Authorization/Model/CompositeUserContext.php new file mode 100644 index 000000000000..5707ac12a325 --- /dev/null +++ b/app/code/Magento/Authorization/Model/CompositeUserContext.php @@ -0,0 +1,129 @@ +add($userContext['type']); + } + } + + /** + * Add user context. + * + * @param UserContextInterface $userContext + * @return CompositeUserContext + */ + protected function add(UserContextInterface $userContext) + { + $this->userContexts[] = $userContext; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getUserId() + { + return $this->getUserContext() ? $this->getUserContext()->getUserId() : null; + } + + /** + * {@inheritdoc} + */ + public function getUserType() + { + return $this->getUserContext() ? $this->getUserContext()->getUserType() : null; + } + + /** + * Retrieve user context + * + * @return UserContextInterface|bool False if none of the registered user contexts can identify user type + */ + protected function getUserContext() + { + if (is_null($this->chosenUserContext)) { + /** @var UserContextInterface $userContext */ + foreach ($this->userContexts as $userContext) { + if ($userContext->getUserType() && !is_null($userContext->getUserId())) { + $this->chosenUserContext = $userContext; + break; + } + } + if (is_null($this->chosenUserContext)) { + $this->chosenUserContext = false; + } + } + return $this->chosenUserContext; + } + + /** + * Compare contexts sortOrder + * + * @param array $contextDataFirst + * @param array $contextDataSecond + * @return int + */ + protected function compareContextsSortOrder($contextDataFirst, $contextDataSecond) + { + if ((int)$contextDataFirst['sortOrder'] == (int)$contextDataSecond['sortOrder']) { + return 0; + } + + if ((int)$contextDataFirst['sortOrder'] < (int)$contextDataSecond['sortOrder']) { + return -1; + } else { + return 1; + } + } +} diff --git a/app/code/Magento/User/Model/Resource/Permissions/Collection.php b/app/code/Magento/Authorization/Model/Resource/Permissions/Collection.php similarity index 88% rename from app/code/Magento/User/Model/Resource/Permissions/Collection.php rename to app/code/Magento/Authorization/Model/Resource/Permissions/Collection.php index 2ca9f8d6506b..4fca3cee80e1 100644 --- a/app/code/Magento/User/Model/Resource/Permissions/Collection.php +++ b/app/code/Magento/Authorization/Model/Resource/Permissions/Collection.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Resource\Permissions; +namespace Magento\Authorization\Model\Resource\Permissions; /** * Admin permissions collection @@ -37,6 +37,6 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac */ protected function _construct() { - $this->_init('Magento\User\Model\Rules', 'Magento\User\Model\Resource\Rules'); + $this->_init('Magento\Authorization\Model\Rules', 'Magento\Authorization\Model\Resource\Rules'); } } diff --git a/app/code/Magento/User/Model/Resource/Role.php b/app/code/Magento/Authorization/Model/Resource/Role.php similarity index 76% rename from app/code/Magento/User/Model/Resource/Role.php rename to app/code/Magento/Authorization/Model/Resource/Role.php index ea45c024f84d..e79cf181e42b 100644 --- a/app/code/Magento/User/Model/Resource/Role.php +++ b/app/code/Magento/Authorization/Model/Resource/Role.php @@ -21,22 +21,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Resource; +namespace Magento\Authorization\Model\Resource; -use Magento\User\Model\Acl\Role\User as RoleUser; +use Magento\Authorization\Model\Acl\Role\User as RoleUser; /** * Admin role resource model */ class Role extends \Magento\Framework\Model\Resource\Db\AbstractDb { - /** - * Users table - * - * @var string - */ - protected $_usersTable; - /** * Rule table * @@ -78,10 +71,8 @@ public function __construct( */ protected function _construct() { - $this->_init('admin_role', 'role_id'); - - $this->_usersTable = $this->getTable('admin_user'); - $this->_ruleTable = $this->getTable('admin_rule'); + $this->_init('authorization_role', 'role_id'); + $this->_ruleTable = $this->getTable('authorization_rule'); } /** @@ -139,7 +130,6 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $role) */ protected function _afterSave(\Magento\Framework\Model\AbstractModel $role) { - $this->_updateRoleUsersAcl($role); $this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(\Magento\Backend\Block\Menu::CACHE_TAGS)); return $this; } @@ -164,47 +154,21 @@ protected function _afterDelete(\Magento\Framework\Model\AbstractModel $role) /** * Get role users * - * @param \Magento\User\Model\Role $role + * @param \Magento\Authorization\Model\Role $role * @return array */ - public function getRoleUsers(\Magento\User\Model\Role $role) + public function getRoleUsers(\Magento\Authorization\Model\Role $role) { $read = $this->_getReadAdapter(); $binds = array('role_id' => $role->getId(), 'role_type' => RoleUser::ROLE_TYPE); - $select = $read->select()->from( - $this->getMainTable(), - array('user_id') - )->where( - 'parent_id = :role_id' - )->where( - 'role_type = :role_type' - )->where( - 'user_id > 0' - ); + $select = $read->select() + ->from($this->getMainTable(), array('user_id')) + ->where('parent_id = :role_id') + ->where('role_type = :role_type') + ->where('user_id > 0'); return $read->fetchCol($select, $binds); } - - /** - * Update role users ACL - * - * @param \Magento\User\Model\Role $role - * @return bool - */ - private function _updateRoleUsersAcl(\Magento\User\Model\Role $role) - { - $write = $this->_getWriteAdapter(); - $users = $this->getRoleUsers($role); - $rowsCount = 0; - - if (sizeof($users) > 0) { - $bind = array('reload_acl_flag' => 1); - $where = array('user_id IN(?)' => $users); - $rowsCount = $write->update($this->_usersTable, $bind, $where); - } - - return $rowsCount > 0; - } } diff --git a/app/code/Magento/User/Model/Resource/Role/Collection.php b/app/code/Magento/Authorization/Model/Resource/Role/Collection.php similarity index 89% rename from app/code/Magento/User/Model/Resource/Role/Collection.php rename to app/code/Magento/Authorization/Model/Resource/Role/Collection.php index 3cce8f1b699c..98e25949f8a5 100644 --- a/app/code/Magento/User/Model/Resource/Role/Collection.php +++ b/app/code/Magento/Authorization/Model/Resource/Role/Collection.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Resource\Role; +namespace Magento\Authorization\Model\Resource\Role; -use Magento\User\Model\Acl\Role\Group as RoleGroup; +use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; /** * Admin role collection @@ -37,7 +37,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac */ protected function _construct() { - $this->_init('Magento\User\Model\Role', 'Magento\User\Model\Resource\Role'); + $this->_init('Magento\Authorization\Model\Role', 'Magento\Authorization\Model\Resource\Role'); } /** diff --git a/app/code/Magento/User/Model/Resource/Role/Grid/Collection.php b/app/code/Magento/Authorization/Model/Resource/Role/Grid/Collection.php similarity index 85% rename from app/code/Magento/User/Model/Resource/Role/Grid/Collection.php rename to app/code/Magento/Authorization/Model/Resource/Role/Grid/Collection.php index a111d9b1d60a..9355017b41d6 100644 --- a/app/code/Magento/User/Model/Resource/Role/Grid/Collection.php +++ b/app/code/Magento/Authorization/Model/Resource/Role/Grid/Collection.php @@ -21,14 +21,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Resource\Role\Grid; +namespace Magento\Authorization\Model\Resource\Role\Grid; -use Magento\User\Model\Acl\Role\Group as RoleGroup; +use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; /** * Admin role data grid collection */ -class Collection extends \Magento\User\Model\Resource\Role\Collection +class Collection extends \Magento\Authorization\Model\Resource\Role\Collection { /** * Prepare select for load diff --git a/app/code/Magento/User/Model/Resource/Rules.php b/app/code/Magento/Authorization/Model/Resource/Rules.php similarity index 95% rename from app/code/Magento/User/Model/Resource/Rules.php rename to app/code/Magento/Authorization/Model/Resource/Rules.php index 1a82b9a49828..478eff8864c7 100644 --- a/app/code/Magento/User/Model/Resource/Rules.php +++ b/app/code/Magento/Authorization/Model/Resource/Rules.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Resource; +namespace Magento\Authorization\Model\Resource; /** * Admin rule resource model @@ -80,17 +80,17 @@ public function __construct( */ protected function _construct() { - $this->_init('admin_rule', 'rule_id'); + $this->_init('authorization_rule', 'rule_id'); } /** * Save ACL resources * - * @param \Magento\User\Model\Rules $rule + * @param \Magento\Authorization\Model\Rules $rule * @return void * @throws \Magento\Framework\Model\Exception */ - public function saveRel(\Magento\User\Model\Rules $rule) + public function saveRel(\Magento\Authorization\Model\Rules $rule) { try { $adapter = $this->_getWriteAdapter(); diff --git a/app/code/Magento/User/Model/Resource/Rules/Collection.php b/app/code/Magento/Authorization/Model/Resource/Rules/Collection.php similarity index 91% rename from app/code/Magento/User/Model/Resource/Rules/Collection.php rename to app/code/Magento/Authorization/Model/Resource/Rules/Collection.php index 8814282b4404..a07788825876 100644 --- a/app/code/Magento/User/Model/Resource/Rules/Collection.php +++ b/app/code/Magento/Authorization/Model/Resource/Rules/Collection.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Resource\Rules; +namespace Magento\Authorization\Model\Resource\Rules; /** * Rules collection @@ -37,7 +37,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac */ protected function _construct() { - $this->_init('Magento\User\Model\Rules', 'Magento\User\Model\Resource\Rules'); + $this->_init('Magento\Authorization\Model\Rules', 'Magento\Authorization\Model\Resource\Rules'); } /** diff --git a/app/code/Magento/User/Model/Resource/Setup.php b/app/code/Magento/Authorization/Model/Resource/Setup.php similarity index 69% rename from app/code/Magento/User/Model/Resource/Setup.php rename to app/code/Magento/Authorization/Model/Resource/Setup.php index da215bd1e586..e66ee4ec3dd3 100644 --- a/app/code/Magento/User/Model/Resource/Setup.php +++ b/app/code/Magento/Authorization/Model/Resource/Setup.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model\Resource; +namespace Magento\Authorization\Model\Resource; /** * Resource Setup Model @@ -34,49 +34,49 @@ class Setup extends \Magento\Framework\Module\Setup /** * Role model factory * - * @var \Magento\User\Model\RoleFactory + * @var \Magento\Authorization\Model\RoleFactory */ protected $_roleCollectionFactory; /** - * Factory for user rules model + * Factory for rules model * - * @var \Magento\User\Model\RulesFactory + * @var \Magento\Authorization\Model\RulesFactory */ protected $_rulesCollectionFactory; /** * Role model factory * - * @var \Magento\User\Model\RoleFactory + * @var \Magento\Authorization\Model\RoleFactory */ protected $_roleFactory; /** * Rules model factory * - * @var \Magento\User\Model\RulesFactory + * @var \Magento\Authorization\Model\RulesFactory */ protected $_rulesFactory; /** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName - * @param \Magento\User\Model\Resource\Role\CollectionFactory $roleCollectionFactory - * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory - * @param \Magento\User\Model\RoleFactory $roleFactory - * @param \Magento\User\Model\RulesFactory $rulesFactory + * @param \Magento\Authorization\Model\Resource\Role\CollectionFactory $roleCollectionFactory + * @param \Magento\Authorization\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory + * @param \Magento\Authorization\Model\RoleFactory $roleFactory + * @param \Magento\Authorization\Model\RulesFactory $rulesFactory * @param string $moduleName * @param string $connectionName */ public function __construct( \Magento\Framework\Module\Setup\Context $context, $resourceName, - \Magento\User\Model\Resource\Role\CollectionFactory $roleCollectionFactory, - \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory, - \Magento\User\Model\RoleFactory $roleFactory, - \Magento\User\Model\RulesFactory $rulesFactory, - $moduleName = 'Magento_User', + \Magento\Authorization\Model\Resource\Role\CollectionFactory $roleCollectionFactory, + \Magento\Authorization\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory, + \Magento\Authorization\Model\RoleFactory $roleFactory, + \Magento\Authorization\Model\RulesFactory $rulesFactory, + $moduleName = 'Magento_Authorization', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_roleCollectionFactory = $roleCollectionFactory; @@ -89,7 +89,7 @@ public function __construct( /** * Creates role collection * - * @return \Magento\User\Model\Resource\Role\Collection + * @return \Magento\Authorization\Model\Resource\Role\Collection */ public function createRoleCollection() { @@ -99,7 +99,7 @@ public function createRoleCollection() /** * Creates rules collection * - * @return \Magento\User\Model\Resource\Rules\Collection + * @return \Magento\Authorization\Model\Resource\Rules\Collection */ public function createRulesCollection() { @@ -109,7 +109,7 @@ public function createRulesCollection() /** * Creates role model * - * @return \Magento\User\Model\Role + * @return \Magento\Authorization\Model\Role */ public function createRole() { @@ -119,7 +119,7 @@ public function createRole() /** * Creates rules model * - * @return \Magento\User\Model\Rules + * @return \Magento\Authorization\Model\Rules */ public function createRules() { diff --git a/app/code/Magento/User/Model/Role.php b/app/code/Magento/Authorization/Model/Role.php similarity index 58% rename from app/code/Magento/User/Model/Role.php rename to app/code/Magento/Authorization/Model/Role.php index ae3bc63f6346..68d9f9276312 100644 --- a/app/code/Magento/User/Model/Role.php +++ b/app/code/Magento/Authorization/Model/Role.php @@ -21,57 +21,49 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model; +namespace Magento\Authorization\Model; /** * Admin Role Model * - * @method \Magento\User\Model\Resource\Role _getResource() - * @method \Magento\User\Model\Resource\Role getResource() + * @method \Magento\Authorization\Model\Resource\Role _getResource() + * @method \Magento\Authorization\Model\Resource\Role getResource() * @method int getParentId() - * @method \Magento\User\Model\Role setParentId(int $value) + * @method \Magento\Authorization\Model\Role setParentId(int $value) * @method int getTreeLevel() - * @method \Magento\User\Model\Role setTreeLevel(int $value) + * @method \Magento\Authorization\Model\Role setTreeLevel(int $value) * @method int getSortOrder() - * @method \Magento\User\Model\Role setSortOrder(int $value) + * @method \Magento\Authorization\Model\Role setSortOrder(int $value) * @method string getRoleType() - * @method \Magento\User\Model\Role setRoleType(string $value) + * @method \Magento\Authorization\Model\Role setRoleType(string $value) * @method int getUserId() - * @method \Magento\User\Model\Role setUserId(int $value) + * @method \Magento\Authorization\Model\Role setUserId(int $value) * @method string getUserType() - * @method \Magento\User\Model\Role setUserType(string $value) + * @method \Magento\Authorization\Model\Role setUserType(string $value) * @method string getRoleName() - * @method \Magento\User\Model\Role setRoleName(string $value) + * @method \Magento\Authorization\Model\Role setRoleName(string $value) */ class Role extends \Magento\Framework\Model\AbstractModel { /** * @var string */ - protected $_eventPrefix = 'admin_roles'; - - /** - * @var \Magento\User\Model\Resource\Role\User\CollectionFactory - */ - protected $_userRolesFactory; + protected $_eventPrefix = 'authorization_roles'; /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param Resource\Role\User\CollectionFactory $userRolesFactory - * @param Resource\Role $resource - * @param Resource\Role\Collection $resourceCollection + * @param \Magento\Authorization\Model\Resource\Role $resource + * @param \Magento\Authorization\Model\Resource\Role\Collection $resourceCollection * @param array $data */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\User\Model\Resource\Role\User\CollectionFactory $userRolesFactory, - \Magento\User\Model\Resource\Role $resource, - \Magento\User\Model\Resource\Role\Collection $resourceCollection, + \Magento\Authorization\Model\Resource\Role $resource, + \Magento\Authorization\Model\Resource\Role\Collection $resourceCollection, array $data = array() ) { - $this->_userRolesFactory = $userRolesFactory; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -81,7 +73,7 @@ public function __construct( public function __sleep() { $properties = parent::__sleep(); - return array_diff($properties, array('_userRolesFactory', '_resource', '_resourceCollection')); + return array_diff($properties, array('_resource', '_resourceCollection')); } /** @@ -91,9 +83,8 @@ public function __wakeup() { parent::__wakeup(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); - $this->_userRolesFactory = $objectManager->get('Magento\User\Model\Resource\Role\User\CollectionFactory'); - $this->_resource = $objectManager->get('Magento\User\Model\Resource\Role'); - $this->_resourceCollection = $objectManager->get('Magento\User\Model\Resource\Role\Collection'); + $this->_resource = $objectManager->get('Magento\Authorization\Model\Resource\Role'); + $this->_resourceCollection = $objectManager->get('Magento\Authorization\Model\Resource\Role\Collection'); } /** @@ -103,7 +94,7 @@ public function __wakeup() */ protected function _construct() { - $this->_init('Magento\User\Model\Resource\Role'); + $this->_init('Magento\Authorization\Model\Resource\Role'); } /** @@ -117,16 +108,6 @@ public function update() return $this; } - /** - * Retrieve users collection - * - * @return \Magento\User\Model\Resource\Role\User\Collection - */ - public function getUsersCollection() - { - return $this->_userRolesFactory->create(); - } - /** * Return users for role * diff --git a/app/code/Magento/User/Model/Rules.php b/app/code/Magento/Authorization/Model/Rules.php similarity index 68% rename from app/code/Magento/User/Model/Rules.php rename to app/code/Magento/Authorization/Model/Rules.php index abfa69254f88..8418ffaa3ff6 100644 --- a/app/code/Magento/User/Model/Rules.php +++ b/app/code/Magento/Authorization/Model/Rules.php @@ -21,23 +21,24 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\User\Model; + +namespace Magento\Authorization\Model; /** * Admin Rules Model * - * @method \Magento\User\Model\Resource\Rules _getResource() - * @method \Magento\User\Model\Resource\Rules getResource() + * @method \Magento\Authorization\Model\Resource\Rules _getResource() + * @method \Magento\Authorization\Model\Resource\Rules getResource() * @method int getRoleId() - * @method \Magento\User\Model\Rules setRoleId(int $value) + * @method \Magento\Authorization\Model\Rules setRoleId(int $value) * @method string getResourceId() - * @method \Magento\User\Model\Rules setResourceId(string $value) + * @method \Magento\Authorization\Model\Rules setResourceId(string $value) * @method string getPrivileges() - * @method \Magento\User\Model\Rules setPrivileges(string $value) + * @method \Magento\Authorization\Model\Rules setPrivileges(string $value) * @method int getAssertId() - * @method \Magento\User\Model\Rules setAssertId(int $value) + * @method \Magento\Authorization\Model\Rules setAssertId(int $value) * @method string getPermission() - * @method \Magento\User\Model\Rules setPermission(string $value) + * @method \Magento\Authorization\Model\Rules setPermission(string $value) */ class Rules extends \Magento\Framework\Model\AbstractModel { @@ -46,15 +47,15 @@ class Rules extends \Magento\Framework\Model\AbstractModel * * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param Resource\Rules $resource - * @param Resource\Permissions\Collection $resourceCollection + * @param \Magento\Authorization\Model\Resource\Rules $resource + * @param \Magento\Authorization\Model\Resource\Permissions\Collection $resourceCollection * @param array $data */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\User\Model\Resource\Rules $resource, - \Magento\User\Model\Resource\Permissions\Collection $resourceCollection, + \Magento\Authorization\Model\Resource\Rules $resource, + \Magento\Authorization\Model\Resource\Permissions\Collection $resourceCollection, array $data = array() ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); @@ -67,7 +68,7 @@ public function __construct( */ protected function _construct() { - $this->_init('Magento\User\Model\Resource\Rules'); + $this->_init('Magento\Authorization\Model\Resource\Rules'); } /** diff --git a/app/code/Magento/Authz/Model/UserLocatorInterface.php b/app/code/Magento/Authorization/Model/UserContextInterface.php similarity index 76% rename from app/code/Magento/Authz/Model/UserLocatorInterface.php rename to app/code/Magento/Authorization/Model/UserContextInterface.php index 361e62e09ceb..948eb755390f 100644 --- a/app/code/Magento/Authz/Model/UserLocatorInterface.php +++ b/app/code/Magento/Authorization/Model/UserContextInterface.php @@ -21,24 +21,34 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Authz\Model; + +namespace Magento\Authorization\Model; /** * Interface for current user identification. */ -interface UserLocatorInterface +interface UserContextInterface { + /**#@+ + * User type + */ + const USER_TYPE_INTEGRATION = 1; + const USER_TYPE_ADMIN = 2; + const USER_TYPE_CUSTOMER = 3; + const USER_TYPE_GUEST = 4; + /**#@-*/ + /** * Identify current user ID. * - * @return int + * @return int|null */ public function getUserId(); /** - * Retrieve current user type (Admin, Customer, Guest, Integration). + * Retrieve current user type. * - * @return string + * @return int|null */ public function getUserType(); } diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json new file mode 100644 index 000000000000..a00c08d4b68d --- /dev/null +++ b/app/code/Magento/Authorization/composer.json @@ -0,0 +1,20 @@ +{ + "name": "magento/module-authorization", + "description": "Authorization module provides access to Magento ACL functionality.", + "require": { + "php": "~5.4.11|~5.5.0", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", + "magento/magento-composer-installer": "*" + }, + "type": "magento2-module", + "version": "0.1.0-alpha90", + "extra": { + "map": [ + [ + "*", + "Magento/Authorization" + ] + ] + } +} diff --git a/app/code/Magento/User/data/user_setup/data-install-1.6.0.0.php b/app/code/Magento/Authorization/data/authorization_setup/data-install-1.0.0.0.php similarity index 69% rename from app/code/Magento/User/data/user_setup/data-install-1.6.0.0.php rename to app/code/Magento/Authorization/data/authorization_setup/data-install-1.0.0.0.php index 013d4117f470..483a6ee18fca 100644 --- a/app/code/Magento/User/data/user_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Authorization/data/authorization_setup/data-install-1.0.0.0.php @@ -21,30 +21,22 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -use Magento\User\Model\Acl\Role\Group as RoleGroup; +use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; +use Magento\Authorization\Model\UserContextInterface; /** * Save administrators group role and rules */ -/** @var \Magento\User\Model\Resource\Setup $this */ +/** @var \Magento\Authorization\Model\Resource\Setup $this */ -$roleCollection = $this->createRoleCollection()->addFieldToFilter( - 'parent_id', - 0 -)->addFieldToFilter( - 'tree_level', - 1 -)->addFieldToFilter( - 'role_type', - RoleGroup::ROLE_TYPE -)->addFieldToFilter( - 'user_id', - 0 -)->addFieldToFilter( - 'role_name', - 'Administrators' -); +$roleCollection = $this->createRoleCollection() + ->addFieldToFilter('parent_id', 0) + ->addFieldToFilter('tree_level', 1) + ->addFieldToFilter('role_type', RoleGroup::ROLE_TYPE) + ->addFieldToFilter('user_id', 0) + ->addFieldToFilter('user_type', UserContextInterface::USER_TYPE_ADMIN) + ->addFieldToFilter('role_name', 'Administrators'); if ($roleCollection->count() == 0) { $admGroupRole = $this->createRole()->setData( @@ -54,6 +46,7 @@ 'sort_order' => 1, 'role_type' => RoleGroup::ROLE_TYPE, 'user_id' => 0, + 'user_type' => UserContextInterface::USER_TYPE_ADMIN, 'role_name' => 'Administrators' ) )->save(); @@ -64,13 +57,9 @@ } } -$rulesCollection = $this->createRulesCollection()->addFieldToFilter( - 'role_id', - $admGroupRole->getId() -)->addFieldToFilter( - 'resource_id', - 'all' -); +$rulesCollection = $this->createRulesCollection() + ->addFieldToFilter('role_id', $admGroupRole->getId()) + ->addFieldToFilter('resource_id', 'all'); if ($rulesCollection->count() == 0) { $this->createRules()->setData( @@ -82,7 +71,7 @@ ) )->save(); } else { - /** @var \Magento\User\Model\Rules $rule */ + /** @var \Magento\Authorization\Model\Rules $rule */ foreach ($rulesCollection as $rule) { $rule->setData('resource_id', 'Magento_Adminhtml::all')->save(); } diff --git a/app/code/Magento/Authorization/etc/di.xml b/app/code/Magento/Authorization/etc/di.xml new file mode 100644 index 000000000000..afd3f40acd4f --- /dev/null +++ b/app/code/Magento/Authorization/etc/di.xml @@ -0,0 +1,47 @@ + + + + + + + Magento\Framework\Acl\RootResource\Proxy + Magento\Framework\Acl\Cache\Proxy + + + + + + Magento\Authorization\Model\Resource\Setup + + + + + + Magento\Authorization\Model\Acl\Loader\Rule + Magento\Authorization\Model\Acl\Loader\Role + + + diff --git a/app/code/Magento/Authz/etc/di.xml b/app/code/Magento/Authorization/etc/module.xml similarity index 80% rename from app/code/Magento/Authz/etc/di.xml rename to app/code/Magento/Authorization/etc/module.xml index 324792fc21e2..4224828dc06f 100644 --- a/app/code/Magento/Authz/etc/di.xml +++ b/app/code/Magento/Authorization/etc/module.xml @@ -23,7 +23,10 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - + + + + + + diff --git a/app/code/Magento/Authorization/sql/authorization_setup/install-1.0.0.0.php b/app/code/Magento/Authorization/sql/authorization_setup/install-1.0.0.0.php new file mode 100644 index 000000000000..eb6661c9dc29 --- /dev/null +++ b/app/code/Magento/Authorization/sql/authorization_setup/install-1.0.0.0.php @@ -0,0 +1,171 @@ +startSetup(); + +if ($installer->getConnection()->isTableExists($installer->getTable('admin_role'))) { + /** + * Rename existing 'admin_role' table into 'authorization_role' (to avoid forcing Magento re-installation) + * TODO: This conditional logic can be removed some time after pull request is delivered to the mainline + */ + $installer->getConnection()->renameTable( + $installer->getTable('admin_role'), + $installer->getTable('authorization_role') + ); + +} else if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_role'))) { + /** + * Create table 'authorization_role' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('authorization_role') + )->addColumn( + 'role_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Role ID' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Parent Role ID' + )->addColumn( + 'tree_level', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Role Tree Level' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Role Sort Order' + )->addColumn( + 'role_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 1, + array('nullable' => false, 'default' => '0'), + 'Role Type' + )->addColumn( + 'user_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'User ID' + )->addColumn( + 'user_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + array('nullable' => true, 'default' => null), + 'User Type' + )->addColumn( + 'role_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + array('nullable' => true, 'default' => null), + 'Role Name' + )->addIndex( + $installer->getIdxName('authorization_role', array('parent_id', 'sort_order')), + array('parent_id', 'sort_order') + )->addIndex( + $installer->getIdxName('authorization_role', array('tree_level')), + array('tree_level') + )->setComment( + 'Admin Role Table' + ); + $installer->getConnection()->createTable($table); +} + +if ($installer->getConnection()->isTableExists($installer->getTable('admin_rule'))) { + /** + * Rename existing 'admin_rule' table into 'authorization_rule' (to avoid forcing Magento re-installation) + * TODO: This conditional logic can be removed some time after pull request is delivered to the mainline + */ + $installer->getConnection()->renameTable( + $installer->getTable('admin_rule'), + $installer->getTable('authorization_rule') + ); + +} else if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_rule'))) { + /** + * Create table 'authorization_rule' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('authorization_rule') + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Rule ID' + )->addColumn( + 'role_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Role ID' + )->addColumn( + 'resource_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => true, 'default' => null), + 'Resource ID' + )->addColumn( + 'privileges', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + array('nullable' => true), + 'Privileges' + )->addColumn( + 'permission', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + array(), + 'Permission' + )->addIndex( + $installer->getIdxName('authorization_rule', array('resource_id', 'role_id')), + array('resource_id', 'role_id') + )->addIndex( + $installer->getIdxName('authorization_rule', array('role_id', 'resource_id')), + array('role_id', 'resource_id') + )->addForeignKey( + $installer->getFkName('authorization_rule', 'role_id', 'authorization_role', 'role_id'), + 'role_id', + $installer->getTable('authorization_role'), + 'role_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Admin Rule Table' + ); + $installer->getConnection()->createTable($table); +} + +$installer->endSetup(); diff --git a/app/code/Magento/Authorizenet/Helper/Data.php b/app/code/Magento/Authorizenet/Helper/Data.php index 8bcfa32014de..0398481a245a 100644 --- a/app/code/Magento/Authorizenet/Helper/Data.php +++ b/app/code/Magento/Authorizenet/Helper/Data.php @@ -197,39 +197,10 @@ public function convertMessagesToMessage($messages) * @param \Magento\Framework\Object $card * @param bool|float $amount * @param bool|string $exception + * @param bool|string $additionalMessage * @return bool|string */ public function getTransactionMessage( - $payment, - $requestType, - $lastTransactionId, - $card, - $amount = false, - $exception = false - ) { - return $this->getExtendedTransactionMessage( - $payment, - $requestType, - $lastTransactionId, - $card, - $amount, - $exception - ); - } - - /** - * Return message for gateway transaction request - * - * @param \Magento\Payment\Model\Info $payment - * @param string $requestType - * @param string $lastTransactionId - * @param \Magento\Framework\Object $card - * @param bool|float $amount - * @param bool|string $exception - * @param bool|string $additionalMessage - * @return bool|mixed - */ - public function getExtendedTransactionMessage( $payment, $requestType, $lastTransactionId, @@ -238,40 +209,27 @@ public function getExtendedTransactionMessage( $exception = false, $additionalMessage = false ) { + $message[] = __('Credit Card: xxxx-%1', $card->getCcLast4()); + if ($amount) { + $message[] = __('amount %1', $this->_formatPrice($payment, $amount)); + } $operation = $this->_getOperation($requestType); - if (!$operation) { return false; - } - - if ($amount) { - $amount = __('amount %1', $this->_formatPrice($payment, $amount)); - } - - if ($exception) { - $result = __('failed'); } else { - $result = __('successful'); + $message[] = $operation; } - - $card = __('Credit Card: xxxx-%1', $card->getCcLast4()); - - $pattern = '%s %s %s - %s.'; - $texts = array($card, $amount, $operation, $result); - + $message[] = ($exception) ? '- ' . __('failed.') : '- ' . __('successful.'); if (!is_null($lastTransactionId)) { - $pattern .= ' %s.'; - $texts[] = __('Authorize.Net Transaction ID %1', $lastTransactionId); + $message[] = __('Authorize.Net Transaction ID %1.', $lastTransactionId); } - if ($additionalMessage) { - $pattern .= ' %s.'; - $texts[] = $additionalMessage; + $message[] = $additionalMessage; } - $pattern .= ' %s'; - $texts[] = $exception; - - return call_user_func_array('__', array_merge(array($pattern), $texts)); + if ($exception) { + $message[] = $exception; + } + return implode(' ', $message); } /** diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php index cf5b2a3bf553..df8c1202f6eb 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php @@ -1054,14 +1054,14 @@ protected function _voidCardTransaction($payment, $card) 'parent_transaction_id' => $authTransactionId ), array(), - $this->_authorizenetData->getExtendedTransactionMessage( + $this->_authorizenetData->getTransactionMessage( $payment, self::REQUEST_TYPE_VOID, null, $card, false, false, - __('Parent Authorize.Net transaction (ID %1) expired', $realAuthTransactionId) + __('Parent Authorize.Net transaction (ID %1) expired.', $realAuthTransactionId) ) ); } diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index ef24c34cdb2d..9d3f76530f6b 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -23,6 +23,8 @@ */ namespace Magento\Authorizenet\Model; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; + /** * Authorize.net DirectPost payment method model. */ @@ -90,6 +92,11 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet */ protected $_helper; + /** + * @var OrderSender + */ + protected $orderSender; + /** * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData @@ -110,6 +117,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * @param \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory * @param \Magento\Authorizenet\Model\Directpost\Response $response * @param \Magento\Authorizenet\Helper\HelperInterface $helper + * @param OrderSender $orderSender * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -134,6 +142,7 @@ public function __construct( \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory, \Magento\Authorizenet\Model\Directpost\Response $response, \Magento\Authorizenet\Helper\HelperInterface $helper, + OrderSender $orderSender, array $data = array() ) { parent::__construct( @@ -158,6 +167,7 @@ public function __construct( $this->_requestFactory = $directRequestFactory; $this->_response = $response; $this->_helper = $helper; + $this->orderSender = $orderSender; } /** @@ -705,7 +715,7 @@ protected function _authOrder(\Magento\Sales\Model\Order $order) try { if (!$response->hasOrderSendConfirmation() || $response->getOrderSendConfirmation()) { - $order->sendNewOrderEmail(); + $this->orderSender->send($order); } $this->_quoteFactory->create()->load($order->getQuoteId())->setIsActive(false)->save(); diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json index 83732fee6399..6b8835ccde63 100644 --- a/app/code/Magento/Authorizenet/composer.json +++ b/app/code/Magento/Authorizenet/composer.json @@ -2,20 +2,20 @@ "name": "magento/module-authorizenet", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-centinel": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-centinel": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Authz/Model/UserIdentifier.php b/app/code/Magento/Authz/Model/UserIdentifier.php deleted file mode 100644 index 999a7f259c84..000000000000 --- a/app/code/Magento/Authz/Model/UserIdentifier.php +++ /dev/null @@ -1,135 +0,0 @@ -getUserType(); - $userId = isset($userId) ? $userId : $userLocator->getUserId(); - if ($userType == self::USER_TYPE_GUEST && $userId) { - throw new \LogicException('Guest user must not have user ID set.'); - } - $this->_setUserId($userId); - $this->_setUserType($userType); - } - - /** - * Get user ID. Null is possible when user type is 'guest'. - * - * @return int - */ - public function getUserId() - { - return $this->_userId; - } - - /** - * Retrieve user type (admin, customer, guest, web API integration). - * - * @return string - */ - public function getUserType() - { - return $this->_userType; - } - - /** - * Set user ID. - * - * @param int $userId - * @return $this - * @throws \LogicException - */ - protected function _setUserId($userId) - { - $userId = is_numeric($userId) ? (int)$userId : $userId; - if (!is_integer($userId) || $userId < 0) { - throw new \LogicException("Invalid user ID: '{$userId}'."); - } - $this->_userId = $userId; - return $this; - } - - /** - * Set user type. - * - * @param string $userType - * @return $this - * @throws \LogicException - */ - protected function _setUserType($userType) - { - $availableTypes = array( - self::USER_TYPE_GUEST, - self::USER_TYPE_CUSTOMER, - self::USER_TYPE_ADMIN, - self::USER_TYPE_INTEGRATION - ); - if (!in_array($userType, $availableTypes)) { - throw new \LogicException( - "Invalid user type: '{$userType}'. Allowed types: " . implode(", ", $availableTypes) - ); - } - $this->_userType = $userType; - return $this; - } -} diff --git a/app/code/Magento/Authz/Service/AuthorizationV1.php b/app/code/Magento/Authz/Service/AuthorizationV1.php deleted file mode 100644 index 216c3c56c8ac..000000000000 --- a/app/code/Magento/Authz/Service/AuthorizationV1.php +++ /dev/null @@ -1,377 +0,0 @@ -_aclBuilder = $aclBuilder; - $this->_userIdentifier = $userIdentifier; - $this->_roleFactory = $roleFactory; - $this->_rulesFactory = $rulesFactory; - $this->_rulesCollectionFactory = $rulesCollectionFactory; - $this->_roleCollectionFactory = $roleCollectionFactory; - $this->_logger = $logger; - $this->_rootAclResource = $rootAclResource; - } - - /** - * {@inheritdoc} - */ - public function isAllowed($resources, UserIdentifier $userIdentifier = null) - { - $resources = is_array($resources) ? $resources : [$resources]; - $userIdentifier = $userIdentifier ? $userIdentifier : $this->_userIdentifier; - if ($this->_isAnonymousOrSelfAllowed($resources, $userIdentifier)) { - return true; - } - return $this->_isUserWithRoleAllowed($resources, $userIdentifier); - } - - /** - * {@inheritdoc} - */ - public function grantPermissions(UserIdentifier $userIdentifier, array $resources) - { - try { - $role = $this->_getUserRole($userIdentifier); - if (!$role) { - $role = $this->_createRole($userIdentifier); - } - $this->_associateResourcesWithRole($role, $resources); - } catch (\Exception $e) { - $this->_logger->logException($e); - throw new LocalizedException('Error happened while granting permissions. Check exception log for details.'); - } - } - - /** - * {@inheritdoc} - */ - public function grantAllPermissions(UserIdentifier $userIdentifier) - { - $this->grantPermissions($userIdentifier, array($this->_rootAclResource->getId())); - } - - /** - * {@inheritdoc} - */ - public function getAllowedResources(UserIdentifier $userIdentifier) - { - if ($userIdentifier->getUserType() == UserIdentifier::USER_TYPE_GUEST) { - return [self::PERMISSION_ANONYMOUS]; - } elseif ($userIdentifier->getUserType() == UserIdentifier::USER_TYPE_CUSTOMER) { - return [self::PERMISSION_SELF]; - } - $allowedResources = []; - try { - $role = $this->_getUserRole($userIdentifier); - if (!$role) { - throw new AuthorizationException('The role associated with the specified user cannot be found.'); - } - $rulesCollection = $this->_rulesCollectionFactory->create(); - $rulesCollection->getByRoles($role->getId())->load(); - $acl = $this->_aclBuilder->getAcl(); - /** @var \Magento\User\Model\Rules $ruleItem */ - foreach ($rulesCollection->getItems() as $ruleItem) { - $resourceId = $ruleItem->getResourceId(); - if ($acl->has($resourceId) && $acl->isAllowed($role->getId(), $resourceId)) { - $allowedResources[] = $resourceId; - } - } - } catch (AuthorizationException $e) { - throw $e; - } catch (\Exception $e) { - $this->_logger->logException($e); - throw new LocalizedException( - 'Error happened while getting a list of allowed resources. Check exception log for details.' - ); - } - return $allowedResources; - } - - /** - * {@inheritdoc} - */ - public function removePermissions(UserIdentifier $userIdentifier) - { - try { - $this->_deleteRole($userIdentifier); - } catch (NoSuchEntityException $e) { - throw $e; - } catch (\Exception $e) { - $this->_logger->logException($e); - throw new LocalizedException( - 'Error happened while deleting role and permissions. Check exception log for details.' - ); - } - } - - /** - * Create new ACL role. - * - * @param UserIdentifier $userIdentifier - * @return Role - * @throws NoSuchEntityException - * @throws \LogicException - */ - protected function _createRole($userIdentifier) - { - $userType = $userIdentifier->getUserType(); - if (!$this->_canRoleBeCreatedForUserType($userType)) { - throw new \LogicException("The role with user type '{$userType}' cannot be created"); - } - $userId = $userIdentifier->getUserId(); - switch ($userType) { - case UserIdentifier::USER_TYPE_INTEGRATION: - $roleName = $userType . $userId; - $roleType = \Magento\User\Model\Acl\Role\User::ROLE_TYPE; - $parentId = 0; - $userId = $userIdentifier->getUserId(); - break; - default: - throw NoSuchEntityException::singleField('userType', $userType); - } - $role = $this->_roleFactory->create(); - $role->setRoleName($roleName) - ->setUserType($userType) - ->setUserId($userId) - ->setRoleType($roleType) - ->setParentId($parentId) - ->save(); - return $role; - } - - /** - * Remove an ACL role. This deletes the cascading permissions - * - * @param UserIdentifier $userIdentifier - * @return Role - * @throws NoSuchEntityException - * @throws \LogicException - */ - protected function _deleteRole($userIdentifier) - { - $userType = $userIdentifier->getUserType(); - if (!$this->_canRoleBeCreatedForUserType($userType)) { - throw new \LogicException("The role with user type '{$userType}' cannot be created or deleted."); - } - $userId = $userIdentifier->getUserId(); - switch ($userType) { - case UserIdentifier::USER_TYPE_INTEGRATION: - $roleName = $userType . $userId; - break; - default: - throw NoSuchEntityException::singleField('userType', $userType); - } - $role = $this->_roleFactory->create()->load($roleName, 'role_name'); - return $role->delete(); - } - - /** - * Identify user role from user identifier. - * - * @param UserIdentifier $userIdentifier - * @return Role|false Return false in case when no role associated with provided user was found. - * @throws \LogicException - */ - protected function _getUserRole($userIdentifier) - { - if (!$this->_canRoleBeCreatedForUserType($userIdentifier)) { - throw new \LogicException( - "The role with user type '{$userIdentifier->getUserType()}' does not exist and cannot be created" - ); - } - $roleCollection = $this->_roleCollectionFactory->create(); - $userType = $userIdentifier->getUserType(); - /** @var Role $role */ - $userId = $userIdentifier->getUserId(); - $role = $roleCollection->setUserFilter($userId, $userType)->getFirstItem(); - return $role->getId() ? $role : false; - } - - /** - * Associate resources with the specified role. All resources previously assigned to the role will be unassigned. - * - * @param Role $role - * @param string[] $resources - * @return void - * @throws \LogicException - */ - protected function _associateResourcesWithRole($role, array $resources) - { - /** @var \Magento\User\Model\Rules $rules */ - $rules = $this->_rulesFactory->create(); - $rules->setRoleId($role->getId())->setResources($resources)->saveRel(); - } - - /** - * Check if there role can be associated with user having provided user type. - * - * Roles cannot be created for guests and customers. - * - * @param string $userType - * @return bool - */ - protected function _canRoleBeCreatedForUserType($userType) - { - return ($userType != UserIdentifier::USER_TYPE_CUSTOMER) && ($userType != UserIdentifier::USER_TYPE_GUEST); - } - - /** - * Check if the user has permission to access the requested resources. - * - * @param string[] $resources - * @param UserIdentifier $userIdentifier - * @return bool - */ - protected function _isAnonymousOrSelfAllowed($resources, UserIdentifier $userIdentifier) - { - if (count($resources) == 1) { - $resource = reset($resources); - $isAnonymousAccess = ($resource == self::PERMISSION_ANONYMOUS); - $isSelfAccess = ($userIdentifier->getUserType() == UserIdentifier::USER_TYPE_CUSTOMER) - && ($resource == self::PERMISSION_SELF); - if ($isAnonymousAccess || $isSelfAccess) { - return true; - } - } - return false; - } - - /** - * Check if user who has role is allowed to access requested resources. - * - * @param string[] $resources - * @param UserIdentifier $userIdentifier - * @return bool - */ - protected function _isUserWithRoleAllowed($resources, UserIdentifier $userIdentifier) - { - try { - $role = $this->_getUserRole($userIdentifier); - if (!$role) { - throw NoSuchEntityException::doubleField( - 'userId', - $userIdentifier->getUserId(), - 'userType', - $userIdentifier->getUserType() - ); - } - foreach ($resources as $resource) { - if (!$this->_aclBuilder->getAcl()->isAllowed($role->getId(), $resource)) { - return false; - } - } - return true; - } catch (\Exception $e) { - $this->_logger->logException($e); - return false; - } - } -} diff --git a/app/code/Magento/Authz/Service/AuthorizationV1Interface.php b/app/code/Magento/Authz/Service/AuthorizationV1Interface.php deleted file mode 100644 index 9fbd2a5cc866..000000000000 --- a/app/code/Magento/Authz/Service/AuthorizationV1Interface.php +++ /dev/null @@ -1,88 +0,0 @@ -getUser()) { - $this->regenerateId(false); + $this->regenerateId(); if ($this->_backendUrl->useSecretKey()) { $this->_backendUrl->renewSecretUrls(); diff --git a/app/code/Magento/Backend/Model/Observer.php b/app/code/Magento/Backend/Model/Observer.php index a95b840671a2..fced5d795f61 100644 --- a/app/code/Magento/Backend/Model/Observer.php +++ b/app/code/Magento/Backend/Model/Observer.php @@ -85,27 +85,4 @@ public function clearCacheConfigurationFilesAccessLevelVerification() { return $this; } - - /** - * Set url class name for store 'admin' - * - * @param \Magento\Framework\Event\Observer $observer - * @return $this - */ - public function setUrlClassName(\Magento\Framework\Event\Observer $observer) - { - /** @var $storeCollection \Magento\Store\Model\Resource\Store\Collection */ - $storeCollection = $observer->getEvent()->getStoreCollection(); - /** @var $store \Magento\Store\Model\Store */ - foreach ($storeCollection as $store) { - if ($store->getId() == 0) { - $store->setUrlClassName('Magento\Backend\Model\UrlInterface'); - break; - } - } - $this->cache->remove( - \Magento\AdminNotification\Model\System\Message\Security::VERIFICATION_RESULT_CACHE_KEY - ); - return $this; - } } diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index 22d9a7215c10..2ff611ae678f 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -2,34 +2,33 @@ "name": "magento/module-backend", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-admin-notification": "0.1.0-alpha89", - "magento/module-cron": "0.1.0-alpha89", - "magento/module-sendfriend": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-weee": "0.1.0-alpha89", - "magento/module-reports": "0.1.0-alpha89", - "magento/module-catalog-search": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-user": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/module-backup": "0.1.0-alpha89", - "magento/module-email": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-url-rewrite": "0.1.0-alpha89", - "magento/module-translation": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-cron": "0.1.0-alpha90", + "magento/module-sendfriend": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-weee": "0.1.0-alpha90", + "magento/module-reports": "0.1.0-alpha90", + "magento/module-catalog-search": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-user": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/module-backup": "0.1.0-alpha90", + "magento/module-email": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-url-rewrite": "0.1.0-alpha90", + "magento/module-translation": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Backend/etc/adminhtml/acl.xml b/app/code/Magento/Backend/etc/acl.xml similarity index 98% rename from app/code/Magento/Backend/etc/adminhtml/acl.xml rename to app/code/Magento/Backend/etc/acl.xml index 45f9521fd7a3..3393e749dbba 100644 --- a/app/code/Magento/Backend/etc/adminhtml/acl.xml +++ b/app/code/Magento/Backend/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 101b83e07768..1b15e3702c49 100644 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -33,7 +33,6 @@ - diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index 8af68b4da046..b14d72430261 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-backup", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-cron": "0.1.0-alpha89", - "magento/module-index": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-cron": "0.1.0-alpha90", + "magento/module-index": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Backup/etc/adminhtml/acl.xml b/app/code/Magento/Backup/etc/acl.xml similarity index 94% rename from app/code/Magento/Backup/etc/adminhtml/acl.xml rename to app/code/Magento/Backup/etc/acl.xml index eb2139dc270a..1abed0fc99ef 100644 --- a/app/code/Magento/Backup/etc/adminhtml/acl.xml +++ b/app/code/Magento/Backup/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php b/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php index 1a70af60d637..678da2ceea6a 100644 --- a/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php +++ b/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php @@ -33,21 +33,22 @@ class PriceBackend /** * @param \Magento\Catalog\Model\Product\Attribute\Backend\Price $subject * @param \Closure $proceed - * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product|\Magento\Framework\Object $object * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundValidate( \Magento\Catalog\Model\Product\Attribute\Backend\Price $subject, \Closure $proceed, - \Magento\Catalog\Model\Product $product + $object ) { - if ($product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE - && $product->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC + if ($object instanceof \Magento\Catalog\Model\Product + && $object->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE + && $object->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC ) { return true; } else { - return $proceed($product); + return $proceed($object); } } } diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Option.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Option.php new file mode 100644 index 000000000000..dfb605d843b2 --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Option.php @@ -0,0 +1,104 @@ +_get(self::ID); + } + + /** + * Get option title + * + * @return string|null + */ + public function getTitle() + { + return $this->_get(self::TITLE); + } + + /** + * Get is required option + * + * @return bool|null + */ + public function isRequired() + { + return $this->_get(self::REQUIRED); + } + + /** + * Get input type + * + * @return string|null + */ + public function getType() + { + return $this->_get(self::TYPE); + } + + /** + * Get option position + * + * @return int|null + */ + public function getPosition() + { + return $this->_get(self::POSITION); + } + + /** + * Get product sku + * + * @return string|null + */ + public function getSku() + { + return $this->_get(self::SKU); + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php new file mode 100644 index 000000000000..596a44f53432 --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php @@ -0,0 +1,56 @@ +_get(self::LABEL); + } + + /** + * Get type code + * + * @return string + */ + public function getCode() + { + return $this->_get(self::CODE); + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php new file mode 100644 index 000000000000..04af6800a310 --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php @@ -0,0 +1,54 @@ +_set(Type::LABEL, $value); + } + + /** + * Set type code + * + * @param int $value + * @return $this + */ + public function setCode($value) + { + return $this->_set(Type::CODE, $value); + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeConverter.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeConverter.php new file mode 100644 index 000000000000..b64fecdbd27f --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeConverter.php @@ -0,0 +1,53 @@ +builder = $builder; + } + + /** + * @param array $option + * @return Type + */ + public function createDataFromModel(array $option) + { + $this->builder->populateWithArray($option) + ->setCode($option['value']); + return $this->builder->create(); + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php b/app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php new file mode 100644 index 000000000000..398f8f1a995b --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php @@ -0,0 +1,98 @@ +_set(Option::ID, $value); + } + + /** + * Set option title + * + * @param string $value + * @return $this + */ + public function setTitle($value) + { + return $this->_set(Option::TITLE, $value); + } + + /** + * Set is required option + * + * @param bool $value + * @return $this + */ + public function setRequired($value) + { + return $this->_set(Option::REQUIRED, $value); + } + + /** + * Set input type + * + * @param string $value + * @return $this + */ + public function setType($value) + { + return $this->_set(Option::TYPE, $value); + } + + /** + * Set option position + * + * @param int $value + * @return $this + */ + public function setPosition($value) + { + return $this->_set(Option::POSITION, $value); + } + + /** + * Set product sku + * + * @param string $value + * @return $this + */ + public function setSku($value) + { + return $this->_set(Option::SKU, $value); + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/OptionConverter.php b/app/code/Magento/Bundle/Service/V1/Data/Product/OptionConverter.php new file mode 100644 index 000000000000..b5de09c3576a --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/OptionConverter.php @@ -0,0 +1,99 @@ +builder = $builder; + $this->optionFactory = $optionFactory; + } + + /** + * @param OptionModel $option + * @param Product $product + * @return Option + */ + public function createDataFromModel(OptionModel $option, Product $product) + { + $this->builder->populateWithArray($option->getData()) + ->setId($option->getId()) + ->setTitle(is_null($option->getTitle()) ? $option->getDefaultTitle() : $option->getTitle()) + ->setSku($product->getSku()); + return $this->builder->create(); + } + + /** + * @param Option $option + * @param Product $product + * @return OptionModel + */ + public function createModelFromData(Option $option, Product $product) + { + $optionModel = $this->optionFactory->create(); + $optionModel->addData($option->__toArray()) + ->unsetData($optionModel->getIdFieldName()) + ->setParentId($product->getId()) + ->setDefaultTitle($option->getTitle()); + return $optionModel; + } + + /** + * @param Option $option + * @param OptionModel $optionModel + * @return OptionModel + */ + public function getModelFromData(Option $option, OptionModel $optionModel) + { + $newOptionModel = $this->optionFactory->create(); + $newOptionModel->setData($optionModel->getData()) + ->addData($option->__toArray()) + ->setId($optionModel->getId()) + ->setDefaultTitle(is_null($option->getTitle()) ? $optionModel->getTitle() : $option->getTitle()); + return $newOptionModel; + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Product/Link/WriteService.php b/app/code/Magento/Bundle/Service/V1/Product/Link/WriteService.php index 1218d7fcfa70..2964310bc693 100644 --- a/app/code/Magento/Bundle/Service/V1/Product/Link/WriteService.php +++ b/app/code/Magento/Bundle/Service/V1/Product/Link/WriteService.php @@ -169,7 +169,7 @@ public function removeChild($productSku, $optionId, $childSku) $removeSelectionIds = array(); foreach ($this->getOptions($product) as $option) { foreach ($option->getSelections() as $selection) { - if (($selection->getSku() == $childSku) && ($selection->getOptionId() == $optionId)) { + if ((strcasecmp($selection->getSku(), $childSku) == 0) && ($selection->getOptionId() == $optionId)) { $removeSelectionIds[] = $selection->getSelectionId(); continue; } diff --git a/app/code/Magento/Bundle/Service/V1/Product/Option/ReadService.php b/app/code/Magento/Bundle/Service/V1/Product/Option/ReadService.php new file mode 100644 index 000000000000..714401d72e44 --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Product/Option/ReadService.php @@ -0,0 +1,113 @@ +optionConverter = $optionConverter; + $this->productRepository = $productRepository; + $this->type = $type; + } + + /** + * {@inheritdoc} + */ + public function get($productSku, $optionId) + { + $product = $this->getProduct($productSku); + $optionCollection = $this->type->getOptionsCollection($product); + $optionCollection->setIdFilter($optionId); + + /** @var \Magento\Bundle\Model\Option $option */ + $option = $optionCollection->getFirstItem(); + if (!$option->getId()) { + throw new NoSuchEntityException('Requested option doesn\'t exist'); + } + return $this->optionConverter->createDataFromModel($option, $product); + } + + /** + * {@inheritdoc} + */ + public function getList($productSku) + { + $product = $this->getProduct($productSku); + $optionCollection = $this->type->getOptionsCollection($product); + + /** @var \Magento\Bundle\Service\V1\Data\Product\Option[] $optionDtoList */ + $optionDtoList = []; + /** @var \Magento\Bundle\Model\Option $option */ + foreach ($optionCollection as $option) { + $optionDtoList[] = $this->optionConverter->createDataFromModel($option, $product); + } + return $optionDtoList; + } + + /** + * @param string $productSku + * @return Product + * @throws Exception + */ + private function getProduct($productSku) + { + $product = $this->productRepository->get($productSku); + + if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { + throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN); + } + + return $product; + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Product/Option/ReadServiceInterface.php b/app/code/Magento/Bundle/Service/V1/Product/Option/ReadServiceInterface.php new file mode 100644 index 000000000000..14abab5ec34a --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Product/Option/ReadServiceInterface.php @@ -0,0 +1,48 @@ +type = $type; + $this->typeConverter = $typeConverter; + } + + /** + * {@inheritdoc} + */ + public function getTypes() + { + $optionList = $this->type->toOptionArray(); + + /** @var Type[] $typeDtoList */ + $typeDtoList = []; + foreach ($optionList as $option) { + $typeDtoList[] = $this->typeConverter->createDataFromModel($option); + } + return $typeDtoList; + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Product/Option/Type/ReadServiceInterface.php b/app/code/Magento/Bundle/Service/V1/Product/Option/Type/ReadServiceInterface.php new file mode 100644 index 000000000000..90fbc02a75e1 --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Product/Option/Type/ReadServiceInterface.php @@ -0,0 +1,34 @@ +productRepository = $productRepository; + $this->type = $type; + $this->optionConverter = $optionConverter; + $this->storeManager = $storeManager; + } + + /** + * {@inheritdoc} + */ + public function remove($productSku, $optionId) + { + $product = $this->getProduct($productSku); + $optionCollection = $this->type->getOptionsCollection($product); + $optionCollection->setIdFilter($optionId); + + /** @var \Magento\Bundle\Model\Option $removeOption */ + $removeOption = $optionCollection->getFirstItem(); + if (!$removeOption->getId()) { + throw new NoSuchEntityException('Requested option doesn\'t exist'); + } + $removeOption->delete(); + + return true; + } + + /** + * {@inheritdoc} + */ + public function add($productSku, Option $option) + { + $product = $this->getProduct($productSku); + $optionModel = $this->optionConverter->createModelFromData($option, $product); + $optionModel->setStoreId($this->storeManager->getStore()->getId()); + + try { + $optionModel->save(); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not save option', [], $e); + } + + return $optionModel->getId(); + } + + /** + * {@inheritdoc} + */ + public function update($productSku, $optionId, \Magento\Bundle\Service\V1\Data\Product\Option $option) + { + $product = $this->getProduct($productSku); + $optionCollection = $this->type->getOptionsCollection($product); + $optionCollection->setIdFilter($optionId); + + /** @var \Magento\Bundle\Model\Option $optionModel */ + $optionModel = $optionCollection->getFirstItem(); + $updateOption = $this->optionConverter->getModelFromData($option, $optionModel); + + if (!$updateOption->getId()) { + throw new NoSuchEntityException('Requested option doesn\'t exist'); + } + $updateOption->setStoreId($this->storeManager->getStore()->getId()); + + try { + $updateOption->save(); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not save option', [], $e); + } + + return true; + } + + /** + * @param string $productSku + * @return Product + * @throws Exception + */ + private function getProduct($productSku) + { + $product = $this->productRepository->get($productSku); + + if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { + throw new Exception( + 'Product with specified sku: "%1" is not a bundle product', + Exception::HTTP_FORBIDDEN, + Exception::HTTP_FORBIDDEN, + [ + $product->getSku() + ] + ); + } + + return $product; + } +} diff --git a/app/code/Magento/Bundle/Service/V1/Product/Option/WriteServiceInterface.php b/app/code/Magento/Bundle/Service/V1/Product/Option/WriteServiceInterface.php new file mode 100644 index 000000000000..a5992eb2f7af --- /dev/null +++ b/app/code/Magento/Bundle/Service/V1/Product/Option/WriteServiceInterface.php @@ -0,0 +1,61 @@ + + + + diff --git a/app/code/Magento/Bundle/etc/webapi.xml b/app/code/Magento/Bundle/etc/webapi.xml index 757c74cee5b1..8e9ea1b5287a 100644 --- a/app/code/Magento/Bundle/etc/webapi.xml +++ b/app/code/Magento/Bundle/etc/webapi.xml @@ -43,4 +43,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml index c66e9c8e7070..f59849e66d53 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml @@ -42,19 +42,19 @@ getOrderItem()->getParentItem()): ?> getSelectionAttributes($_item) ?> - +
- +getParentItem()): ?> data-th=""> getOrderItem()->getParentItem()): ?> escapeHtml($_item->getName()) ?> - getValueHtml($_item) ?> + getValueHtml($_item) ?> escapeHtml($_item->getSku()) ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml index 2515d5a29c3a..20b29c9f3172 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml @@ -41,19 +41,19 @@ getOrderItem()->getParentItem()): ?> getSelectionAttributes($_item) ?> - +
- + getOrderItem()->getParentItem()): ?> data-th=""> getOrderItem()->getParentItem()): ?> escapeHtml($_item->getName()) ?> - getValueHtml($_item) ?> + getValueHtml($_item) ?> escapeHtml($_item->getSku()) ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml index 1581213677ea..b1908e1964b7 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml @@ -42,19 +42,19 @@ getParentItem()): ?> getSelectionAttributes($_item) ?> - getLastRow()) echo 'class="last"'; ?>> -
+ + - +getParentItem()): ?> data-th=""> getParentItem()): ?> escapeHtml($_item->getName()) ?> - getValueHtml($_item)?> + getValueHtml($_item)?> prepareSku($_item->getSku()) ?> @@ -295,7 +295,7 @@ - + getItemOptions()): ?>
diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml index d47b684a7d80..5e3fc45b43d7 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml @@ -41,19 +41,19 @@ getParentItem()): ?> getSelectionAttributes($_item) ?> - +
- + getParentItem()): ?> data-th=""> getParentItem()): ?> escapeHtml($_item->getName()) ?> - getValueHtml($_item) ?> + getValueHtml($_item) ?> escapeHtml($_item->getSku()) ?> diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index 958b9216861f..c00bf2b08251 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-captcha", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Captcha/view/frontend/templates/default.phtml b/app/code/Magento/Captcha/view/frontend/templates/default.phtml index ef872a1f5927..f382e4f6eb35 100644 --- a/app/code/Magento/Captcha/view/frontend/templates/default.phtml +++ b/app/code/Magento/Captcha/view/frontend/templates/default.phtml @@ -36,13 +36,13 @@ data-mage-init='{"captcha":{"url": "getRefreshUrl()?>", "type": "getFormId() ?>"}}'>
- <?php echo __('Please type the letters below')?> isCaseSensitive()) :?>
Attention: Captcha is case sensitive.') ?>
+
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php index 5d17b451a4a8..d4a5e5e111d4 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php @@ -334,7 +334,8 @@ protected function _prepareColumns() 'editable' => !$this->isReadonly(), 'edit_only' => !$this->getProduct()->getId(), 'header_css_class' => 'col-position', - 'column_css_class' => 'col-position' + 'column_css_class' => 'col-position', + 'filter_condition_callback' => array($this, 'filterProductPosition') ) ); @@ -385,4 +386,17 @@ public function getSelectedCrossSellProducts() } return $products; } + + /** + * Apply `position` filter to cross-sell grid. + * + * @param \Magento\Catalog\Model\Resource\Product\Link\Product\Collection $collection $collection + * @param \Magento\Backend\Block\Widget\Grid\Column\Extended $column + * @return $this + */ + public function filterProductPosition($collection, $column) + { + $collection->addLinkAttributeToFilter($column->getIndex(), $column->getFilter()->getCondition()); + return $this; + } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php index 738fe7b50d24..323ead3a5cfd 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php @@ -340,7 +340,7 @@ public function getOptionValues() ) : '', 'price_type' => $showPrice ? $_value->getPriceType() : 0, 'sku' => $this->escapeHtml($_value->getSku()), - 'sort_order' => $_value->getSortOrder() + 'sort_order' => $_value->getSortOrder(), ); if ($this->getProduct()->getStoreId() != '0') { @@ -358,7 +358,8 @@ public function getOptionValues() $_value->getOptionId(), 'price', is_null($_value->getstorePrice()), - $_value->getOptionTypeId() + $_value->getOptionTypeId(), + ['$(this).up(1).previous()'] ); $value['optionValues'][$i]['scopePriceDisabled'] = is_null( $_value->getStorePrice() @@ -404,9 +405,10 @@ public function getOptionValues() * @param string $name * @param boolean $checked * @param string $select_id + * @param array $containers * @return string */ - public function getCheckboxScopeHtml($id, $name, $checked = true, $select_id = '-1') + public function getCheckboxScopeHtml($id, $name, $checked = true, $select_id = '-1', array $containers = []) { $checkedHtml = ''; if ($checked) { @@ -418,14 +420,20 @@ public function getCheckboxScopeHtml($id, $name, $checked = true, $select_id = ' $selectNameHtml = '[values][' . $select_id . ']'; $selectIdHtml = 'select_' . $select_id . '_'; } + $containers[] = '$(this).up(1)'; + $containers = implode(',', $containers); + $localId = $this->getFieldId() . '_' . $id . '_' . $selectIdHtml . $name . '_use_default'; + $localName = "options_use_default[" . $id . "]" . $selectNameHtml . "[" . $name . "]"; $useDefault = - '
' . '
'; + '
' + . '' + . '
'; return $useDefault; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php index 5fc2bd2a1460..e55b1ef0ec37 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php @@ -94,9 +94,12 @@ public function getDeleteButtonHtml() } /** + * Return select input for price type + * + * @param string $extraParams * @return string */ - public function getPriceTypeSelectHtml() + public function getPriceTypeSelectHtml($extraParams = '') { $this->getChildBlock( 'option_price_type' @@ -105,7 +108,7 @@ public function getPriceTypeSelectHtml() 'product_option_${id}_select_${select_id}_price_type' )->setName( 'product[options][${id}][values][${select_id}][price_type]' - ); + )->setExtraParams($extraParams); return parent::getPriceTypeSelectHtml(); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php index b17bdfcbb78c..746bb97b5000 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php @@ -325,7 +325,8 @@ protected function _prepareColumns() 'editable' => !$this->getProduct()->getUpsellReadonly(), 'edit_only' => !$this->getProduct()->getId(), 'header_css_class' => 'col-position', - 'column_css_class' => 'col-position' + 'column_css_class' => 'col-position', + 'filter_condition_callback' => array($this, 'filterProductPosition') ) ); @@ -376,4 +377,17 @@ public function getSelectedUpsellProducts() } return $products; } + + /** + * Apply `position` filter to cross-sell grid. + * + * @param \Magento\Catalog\Model\Resource\Product\Link\Product\Collection $collection + * @param \Magento\Backend\Block\Widget\Grid\Column\Extended $column + * @return $this + */ + public function filterProductPosition($collection, $column) + { + $collection->addLinkAttributeToFilter($column->getIndex(), $column->getFilter()->getCondition()); + return $this; + } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php index c8d62fa9e671..81a22bbbdd45 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php @@ -122,6 +122,18 @@ protected function _construct() $this->setDestElementId('product-edit-form-tabs'); } + /** + * @param int $attributeSetId + * @return \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection + */ + public function getGroupCollection($attributeSetId) + { + return $this->_collectionFactory->create() + ->setAttributeSetFilter($attributeSetId) + ->setSortOrder() + ->load(); + } + /** * @return $this */ @@ -134,16 +146,13 @@ protected function _prepareLayout() } if ($setId) { - $groupCollection = $this->_collectionFactory->create()->setAttributeSetFilter( - $setId - )->setSortOrder()->load(); - $tabAttributesBlock = $this->getLayout()->createBlock( $this->getAttributeTabBlock(), $this->getNameInLayout() . '_attributes_tab' ); $advancedGroups = array(); - foreach ($groupCollection as $group) { + + foreach ($this->getGroupCollection($setId) as $group) { /** @var $group \Magento\Eav\Model\Entity\Attribute\Group*/ $attributes = $product->getAttributes($group->getId(), true); diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 0e5cc16085e4..d1a2a44fcf66 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -244,36 +244,6 @@ public function getMinimalQty($product) return $minSaleQty > 0 ? $minSaleQty : null; } - /** - * Returns product price block html - * - * @param \Magento\Catalog\Model\Product $product - * @param boolean $displayMinimalPrice - * @param string $idSuffix - * @return string - * @deprecated - */ - public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '') - { - $typeId = $product->getTypeId(); - if ($this->_catalogData->canApplyMsrp($product)) { - $realPriceHtml = $this->_preparePriceRenderer($typeId) - ->setProduct($product) - ->setDisplayMinimalPrice($displayMinimalPrice) - ->setIdSuffix($idSuffix) - ->toHtml(); - $product->setAddToCartUrl($this->getAddToCartUrl($product)); - $product->setRealPriceHtml($realPriceHtml); - $typeId = $this->_mapRenderer; - } - - return $this->_preparePriceRenderer($typeId) - ->setProduct($product) - ->setDisplayMinimalPrice($displayMinimalPrice) - ->setIdSuffix($idSuffix) - ->toHtml(); - } - /** * Get product reviews summary * diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php index e16c7a36c3bd..c6ef67d19479 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php @@ -139,7 +139,12 @@ public function initialize(\Magento\Catalog\Model\Product $product) * Initialize product options */ if (isset($productData['options']) && !$product->getOptionsReadonly()) { - $product->setProductOptions($productData['options']); + // mark custom options that should to fall back to default value + $options = $this->mergeProductOptions( + $productData['options'], + $this->request->getPost('options_use_default') + ); + $product->setProductOptions($options); } $product->setCanSaveCustomOptions( @@ -148,4 +153,30 @@ public function initialize(\Magento\Catalog\Model\Product $product) return $product; } + + /** + * Merge product and default options for product + * + * @param array $productOptions product options + * @param array $overwriteOptions default value options + * @return array + */ + public function mergeProductOptions($productOptions, $overwriteOptions) + { + if (!is_array($productOptions)) { + $productOptions = []; + } + if (is_array($overwriteOptions)) { + $options = array_replace_recursive($productOptions, $overwriteOptions); + array_walk_recursive($options, function (&$item) { + if ($item === "") { + $item = null; + } + }); + } else { + $options = $productOptions; + } + + return $options; + } } diff --git a/app/code/Magento/Catalog/Model/Product/Link.php b/app/code/Magento/Catalog/Model/Product/Link.php index 447b1712261d..40955dc3b44b 100644 --- a/app/code/Magento/Catalog/Model/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Product/Link.php @@ -51,7 +51,7 @@ class Link extends \Magento\Framework\Model\AbstractModel /** * @var mixed */ - protected $_attributeCollection = null; + protected $_attributes = null; /** * Product collection factory @@ -169,7 +169,11 @@ public function getAttributes($type = null) if (is_null($type)) { $type = $this->getLinkTypeId(); } - return $this->_getResource()->getAttributesByType($type); + if (!isset($this->_attributes[$type])) { + $this->_attributes[$type] = $this->_getResource()->getAttributesByType($type); + } + + return $this->_attributes[$type]; } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php b/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php index 6433e327fcb8..72067a2e1935 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php @@ -102,7 +102,33 @@ public function isValid($value) */ protected function validateOptionRequiredFields(Option $option) { - return !$this->isEmpty($option->getTitle()) && !$this->isEmpty($option->getType()); + $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; + $product = $option->getProduct(); + if ($product) { + $storeId = $product->getStoreId(); + } + $title = $option->getTitle(); + return $this->isValidOptionTitle($title, $storeId) && !$this->isEmpty($option->getType()); + } + + /** + * Validate option title + * + * @param string $title + * @param int $storeId + * @return bool + */ + protected function isValidOptionTitle($title, $storeId) + { + // we should be able to set null title for not default store (used for deletion from store view) + if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $title === null) { + return true; + } + if ($this->isEmpty($title)) { + return false; + } + + return true; } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Validator/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Validator/Select.php index 37a8dfc9ad0b..4ee412006c0a 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Validator/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Validator/Select.php @@ -62,14 +62,41 @@ protected function validateOptionValue(Option $option) return false; } + $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; + if ($option->getProduct()) { + $storeId = $option->getProduct()->getStoreId(); + } foreach ($option->getData('values') as $value) { - $type = isset($value['price_type']) ? $value['price_type'] : ''; - $price = isset($value['price']) ? $value['price'] : 0; - $title = isset($value['title']) ? $value['title'] : ''; - if (!$this->isInRange($type, $this->priceTypes) || $this->isNegative($price) || $this->isEmpty($title)) { + $type = isset($value['price_type']) ? $value['price_type'] : null; + $price = isset($value['price']) ? $value['price'] : null; + $title = isset($value['title']) ? $value['title'] : null; + if (!$this->isValidOptionPrice($type, $price, $storeId) + || !$this->isValidOptionTitle($title, $storeId) + ) { return false; } } return true; } + + /** + * Validate option price + * + * @param string $priceType + * @param int $price + * @param int $storeId + * @return bool + */ + protected function isValidOptionPrice($priceType, $price, $storeId) + { + // we should be able to remove website values for default store fallback + if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $priceType === null && $price === null) { + return true; + } + if (!$this->isInRange($priceType, $this->priceTypes) || $this->isNegative($price)) { + return false; + } + + return true; + } } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Link/Product/Collection.php index 6fa34b625770..a23c57bfcd11 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Link/Product/Collection.php @@ -280,10 +280,8 @@ public function joinAttributes() if (!$this->getLinkModel()) { return $this; } - $attributes = $this->getLinkModel()->getAttributes(); - $attributesByType = array(); - foreach ($attributes as $attribute) { + foreach ($this->getLinkAttributes() as $attribute) { $table = $this->getLinkModel()->getAttributeTypeTable($attribute['type']); $alias = sprintf('link_attribute_%s_%s', $attribute['code'], $attribute['type']); @@ -319,4 +317,34 @@ public function setOrder($attribute, $dir = self::SORT_ORDER_ASC) } return parent::setOrder($attribute, $dir); } + + /** + * Get attributes of specified link type + * + * @param int $type + * @return array + */ + public function getLinkAttributes($type = null) + { + return $this->getLinkModel()->getAttributes($type); + } + + /** + * Add link attribute to filter. + * + * @param string $code + * @param array $condition + * @return $this + */ + public function addLinkAttributeToFilter($code, $condition) + { + foreach ($this->getLinkAttributes() as $attribute) { + if ($attribute['code'] == $code) { + $alias = sprintf('link_attribute_%s_%s', $code, $attribute['type']); + $whereCondition = $this->_getConditionSql($alias.'.`value`', $condition); + $this->getSelect()->where($whereCondition); + } + } + return $this; + } } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option.php b/app/code/Magento/Catalog/Model/Resource/Product/Option.php index 60578fff48f9..a87e5e2bdf8a 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option.php @@ -252,95 +252,87 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje */ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $object) { - $readAdapter = $this->_getReadAdapter(); $writeAdapter = $this->_getWriteAdapter(); - $titleTable = $this->getTable('catalog_product_option_title'); - - //title - if (!$object->getData('scope', 'title')) { - $statement = $readAdapter->select()->from( - $titleTable - )->where( - 'option_id = ?', - $object->getId() - )->where( - 'store_id = ?', + $titleTableName = $this->getTable('catalog_product_option_title'); + foreach ([\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) { + $existInCurrentStore = $this->getColFromOptionTable($titleTableName, (int)$object->getId(), (int)$storeId); + $existInDefaultStore = $this->getColFromOptionTable( + $titleTableName, + (int)$object->getId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID ); - - if ($readAdapter->fetchOne($statement)) { - if ($object->getStoreId() == '0') { - $data = $this->_prepareDataForTable( - new \Magento\Framework\Object(array('title' => $object->getTitle())), - $titleTable - ); - - $writeAdapter->update( - $titleTable, - $data, + if ($object->getTitle()) { + if ($existInCurrentStore) { + if ($object->getStoreId() == $storeId) { + $data = $this->_prepareDataForTable( + new \Magento\Framework\Object(array('title' => $object->getTitle())), + $titleTableName + ); + $writeAdapter->update( + $titleTableName, + $data, + array( + 'option_id = ?' => $object->getId(), + 'store_id = ?' => $storeId, + ) + ); + } + } else { + // we should insert record into not default store only of if it does not exist in default store + if (($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInDefaultStore) + || ($storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInCurrentStore) + ) { + $data = $this->_prepareDataForTable( + new \Magento\Framework\Object( + array( + 'option_id' => $object->getId(), + 'store_id' => $storeId, + 'title' => $object->getTitle(), + ) + ), + $titleTableName + ); + $writeAdapter->insert($titleTableName, $data); + } + } + } else { + if ($object->getId() && $object->getStoreId() > \Magento\Store\Model\Store::DEFAULT_STORE_ID + && $storeId + ) { + $writeAdapter->delete( + $titleTableName, array( 'option_id = ?' => $object->getId(), - 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID + 'store_id = ?' => $object->getStoreId(), ) ); } - } else { - $data = $this->_prepareDataForTable( - new \Magento\Framework\Object( - array( - 'option_id' => $object->getId(), - 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, - 'title' => $object->getTitle() - ) - ), - $titleTable - ); - - $writeAdapter->insert($titleTable, $data); } } + } - if ($object->getStoreId() != '0' && !$object->getData('scope', 'title')) { - $statement = $readAdapter->select()->from( - $titleTable - )->where( - 'option_id = ?', - $object->getId() - )->where( - 'store_id = ?', - $object->getStoreId() - ); - - if ($readAdapter->fetchOne($statement)) { - $data = $this->_prepareDataForTable( - new \Magento\Framework\Object(array('title' => $object->getTitle())), - $titleTable - ); + /** + * Get first col from from first row for option table + * + * @param string $tableName + * @param int $optionId + * @param int $storeId + * @return string + */ + protected function getColFromOptionTable($tableName, $optionId, $storeId) + { + $readAdapter = $this->_getReadAdapter(); + $statement = $readAdapter->select()->from( + $tableName + )->where( + 'option_id = ?', + $optionId + )->where( + 'store_id = ?', + $storeId + ); - $writeAdapter->update( - $titleTable, - $data, - array('option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()) - ); - } else { - $data = $this->_prepareDataForTable( - new \Magento\Framework\Object( - array( - 'option_id' => $object->getId(), - 'store_id' => $object->getStoreId(), - 'title' => $object->getTitle() - ) - ), - $titleTable - ); - $writeAdapter->insert($titleTable, $data); - } - } elseif ($object->getData('scope', 'title')) { - $writeAdapter->delete( - $titleTable, - array('option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()) - ); - } + return $readAdapter->fetchOne($statement); } /** diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php index 8cbe4443b0ac..741aa4c7c3ea 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php @@ -109,7 +109,7 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje $price = (double)sprintf('%F', $object->getPrice()); $priceType = $object->getPriceType(); - if (!$object->getData('scope', 'price')) { + if ($object->getPrice() && $priceType) { //save for store_id = 0 $select = $this->_getReadAdapter()->select()->from( $priceTable, @@ -149,7 +149,11 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { + if ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE + && $priceType + && $object->getPrice() + && $object->getStoreId() != \Magento\Store\Model\Store::DEFAULT_STORE_ID + ) { $baseCurrency = $this->_config->getValue( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, @@ -203,12 +207,18 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje } } } else { - if ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) { - $where = array( - 'option_type_id = ?' => (int)$object->getId(), - 'store_id = ?' => (int)$object->getStoreId() - ); - $this->_getWriteAdapter()->delete($priceTable, $where); + if ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE + && !$object->getPrice() + && !$priceType + ) { + $storeIds = $this->_storeManager->getStore($object->getStoreId())->getWebsite()->getStoreIds(); + foreach ($storeIds as $storeId) { + $where = array( + 'option_type_id = ?' => (int)$object->getId(), + 'store_id = ?' => $storeId, + ); + $this->_getWriteAdapter()->delete($priceTable, $where); + } } } } @@ -221,9 +231,8 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje */ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $object) { - $titleTable = $this->getTable('catalog_product_option_type_title'); - - if (!$object->getData('scope', 'title')) { + foreach ([\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) { + $titleTable = $this->getTable('catalog_product_option_type_title'); $select = $this->_getReadAdapter()->select()->from( $titleTable, array('option_type_id') @@ -232,69 +241,78 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje (int)$object->getId() )->where( 'store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID + (int)$storeId ); $optionTypeId = $this->_getReadAdapter()->fetchOne($select); - - if ($optionTypeId) { - if ($object->getStoreId() == '0') { + $existInCurrentStore = $this->getOptionIdFromOptionTable($titleTable, (int)$object->getId(), (int)$storeId); + if ($object->getTitle()) { + if ($existInCurrentStore) { + if ($storeId == $object->getStoreId()) { + $where = array( + 'option_type_id = ?' => (int)$optionTypeId, + 'store_id = ?' => $storeId, + ); + $bind = array('title' => $object->getTitle()); + $this->_getWriteAdapter()->update($titleTable, $bind, $where); + } + } else { + $existInDefaultStore = $this->getOptionIdFromOptionTable( + $titleTable, + (int)$object->getId(), + \Magento\Store\Model\Store::DEFAULT_STORE_ID + ); + // we should insert record into not default store only of if it does not exist in default store + if (($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInDefaultStore) + || ($storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInCurrentStore) + ) { + $bind = array( + 'option_type_id' => (int)$object->getId(), + 'store_id' => $storeId, + 'title' => $object->getTitle() + ); + $this->_getWriteAdapter()->insert($titleTable, $bind); + } + } + } else { + if ($storeId + && $optionTypeId + && $object->getStoreId() > \Magento\Store\Model\Store::DEFAULT_STORE_ID + ) { $where = array( 'option_type_id = ?' => (int)$optionTypeId, - 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID + 'store_id = ?' => $storeId, ); - $bind = array('title' => $object->getTitle()); - $bind = array('title' => $object->getTitle()); - $this->_getWriteAdapter()->update($titleTable, $bind, $where); + $this->_getWriteAdapter()->delete($titleTable, $where); } - } else { - $bind = array( - 'option_type_id' => (int)$object->getId(), - 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, - 'title' => $object->getTitle() - ); - $this->_getWriteAdapter()->insert($titleTable, $bind); } } + } - if ($object->getStoreId() != '0' && !$object->getData('scope', 'title')) { - $select = $this->_getReadAdapter()->select()->from( - $titleTable, - array('option_type_id') - )->where( - 'option_type_id = ?', - (int)$object->getId() - )->where( - 'store_id = ?', - (int)$object->getStoreId() - ); - $optionTypeId = $this->_getReadAdapter()->fetchOne($select); - - if ($optionTypeId) { - $bind = array('title' => $object->getTitle()); - $where = array( - 'option_type_id = ?' => (int)$optionTypeId, - 'store_id = ?' => (int)$object->getStoreId() - ); - $this->_getWriteAdapter()->update($titleTable, $bind, $where); - } else { - $bind = array( - 'option_type_id' => (int)$object->getId(), - 'store_id' => (int)$object->getStoreId(), - 'title' => $object->getTitle() - ); - $this->_getWriteAdapter()->insert($titleTable, $bind); - } - } else { - if ($object->getData('scope', 'title')) { - $where = array( - 'option_type_id = ?' => (int)$object->getId(), - 'store_id = ?' => (int)$object->getStoreId() - ); - $this->_getWriteAdapter()->delete($titleTable, $where); - } - } + /** + * Get first col from from first row for option table + * + * @param string $tableName + * @param int $optionId + * @param int $storeId + * @return string + */ + protected function getOptionIdFromOptionTable($tableName, $optionId, $storeId) + { + $readAdapter = $this->_getReadAdapter(); + $select = $readAdapter->select()->from( + $tableName, + array('option_type_id') + )->where( + 'option_type_id = ?', + $optionId + )->where( + 'store_id = ?', + (int)$storeId + ); + return $readAdapter->fetchOne($select); } + /** * Delete values by option id * diff --git a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadService.php b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadService.php index 6b8b1d3fa5a5..15a67d8eac56 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadService.php +++ b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadService.php @@ -26,9 +26,8 @@ use Magento\Catalog\Model\Category as CategoryModel; use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Service\V1\Data\Category; -use Magento\Catalog\Service\V1\Data\Eav\Category\ProductConverterFactory; -use Magento\Catalog\Service\V1\Data\Eav\Category\ProductLink; -use Magento\Catalog\Service\V1\Data\Eav\Category\ProductLinkBuilder; +use Magento\Catalog\Service\V1\Data\Category\ProductLink; +use Magento\Catalog\Service\V1\Data\Category\ProductLinkBuilder; use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; diff --git a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php index 597d54019382..2d9601c55df9 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php @@ -27,7 +27,7 @@ interface ReadServiceInterface { /** * @param int $categoryId - * @return \Magento\Catalog\Service\V1\Data\Eav\Category\ProductLink[] + * @return \Magento\Catalog\Service\V1\Data\Category\ProductLink[] * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function assignedProducts($categoryId); diff --git a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteService.php b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteService.php index b52114a39f18..082b927dd109 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteService.php +++ b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteService.php @@ -29,7 +29,7 @@ use Magento\Catalog\Model\ProductFactory; use Magento\Catalog\Service\V1\Category\CategoryLoaderFactory; use Magento\Catalog\Service\V1\Data\Category; -use Magento\Catalog\Service\V1\Data\Eav\Category\ProductLink; +use Magento\Catalog\Service\V1\Data\Category\ProductLink; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\StateException; diff --git a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php index cd0c22d8e44a..bcf6f7525040 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php @@ -23,7 +23,7 @@ */ namespace Magento\Catalog\Service\V1\Category\ProductLinks; -use Magento\Catalog\Service\V1\Data\Eav\Category\ProductLink; +use Magento\Catalog\Service\V1\Data\Category\ProductLink; interface WriteServiceInterface { @@ -31,7 +31,7 @@ interface WriteServiceInterface * Assign a product to the required category * * @param int $categoryId - * @param \Magento\Catalog\Service\V1\Data\Eav\Category\ProductLink $productLink + * @param \Magento\Catalog\Service\V1\Data\Category\ProductLink $productLink * @return bool Will returned True if assigned * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\NoSuchEntityException @@ -41,7 +41,7 @@ public function assignProduct($categoryId, ProductLink $productLink); /** * @param int $categoryId - * @param \Magento\Catalog\Service\V1\Data\Eav\Category\ProductLink $productLink + * @param \Magento\Catalog\Service\V1\Data\Category\ProductLink $productLink * @return bool Will returned True if updated * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\NoSuchEntityException diff --git a/app/code/Magento/Catalog/Service/V1/Category/WriteService.php b/app/code/Magento/Catalog/Service/V1/Category/WriteService.php index 8936631404a7..8e0a607ff186 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/WriteService.php +++ b/app/code/Magento/Catalog/Service/V1/Category/WriteService.php @@ -27,7 +27,9 @@ use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Service\V1\Data\Category as CategoryDataObject; use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Exception\StateException; use Magento\Catalog\Service\V1\Data\Category\Mapper as CategoryMapper; use Magento\Store\Model\StoreManagerInterface; @@ -94,13 +96,16 @@ public function create(CategoryDataObject $category) */ public function delete($categoryId) { + if (\Magento\Catalog\Model\Category::TREE_ROOT_ID == $categoryId) { + throw new InputException('Cannot remove the system category.'); + } /** @var Category $category */ $category = $this->loadCategory($categoryId); try { $category->delete(); } catch (\Exception $e) { - throw new CouldNotSaveException('Cannot delete category with id %1', [$categoryId], $e); + throw new StateException('Cannot delete category with id %1', [$categoryId], $e); } return true; @@ -131,10 +136,11 @@ public function move($categoryId, $parentId, $afterId = null) $model = $this->loadCategory($categoryId); $parentCategory = $this->loadCategory($parentId); - if (is_null($afterId) && $parentCategory->hasChildren()) { + if ($parentCategory->hasChildren()) { $parentChildren = $parentCategory->getChildren(); $categoryIds = explode(',', $parentChildren); - $afterId = array_pop($categoryIds); + $lastId = array_pop($categoryIds); + $afterId = (is_null($afterId) || $afterId > $lastId) ? $lastId : $afterId; } if (strpos($parentCategory->getPath(), $model->getPath()) === 0) { diff --git a/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php index 29a6ec664644..46d46f872995 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php @@ -39,7 +39,8 @@ public function create(\Magento\Catalog\Service\V1\Data\Category $category); * * @param int $categoryId category which will deleted * @return bool Will returned True if deleted - * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\StateException * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function delete($categoryId); diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/ProductLink.php b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php similarity index 96% rename from app/code/Magento/Catalog/Service/V1/Data/Eav/Category/ProductLink.php rename to app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php index fe5a6a1976bc..8383aa9a983a 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/ProductLink.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Service\V1\Data\Eav\Category; +namespace Magento\Catalog\Service\V1\Data\Category; /** * @codeCoverageIgnore diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/ProductLinkBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLinkBuilder.php similarity index 96% rename from app/code/Magento/Catalog/Service/V1/Data/Eav/Category/ProductLinkBuilder.php rename to app/code/Magento/Catalog/Service/V1/Data/Category/ProductLinkBuilder.php index 7b0a76b7e109..6f00b75e6869 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/ProductLinkBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLinkBuilder.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Service\V1\Data\Eav\Category; +namespace Magento\Catalog\Service\V1\Data\Category; /** * @codeCoverageIgnore diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category/Tree.php b/app/code/Magento/Catalog/Service/V1/Data/Category/Tree.php index 33bf85cbaa6d..e0eb76424667 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category/Tree.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/Tree.php @@ -136,6 +136,7 @@ public function getTree($node, $depth = null, $currentLevel = 0) ->setPosition($node->getPosition()) ->setLevel($node->getLevel()) ->setActive($node->getIsActive()) + ->setProductCount($node->getProductCount()) ->setChildren([]); if ($node->hasChildren()) { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php index 1b77875b87cb..087b9798c7fb 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php @@ -32,6 +32,7 @@ class Tree extends \Magento\Framework\Service\Data\AbstractObject const POSITION = 'position'; const LEVEL = 'level'; const CHILDREN = 'children'; + const PRODUCT_COUNT = 'product_count'; /** * Get category ID @@ -93,6 +94,16 @@ public function getLevel() return $this->_get(self::LEVEL); } + /** + * Get product count + * + * @return int + */ + public function getProductCount() + { + return $this->_get(self::PRODUCT_COUNT); + } + /** * Get category level * diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php index b2250ff04e57..f46ca55aaddc 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php @@ -82,6 +82,17 @@ public function setPosition($position) return $this->_set(Tree::POSITION, $position); } + /** + * Set product count + * + * @param int $productCount + * @return int + */ + public function setProductCount($productCount) + { + return $this->_set(Tree::PRODUCT_COUNT, $productCount); + } + /** * Set category level * diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index ff3ef067362d..76630102310a 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -2,35 +2,35 @@ "name": "magento/module-catalog", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/module-index": "0.1.0-alpha89", - "magento/module-indexer": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-log": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-widget": "0.1.0-alpha89", - "magento/module-wishlist": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-bundle": "0.1.0-alpha89", - "magento/module-catalog-inventory": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-catalog-rule": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-catalog-search": "0.1.0-alpha89", - "magento/module-weee": "0.1.0-alpha89", - "magento/module-product-alert": "0.1.0-alpha89", - "magento/module-url-rewrite": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/module-index": "0.1.0-alpha90", + "magento/module-indexer": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-log": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-widget": "0.1.0-alpha90", + "magento/module-wishlist": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-bundle": "0.1.0-alpha90", + "magento/module-catalog-inventory": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-catalog-rule": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-catalog-search": "0.1.0-alpha90", + "magento/module-weee": "0.1.0-alpha90", + "magento/module-product-alert": "0.1.0-alpha90", + "magento/module-url-rewrite": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Catalog/etc/adminhtml/acl.xml b/app/code/Magento/Catalog/etc/acl.xml similarity index 96% rename from app/code/Magento/Catalog/etc/adminhtml/acl.xml rename to app/code/Magento/Catalog/etc/acl.xml index ca0bad3473dc..d7e160064098 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/acl.xml +++ b/app/code/Magento/Catalog/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml index 96c4185e5a75..15128975a4c5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml @@ -58,7 +58,9 @@ class="required-entry input-text" type="text" value="${title}" - data-store-label="${title}"> + data-store-label="${title}" + {{if typeof(scopeTitleDisabled) != 'undefined' && scopeTitleDisabled != null}} disabled="disabled" {{/if}} + > {{html checkboxScopeTitle}} @@ -83,7 +85,7 @@ - + diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml index 732dc4636390..ea85c37c21b5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml @@ -59,11 +59,12 @@ - {{html checkboxScopeTitle}} + {{html checkboxScopeTitle}} getCanReadPrice() !== false) : ?> > - getPriceTypeSelectHtml() ?>{{html checkboxScopePrice}} + getPriceTypeSelectHtml('{{if typeof(scopePriceDisabled) != "undefined" && scopePriceDisabled != null}} disabled="disabled" {{/if}}') ?>{{html checkboxScopePrice}} diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml index e3692359697b..8aef6a6e4b96 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml @@ -30,7 +30,7 @@ getLayout()->createBlock('Magento\Catalog\Block\Product\Image'); ?>
- - helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - + helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> - - - - - - - - - diff --git a/app/code/Magento/Cms/etc/adminhtml/acl.xml b/app/code/Magento/Cms/etc/acl.xml similarity index 95% rename from app/code/Magento/Cms/etc/adminhtml/acl.xml rename to app/code/Magento/Cms/etc/acl.xml index 59a0ca89f89b..c26880bbbbb3 100644 --- a/app/code/Magento/Cms/etc/adminhtml/acl.xml +++ b/app/code/Magento/Cms/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index 8eb91f0ab2bd..091d2ae7c31b 100644 --- a/app/code/Magento/CmsUrlRewrite/composer.json +++ b/app/code/Magento/CmsUrlRewrite/composer.json @@ -2,13 +2,13 @@ "name": "magento/module-cms-url-rewrite", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-url-redirect": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89" + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-url-redirect": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Export/Product/Type/Configurable.php similarity index 93% rename from app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Configurable.php rename to app/code/Magento/ConfigurableImportExport/Model/Export/Product/Type/Configurable.php index 290a8019075f..8aa67371907e 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Export/Product/Type/Configurable.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\CatalogImportExport\Model\Export\Product\Type; +namespace Magento\ConfigurableImportExport\Model\Export\Product\Type; class Configurable extends \Magento\CatalogImportExport\Model\Export\Product\Type\AbstractType { diff --git a/app/code/Magento/CatalogImportExport/Model/Export/RowCustomizer.php b/app/code/Magento/ConfigurableImportExport/Model/Export/RowCustomizer.php similarity index 96% rename from app/code/Magento/CatalogImportExport/Model/Export/RowCustomizer.php rename to app/code/Magento/ConfigurableImportExport/Model/Export/RowCustomizer.php index 97db1a13b3ca..280d3af873ba 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/RowCustomizer.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Export/RowCustomizer.php @@ -21,7 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\CatalogImportExport\Model\Export; +namespace Magento\ConfigurableImportExport\Model\Export; + +use \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface; class RowCustomizer implements RowCustomizerInterface { diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php similarity index 99% rename from app/code/Magento/CatalogImportExport/Model/Import/Product/Type/Configurable.php rename to app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php index 8baafce4c66e..ba6b3f4ddecc 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php @@ -1,7 +1,7 @@ + + + + + + Magento\ConfigurableImportExport\Model\Export\RowCustomizer + + + + diff --git a/app/code/Magento/ConfigurableImportExport/etc/export.xml b/app/code/Magento/ConfigurableImportExport/etc/export.xml new file mode 100644 index 000000000000..ff4060a99d80 --- /dev/null +++ b/app/code/Magento/ConfigurableImportExport/etc/export.xml @@ -0,0 +1,28 @@ + + + + + diff --git a/app/code/Magento/ConfigurableImportExport/etc/import.xml b/app/code/Magento/ConfigurableImportExport/etc/import.xml new file mode 100644 index 000000000000..0ae338bc6fe4 --- /dev/null +++ b/app/code/Magento/ConfigurableImportExport/etc/import.xml @@ -0,0 +1,28 @@ + + + + + diff --git a/app/code/Magento/Authz/etc/module.xml b/app/code/Magento/ConfigurableImportExport/etc/module.xml similarity index 76% rename from app/code/Magento/Authz/etc/module.xml rename to app/code/Magento/ConfigurableImportExport/etc/module.xml index 6d155cc63744..1d64d1dcc52b 100644 --- a/app/code/Magento/Authz/etc/module.xml +++ b/app/code/Magento/ConfigurableImportExport/etc/module.xml @@ -24,14 +24,13 @@ */ --> - - - - + - - - + + + + + diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 040930fe7486..9326f2db453f 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -409,7 +409,7 @@ public function getConfigurableAttributesAsArray($product) * @param \Magento\Catalog\Model\Product $product * @return \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\Collection */ - public function getConfigurableAttributeCollection($product) + public function getConfigurableAttributeCollection(\Magento\Catalog\Model\Product $product) { return $this->_attributeCollectionFactory->create()->setProductFilter($product); } @@ -537,8 +537,9 @@ public function beforeSave($product) /** * Save configurable product depended data * - * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $product * @return $this + * @throws \InvalidArgumentException */ public function save($product) { @@ -553,21 +554,26 @@ public function save($product) if (!$product->getIsDuplicate()) { if (!empty($attributeData['id'])) { $configurableAttribute->load($attributeData['id']); - } else { - $configurableAttribute->loadByProductAndAttribute( - $product, - $this->getAttributeById($attributeData['attribute_id'], $product) + $attributeData['attribute_id'] = $configurableAttribute->getAttributeId(); + } elseif (!empty($attributeData['attribute_id'])) { + $attribute = $this->_eavConfig->getAttribute( + \Magento\Catalog\Model\Product::ENTITY, $attributeData['attribute_id'] ); + $attributeData['attribute_id'] = $attribute->getId(); + if (!$this->canUseAttribute($attribute)) { + throw new \InvalidArgumentException( + 'Provided attribute can not be used with configurable product' + ); + } + $configurableAttribute->loadByProductAndAttribute($product, $attribute); } } unset($attributeData['id']); - $configurableAttribute->addData( - $attributeData - )->setStoreId( - $product->getStoreId() - )->setProductId( - $product->getId() - )->save(); + $configurableAttribute + ->addData($attributeData) + ->setStoreId($product->getStoreId()) + ->setProductId($product->getId()) + ->save(); } /** @var $configurableAttributesCollection \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\Collection */ $configurableAttributesCollection = $this->_attributeCollectionFactory->create(); diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php index dc79a87d0843..f00b37516171 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php @@ -25,6 +25,8 @@ */ namespace Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Framework\Model\Context; + /** * @method Attribute _getResource() * @method Attribute getResource() diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php index a84a84b57456..b832a6c8c4e0 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php @@ -25,6 +25,8 @@ */ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute as ConfigurableAttribute; + class Attribute extends \Magento\Framework\Model\Resource\Db\AbstractDb { /** @@ -349,4 +351,74 @@ public function deleteAttributesByProductId($productId) ); $this->_getWriteAdapter()->query($this->_getReadAdapter()->deleteFromSelect($select, $this->getMainTable())); } + + /** + * @param \Magento\Framework\Model\AbstractModel $object + * @return $this + */ + protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object) + { + parent::_afterLoad($object); + $this->loadLabel($object); + $this->loadPrices($object); + return $this; + } + + /** + * Load label for configurable attribute + * + * @param ConfigurableAttribute $object + * @return $this + */ + protected function loadLabel(ConfigurableAttribute $object) + { + $storeId = (int)$this->_storeManager->getStore()->getId(); + $connection = $this->_getReadAdapter(); + $useDefaultCheck = $connection + ->getCheckSql('store.use_default IS NULL', 'def.use_default', 'store.use_default'); + $labelCheck = $connection->getCheckSql('store.value IS NULL', 'def.value', 'store.value'); + $select = $connection + ->select() + ->from(array('def' => $this->_labelTable)) + ->joinLeft( + array('store' => $this->_labelTable), + $connection->quoteInto( + 'store.product_super_attribute_id = def.product_super_attribute_id AND store.store_id = ?', + $storeId + ), + array('use_default' => $useDefaultCheck, 'label' => $labelCheck) + ) + ->where('def.product_super_attribute_id = ?', $object->getId()) + ->where('def.store_id = ?', 0); + + $data = $connection->fetchRow($select); + $object->setLabel($data['label']); + $object->setUseDefault($data['use_default']); + return $this; + } + + /** + * Load prices for configurable attribute + * + * @param ConfigurableAttribute $object + * @return $this + */ + protected function loadPrices(ConfigurableAttribute $object) + { + $websiteId = $this->_catalogData->isPriceGlobal() ? 0 : (int)$this->_storeManager->getStore()->getWebsiteId(); + $select = $this->_getReadAdapter()->select() + ->from($this->_priceTable) + ->where('product_super_attribute_id = ?', $object->getId()) + ->where('website_id = ?', $websiteId); + + foreach ($select->query() as $row) { + $data = [ + 'value_index' => $row['value_index'], + 'is_percent' => $row['is_percent'], + 'pricing_value' => $row['pricing_value'], + ]; + $object->addPrice($data); + } + return $this; + } } diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option.php similarity index 76% rename from app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute.php rename to app/code/Magento/ConfigurableProduct/Service/V1/Data/Option.php index 99e92729f394..0a723a8b6f2a 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option.php @@ -23,14 +23,25 @@ */ namespace Magento\ConfigurableProduct\Service\V1\Data; -class ConfigurableAttribute extends \Magento\Framework\Service\Data\AbstractObject +class Option extends \Magento\Framework\Service\Data\AbstractObject { + /**#@+ + * Constants defined for keys of array + */ const ID = 'id'; + const LABEL = 'label'; + + const TYPE = 'type'; + const USE_DEFAULT = 'use_default'; + const POSITION = 'position'; + const VALUES = 'values'; + const ATTRIBUTE_ID = 'attribute_id'; + /**#@-*/ /** * @return int|null @@ -41,7 +52,7 @@ public function getId() } /** - * @return string + * @return string|null */ public function getAttributeId() { @@ -56,6 +67,22 @@ public function getLabel() return $this->_get(self::LABEL); } + /** + * @return string|null + */ + public function getType() + { + return $this->_get(self::TYPE); + } + + /** + * @return int|null + */ + public function getPosition() + { + return $this->_get(self::POSITION); + } + /** * @return bool|null */ @@ -65,7 +92,7 @@ public function isUseDefault() } /** - * @return \Magento\ConfigurableProduct\Service\V1\Data\ConfigurableAttribute\Value[] + * @return \Magento\ConfigurableProduct\Service\V1\Data\Option\Value[]|null */ public function getValues() { diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute/Value.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/Value.php similarity index 82% rename from app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute/Value.php rename to app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/Value.php index 6b88e10b4ac8..0ecd1e149249 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute/Value.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/Value.php @@ -1,6 +1,4 @@ _get(self::PRICE_IS_PERCENT); + return $this->_get(self::IS_PERCENT); } /** diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute/ValueBuilder.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueBuilder.php similarity index 88% rename from app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute/ValueBuilder.php rename to app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueBuilder.php index 511e1c33b15f..f113fde85bf7 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttribute/ValueBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueBuilder.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\ConfigurableProduct\Service\V1\Data\ConfigurableAttribute; +namespace Magento\ConfigurableProduct\Service\V1\Data\Option; use Magento\Framework\Service\Data\AbstractObjectBuilder; @@ -40,9 +40,9 @@ public function setPrice($value) * @param int $value * @return self */ - public function setPriceIsPercent($value) + public function setPercent($value) { - return $this->_set(Value::PRICE_IS_PERCENT, $value); + return $this->_set(Value::IS_PERCENT, $value); } /** diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueConverter.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueConverter.php new file mode 100644 index 000000000000..202c6f19b1f2 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueConverter.php @@ -0,0 +1,40 @@ + $value->getIndex(), + 'is_percent' => $value->isPercent(), + 'pricing_value' => $value->getPrice(), + ]; + } +} diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttributeBuilder.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionBuilder.php similarity index 58% rename from app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttributeBuilder.php rename to app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionBuilder.php index a50a266156f4..e720f3e8213f 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/ConfigurableAttributeBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionBuilder.php @@ -23,50 +23,68 @@ */ namespace Magento\ConfigurableProduct\Service\V1\Data; -class ConfigurableAttributeBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class OptionBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder { /** - * @param int $value - * @return self + * @param int $value + * @return $this */ public function setId($value) { - return $this->_set(ConfigurableAttribute::ID, $value); + return $this->_set(Option::ID, $value); } /** * @param string $value - * @return self + * @return $this */ public function setAttributeId($value) { - return $this->_set(ConfigurableAttribute::ATTRIBUTE_ID, $value); + return $this->_set(Option::ATTRIBUTE_ID, $value); } /** - * @param string $value - * @return self + * @param string $value + * @return $this */ public function setLabel($value) { - return $this->_set(ConfigurableAttribute::LABEL, $value); + return $this->_set(Option::LABEL, $value); + } + + /** + * @param int $value + * @return $this + */ + public function setPosition($value) + { + return $this->_set(Option::POSITION, $value); } /** * @param bool $value * @return self */ - public function useDefault($value) + public function setType($value) { - return $this->_set(ConfigurableAttribute::USE_DEFAULT, $value); + return $this->_set(Option::TYPE, $value); } /** - * @param \Magento\ConfigurableProduct\Service\V1\Data\ConfigurableAttribute\Value[] $value - * @return self + * @param bool $value + * @return $this + */ + public function setUseDefault($value) + { + return $this->_set(Option::USE_DEFAULT, $value); + } + + /** + * @param \Magento\ConfigurableProduct\Service\V1\Data\Option\Value[] $value + * @return $this */ public function setValues($value) { - return $this->_set(ConfigurableAttribute::VALUES, $value); + return $this->_set(Option::VALUES, $value); } } diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionConverter.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionConverter.php new file mode 100644 index 000000000000..d50d21f1f612 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionConverter.php @@ -0,0 +1,152 @@ +optionBuilder = $optionBuilder; + $this->valueBuilder = $valueBuilder; + $this->attributeFactory = $attributeFactory; + $this->valueConverter = $valueConverter; + } + + /** + * Convert configurable attribute to option data object + * + * @param Attribute $configurableAttribute + * @return \Magento\ConfigurableProduct\Service\V1\Data\Option + */ + public function convertFromModel(Attribute $configurableAttribute) + { + $values = []; + $prices = $configurableAttribute->getPrices(); + if (is_array($prices)) { + foreach ($prices as $price) { + $values[] = $this->valueBuilder + ->setIndex($price['value_index']) + ->setPrice($price['pricing_value']) + ->setPercent($price['is_percent']) + ->create(); + } + } + + $data = [ + Option::ID => $configurableAttribute->getId(), + Option::ATTRIBUTE_ID => $configurableAttribute->getAttributeId(), + Option::LABEL => $configurableAttribute->getLabel(), + Option::TYPE => $configurableAttribute->getProductAttribute()->getFrontend()->getInputType(), + Option::POSITION => $configurableAttribute->getPosition(), + Option::USE_DEFAULT => $configurableAttribute->getData('use_default'), + Option::VALUES => $values + ]; + + return $this->optionBuilder->populateWithArray($data)->create(); + } + + /** + * @param Option $option + * @return array + */ + public function convertArrayFromData(Option $option) + { + $values = []; + if (is_array($option->getValues())) { + foreach ($option->getValues() as $value) { + $values[] = $this->valueConverter->convertArrayFromData($value); + } + } + return [ + 'attribute_id' => $option->getAttributeId(), + 'position' => $option->getPosition(), + 'use_default' => $option->isUseDefault(), + 'label' => $option->getLabel(), + 'values' => $values + ]; + } + + /** + * @param Option $option + * @param Attribute $configurableAttribute + * @return Attribute + */ + public function getModelFromData(Option $option, Attribute $configurableAttribute) + { + /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $returnConfigurableAttribute */ + $returnConfigurableAttribute = $this->attributeFactory->create(); + $returnConfigurableAttribute->setData($configurableAttribute->getData()); + $returnConfigurableAttribute->addData($option->__toArray()); + $returnConfigurableAttribute->setId($configurableAttribute->getId()); + $returnConfigurableAttribute->setAttributeId($configurableAttribute->getAttributeId()); + $returnConfigurableAttribute->setValues($configurableAttribute->getPrices()); + + $values = $option->getValues(); + if (!is_null($values)) { + $prices = []; + foreach ($values as $value) { + $prices[] = $this->valueConverter->convertArrayFromData($value); + } + $returnConfigurableAttribute->setValues($prices); + } + + return $returnConfigurableAttribute; + } +} diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadService.php b/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadService.php new file mode 100644 index 000000000000..57b4e17625fe --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadService.php @@ -0,0 +1,144 @@ +productRepository = $productRepository; + $this->optionConverter = $optionConverter; + $this->configurableType = $configurableType; + $this->inputType = $inputType; + } + + /** + * {@inheritdoc} + */ + public function get($productSku, $optionId) + { + $product = $this->getProduct($productSku); + $collection = $this->getConfigurableAttributesCollection($product); + $collection->addFieldToFilter($collection->getResource()->getIdFieldName(), $optionId); + /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $configurableAttribute */ + $configurableAttribute = $collection->getFirstItem(); + if (!$configurableAttribute->getId()) { + throw new NoSuchEntityException(sprintf('Requested option doesn\'t exist: %s', $optionId)); + } + return $this->optionConverter->convertFromModel($configurableAttribute); + } + + /** + * {@inheritdoc} + */ + public function getList($productSku) + { + $options = []; + $product = $this->getProduct($productSku); + foreach ($this->getConfigurableAttributesCollection($product) as $option) { + $options[] = $this->optionConverter->convertFromModel($option); + } + return $options; + } + + /** + * @inheritdoc + */ + public function getTypes() + { + return array_map( + function ($inputType) { + return $inputType['value']; + }, + $this->inputType->toOptionArray() + ); + } + + /** + * Retrieve product instance by sku + * + * @param string $productSku + * @return \Magento\Catalog\Model\Product + * @throws \Magento\Webapi\Exception + */ + private function getProduct($productSku) + { + $product = $this->productRepository->get($productSku); + if (ConfigurableType::TYPE_CODE !== $product->getTypeId()) { + throw new Exception( + sprintf('Only implemented for configurable product: %s', $productSku), + Exception::HTTP_FORBIDDEN + ); + } + return $product; + } + + /** + * Retrieve configurable attribute collection through product object + * + * @param \Magento\Catalog\Model\Product $product + * @return Collection + */ + private function getConfigurableAttributesCollection(\Magento\Catalog\Model\Product $product) + { + return $this->configurableType->getConfigurableAttributeCollection($product); + } +} diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadServiceInterface.php b/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadServiceInterface.php new file mode 100644 index 000000000000..1cfd5c2d8e80 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/ReadServiceInterface.php @@ -0,0 +1,58 @@ +productRepository = $productRepository; + $this->configurableAttributeFactory = $configurableAttributeFactory; + $this->eavConfig = $eavConfig; + $this->optionConverter = $optionConverter; + $this->storeManager = $storeManager; + $this->productType = $productType; + } + + /** + * {@inheritdoc} + */ + public function add($productSku, Option $option) + { + $product = $this->productRepository->get($productSku); + $allowedTypes = [ProductType::TYPE_SIMPLE, ProductType::TYPE_VIRTUAL, ConfigurableType::TYPE_CODE]; + if (!in_array($product->getTypeId(), $allowedTypes)) { + throw new \InvalidArgumentException('Incompatible product type'); + } + + $eavAttribute = $this->eavConfig->getAttribute(Product::ENTITY, $option->getAttributeId()); + + /** @var $configurableAttribute \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute */ + $configurableAttribute = $this->configurableAttributeFactory->create(); + $configurableAttribute->loadByProductAndAttribute($product, $eavAttribute); + if ($configurableAttribute->getId()) { + throw new CouldNotSaveException('Product already has this option'); + } + + try { + $product->setTypeId(ConfigurableType::TYPE_CODE); + $product->setConfigurableAttributesData([$this->optionConverter->convertArrayFromData($option)]); + $product->setStoreId($this->storeManager->getStore(Store::ADMIN_CODE)->getId()); + $product->save(); + } catch (\Exception $e) { + throw new CouldNotSaveException('An error occurred while saving option'); + } + + $configurableAttribute = $this->configurableAttributeFactory->create(); + $configurableAttribute->loadByProductAndAttribute($product, $eavAttribute); + if (!$configurableAttribute->getId()) { + throw new CouldNotSaveException('An error occurred while saving option'); + } + + return $configurableAttribute->getId(); + } + + /** + * {@inheritdoc} + */ + public function update($productSku, $optionId, Option $option) + { + $product = $this->getProduct($productSku); + + $configurableAttribute = $this->configurableAttributeFactory->create(); + $configurableAttribute->load($optionId); + if (!$configurableAttribute->getId() || $configurableAttribute->getProductId() != $product->getId()) { + throw new NoSuchEntityException('Option with id "%1" not found', [$optionId]); + } + $configurableAttribute = $this->optionConverter->getModelFromData($option, $configurableAttribute); + try { + $configurableAttribute->save(); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not update option with id "%1"', [$optionId]); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function remove($productSku, $optionId) + { + $product = $this->getProduct($productSku); + + $attributeCollection = $this->productType->getConfigurableAttributeCollection($product); + /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $option */ + $option = $attributeCollection->getItemById($optionId); + + if ($option === null) { + throw new NoSuchEntityException('Requested option doesn\'t exist'); + } + $option->delete(); + + return true; + } + + /** + * @param string $productSku + * @return \Magento\Catalog\Model\Product + * @throws \Magento\Webapi\Exception + */ + private function getProduct($productSku) + { + $product = $this->productRepository->get($productSku); + if (ConfigurableType::TYPE_CODE !== $product->getTypeId()) { + throw new Exception( + 'Product with specified sku: "%1" is not a configurable product', + Exception::HTTP_FORBIDDEN, + Exception::HTTP_FORBIDDEN, + [ + $product->getSku() + ] + ); + } + return $product; + } +} diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceInterface.php b/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceInterface.php new file mode 100644 index 000000000000..4b01d72194bf --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceInterface.php @@ -0,0 +1,61 @@ +getAttributesForMatrix($configurableAttributes); + $attributes = $this->getAttributesForMatrix($options); $variations = $this->variationMatrix->getVariations($attributes); $products = $this->populateProductVariation($product, $variations, $attributes); return $products; @@ -74,18 +74,18 @@ public function generateVariation(Product $product, $configurableAttributes) /** * Prepare attribute info for variation matrix generation * - * @param \Magento\ConfigurableProduct\Service\V1\Data\ConfigurableAttribute[] $configurableAttributes + * @param \Magento\ConfigurableProduct\Service\V1\Data\Option[] $options * @return array */ - private function getAttributesForMatrix($configurableAttributes) + private function getAttributesForMatrix($options) { $attributes = []; - foreach ($configurableAttributes as $configurableAttribute) { - $configurable = $configurableAttribute->__toArray(); - $attribute = $this->attributeReadService->info($configurableAttribute->getAttributeId()); + foreach ($options as $option) { + $configurable = $option->__toArray(); + $attribute = $this->attributeReadService->info($option->getAttributeId()); $configurable['options'] = $attribute->__toArray()['options']; $configurable['attribute_code'] = $attribute->getAttributeCode(); - $attributes[$configurableAttribute->getAttributeId()] = $configurable; + $attributes[$option->getAttributeId()] = $configurable; } return $attributes; } @@ -113,7 +113,7 @@ private function populateProductVariation(Product $product, $variations, $attrib ); $priceInfo = $valueInfo['price']; $price += (!empty($priceInfo['is_percent']) ? $product->getPrice() / 100.0 : 1.0) - * $priceInfo['pricing_value']; + * $priceInfo['price']; } $this->productBuilder->setPrice($price); $this->productBuilder->setName($product->getName() . $suffix); diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/ReadServiceInterface.php b/app/code/Magento/ConfigurableProduct/Service/V1/ReadServiceInterface.php index 49ac8f1ff90f..7b4bd51b4051 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/ReadServiceInterface.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/ReadServiceInterface.php @@ -29,11 +29,11 @@ interface ReadServiceInterface * Generate variation based on same product * * @param \Magento\Catalog\Service\V1\Data\Product $product - * @param \Magento\ConfigurableProduct\Service\V1\Data\ConfigurableAttribute[] $configurableAttributes + * @param \Magento\ConfigurableProduct\Service\V1\Data\Option[] $options * @return \Magento\Catalog\Service\V1\Data\Product[] */ public function generateVariation( \Magento\Catalog\Service\V1\Data\Product $product, - $configurableAttributes + $options ); } diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 27f4fed2b11a..7c456e44c9bf 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -2,26 +2,26 @@ "name": "magento/module-configurable-product", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-catalog-inventory": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-catalog-rule": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-weee": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", - "magento/module-webapi": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-catalog-inventory": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-catalog-rule": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-weee": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", + "magento/module-webapi": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/ConfigurableProduct/etc/di.xml b/app/code/Magento/ConfigurableProduct/etc/di.xml index 472fdd85bdc1..447c8e94c509 100644 --- a/app/code/Magento/ConfigurableProduct/etc/di.xml +++ b/app/code/Magento/ConfigurableProduct/etc/di.xml @@ -24,9 +24,12 @@ */ --> + + + diff --git a/app/code/Magento/ConfigurableProduct/etc/webapi.xml b/app/code/Magento/ConfigurableProduct/etc/webapi.xml index fd11c2f6b29f..315bcd1423e5 100644 --- a/app/code/Magento/ConfigurableProduct/etc/webapi.xml +++ b/app/code/Magento/ConfigurableProduct/etc/webapi.xml @@ -49,4 +49,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index 067e82511f5d..acae9e53d5a3 100644 --- a/app/code/Magento/Contact/composer.json +++ b/app/code/Magento/Contact/composer.json @@ -2,16 +2,16 @@ "name": "magento/module-contact", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Contact/etc/adminhtml/acl.xml b/app/code/Magento/Contact/etc/acl.xml similarity index 94% rename from app/code/Magento/Contact/etc/adminhtml/acl.xml rename to app/code/Magento/Contact/etc/acl.xml index d957ae0cd5a1..4a8bd27964d7 100644 --- a/app/code/Magento/Contact/etc/adminhtml/acl.xml +++ b/app/code/Magento/Contact/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json index 1cef33c57154..a79885d900b3 100644 --- a/app/code/Magento/Core/composer.json +++ b/app/code/Magento/Core/composer.json @@ -2,19 +2,19 @@ "name": "magento/module-core", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-cron": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-page-cache": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-cron": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-page-cache": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php index 56d23dbff9d8..0e03bc5a2968 100644 --- a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php +++ b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php @@ -26,7 +26,7 @@ $installer = $this; $installer->startSetup(); -$tableName = $installer->getTable('admin_rule'); +$tableName = $installer->getTable('authorization_rule'); if ($tableName) { $installer->getConnection()->delete($tableName, array('resource_id = ?' => 'admin/system/tools/compiler')); } diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index a46386ee5215..24bb9c00e22f 100644 --- a/app/code/Magento/Cron/composer.json +++ b/app/code/Magento/Cron/composer.json @@ -2,14 +2,14 @@ "name": "magento/module-cron", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index a47864769f57..616e2e5509aa 100644 --- a/app/code/Magento/CurrencySymbol/composer.json +++ b/app/code/Magento/CurrencySymbol/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-currency-symbol", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-page-cache": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-page-cache": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/CurrencySymbol/etc/adminhtml/acl.xml b/app/code/Magento/CurrencySymbol/etc/acl.xml similarity index 94% rename from app/code/Magento/CurrencySymbol/etc/adminhtml/acl.xml rename to app/code/Magento/CurrencySymbol/etc/acl.xml index 001ddce96688..5afa8f8b167f 100644 --- a/app/code/Magento/CurrencySymbol/etc/adminhtml/acl.xml +++ b/app/code/Magento/CurrencySymbol/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Customer/Model/Authorization/CustomerSessionUserContext.php b/app/code/Magento/Customer/Model/Authorization/CustomerSessionUserContext.php new file mode 100644 index 000000000000..4fa7209e9790 --- /dev/null +++ b/app/code/Magento/Customer/Model/Authorization/CustomerSessionUserContext.php @@ -0,0 +1,66 @@ +_customerSession = $customerSession; + } + + /** + * {@inheritdoc} + */ + public function getUserId() + { + return $this->_customerSession->getId(); + } + + /** + * {@inheritdoc} + */ + public function getUserType() + { + return UserContextInterface::USER_TYPE_CUSTOMER; + } +} diff --git a/app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php b/app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php new file mode 100644 index 000000000000..d75d2f4d91e6 --- /dev/null +++ b/app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php @@ -0,0 +1,79 @@ +userContext = $userContext; + } + + /** + * Check if resource for which access is needed has self permissions defined in webapi config. + * + * @param \Magento\Framework\Authorization $subject + * @param callable $proceed + * @param string $resource + * @param string $privilege + * + * @return bool true If resource permission is self, to allow + * customer access without further checks in parent method + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundIsAllowed( + \Magento\Framework\Authorization $subject, + \Closure $proceed, + $resource, + $privilege = null + ) { + if ($resource == AuthorizationService::PERMISSION_SELF + && $this->userContext->getUserId() + && $this->userContext->getUserType() === UserContextInterface::USER_TYPE_CUSTOMER + ) { + return true; + } else { + return $proceed($resource, $privilege); + } + } +} diff --git a/app/code/Magento/Customer/Model/Resource/Address.php b/app/code/Magento/Customer/Model/Resource/Address.php index 756b65d6fefe..c86f39abb472 100644 --- a/app/code/Magento/Customer/Model/Resource/Address.php +++ b/app/code/Magento/Customer/Model/Resource/Address.php @@ -25,6 +25,8 @@ */ namespace Magento\Customer\Model\Resource; +use \Magento\Framework\Exception\InputException; + class Address extends \Magento\Eav\Model\Entity\AbstractEntity { /** @@ -140,7 +142,12 @@ protected function _validate($address) $validator = $this->_validatorFactory->createValidator('customer_address', 'save'); if (!$validator->isValid($address)) { - throw new \Magento\Framework\Validator\ValidatorException($validator->getMessages()); + throw new \Magento\Framework\Validator\ValidatorException( + InputException::DEFAULT_MESSAGE, + [], + null, + $validator->getMessages() + ); } } diff --git a/app/code/Magento/Customer/Model/Resource/Customer.php b/app/code/Magento/Customer/Model/Resource/Customer.php index 663754c47e06..b4e646ba88c8 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer.php +++ b/app/code/Magento/Customer/Model/Resource/Customer.php @@ -23,6 +23,8 @@ */ namespace Magento\Customer\Model\Resource; +use \Magento\Framework\Exception\InputException; + /** * Customer entity resource model */ @@ -174,7 +176,12 @@ protected function _validate($customer) $validator = $this->_validatorFactory->createValidator('customer', 'save'); if (!$validator->isValid($customer)) { - throw new \Magento\Framework\Validator\ValidatorException($validator->getMessages()); + throw new \Magento\Framework\Validator\ValidatorException( + InputException::DEFAULT_MESSAGE, + [], + null, + $validator->getMessages() + ); } } diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index b98cad217d00..5b847f192ad4 100755 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -547,12 +547,11 @@ public function setAfterAuthUrl($url) /** * Reset core session hosts after reseting session ID * - * @param bool $deleteOldSession * @return $this */ - public function regenerateId($deleteOldSession = true) + public function regenerateId() { - parent::regenerateId($deleteOldSession); + parent::regenerateId(); $this->_cleanHosts(); return $this; } diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php index be9307eff68c..5a14411d22d2 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php @@ -278,10 +278,10 @@ public function authenticate($username, $password) $this->eventManager->dispatch('customer_login', array('customer' => $customerModel)); - $customerDto = $this->converter->createCustomerFromModel($customerModel); - $this->eventManager->dispatch('customer_data_object_login', array('customer' => $customerDto)); + $customerData = $this->converter->createCustomerFromModel($customerModel); + $this->eventManager->dispatch('customer_data_object_login', array('customer' => $customerData)); - return $customerDto; + return $customerData; } /** diff --git a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php index 1551885f9575..ae79cc3044e3 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php @@ -226,7 +226,7 @@ private function _createMetadataAttribute($attribute) } $validationRules = []; foreach ($attribute->getValidateRules() as $name => $value) { - $validationRules[$name] = $this->_validationRuleBuilder->setName($name) + $validationRules[] = $this->_validationRuleBuilder->setName($name) ->setValue($value) ->create(); } @@ -243,6 +243,7 @@ private function _createMetadataAttribute($attribute) ->setOptions($options) ->setFrontendClass($attribute->getFrontend()->getClass()) ->setFrontendLabel($attribute->getFrontendLabel()) + ->setBackendType($attribute->getBackendType()) ->setNote($attribute->getNote()) ->setIsSystem($attribute->getIsSystem()) ->setIsUserDefined($attribute->getIsUserDefined()) diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php index c9ba34c2d77d..4ba3c371fcb1 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php @@ -51,7 +51,7 @@ class AttributeMetadata extends \Magento\Framework\Service\Data\AbstractObject const DATA_MODEL = 'data_model'; - const IS_USER_DEFINED = 'is_user_defined'; + const USER_DEFINED = 'user_defined'; const FRONTEND_CLASS = 'frontend_class'; @@ -59,7 +59,7 @@ class AttributeMetadata extends \Magento\Framework\Service\Data\AbstractObject const FRONTEND_LABEL = 'frontend_label'; - const IS_SYSTEM = 'is_system'; + const SYSTEM = 'system'; const NOTE = 'note'; @@ -184,7 +184,7 @@ public function getFrontendClass() */ public function isUserDefined() { - return $this->_get(self::IS_USER_DEFINED); + return $this->_get(self::USER_DEFINED); } /** @@ -224,7 +224,7 @@ public function getNote() */ public function isSystem() { - return $this->_get(self::IS_SYSTEM); + return $this->_get(self::SYSTEM); } /** diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php index e45d018fad67..ef50ab9a124a 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php @@ -188,7 +188,7 @@ public function setFrontendClass($frontendClass) */ public function setIsUserDefined($isUserDefined) { - return $this->_set(AttributeMetadata::IS_USER_DEFINED, $isUserDefined); + return $this->_set(AttributeMetadata::USER_DEFINED, $isUserDefined); } /** @@ -221,7 +221,7 @@ public function setFrontendLabel($frontendLabel) */ public function setIsSystem($isSystem) { - return $this->_set(AttributeMetadata::IS_SYSTEM, $isSystem); + return $this->_set(AttributeMetadata::SYSTEM, $isSystem); } /** diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index 020cabb48bc2..883e23e784e9 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -2,28 +2,30 @@ "name": "magento/module-customer", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-newsletter": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-wishlist": "0.1.0-alpha89", - "magento/module-index": "0.1.0-alpha89", - "magento/module-log": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-review": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-page-cache": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-newsletter": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-wishlist": "0.1.0-alpha90", + "magento/module-index": "0.1.0-alpha90", + "magento/module-log": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-review": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-page-cache": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", + "magento/module-authorization": "0.1.0-alpha90", + "magento/module-integration": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Customer/etc/adminhtml/acl.xml b/app/code/Magento/Customer/etc/acl.xml similarity index 95% rename from app/code/Magento/Customer/etc/adminhtml/acl.xml rename to app/code/Magento/Customer/etc/acl.xml index 392c11a83598..0544b9cd0e61 100644 --- a/app/code/Magento/Customer/etc/adminhtml/acl.xml +++ b/app/code/Magento/Customer/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 186380578ca1..f84399e87a6a 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -68,7 +68,7 @@ - + diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index 91d05a2966cf..57366ea6e061 100644 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -30,6 +30,7 @@ + @@ -46,6 +47,7 @@ + diff --git a/app/code/Magento/Customer/etc/webapi.xml b/app/code/Magento/Customer/etc/webapi.xml index 2d2179ffa7a6..842e90b8f044 100644 --- a/app/code/Magento/Customer/etc/webapi.xml +++ b/app/code/Magento/Customer/etc/webapi.xml @@ -161,7 +161,7 @@ - null + %customer_id% diff --git a/app/code/Magento/Customer/etc/webapi_rest/di.xml b/app/code/Magento/Customer/etc/webapi_rest/di.xml new file mode 100644 index 000000000000..8eb5b6d92bad --- /dev/null +++ b/app/code/Magento/Customer/etc/webapi_rest/di.xml @@ -0,0 +1,45 @@ + + + + + + + + + frontend + + + + + + + Magento\Customer\Model\Authorization\CustomerSessionUserContext + 20 + + + + + diff --git a/app/code/Magento/Authz/etc/adminhtml/di.xml b/app/code/Magento/Customer/etc/webapi_soap/di.xml similarity index 86% rename from app/code/Magento/Authz/etc/adminhtml/di.xml rename to app/code/Magento/Customer/etc/webapi_soap/di.xml index d4a583c57f7a..2b574a8f2377 100644 --- a/app/code/Magento/Authz/etc/adminhtml/di.xml +++ b/app/code/Magento/Customer/etc/webapi_soap/di.xml @@ -24,5 +24,7 @@ */ --> - + + + diff --git a/app/code/Magento/Customer/view/frontend/templates/account/customer.phtml b/app/code/Magento/Customer/view/frontend/templates/account/customer.phtml index d4be822c8c8d..81f3c80517d4 100644 --- a/app/code/Magento/Customer/view/frontend/templates/account/customer.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/account/customer.phtml @@ -23,13 +23,13 @@ */ ?> customerLoggedIn()): ?> -
  • +
  • getCustomerName(); ?> getChildHtml()):?> -
  • - + init($_item, 'product_comparison_list')->toHtml() ?> - + productAttribute($_item, $_item->getName(), 'name') ?> getReviewsSummaryHtml($_item, 'short') ?> getProductPrice($_item, '-compare-list-top') ?> -
    -
    +
    +
    isSaleable()): ?>
    helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> -
    escapeHtml($this->getProductName()) ?> + escapeHtml($this->getProductName()) ?> getOptionList()):?>
    @@ -54,7 +54,7 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data');
    + helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> @@ -138,9 +138,9 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); getQty() ?>getQty() ?> + helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js index 3cbfea4d1699..5b5dfcf568ba 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js @@ -44,6 +44,7 @@ define([ registerCustomerPasswordSelector: '#co-billing-form .field.password,#co-billing-form .field.confirm', suggestRegistration: false }, + pageMessages: '#maincontent .messages .message', sectionSelectorPrefix: 'opc-', billingSection: 'billing', ajaxLoaderPlaceButton: false, @@ -174,6 +175,9 @@ define([ loginRegister = $( checkout.loginRegisterSelector )[0], method = 'register', action = 'show'; + + //Remove page messages + $(this.options.pageMessages).remove(); if (json.isGuestCheckoutAllowed) { @@ -288,5 +292,4 @@ define([ } } }); - }); diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index e7721e204233..53612c3a15a9 100644 --- a/app/code/Magento/CheckoutAgreements/composer.json +++ b/app/code/Magento/CheckoutAgreements/composer.json @@ -2,15 +2,15 @@ "name": "magento/module-checkout-agreements", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-store": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-store": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/CheckoutAgreements/etc/adminhtml/acl.xml b/app/code/Magento/CheckoutAgreements/etc/acl.xml similarity index 93% rename from app/code/Magento/CheckoutAgreements/etc/adminhtml/acl.xml rename to app/code/Magento/CheckoutAgreements/etc/acl.xml index b51f0fe9565c..5bedc875cd00 100644 --- a/app/code/Magento/CheckoutAgreements/etc/adminhtml/acl.xml +++ b/app/code/Magento/CheckoutAgreements/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index 94f9e1f5d553..04e668fb805e 100644 --- a/app/code/Magento/Cms/composer.json +++ b/app/code/Magento/Cms/composer.json @@ -2,20 +2,20 @@ "name": "magento/module-cms", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-widget": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-email": "0.1.0-alpha89", - "magento/module-install": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-widget": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-email": "0.1.0-alpha90", + "magento/module-install": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php b/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php index e01cc7508ba8..2ad56df0bea7 100644 --- a/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php +++ b/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php @@ -202,14 +202,6 @@ PERSISTENT_SHOPPING_CART A link to information about your cart and viewing history if you have asked the site.
    POLLThe ID of any polls you have recently voted in.
    POLLNInformation on what polls you have voted on.
    RECENTLYCOMPARED The items that you have recently compared.
    diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index 650b3fa8db6b..4ff54743f583 100644 --- a/app/code/Magento/Eav/composer.json +++ b/app/code/Magento/Eav/composer.json @@ -2,16 +2,16 @@ "name": "magento/module-eav", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 3f8c783a0bf5..1f01b6d4c0d6 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-email", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Email/etc/adminhtml/acl.xml b/app/code/Magento/Email/etc/acl.xml similarity index 93% rename from app/code/Magento/Email/etc/adminhtml/acl.xml rename to app/code/Magento/Email/etc/acl.xml index 46699dfcc8fe..39c597eb28d9 100644 --- a/app/code/Magento/Email/etc/adminhtml/acl.xml +++ b/app/code/Magento/Email/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 10a02701ac65..1daa81c68b19 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -62,6 +62,22 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C */ protected $_code = self::CODE; + /** + * Types of rates, order is important + * + * @var array + */ + protected $_ratesOrder = [ + 'RATED_ACCOUNT_PACKAGE', + 'PAYOR_ACCOUNT_PACKAGE', + 'RATED_ACCOUNT_SHIPMENT', + 'PAYOR_ACCOUNT_SHIPMENT', + 'RATED_LIST_PACKAGE', + 'PAYOR_LIST_PACKAGE', + 'RATED_LIST_SHIPMENT', + 'PAYOR_LIST_SHIPMENT' + ]; + /** * Rate request data * @@ -585,8 +601,7 @@ protected function _getRateAmountOriginBased($rate) $rateTypeAmounts[$rateType] = $netAmount; } - // Order is important - foreach (array('RATED_ACCOUNT_SHIPMENT', 'RATED_LIST_SHIPMENT', 'RATED_LIST_PACKAGE') as $rateType) { + foreach ($this->_ratesOrder as $rateType) { if (!empty($rateTypeAmounts[$rateType])) { $amount = $rateTypeAmounts[$rateType]; break; diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 9c13f7eb7d88..462b906d6202 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -2,20 +2,20 @@ "name": "magento/module-fedex", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-shipping": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-catalog-inventory": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-shipping": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-catalog-inventory": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index d48fce67defd..1b7228317bb7 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -2,21 +2,21 @@ "name": "magento/module-gift-message", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-multishipping": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-multishipping": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index 5fc47874f0d9..d6f7e5d6a8e8 100644 --- a/app/code/Magento/GoogleAdwords/composer.json +++ b/app/code/Magento/GoogleAdwords/composer.json @@ -2,14 +2,14 @@ "name": "magento/module-google-adwords", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index 5cb9bc78c258..4919131005d3 100644 --- a/app/code/Magento/GoogleAnalytics/composer.json +++ b/app/code/Magento/GoogleAnalytics/composer.json @@ -2,14 +2,14 @@ "name": "magento/module-google-analytics", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleAnalytics/etc/adminhtml/acl.xml b/app/code/Magento/GoogleAnalytics/etc/acl.xml similarity index 94% rename from app/code/Magento/GoogleAnalytics/etc/adminhtml/acl.xml rename to app/code/Magento/GoogleAnalytics/etc/acl.xml index 7354a089cf21..4107ab44caa7 100644 --- a/app/code/Magento/GoogleAnalytics/etc/adminhtml/acl.xml +++ b/app/code/Magento/GoogleAnalytics/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index 094f6b1f9dcd..c4caba7bbb77 100644 --- a/app/code/Magento/GoogleOptimizer/composer.json +++ b/app/code/Magento/GoogleOptimizer/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-google-optimizer", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-google-analytics": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-google-analytics": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php index 512f6b69ab88..74e74bb29299 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php @@ -23,6 +23,9 @@ */ namespace Magento\GoogleShopping\Controller\Adminhtml\Googleshopping; +use \Magento\Framework\Notification\NotifierInterface; +use \Magento\Backend\App\Action; + /** * GoogleShopping Admin Items Controller * @@ -31,6 +34,20 @@ */ class Items extends \Magento\Backend\App\Action { + /** + * @var NotifierInterface + */ + protected $notifier; + + /** + * @param \Magento\Backend\App\Action\Context $context + * @param NotifierInterface $notifier + */ + public function __construct(Action\Context $context, NotifierInterface $notifier) + { + parent::__construct($context); + $this->notifier = $notifier; + } /** * Retrieve synchronization process mutex diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/MassAdd.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/MassAdd.php index 0b8245af5f0c..d3030a4e92e1 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/MassAdd.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/MassAdd.php @@ -44,7 +44,6 @@ public function execute() $storeId = $this->_getStore()->getId(); $productIds = $this->getRequest()->getParam('product', null); - $notifier = $this->_objectManager->create('Magento\AdminNotification\Model\Inbox'); try { $flag->lock(); @@ -64,7 +63,7 @@ public function execute() return; } catch (\Exception $e) { $flag->unlock(); - $notifier->addMajor( + $this->notifier->addMajor( __('An error has occurred while adding products to google shopping account.'), $e->getMessage() ); diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/Refresh.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/Refresh.php index bb294d6af1e3..2e6514c7b19e 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/Refresh.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items/Refresh.php @@ -68,9 +68,7 @@ public function execute() return; } catch (\Exception $e) { $flag->unlock(); - $this->_objectManager->create( - 'Magento\AdminNotification\Model\Inbox' - )->addMajor( + $this->notifier->addMajor( __('An error has occurred while deleting products from google shopping account.'), __( 'One or more products were not deleted from google shopping account. Refer to the log file for details.' diff --git a/app/code/Magento/GoogleShopping/Model/MassOperations.php b/app/code/Magento/GoogleShopping/Model/MassOperations.php index 8cf0e940823c..180aa443eeec 100644 --- a/app/code/Magento/GoogleShopping/Model/MassOperations.php +++ b/app/code/Magento/GoogleShopping/Model/MassOperations.php @@ -69,11 +69,11 @@ class MassOperations protected $_productFactory; /** - * Inbox factory + * Notifier * - * @var \Magento\AdminNotification\Model\InboxFactory + * @var \Magento\Framework\Notification\NotifierInterface */ - protected $_inboxFactory; + protected $_notifier; /** * Collection factory @@ -86,7 +86,7 @@ class MassOperations * @param \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory * @param \Magento\GoogleShopping\Model\ItemFactory $itemFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory + * @param \Magento\Framework\Notification\NotifierInterface $notifier * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Logger $logger * @param \Magento\GoogleShopping\Helper\Data $gleShoppingData @@ -97,7 +97,7 @@ public function __construct( \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory, \Magento\GoogleShopping\Model\ItemFactory $itemFactory, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\AdminNotification\Model\InboxFactory $inboxFactory, + \Magento\Framework\Notification\NotifierInterface $notifier, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Logger $logger, \Magento\GoogleShopping\Helper\Data $gleShoppingData, @@ -107,7 +107,7 @@ public function __construct( $this->_collectionFactory = $collectionFactory; $this->_itemFactory = $itemFactory; $this->_productFactory = $productFactory; - $this->_inboxFactory = $inboxFactory; + $this->_notifier = $notifier; $this->_storeManager = $storeManager; $this->_gleShoppingData = $gleShoppingData; $this->_gleShoppingCategory = $gleShoppingCategory; @@ -211,18 +211,18 @@ public function addProducts($productIds, $storeId) } if ($totalAdded > 0) { - $this->_getNotifier()->addNotice( + $this->_notifier->addNotice( __('Products were added to Google Shopping account.'), __('A total of %1 product(s) have been added to Google Content.', $totalAdded) ); } if (count($errors)) { - $this->_getNotifier()->addMajor(__('Errors happened while adding products to Google Shopping.'), $errors); + $this->_notifier->addMajor(__('Errors happened while adding products to Google Shopping.'), $errors); } if ($this->_flag->isExpired()) { - $this->_getNotifier()->addMajor( + $this->_notifier->addMajor( __('Operation of adding products to Google Shopping expired.'), __('Some products may have not been added to Google Shopping bacause of expiration') ); @@ -298,7 +298,7 @@ public function synchronizeItems($items) return $this; } - $this->_getNotifier()->addNotice( + $this->_notifier->addNotice( __('Product synchronization with Google Shopping completed'), __( 'A total of %1 items(s) have been deleted; a total of %2 items(s) have been updated.', @@ -308,7 +308,7 @@ public function synchronizeItems($items) ); if ($totalFailed > 0 || count($errors)) { array_unshift($errors, __("We cannot update %1 items.", $totalFailed)); - $this->_getNotifier()->addMajor( + $this->_notifier->addMajor( __('Errors happened during synchronization with Google Shopping'), $errors ); @@ -359,13 +359,13 @@ public function deleteItems($items) } if ($totalDeleted > 0) { - $this->_getNotifier()->addNotice( + $this->_notifier->addNotice( __('Google Shopping item removal process succeded'), __('Total of %1 items(s) have been removed from Google Shopping.', $totalDeleted) ); } if (count($errors)) { - $this->_getNotifier()->addMajor(__('Errors happened while deleting items from Google Shopping'), $errors); + $this->_notifier->addMajor(__('Errors happened while deleting items from Google Shopping'), $errors); } return $this; @@ -390,16 +390,6 @@ protected function _getItemsCollection($items) return $itemsCollection; } - /** - * Retrieve admin notifier - * - * @return \Magento\AdminNotification\Model\Inbox - */ - protected function _getNotifier() - { - return $this->_inboxFactory->create(); - } - /** * Provides general error information * @@ -408,7 +398,7 @@ protected function _getNotifier() protected function _addGeneralError() { if (!$this->_hasError) { - $this->_getNotifier()->addMajor(__('Google Shopping Error'), $this->_gleShoppingCategory->getMessage()); + $this->_notifier->addMajor(__('Google Shopping Error'), $this->_gleShoppingCategory->getMessage()); $this->_hasError = true; } } diff --git a/app/code/Magento/GoogleShopping/Model/Observer.php b/app/code/Magento/GoogleShopping/Model/Observer.php index 83dd68d6432e..4eafd2d0704c 100644 --- a/app/code/Magento/GoogleShopping/Model/Observer.php +++ b/app/code/Magento/GoogleShopping/Model/Observer.php @@ -55,11 +55,11 @@ class Observer protected $_operationsFactory; /** - * Inbox factory + * Notifier * - * @var \Magento\AdminNotification\Model\InboxFactory + * @var \Magento\Framework\Notification\NotifierInterface */ - protected $_inboxFactory; + protected $_notifier; /** * Collection factory @@ -71,7 +71,7 @@ class Observer /** * @param \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory * @param \Magento\GoogleShopping\Model\MassOperationsFactory $operationsFactory - * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory + * @param \Magento\Framework\Notification\NotifierInterface $notifier * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Message\ManagerInterface $messageManager * @param \Magento\GoogleShopping\Model\Flag $flag @@ -79,14 +79,14 @@ class Observer public function __construct( \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory, \Magento\GoogleShopping\Model\MassOperationsFactory $operationsFactory, - \Magento\AdminNotification\Model\InboxFactory $inboxFactory, + \Magento\Framework\Notification\NotifierInterface $notifier, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Message\ManagerInterface $messageManager, \Magento\GoogleShopping\Model\Flag $flag ) { $this->_collectionFactory = $collectionFactory; $this->_operationsFactory = $operationsFactory; - $this->_inboxFactory = $inboxFactory; + $this->_notifier = $notifier; $this->_scopeConfig = $scopeConfig; $this->messageManager = $messageManager; $this->_flag = $flag; @@ -146,7 +146,12 @@ protected function _getItemsCollection($product) } foreach ($items as $item) { - if (!$this->_scopeConfig->isSetFlag('google/googleshopping/observed', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $item->getStoreId())) { + $flag = $this->_scopeConfig->isSetFlag( + 'google/googleshopping/observed', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $item->getStoreId() + ); + if (!$flag) { $items->removeItemByKey($item->getId()); } } @@ -164,7 +169,7 @@ public function checkSynchronizationOperations(\Magento\Framework\Event\Observer { $this->_flag->loadSelf(); if ($this->_flag->isExpired()) { - $this->_inboxFactory->create()->addMajor( + $this->_notifier->addMajor( __('Google Shopping operation has expired.'), __('One or more google shopping synchronization operations failed because of timeout.') ); diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json index 1714fabb5098..5fc87f04a43f 100644 --- a/app/code/Magento/GoogleShopping/composer.json +++ b/app/code/Magento/GoogleShopping/composer.json @@ -2,22 +2,21 @@ "name": "magento/module-google-shopping", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-admin-notification": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleShopping/etc/adminhtml/acl.xml b/app/code/Magento/GoogleShopping/etc/acl.xml similarity index 94% rename from app/code/Magento/GoogleShopping/etc/adminhtml/acl.xml rename to app/code/Magento/GoogleShopping/etc/acl.xml index 965d797ebb1a..0a8c2e4245cf 100644 --- a/app/code/Magento/GoogleShopping/etc/adminhtml/acl.xml +++ b/app/code/Magento/GoogleShopping/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/GoogleShopping/etc/module.xml b/app/code/Magento/GoogleShopping/etc/module.xml index e7a52ba4ee9d..89c6286283da 100644 --- a/app/code/Magento/GoogleShopping/etc/module.xml +++ b/app/code/Magento/GoogleShopping/etc/module.xml @@ -30,7 +30,6 @@ - diff --git a/app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php b/app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php new file mode 100644 index 000000000000..1f8478909aa5 --- /dev/null +++ b/app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php @@ -0,0 +1,30 @@ + + + + + + + Magento\GroupedImportExport\Model\Export\RowCustomizer + + + + diff --git a/app/code/Magento/GroupedImportExport/etc/export.xml b/app/code/Magento/GroupedImportExport/etc/export.xml new file mode 100644 index 000000000000..c29cda67913d --- /dev/null +++ b/app/code/Magento/GroupedImportExport/etc/export.xml @@ -0,0 +1,28 @@ + + + + + diff --git a/app/code/Magento/GroupedImportExport/etc/import.xml b/app/code/Magento/GroupedImportExport/etc/import.xml new file mode 100644 index 000000000000..20251196082f --- /dev/null +++ b/app/code/Magento/GroupedImportExport/etc/import.xml @@ -0,0 +1,28 @@ + + + + + diff --git a/app/code/Magento/GroupedImportExport/etc/module.xml b/app/code/Magento/GroupedImportExport/etc/module.xml new file mode 100644 index 000000000000..27708b2a0323 --- /dev/null +++ b/app/code/Magento/GroupedImportExport/etc/module.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index 65984cf03f57..cf8b138e08ef 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -2,23 +2,23 @@ "name": "magento/module-grouped-product", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-catalog-inventory": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-catalog-inventory": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index 004eb3554d51..3b83b0384762 100644 --- a/app/code/Magento/ImportExport/composer.json +++ b/app/code/Magento/ImportExport/composer.json @@ -2,18 +2,18 @@ "name": "magento/module-import-export", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-index": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-index": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/ImportExport/etc/adminhtml/acl.xml b/app/code/Magento/ImportExport/etc/acl.xml similarity index 94% rename from app/code/Magento/ImportExport/etc/adminhtml/acl.xml rename to app/code/Magento/ImportExport/etc/acl.xml index 21a4534e03b3..1ea1488aedc1 100644 --- a/app/code/Magento/ImportExport/etc/adminhtml/acl.xml +++ b/app/code/Magento/ImportExport/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Index/Model/System/Message/IndexOutdated.php b/app/code/Magento/Index/Model/System/Message/IndexOutdated.php index a5a46aa6bd08..a25fc378e560 100644 --- a/app/code/Magento/Index/Model/System/Message/IndexOutdated.php +++ b/app/code/Magento/Index/Model/System/Message/IndexOutdated.php @@ -17,13 +17,13 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Index\Model\System\Message; -class IndexOutdated implements \Magento\AdminNotification\Model\System\MessageInterface +class IndexOutdated implements \Magento\Framework\Notification\MessageInterface { /** * @var \Magento\Index\Model\Indexer diff --git a/app/code/Magento/Index/composer.json b/app/code/Magento/Index/composer.json index 4d5201a449ca..fcf3e916598b 100644 --- a/app/code/Magento/Index/composer.json +++ b/app/code/Magento/Index/composer.json @@ -2,15 +2,14 @@ "name": "magento/module-index", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-admin-notification": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Index/etc/adminhtml/acl.xml b/app/code/Magento/Index/etc/acl.xml similarity index 93% rename from app/code/Magento/Index/etc/adminhtml/acl.xml rename to app/code/Magento/Index/etc/acl.xml index 3c2f0f492508..915fc10d066e 100644 --- a/app/code/Magento/Index/etc/adminhtml/acl.xml +++ b/app/code/Magento/Index/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Index/etc/adminhtml/di.xml b/app/code/Magento/Index/etc/adminhtml/di.xml index 8ec4ff4eadd2..5805634b012d 100644 --- a/app/code/Magento/Index/etc/adminhtml/di.xml +++ b/app/code/Magento/Index/etc/adminhtml/di.xml @@ -24,7 +24,7 @@ */ --> - + Magento\Index\Model\System\Message\IndexOutdated diff --git a/app/code/Magento/Index/etc/module.xml b/app/code/Magento/Index/etc/module.xml index 8ff8a9e206d5..92b3bfd022cb 100644 --- a/app/code/Magento/Index/etc/module.xml +++ b/app/code/Magento/Index/etc/module.xml @@ -32,7 +32,6 @@ - diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index 71272f04ac08..4409860e4a06 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -2,14 +2,14 @@ "name": "magento/module-indexer", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-page-cache": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-page-cache": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Indexer/etc/adminhtml/acl.xml b/app/code/Magento/Indexer/etc/acl.xml similarity index 94% rename from app/code/Magento/Indexer/etc/adminhtml/acl.xml rename to app/code/Magento/Indexer/etc/acl.xml index 43be5a630531..ecc2b372817d 100644 --- a/app/code/Magento/Indexer/etc/adminhtml/acl.xml +++ b/app/code/Magento/Indexer/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Install/Block/End.php b/app/code/Magento/Install/Block/End.php index 012870dabd88..75d895086e98 100644 --- a/app/code/Magento/Install/Block/End.php +++ b/app/code/Magento/Install/Block/End.php @@ -24,8 +24,6 @@ /** * Installation ending block - * - * @author Magento Core Team */ namespace Magento\Install\Block; @@ -37,7 +35,7 @@ class End extends \Magento\Install\Block\AbstractBlock protected $_template = 'end.phtml'; /** - * @var \Magento\AdminNotification\Model\Survey + * @var \Magento\Install\Model\Survey */ protected $_survey; @@ -53,7 +51,7 @@ class End extends \Magento\Install\Block\AbstractBlock * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard * @param \Magento\Framework\Session\Generic $session - * @param \Magento\AdminNotification\Model\Survey $survey + * @param \Magento\Install\Model\Survey $survey * @param string $cryptKey * @param array $data */ @@ -62,7 +60,7 @@ public function __construct( \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, \Magento\Framework\Session\Generic $session, - \Magento\AdminNotification\Model\Survey $survey, + \Magento\Install\Model\Survey $survey, $cryptKey, array $data = array() ) { diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Survey.php b/app/code/Magento/Install/Controller/Adminhtml/Survey.php similarity index 90% rename from app/code/Magento/AdminNotification/Controller/Adminhtml/Survey.php rename to app/code/Magento/Install/Controller/Adminhtml/Survey.php index e7650a90e5a9..5358b053e9d2 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Survey.php +++ b/app/code/Magento/Install/Controller/Adminhtml/Survey.php @@ -21,12 +21,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\AdminNotification\Controller\Adminhtml; +namespace Magento\Install\Controller\Adminhtml; /** * Adminhtml Survey Action - * - * @author Magento Core Team */ class Survey extends \Magento\Backend\App\Action { diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Survey/Index.php b/app/code/Magento/Install/Controller/Adminhtml/Survey/Index.php similarity index 83% rename from app/code/Magento/AdminNotification/Controller/Adminhtml/Survey/Index.php rename to app/code/Magento/Install/Controller/Adminhtml/Survey/Index.php index 98caa51c392c..69fb6a58c2b6 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Survey/Index.php +++ b/app/code/Magento/Install/Controller/Adminhtml/Survey/Index.php @@ -22,9 +22,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\AdminNotification\Controller\Adminhtml\Survey; +namespace Magento\Install\Controller\Adminhtml\Survey; -class Index extends \Magento\AdminNotification\Controller\Adminhtml\Survey +class Index extends \Magento\Install\Controller\Adminhtml\Survey { /** * Index Action @@ -34,7 +34,7 @@ class Index extends \Magento\AdminNotification\Controller\Adminhtml\Survey public function execute() { if ($this->getRequest()->getParam('isAjax', false)) { - $this->_objectManager->get('Magento\AdminNotification\Model\Survey')->saveSurveyViewed(true); + $this->_objectManager->get('Magento\Install\Model\Survey')->saveSurveyViewed(true); } $this->getResponse()->representJson(\Zend_Json::encode(array('survey_decision_saved' => 1))); } diff --git a/app/code/Magento/Install/Controller/Wizard/End.php b/app/code/Magento/Install/Controller/Wizard/End.php index dfd9c13d944c..ce9238c03484 100644 --- a/app/code/Magento/Install/Controller/Wizard/End.php +++ b/app/code/Magento/Install/Controller/Wizard/End.php @@ -42,7 +42,7 @@ public function execute() $this->_getInstaller()->finish(); - $this->_objectManager->get('Magento\AdminNotification\Model\Survey')->saveSurveyViewed(true); + $this->_objectManager->get('Magento\Install\Model\Survey')->saveSurveyViewed(true); $this->_prepareLayout(); $this->_view->getLayout()->initMessages(); diff --git a/app/code/Magento/AdminNotification/Model/Survey.php b/app/code/Magento/Install/Model/Survey.php similarity index 94% rename from app/code/Magento/AdminNotification/Model/Survey.php rename to app/code/Magento/Install/Model/Survey.php index 1b061be7a1dc..1278e3938f4b 100644 --- a/app/code/Magento/AdminNotification/Model/Survey.php +++ b/app/code/Magento/Install/Model/Survey.php @@ -24,11 +24,9 @@ /** - * AdminNotification survey model - * - * @author Magento Core Team + * Installation survey model */ -namespace Magento\AdminNotification\Model; +namespace Magento\Install\Model; class Survey { @@ -37,7 +35,7 @@ class Survey /** * @var string */ - protected $_flagCode = 'admin_notification_survey'; + protected $_flagCode = 'install_survey'; /** * @var \Magento\Framework\Flag diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Survey.php b/app/code/Magento/Install/Model/System/Message/Survey.php similarity index 87% rename from app/code/Magento/AdminNotification/Model/System/Message/Survey.php rename to app/code/Magento/Install/Model/System/Message/Survey.php index e2aad4101909..3d516ed61c2a 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Survey.php +++ b/app/code/Magento/Install/Model/System/Message/Survey.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\AdminNotification\Model\System\Message; +namespace Magento\Install\Model\System\Message; -class Survey implements \Magento\AdminNotification\Model\System\MessageInterface +class Survey implements \Magento\Framework\Notification\MessageInterface { /** * @var \Magento\Backend\Model\Auth\Session @@ -41,7 +41,7 @@ class Survey implements \Magento\AdminNotification\Model\System\MessageInterface protected $_urlBuilder; /** - * @var \Magento\AdminNotification\Model\Survey + * @var \Magento\Install\Model\Survey */ protected $_survey; @@ -49,13 +49,13 @@ class Survey implements \Magento\AdminNotification\Model\System\MessageInterface * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Framework\AuthorizationInterface $authorization * @param \Magento\Framework\UrlInterface $urlBuilder - * @param \Magento\AdminNotification\Model\Survey $survey + * @param \Magento\Install\Model\Survey $survey */ public function __construct( \Magento\Backend\Model\Auth\Session $authSession, \Magento\Framework\AuthorizationInterface $authorization, \Magento\Framework\UrlInterface $urlBuilder, - \Magento\AdminNotification\Model\Survey $survey + \Magento\Install\Model\Survey $survey ) { $this->_authorization = $authorization; $this->_authSession = $authSession; @@ -118,7 +118,7 @@ public function getText() ) ); return __( - 'We appreciate our merchants\' feedback. Please take our survey and tell us about features you\'d like to see in Magento.', + 'We appreciate our merchants\' feedback. Please take our survey and tell us about features you\'d like to see in Magento.', json_encode($params, JSON_FORCE_OBJECT) ); } @@ -130,6 +130,6 @@ public function getText() */ public function getSeverity() { - return \Magento\AdminNotification\Model\System\MessageInterface::SEVERITY_MAJOR; + return \Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR; } } diff --git a/app/code/Magento/Install/composer.json b/app/code/Magento/Install/composer.json index fc8c08ee1d03..37ae0241420a 100644 --- a/app/code/Magento/Install/composer.json +++ b/app/code/Magento/Install/composer.json @@ -2,18 +2,17 @@ "name": "magento/module-install", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-admin-notification": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-user": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-user": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Install/etc/adminhtml/routes.xml b/app/code/Magento/Install/etc/adminhtml/routes.xml new file mode 100644 index 000000000000..6561687d7773 --- /dev/null +++ b/app/code/Magento/Install/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/app/code/Magento/Install/etc/di.xml b/app/code/Magento/Install/etc/di.xml index 5978523573d5..c502e62e5a7a 100644 --- a/app/code/Magento/Install/etc/di.xml +++ b/app/code/Magento/Install/etc/di.xml @@ -36,6 +36,13 @@ Magento\Install\Model\Session\Storage + + + + Magento\Install\Model\System\Message\Survey + + + LICENSE.html diff --git a/app/code/Magento/Install/etc/module.xml b/app/code/Magento/Install/etc/module.xml index bb2fd20c81dd..64f361175393 100644 --- a/app/code/Magento/Install/etc/module.xml +++ b/app/code/Magento/Install/etc/module.xml @@ -31,7 +31,6 @@ - diff --git a/app/code/Magento/Install/view/adminhtml/layout/default.xml b/app/code/Magento/Install/view/adminhtml/layout/default.xml new file mode 100644 index 000000000000..4eb246a43bf1 --- /dev/null +++ b/app/code/Magento/Install/view/adminhtml/layout/default.xml @@ -0,0 +1,34 @@ + + + + + + + Magento_Install::survey_notification.js + + + + diff --git a/app/code/Magento/Install/view/adminhtml/web/survey_notification.js b/app/code/Magento/Install/view/adminhtml/web/survey_notification.js new file mode 100644 index 000000000000..c008c47217a2 --- /dev/null +++ b/app/code/Magento/Install/view/adminhtml/web/survey_notification.js @@ -0,0 +1,41 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +/*jshint jquery:true*/ +require(["jquery"], function($){ + "use strict"; + + $(document).ready(function(){ + $('body').on('surveyYes surveyNo', function(e, data) { + if (e.type == 'surveyYes') { + var win = window.open(data.surveyUrl, '', 'width=900,height=600,resizable=1,scrollbars=1'); + win.focus(); + } + $.ajax({ + url: data.surveyAction, + type: 'post', + data: {decision: data.decision} + }); + }); + }); + +}); diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php index a18d4416e1e4..fc65d977e6ad 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php @@ -33,16 +33,12 @@ class Tokens extends \Magento\Backend\Block\Widget\Form\Generic { /**#@+ - * Form elements names. + * Form element name. */ const DATA_TOKEN = 'token'; - const DATA_TOKEN_SECRET = 'token_secret'; - const DATA_CONSUMER_KEY = 'consumer_key'; - const DATA_CONSUMER_SECRET = 'consumer_secret'; - /**#@-*/ /** diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php index 6c68fd46dfd4..978d7394e6bb 100644 --- a/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php @@ -60,7 +60,7 @@ public function execute() $integration = $this->_integrationService->get($integrationId); if ($isReauthorize) { /** Remove existing token associated with consumer before issuing a new one. */ - $this->_oauthService->deleteToken($integration->getConsumerId()); + $this->_oauthService->deleteIntegrationToken($integration->getConsumerId()); $integration->setStatus(IntegrationModel::STATUS_INACTIVE)->save(); } //Integration chooses to use Oauth for token exchange diff --git a/app/code/Magento/Integration/Model/Integration.php b/app/code/Magento/Integration/Model/Integration.php index 03df47f4b403..4daefc25f71b 100644 --- a/app/code/Magento/Integration/Model/Integration.php +++ b/app/code/Magento/Integration/Model/Integration.php @@ -43,6 +43,7 @@ * @method Integration setCreatedAt(\string $createdAt) * @method \string getUpdatedAt() * @method Integration setUpdatedAt(\string $createdAt) + * @method \Magento\Integration\Model\Resource\Integration getResource() */ class Integration extends \Magento\Framework\Model\AbstractModel { @@ -147,6 +148,19 @@ public function loadByConsumerId($consumerId) return $this->load($consumerId, self::CONSUMER_ID); } + /** + * Load active integration by oAuth consumer ID. + * + * @param int $consumerId + * @return $this + */ + public function loadActiveIntegrationByConsumerId($consumerId) + { + $integrationData = $this->getResource()->selectActiveIntegrationByConsumerId($consumerId); + $this->setData($integrationData ? $integrationData : []); + return $this; + } + /** * Get integration status. Cast to the type of STATUS_* constants in order to make strict comparison valid. * diff --git a/app/code/Magento/Integration/Model/Oauth/Token.php b/app/code/Magento/Integration/Model/Oauth/Token.php index 67f2a3632d41..1d692ba2c656 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Oauth/Token.php @@ -23,6 +23,7 @@ */ namespace Magento\Integration\Model\Oauth; +use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\Oauth\Helper\Oauth as OauthHelper; use Magento\Integration\Model\Resource\Oauth\Token\Collection as TokenCollection; use Magento\Framework\Oauth\Exception as OauthException; @@ -41,6 +42,8 @@ * @method Token setAdminId() setAdminId(int $adminId) * @method int getCustomerId() * @method Token setCustomerId() setCustomerId(int $customerId) + * @method int getUserType() + * @method Token setUserType() setUserType(int $userType) * @method string getType() * @method Token setType() setType(string $type) * @method string getCallbackUrl() @@ -70,15 +73,6 @@ class Token extends \Magento\Framework\Model\AbstractModel /**#@- */ - /**#@+ - * Customer types - */ - const USER_TYPE_ADMIN = 'admin'; - - const USER_TYPE_CUSTOMER = 'customer'; - - /**#@- */ - /** * @var OauthHelper */ @@ -191,65 +185,52 @@ public function createVerifierToken($consumerId) 'token' => $this->_oauthHelper->generateToken(), 'secret' => $this->_oauthHelper->generateTokenSecret(), 'verifier' => $this->_oauthHelper->generateVerifier(), - 'callback_url' => OauthHelper::CALLBACK_ESTABLISHED + 'callback_url' => OauthHelper::CALLBACK_ESTABLISHED, + 'user_type' => UserContextInterface::USER_TYPE_INTEGRATION //As of now only integrations use Oauth ) ); + $this->validate(); $this->save(); } return $this; } /** - * Authorize token + * Convert token to access type * - * @param int $userId Authorization user identifier - * @param string $userType Authorization user type * @return $this * @throws OauthException */ - public function authorize($userId, $userType) + public function convertToAccess() { - if (!$this->getId() || !$this->getConsumerId()) { - throw new OauthException('Token is not ready to be authorized'); - } - if ($this->getAuthorized()) { - throw new OauthException('Token is already authorized'); - } - if (self::USER_TYPE_ADMIN == $userType) { - $this->setAdminId($userId); - } elseif (self::USER_TYPE_CUSTOMER == $userType) { - $this->setCustomerId($userId); - } else { - throw new OauthException('User type is unknown'); + if (self::TYPE_REQUEST != $this->getType()) { + throw new OauthException('Cannot convert to access token due to token is not request type'); } - - $this->setVerifier($this->_oauthHelper->generateVerifier()); - $this->setAuthorized(1); - $this->save(); - - $this->getResource()->cleanOldAuthorizedTokensExcept($this); - - return $this; + return $this->saveAccessToken(UserContextInterface::USER_TYPE_INTEGRATION); } /** - * Convert token to access type + * Create access token for a admin * + * @param int $userId * @return $this - * @throws OauthException */ - public function convertToAccess() + public function createAdminToken($userId) { - if (self::TYPE_REQUEST != $this->getType()) { - throw new OauthException('Cannot convert to access token due to token is not request type'); - } - - $this->setType(self::TYPE_ACCESS); - $this->setToken($this->_oauthHelper->generateToken()); - $this->setSecret($this->_oauthHelper->generateTokenSecret()); - $this->save(); + $this->setAdminId($userId); + return $this->saveAccessToken(UserContextInterface::USER_TYPE_ADMIN); + } - return $this; + /** + * Create access token for a customer + * + * @param int $userId + * @return $this + */ + public function createCustomerToken($userId) + { + $this->setCustomerId($userId); + return $this->saveAccessToken(UserContextInterface::USER_TYPE_CUSTOMER, $userId); } /** @@ -271,28 +252,12 @@ public function createRequestToken($entityId, $callbackUrl) 'callback_url' => $callbackUrl ) ); + $this->validate(); $this->save(); return $this; } - /** - * Get OAuth user type - * - * @return string - * @throws OauthException - */ - public function getUserType() - { - if ($this->getAdminId()) { - return self::USER_TYPE_ADMIN; - } elseif ($this->getCustomerId()) { - return self::USER_TYPE_CUSTOMER; - } else { - throw new OauthException('User type is unknown'); - } - } - /** * Get string representation of token * @@ -312,8 +277,6 @@ public function toString($format = '') */ protected function _beforeSave() { - $this->validate(); - if ($this->isObjectNew() && null === $this->getCreatedAt()) { $this->setCreatedAt($this->_dateTime->now()); } @@ -365,39 +328,78 @@ public function validate() } /** - * Get Token Consumer + * Return the token's verifier. * - * @return \Magento\Integration\Model\Oauth\Consumer + * @return string */ - public function getConsumer() + public function getVerifier() { - if (!$this->getData('consumer')) { - $consumer = $this->_consumerFactory->create()->load($this->getConsumerId()); - $this->setData('consumer', $consumer); - } + return $this->getData('verifier'); + } - return $this->getData('consumer'); + /** + * Generate and save access token for a given user type + * + * @param int $userType + * @return $this + */ + protected function saveAccessToken($userType) + { + $this->setUserType($userType); + $this->setType(self::TYPE_ACCESS); + $this->setToken($this->_oauthHelper->generateToken()); + $this->setSecret($this->_oauthHelper->generateTokenSecret()); + return $this->save(); } /** - * Return the token's verifier. + * Get token by consumer and user type * - * @return string + * @param int $consumerId + * @param int $userType + * @return $this */ - public function getVerifier() + public function loadByConsumerIdAndUserType($consumerId, $userType) { - return $this->getData('verifier'); + $tokenData = $this->getResource()->selectTokenByConsumerIdAndUserType($consumerId, $userType); + $this->setData($tokenData ? $tokenData : []); + return $this; + } + + /** + * Get token by admin id + * + * @param int $adminId + * @return $this + */ + public function loadByAdminId($adminId) + { + $tokenData = $this->getResource()->selectTokenByAdminId($adminId); + $this->setData($tokenData ? $tokenData : []); + return $this; } /** - * Set the token's verifier. + * Get token by admin id * - * @param string $verifier + * @param int $customerId * @return $this */ - public function setVerifier($verifier) + public function loadByCustomerId($customerId) { - $this->setData('verifier', $verifier); + $tokenData = $this->getResource()->selectTokenByCustomerId($customerId); + $this->setData($tokenData ? $tokenData : []); return $this; } + + /** + * Load token data by token. + * + * @param string $token + * @return $this + */ + public function loadByToken($token) + { + return $this->load($token, 'token'); + } } diff --git a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php index 8ca3ff82b52b..1ac01035d502 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php +++ b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php @@ -21,9 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Integration\Model\Oauth\Token; +use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\Oauth\TokenProviderInterface; +use Magento\Integration\Model\Oauth\Token; class Provider implements TokenProviderInterface { @@ -47,22 +50,30 @@ class Provider implements TokenProviderInterface */ protected $_date; + /** + * @var Token + */ + protected $token; + /** * @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory * @param \Magento\Integration\Model\Oauth\Token\Factory $tokenFactory * @param \Magento\Integration\Helper\Oauth\Data $dataHelper * @param \Magento\Framework\Stdlib\DateTime\DateTime $date + * @param Token $token */ public function __construct( \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory, \Magento\Integration\Model\Oauth\Token\Factory $tokenFactory, \Magento\Integration\Helper\Oauth\Data $dataHelper, - \Magento\Framework\Stdlib\DateTime\DateTime $date + \Magento\Framework\Stdlib\DateTime\DateTime $date, + Token $token ) { $this->_consumerFactory = $consumerFactory; $this->_tokenFactory = $tokenFactory; $this->_dataHelper = $dataHelper; $this->_date = $date; + $this->token = $token; } /** @@ -86,8 +97,8 @@ public function validateConsumer($consumer) */ public function createRequestToken($consumer) { - $token = $this->getTokenByConsumerId($consumer->getId()); - if ($token->getType() != \Magento\Integration\Model\Oauth\Token::TYPE_VERIFIER) { + $token = $this->getIntegrationTokenByConsumerId($consumer->getId()); + if ($token->getType() != Token::TYPE_VERIFIER) { throw new \Magento\Framework\Oauth\Exception( 'Cannot create request token because consumer token is not a verifier token' ); @@ -111,7 +122,7 @@ public function validateRequestToken($requestToken, $consumer, $oauthVerifier) // The pre-auth token has a value of "request" in the type when it is requested and created initially. // In this flow (token flow) the token has to be of type "request" else its marked as reused. - if (\Magento\Integration\Model\Oauth\Token::TYPE_REQUEST != $token->getType()) { + if (Token::TYPE_REQUEST != $token->getType()) { throw new \Magento\Framework\Oauth\Exception( 'Token is already being used' ); @@ -128,8 +139,8 @@ public function validateRequestToken($requestToken, $consumer, $oauthVerifier) public function getAccessToken($consumer) { /** TODO: log the request token in dev mode since its not persisted. */ - $token = $this->getTokenByConsumerId($consumer->getId()); - if (\Magento\Integration\Model\Oauth\Token::TYPE_REQUEST != $token->getType()) { + $token = $this->getIntegrationTokenByConsumerId($consumer->getId()); + if (Token::TYPE_REQUEST != $token->getType()) { throw new \Magento\Framework\Oauth\Exception( 'Cannot get access token because consumer token is not a request token' ); @@ -150,7 +161,7 @@ public function validateAccessTokenRequest($accessToken, $consumer) 'Token is not associated with the specified consumer' ); } - if (\Magento\Integration\Model\Oauth\Token::TYPE_ACCESS != $token->getType()) { + if (Token::TYPE_ACCESS != $token->getType()) { throw new \Magento\Framework\Oauth\Exception( 'Token is not an access token' ); @@ -173,7 +184,7 @@ public function validateAccessToken($accessToken) // Make sure a consumer is associated with the token. $this->_getConsumer($token->getConsumerId()); - if (\Magento\Integration\Model\Oauth\Token::TYPE_ACCESS != $token->getType()) { + if (Token::TYPE_ACCESS != $token->getType()) { throw new \Magento\Framework\Oauth\Exception( 'Token is not an access token' ); @@ -270,7 +281,7 @@ protected function _getConsumer($consumerId) * Load token object and validate it. * * @param string $token - * @return \Magento\Integration\Model\Oauth\Token + * @return Token * @throws \Magento\Framework\Oauth\Exception */ protected function _getToken($token) @@ -296,12 +307,12 @@ protected function _getToken($token) * Load token object given a consumer Id. * * @param int $consumerId - The Id of the consumer. - * @return \Magento\Integration\Model\Oauth\Token + * @return Token * @throws \Magento\Framework\Oauth\Exception */ - public function getTokenByConsumerId($consumerId) + public function getIntegrationTokenByConsumerId($consumerId) { - $token = $this->_tokenFactory->create()->load($consumerId, 'consumer_id'); + $token = $this->token->loadByConsumerIdAndUserType($consumerId, UserContextInterface::USER_TYPE_INTEGRATION); if (!$token->getId()) { throw new \Magento\Framework\Oauth\Exception( @@ -316,7 +327,7 @@ public function getTokenByConsumerId($consumerId) /** * Check if token belongs to the same consumer. * - * @param \Magento\Integration\Model\Oauth\Token $token + * @param Token $token * @param \Magento\Framework\Oauth\ConsumerInterface $consumer * @return bool */ diff --git a/app/code/Magento/Integration/Model/Resource/Integration.php b/app/code/Magento/Integration/Model/Resource/Integration.php index 39c9f60bc1a5..54f3c460daba 100644 --- a/app/code/Magento/Integration/Model/Resource/Integration.php +++ b/app/code/Magento/Integration/Model/Resource/Integration.php @@ -21,6 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Integration\Model\Resource; /** @@ -37,4 +38,20 @@ protected function _construct() { $this->_init('integration', 'integration_id'); } + + /** + * Select token for a given customer. + * + * @param int $consumerId + * @return array|boolean - Row data (array) or false if there is no corresponding row + */ + public function selectActiveIntegrationByConsumerId($consumerId) + { + $adapter = $this->_getReadAdapter(); + $select = $adapter->select() + ->from($this->getMainTable()) + ->where('consumer_id = ?', $consumerId) + ->where('status = ?', \Magento\Integration\Model\Integration::STATUS_ACTIVE); + return $adapter->fetchRow($select); + } } diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Token.php b/app/code/Magento/Integration/Model/Resource/Oauth/Token.php index 522696ae63ec..469f492ac3a9 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Token.php @@ -23,6 +23,8 @@ */ namespace Magento\Integration\Model\Resource\Oauth; +use Magento\Authorization\Model\UserContextInterface; + /** * OAuth token resource model */ @@ -116,15 +118,59 @@ public function deleteOldEntries($minutes) public function selectTokenByType($consumerId, $type) { $adapter = $this->_getReadAdapter(); - $select = $adapter->select()->from( - $this->getMainTable() - )->where( - 'consumer_id = ?', - $consumerId - )->where( - 'type = ?', - $type - ); + $select = $adapter->select() + ->from($this->getMainTable()) + ->where('consumer_id = ?', $consumerId) + ->where('type = ?', $type); + return $adapter->fetchRow($select); + } + + /** + * Select token for a given consumer and user type. + * + * @param int $consumerId + * @param int $userType + * @return array|boolean - Row data (array) or false if there is no corresponding row + */ + public function selectTokenByConsumerIdAndUserType($consumerId, $userType) + { + $adapter = $this->_getReadAdapter(); + $select = $adapter->select() + ->from($this->getMainTable()) + ->where('consumer_id = ?', (int)$consumerId) + ->where('user_type = ?', (int)$userType); + return $adapter->fetchRow($select); + } + + /** + * Select token for a given admin id. + * + * @param int $adminId + * @return array|boolean - Row data (array) or false if there is no corresponding row + */ + public function selectTokenByAdminId($adminId) + { + $adapter = $this->_getReadAdapter(); + $select = $adapter->select() + ->from($this->getMainTable()) + ->where('admin_id = ?', $adminId) + ->where('user_type = ?', UserContextInterface::USER_TYPE_ADMIN); + return $adapter->fetchRow($select); + } + + /** + * Select token for a given customer. + * + * @param int $customerId + * @return array|boolean - Row data (array) or false if there is no corresponding row + */ + public function selectTokenByCustomerId($customerId) + { + $adapter = $this->_getReadAdapter(); + $select = $adapter->select() + ->from($this->getMainTable()) + ->where('customer_id = ?', $customerId) + ->where('user_type = ?', UserContextInterface::USER_TYPE_CUSTOMER); return $adapter->fetchRow($select); } } diff --git a/app/code/Magento/Integration/Service/V1/AuthorizationService.php b/app/code/Magento/Integration/Service/V1/AuthorizationService.php new file mode 100644 index 000000000000..bcbcfdff755e --- /dev/null +++ b/app/code/Magento/Integration/Service/V1/AuthorizationService.php @@ -0,0 +1,214 @@ +_aclBuilder = $aclBuilder; + $this->_roleFactory = $roleFactory; + $this->_rulesFactory = $rulesFactory; + $this->_rulesCollectionFactory = $rulesCollectionFactory; + $this->_roleCollectionFactory = $roleCollectionFactory; + $this->_logger = $logger; + $this->_rootAclResource = $rootAclResource; + } + + /** + * {@inheritdoc} + */ + public function grantPermissions($integrationId, $resources) + { + try { + $role = $this->_getUserRole($integrationId); + if (!$role) { + $role = $this->_createRole($integrationId); + } + $this->_associateResourcesWithRole($role, $resources); + } catch (\Exception $e) { + $this->_logger->logException($e); + throw new LocalizedException('Error happened while granting permissions. Check exception log for details.'); + } + } + + /** + * {@inheritdoc} + */ + public function grantAllPermissions($integrationId) + { + $this->grantPermissions($integrationId, array($this->_rootAclResource->getId())); + } + + /** + * {@inheritdoc} + */ + public function removePermissions($integrationId) + { + try { + $this->_deleteRole($integrationId); + } catch (\Exception $e) { + $this->_logger->logException($e); + throw new LocalizedException( + 'Error happened while deleting role and permissions. Check exception log for details.' + ); + } + } + + /** + * Create new ACL role. + * + * @param int $integrationId + * @return \Magento\Authorization\Model\Role + */ + protected function _createRole($integrationId) + { + $roleName = UserContextInterface::USER_TYPE_INTEGRATION . $integrationId; + $role = $this->_roleFactory->create(); + $role->setRoleName($roleName) + ->setUserType(UserContextInterface::USER_TYPE_INTEGRATION) + ->setUserId($integrationId) + ->setRoleType(\Magento\Authorization\Model\Acl\Role\User::ROLE_TYPE) + ->setParentId(0) + ->save(); + return $role; + } + + /** + * Remove integration role. This deletes the cascading permissions + * + * @param int $integrationId + * @return \Magento\Authorization\Model\Role + */ + protected function _deleteRole($integrationId) + { + $roleName = UserContextInterface::USER_TYPE_INTEGRATION . $integrationId; + $role = $this->_roleFactory->create()->load($roleName, 'role_name'); + return $role->delete(); + } + + /** + * Identify authorization role associated with provided integration. + * + * @param int $integrationId + * @return \Magento\Authorization\Model\Role|false Return false in case when no role associated with user was found. + */ + protected function _getUserRole($integrationId) + { + $roleCollection = $this->_roleCollectionFactory->create(); + /** @var Role $role */ + $role = $roleCollection + ->setUserFilter($integrationId, UserContextInterface::USER_TYPE_INTEGRATION) + ->getFirstItem(); + return $role->getId() ? $role : false; + } + + /** + * Associate resources with the specified role. All resources previously assigned to the role will be unassigned. + * + * @param \Magento\Authorization\Model\Role $role + * @param string[] $resources + * @return void + * @throws \LogicException + */ + protected function _associateResourcesWithRole($role, $resources) + { + /** @var \Magento\Authorization\Model\Rules $rules */ + $rules = $this->_rulesFactory->create(); + $rules->setRoleId($role->getId())->setResources($resources)->saveRel(); + } +} diff --git a/app/code/Magento/Integration/Service/V1/AuthorizationServiceInterface.php b/app/code/Magento/Integration/Service/V1/AuthorizationServiceInterface.php new file mode 100644 index 000000000000..1b7b04381387 --- /dev/null +++ b/app/code/Magento/Integration/Service/V1/AuthorizationServiceInterface.php @@ -0,0 +1,68 @@ +_integrationFactory->create()->loadActiveIntegrationByConsumerId($consumerId); + return $integration; + } + /** * Check if an integration exists by the name * diff --git a/app/code/Magento/Integration/Service/V1/IntegrationInterface.php b/app/code/Magento/Integration/Service/V1/IntegrationInterface.php index 473d6926dd4e..651089a51e57 100644 --- a/app/code/Magento/Integration/Service/V1/IntegrationInterface.php +++ b/app/code/Magento/Integration/Service/V1/IntegrationInterface.php @@ -64,6 +64,14 @@ public function findByName($integrationName); */ public function findByConsumerId($consumerId); + /** + * Get the details of an active Integration by consumer_id. + * + * @param int $consumerId + * @return IntegrationModel + */ + public function findActiveIntegrationByConsumerId($consumerId); + /** * Update an Integration. * diff --git a/app/code/Magento/Integration/Service/V1/Oauth.php b/app/code/Magento/Integration/Service/V1/Oauth.php index 054de2b40135..0456688ad217 100644 --- a/app/code/Magento/Integration/Service/V1/Oauth.php +++ b/app/code/Magento/Integration/Service/V1/Oauth.php @@ -24,7 +24,7 @@ namespace Magento\Integration\Service\V1; use Magento\Integration\Model\Oauth\Token\Provider as TokenProvider; -use Magento\Integration\Model\Oauth\Token; +use Magento\Integration\Model\Oauth\Token as OauthTokenModel; use Magento\Integration\Model\Oauth\Token\Factory as TokenFactory; use Magento\Integration\Helper\Oauth\Data as IntegrationOauthHelper; use Magento\Framework\Oauth\Helper\Oauth as OauthHelper; @@ -138,7 +138,7 @@ public function createAccessToken($consumerId, $clearExistingToken = false) { try { $consumer = $this->_consumerFactory->create()->load($consumerId); - $existingToken = $this->_tokenProvider->getTokenByConsumerId($consumer->getId()); + $existingToken = $this->_tokenProvider->getIntegrationTokenByConsumerId($consumer->getId()); if ($existingToken && $clearExistingToken) { $existingToken->delete(); unset($existingToken); @@ -162,8 +162,8 @@ public function getAccessToken($consumerId) { try { $consumer = $this->_consumerFactory->create()->load($consumerId); - $token = $this->_tokenProvider->getTokenByConsumerId($consumer->getId()); - if ($token->getType() != Token::TYPE_ACCESS) { + $token = $this->_tokenProvider->getIntegrationTokenByConsumerId($consumer->getId()); + if ($token->getType() != OauthTokenModel::TYPE_ACCESS) { return false; } } catch (\Exception $e) { @@ -260,11 +260,11 @@ public function deleteConsumer($consumerId) /** * {@inheritdoc} */ - public function deleteToken($consumerId) + public function deleteIntegrationToken($consumerId) { try { $consumer = $this->_consumerFactory->create()->load($consumerId); - $existingToken = $this->_tokenProvider->getTokenByConsumerId($consumer->getId()); + $existingToken = $this->_tokenProvider->getIntegrationTokenByConsumerId($consumer->getId()); $existingToken->delete(); return true; } catch (\Exception $e) { diff --git a/app/code/Magento/Integration/Service/V1/OauthInterface.php b/app/code/Magento/Integration/Service/V1/OauthInterface.php index 7a1859b1bd4e..c468a2067ab7 100644 --- a/app/code/Magento/Integration/Service/V1/OauthInterface.php +++ b/app/code/Magento/Integration/Service/V1/OauthInterface.php @@ -23,7 +23,7 @@ */ namespace Magento\Integration\Service\V1; -use Magento\Integration\Model\Oauth\Token; +use Magento\Integration\Model\Oauth\Token as OauthTokenModel; /** * Integration oAuth Service Interface @@ -59,7 +59,7 @@ public function createAccessToken($consumerId, $clearExistingToken = false); * Retrieve access token assigned to the consumer. * * @param int $consumerId - * @return Token|bool Return false if no access token is available. + * @return OauthTokenModel|bool Return false if no access token is available. */ public function getAccessToken($consumerId); @@ -108,5 +108,5 @@ public function deleteConsumer($consumerId); * @param int $consumerId * @return bool If token was deleted */ - public function deleteToken($consumerId); + public function deleteIntegrationToken($consumerId); } diff --git a/app/code/Magento/Integration/Service/V1/TokenService.php b/app/code/Magento/Integration/Service/V1/TokenService.php new file mode 100644 index 000000000000..0b860f33655a --- /dev/null +++ b/app/code/Magento/Integration/Service/V1/TokenService.php @@ -0,0 +1,132 @@ +tokenModelFactory = $tokenModelFactory; + $this->userModel = $userModel; + $this->customerAccountService = $customerAccountService; + } + + /** + * {@inheritdoc} + */ + public function createAdminAccessToken($username, $password) + { + $this->validateCredentials($username, $password); + try { + $this->userModel->login($username, $password); + if (!$this->userModel->getId()) { + /* + * This message is same as one thrown in \Magento\Backend\Model\Auth to keep the behavior consistent. + * Constant cannot be created in Auth Model since it uses legacy translation that doesn't support it. + * Need to make sure that this is refactored once exception handling is updated in Auth Model. + */ + throw new AuthenticationException('Please correct the user name or password.'); + } + } catch (\Magento\Backend\Model\Auth\Exception $e) { + throw new AuthenticationException($e->getMessage(), [], $e); + } catch (\Magento\Framework\Model\Exception $e) { + throw new LocalizedException($e->getMessage(), [], $e); + } + return $this->tokenModelFactory->create()->createAdminToken($this->userModel->getId())->getToken(); + } + + /** + * {@inheritdoc} + */ + public function createCustomerAccessToken($username, $password) + { + $this->validateCredentials($username, $password); + $customerDataObject = $this->customerAccountService->authenticate($username, $password); + return $this->tokenModelFactory->create()->createCustomerToken($customerDataObject->getId())->getToken(); + } + + /** + * Validate user credentials + * + * @param string $username + * @param string $password + * @return void + * @throws \Magento\Framework\Exception\InputException + */ + protected function validateCredentials($username, $password) + { + $exception = new InputException(); + if (!is_string($username) || strlen($username) == 0) { + $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'username']); + } + if (!is_string($username) || strlen($password) == 0) { + $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'password']); + } + if ($exception->wasErrorAdded()) { + throw $exception; + } + } +} diff --git a/app/code/Magento/Integration/Service/V1/TokenServiceInterface.php b/app/code/Magento/Integration/Service/V1/TokenServiceInterface.php new file mode 100644 index 000000000000..0f374a7a638a --- /dev/null +++ b/app/code/Magento/Integration/Service/V1/TokenServiceInterface.php @@ -0,0 +1,58 @@ + + + Magento\Framework\Stdlib\DateTime\DateTime\Proxy diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index e16c617dce95..eb76e22b29dd 100644 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -24,17 +24,20 @@ */ --> - + + + + diff --git a/app/code/Magento/Integration/etc/webapi.xml b/app/code/Magento/Integration/etc/webapi.xml new file mode 100644 index 000000000000..2153888cff31 --- /dev/null +++ b/app/code/Magento/Integration/etc/webapi.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Integration/sql/integration_setup/upgrade-1.0.0.2-1.0.0.3.php b/app/code/Magento/Integration/sql/integration_setup/upgrade-1.0.0.2-1.0.0.3.php new file mode 100644 index 000000000000..f77a5d32b3ca --- /dev/null +++ b/app/code/Magento/Integration/sql/integration_setup/upgrade-1.0.0.2-1.0.0.3.php @@ -0,0 +1,68 @@ +getConnection(); + +$oauthTokenTable = $installer->getTable('oauth_token'); +$adminTable = $installer->getTable('admin_user'); +$customerTable = $installer->getTable('customer_entity'); + +$connection->addColumn( + $oauthTokenTable, + 'user_type', + array( + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 'comment' => 'User type' + ) +); +$connection->modifyColumn( + $oauthTokenTable, + 'consumer_id', + array( + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 'unsigned' => true, + 'nullable' => true, + 'comment' => 'Oauth Consumer ID' + ) +); +$connection->addForeignKey( + $installer->getFkName($oauthTokenTable, 'admin_id', $adminTable, 'user_id'), + $oauthTokenTable, + 'admin_id', + $adminTable, + 'user_id' +); +$connection->addForeignKey( + $installer->getFkName($oauthTokenTable, 'admin_id', $customerTable, 'entity_id'), + $oauthTokenTable, + 'customer_id', + $customerTable, + 'entity_id' +); diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index be9d3df13b41..00ec2ff67d6d 100644 --- a/app/code/Magento/LayeredNavigation/composer.json +++ b/app/code/Magento/LayeredNavigation/composer.json @@ -2,14 +2,14 @@ "name": "magento/module-layered-navigation", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/page_one_column.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/page_one_column.xml index a73bba5fcada..d99697645da7 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/layout/page_one_column.xml +++ b/app/code/Magento/LayeredNavigation/view/frontend/layout/page_one_column.xml @@ -24,5 +24,5 @@ */ --> - + diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml index 77cb12ee001e..431a63e830c7 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml @@ -31,8 +31,8 @@ ?> getActiveFilters() ?> -
    - +
    +
    1. diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml index 6af9a7ed80eb..2fb0ffd37cd0 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml @@ -34,7 +34,6 @@
      - getLayer()->getState()->getActiveFilters()) ?>
      @@ -45,17 +44,20 @@
      - - - -
      - getFilters() as $filter): ?> + + getFilters() as $filter): ?> + + +
      + getItemsCount()): ?>
      escapeHtml(__($filter->getName())) ?>
      getChildBlock('renderer')->render($filter); ?>
      - -
      + + +
      +
    diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json index a61e95929ee8..5fb3aacf06e9 100644 --- a/app/code/Magento/Log/composer.json +++ b/app/code/Magento/Log/composer.json @@ -2,18 +2,18 @@ "name": "magento/module-log", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index 8062806648e5..c5a34e64e590 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -24,6 +24,7 @@ namespace Magento\Multishipping\Model\Checkout\Type; use Magento\Customer\Service\V1\CustomerAddressServiceInterface; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; /** * Multishipping checkout model @@ -103,6 +104,11 @@ class Multishipping extends \Magento\Framework\Object */ protected $_customerAddressService; + /** + * @var OrderSender + */ + protected $orderSender; + /** * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession @@ -116,6 +122,7 @@ class Multishipping extends \Magento\Framework\Object * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Payment\Model\Method\SpecificationInterface $paymentSpecification * @param \Magento\Multishipping\Helper\Data $helper + * @param OrderSender $orderSender * @param array $data */ public function __construct( @@ -131,6 +138,7 @@ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Payment\Model\Method\SpecificationInterface $paymentSpecification, \Magento\Multishipping\Helper\Data $helper, + OrderSender $orderSender, array $data = array() ) { $this->_eventManager = $eventManager; @@ -145,6 +153,7 @@ public function __construct( $this->_customerSession = $customerSession; $this->_orderFactory = $orderFactory; $this->_customerAddressService = $customerAddressService; + $this->orderSender = $orderSender; parent::__construct($data); $this->_init(); } @@ -639,7 +648,7 @@ public function createOrders() $order->place(); $order->save(); if ($order->getCanSendNewEmailFlag()) { - $order->sendNewOrderEmail(); + $this->orderSender->send($order); } $orderIds[$order->getId()] = $order->getIncrementId(); } diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index 6dee20220838..023416f651c9 100644 --- a/app/code/Magento/Multishipping/composer.json +++ b/app/code/Magento/Multishipping/composer.json @@ -2,21 +2,21 @@ "name": "magento/module-multishipping", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-weee": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-weee": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Multishipping/etc/adminhtml/acl.xml b/app/code/Magento/Multishipping/etc/acl.xml similarity index 94% rename from app/code/Magento/Multishipping/etc/adminhtml/acl.xml rename to app/code/Magento/Multishipping/etc/acl.xml index 82bdbc1398e6..b6cad29cbc15 100644 --- a/app/code/Magento/Multishipping/etc/adminhtml/acl.xml +++ b/app/code/Magento/Multishipping/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index 1850aa528a44..4bc48b94f699 100644 --- a/app/code/Magento/Newsletter/composer.json +++ b/app/code/Magento/Newsletter/composer.json @@ -2,22 +2,22 @@ "name": "magento/module-newsletter", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-widget": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/module-email": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-cron": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-widget": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/module-email": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-cron": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Newsletter/etc/adminhtml/acl.xml b/app/code/Magento/Newsletter/etc/acl.xml similarity index 96% rename from app/code/Magento/Newsletter/etc/adminhtml/acl.xml rename to app/code/Magento/Newsletter/etc/acl.xml index c8d22e1fd87d..d1eb2f175c35 100644 --- a/app/code/Magento/Newsletter/etc/adminhtml/acl.xml +++ b/app/code/Magento/Newsletter/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index 93acbbb7a289..ec0bfcae4b8d 100644 --- a/app/code/Magento/OfflinePayments/composer.json +++ b/app/code/Magento/OfflinePayments/composer.json @@ -2,13 +2,13 @@ "name": "magento/module-offline-payments", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-payment": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-payment": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index 417547b6b4d5..e35cbbe21966 100644 --- a/app/code/Magento/OfflineShipping/composer.json +++ b/app/code/Magento/OfflineShipping/composer.json @@ -2,20 +2,20 @@ "name": "magento/module-offline-shipping", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-shipping": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-sales-rule": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-shipping": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-sales-rule": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Ogone/Controller/Api.php b/app/code/Magento/Ogone/Controller/Api.php index 0a3493b97284..faff1fdefffb 100644 --- a/app/code/Magento/Ogone/Controller/Api.php +++ b/app/code/Magento/Ogone/Controller/Api.php @@ -25,6 +25,7 @@ use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Payment\Transaction as PaymentTransaction; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; /** * Ogone Api Controller @@ -48,19 +49,27 @@ class Api extends \Magento\Framework\App\Action\Action */ protected $_transactionFactory; + /** + * @var OrderSender + */ + protected $orderSender; + /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Framework\DB\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\OrderFactory $salesOrderFactory + * @param OrderSender $orderSender */ public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Framework\DB\TransactionFactory $transactionFactory, - \Magento\Sales\Model\OrderFactory $salesOrderFactory + \Magento\Sales\Model\OrderFactory $salesOrderFactory, + OrderSender $orderSender ) { parent::__construct($context); $this->_transactionFactory = $transactionFactory; $this->_salesOrderFactory = $salesOrderFactory; + $this->orderSender = $orderSender; } /** @@ -248,7 +257,7 @@ protected function _processDirectSale() $invoice->getOrder()->setIsInProcess(true); $this->_transactionFactory->create()->addObject($invoice)->addObject($invoice->getOrder())->save(); - $order->sendNewOrderEmail(); + $this->orderSender->send($order); } } else { $order->save(); @@ -282,7 +291,7 @@ protected function _processAuthorize() } else { //to send new order email only when state is pending payment if ($order->getState() == \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT) { - $order->sendNewOrderEmail(); + $this->orderSender->send($order); } $order->setState( \Magento\Sales\Model\Order::STATE_PROCESSING, @@ -356,7 +365,7 @@ public function _exceptionProcess() $order->getPayment()->setLastTransId($params['PAYID']); //to send new order email only when state is pending payment if ($order->getState() == \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT) { - $order->sendNewOrderEmail(); + $this->orderSender->send($order); $order->setState( \Magento\Sales\Model\Order::STATE_PROCESSING, \Magento\Ogone\Model\Api::PROCESSING_OGONE_STATUS, diff --git a/app/code/Magento/Ogone/composer.json b/app/code/Magento/Ogone/composer.json index 324926c35f23..c32adb17524f 100644 --- a/app/code/Magento/Ogone/composer.json +++ b/app/code/Magento/Ogone/composer.json @@ -2,16 +2,16 @@ "name": "magento/module-ogone", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index c0f7ecc263fa..1a1968b4da93 100644 --- a/app/code/Magento/PageCache/composer.json +++ b/app/code/Magento/PageCache/composer.json @@ -2,14 +2,14 @@ "name": "magento/module-page-cache", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php b/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php index d04c57253fb7..f8908adecfe6 100644 --- a/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php +++ b/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php @@ -25,6 +25,8 @@ use Exception; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; + /** * PayPal Recurring Instant Payment Notification processor model */ @@ -42,11 +44,17 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements \Magento\Paypal\M */ protected $_recurringPaymentFactory; + /** + * @var OrderSender + */ + protected $orderSender; + /** * @param \Magento\Paypal\Model\ConfigFactory $configFactory * @param \Magento\Framework\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory * @param \Magento\RecurringPayment\Model\PaymentFactory $recurringPaymentFactory + * @param OrderSender $orderSender * @param array $data */ public function __construct( @@ -54,10 +62,12 @@ public function __construct( \Magento\Framework\Logger\AdapterFactory $logAdapterFactory, \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, \Magento\RecurringPayment\Model\PaymentFactory $recurringPaymentFactory, + OrderSender $orderSender, array $data = array() ) { parent::__construct($configFactory, $logAdapterFactory, $curlFactory, $data); $this->_recurringPaymentFactory = $recurringPaymentFactory; + $this->orderSender = $orderSender; } /** @@ -171,7 +181,8 @@ protected function _processRecurringPayment() $invoice = $payment->getCreatedInvoice(); if ($invoice) { $message = __('You notified customer about invoice #%1.', $invoice->getIncrementId()); - $order->sendNewOrderEmail()->addStatusHistoryComment($message)->setIsCustomerNotified(true)->save(); + $this->orderSender->send($order); + $order->addStatusHistoryComment($message)->setIsCustomerNotified(true)->save(); } } catch (\Magento\Framework\Model\Exception $e) { $comment = $this->_createIpnComment(__('Note: %1', $e->getMessage()), true); diff --git a/app/code/Magento/PayPalRecurringPayment/composer.json b/app/code/Magento/PayPalRecurringPayment/composer.json index 61cff656014e..8c2e560ad964 100644 --- a/app/code/Magento/PayPalRecurringPayment/composer.json +++ b/app/code/Magento/PayPalRecurringPayment/composer.json @@ -2,17 +2,18 @@ "name": "magento/module-pay-pal-recurring-payment", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-paypal": "0.1.0-alpha89", - "magento/module-recurring-payment": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-paypal": "0.1.0-alpha90", + "magento/module-recurring-payment": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/PayPalRecurringPayment/etc/module.xml b/app/code/Magento/PayPalRecurringPayment/etc/module.xml index 1a7957cf93bb..c0f24a5bf827 100644 --- a/app/code/Magento/PayPalRecurringPayment/etc/module.xml +++ b/app/code/Magento/PayPalRecurringPayment/etc/module.xml @@ -30,6 +30,7 @@ + diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index 789f80d72d54..fce23ae89598 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-payment", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-centinel": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-centinel": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Payment/etc/adminhtml/acl.xml b/app/code/Magento/Payment/etc/acl.xml similarity index 94% rename from app/code/Magento/Payment/etc/adminhtml/acl.xml rename to app/code/Magento/Payment/etc/acl.xml index c8ad3fd70b76..30c6482acc4d 100644 --- a/app/code/Magento/Payment/etc/adminhtml/acl.xml +++ b/app/code/Magento/Payment/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php index 83bf85995421..e1c9bb83bbd1 100644 --- a/app/code/Magento/Paypal/Model/Express/Checkout.php +++ b/app/code/Magento/Paypal/Model/Express/Checkout.php @@ -27,6 +27,7 @@ use Magento\Sales\Model\Quote\Address; use Magento\Customer\Service\V1\Data\Customer as CustomerDataObject; use Magento\Paypal\Model\Config as PaypalConfig; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; /** * Wrapper that performs Paypal Express and Checkout communication @@ -280,6 +281,11 @@ class Checkout */ protected $_messageManager; + /** + * @var OrderSender + */ + protected $orderSender; + /** * Set config, session and quote instances * @@ -307,6 +313,7 @@ class Checkout * @param \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param OrderSender $orderSender * @param array $params * @throws \Exception */ @@ -335,6 +342,7 @@ public function __construct( \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Message\ManagerInterface $messageManager, + OrderSender $orderSender, $params = array() ) { $this->_customerData = $customerData; @@ -360,6 +368,7 @@ public function __construct( $this->_customerDetailsBuilder = $customerDetailsBuilder; $this->_encryptor = $encryptor; $this->_messageManager = $messageManager; + $this->orderSender = $orderSender; $this->_customerSession = isset($params['session']) && $params['session'] instanceof \Magento\Customer\Model\Session ? $params['session'] : $customerSession; @@ -842,7 +851,7 @@ public function place($token, $shippingMethodCode = null) case \Magento\Sales\Model\Order::STATE_PROCESSING: case \Magento\Sales\Model\Order::STATE_COMPLETE: case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW: - $order->sendNewOrderEmail(); + $this->orderSender->send($order); break; default: break; diff --git a/app/code/Magento/Paypal/Model/Ipn.php b/app/code/Magento/Paypal/Model/Ipn.php index e871ca462aa0..d0d432d53c67 100644 --- a/app/code/Magento/Paypal/Model/Ipn.php +++ b/app/code/Magento/Paypal/Model/Ipn.php @@ -24,6 +24,8 @@ namespace Magento\Paypal\Model; use Exception; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; +use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; /** * PayPal Instant Payment Notification processor model @@ -47,12 +49,24 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface */ protected $_paypalInfo; + /** + * @var OrderSender + */ + protected $orderSender; + + /** + * @var CreditmemoSender + */ + protected $creditmemoSender; + /** * @param \Magento\Paypal\Model\ConfigFactory $configFactory * @param \Magento\Framework\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param Info $paypalInfo + * @param OrderSender $orderSender + * @param CreditmemoSender $creditmemoSender * @param array $data */ public function __construct( @@ -61,11 +75,15 @@ public function __construct( \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, \Magento\Sales\Model\OrderFactory $orderFactory, Info $paypalInfo, + OrderSender $orderSender, + CreditmemoSender $creditmemoSender, array $data = array() ) { parent::__construct($configFactory, $logAdapterFactory, $curlFactory, $data); $this->_orderFactory = $orderFactory; $this->_paypalInfo = $paypalInfo; + $this->orderSender = $orderSender; + $this->creditmemoSender = $creditmemoSender; } /** @@ -312,7 +330,8 @@ protected function _registerPaymentCapture($skipFraudDetection = false) // notify customer $invoice = $payment->getCreatedInvoice(); if ($invoice && !$this->_order->getEmailSent()) { - $this->_order->sendNewOrderEmail()->addStatusHistoryComment( + $this->orderSender->send($this->_order); + $this->_order->addStatusHistoryComment( __('You notified customer about invoice #%1.', $invoice->getIncrementId()) )->setIsCustomerNotified( true @@ -419,7 +438,7 @@ protected function _registerPaymentAuthorization() ); } if (!$this->_order->getEmailSent()) { - $this->_order->sendNewOrderEmail(); + $this->orderSender->send($this->_order); } $this->_order->save(); } @@ -490,7 +509,7 @@ protected function _registerPaymentRefund() $creditMemo = $payment->getCreatedCreditmemo(); if ($creditMemo) { - $creditMemo->sendEmail(); + $this->creditmemoSender->send($creditMemo); $this->_order->addStatusHistoryComment( __('You notified customer about creditmemo #%1.', $creditMemo->getIncrementId()) )->setIsCustomerNotified( diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index 31b9354b080b..370bb739c7be 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -23,6 +23,8 @@ */ namespace Magento\Paypal\Model; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; + /** * Payflow Link payment gateway model */ @@ -144,6 +146,11 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro */ protected $_websiteFactory; + /** + * @var OrderSender + */ + protected $orderSender; + /** * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData @@ -162,6 +169,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Framework\App\RequestInterface $requestHttp * @param \Magento\Store\Model\WebsiteFactory $websiteFactory + * @param OrderSender $orderSender * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -184,6 +192,7 @@ public function __construct( \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Framework\App\RequestInterface $requestHttp, \Magento\Store\Model\WebsiteFactory $websiteFactory, + OrderSender $orderSender, array $data = array() ) { $this->_requestFactory = $requestFactory; @@ -191,6 +200,7 @@ public function __construct( $this->_orderFactory = $orderFactory; $this->_requestHttp = $requestHttp; $this->_websiteFactory = $websiteFactory; + $this->orderSender = $orderSender; parent::__construct( $eventManager, $paymentData, @@ -389,7 +399,7 @@ protected function _processOrder(\Magento\Sales\Model\Order $order) try { if ($canSendNewOrderEmail) { - $order->sendNewOrderEmail(); + $this->orderSender->send($order); } $this->_quoteFactory->create()->load($order->getQuoteId())->setIsActive(false)->save(); } catch (\Exception $e) { diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json index cfc787d36f47..cd97fcde61a5 100644 --- a/app/code/Magento/Paypal/composer.json +++ b/app/code/Magento/Paypal/composer.json @@ -2,26 +2,26 @@ "name": "magento/module-paypal", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/module-centinel": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/module-centinel": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Paypal/etc/adminhtml/acl.xml b/app/code/Magento/Paypal/etc/acl.xml similarity index 96% rename from app/code/Magento/Paypal/etc/adminhtml/acl.xml rename to app/code/Magento/Paypal/etc/acl.xml index d0f32046bc40..3dc6a973cf8f 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/acl.xml +++ b/app/code/Magento/Paypal/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Paypal/etc/adminhtml/system.xml b/app/code/Magento/Paypal/etc/adminhtml/system.xml index 6f826847aefc..838e2e42de04 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system.xml @@ -749,7 +749,7 @@ You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with Bill Me Later®. Learn More]]> - payment/paypal_express_bml/active + payment/payflow_express_bml/active diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json index 92987b1525fa..9f15f4a5107f 100644 --- a/app/code/Magento/Persistent/composer.json +++ b/app/code/Magento/Persistent/composer.json @@ -2,18 +2,18 @@ "name": "magento/module-persistent", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-cron": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-cron": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Persistent/etc/adminhtml/acl.xml b/app/code/Magento/Persistent/etc/acl.xml similarity index 94% rename from app/code/Magento/Persistent/etc/adminhtml/acl.xml rename to app/code/Magento/Persistent/etc/acl.xml index 986e38739e4d..8783b80c14f0 100644 --- a/app/code/Magento/Persistent/etc/adminhtml/acl.xml +++ b/app/code/Magento/Persistent/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index 478a634fc044..cae86a3d2c98 100644 --- a/app/code/Magento/ProductAlert/composer.json +++ b/app/code/Magento/ProductAlert/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-product-alert", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php b/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php index f6e988b9c9a2..27bd0e404d5d 100644 --- a/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php @@ -99,10 +99,12 @@ protected function _viewAction() { try { $payment = $this->_initPayment(); - $this->_title->add(__('Recurring Billing Payments')); - $this->_title->add(__('Payment #%1', $payment->getReferenceId())); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); + + $title = __('Recurring Payment #%1', $payment->getReferenceId()); + $this->_view->getLayout()->getBlock('head')->setTitle($title); + $this->_view->renderLayout(); return; } catch (\Magento\Framework\Model\Exception $e) { diff --git a/app/code/Magento/RecurringPayment/Model/Plugin/Tabs.php b/app/code/Magento/RecurringPayment/Model/Plugin/Tabs.php new file mode 100644 index 000000000000..4c4e54548c68 --- /dev/null +++ b/app/code/Magento/RecurringPayment/Model/Plugin/Tabs.php @@ -0,0 +1,60 @@ +_moduleManager = $moduleManager; + } + + /** + * @param \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs $subject + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection $result + * + * @return \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterGetGroupCollection(\Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs $subject, $result) + { + if (!$this->_moduleManager->isOutputEnabled('Magento_RecurringPayment')) { + foreach ($result as $key => $group) { + if ($group->getAttributeGroupCode() === 'recurring-payment') { + $result->removeItemByKey($key); + } + } + } + return $result; + } +} diff --git a/app/code/Magento/RecurringPayment/composer.json b/app/code/Magento/RecurringPayment/composer.json index 98a7df3d23c4..1c8a325da56a 100644 --- a/app/code/Magento/RecurringPayment/composer.json +++ b/app/code/Magento/RecurringPayment/composer.json @@ -2,22 +2,22 @@ "name": "magento/module-recurring-payment", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-checkout": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-checkout": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php b/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php index 87c94686774a..a6d44ef51661 100644 --- a/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php +++ b/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php @@ -35,7 +35,7 @@ $this->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, 'recurring_payment'); $connection = $this->getConnection(); -$adminRuleTable = $this->getTable('admin_rule'); +$adminRuleTable = $this->getTable('authorization_rule'); $connection->update( $adminRuleTable, array('resource_id' => 'Magento_RecurringPayment::recurring_payment'), diff --git a/app/code/Magento/RecurringPayment/etc/adminhtml/acl.xml b/app/code/Magento/RecurringPayment/etc/acl.xml similarity index 94% rename from app/code/Magento/RecurringPayment/etc/adminhtml/acl.xml rename to app/code/Magento/RecurringPayment/etc/acl.xml index 5a259ef64af4..a83953dd5bc9 100644 --- a/app/code/Magento/RecurringPayment/etc/adminhtml/acl.xml +++ b/app/code/Magento/RecurringPayment/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/RecurringPayment/etc/di.xml b/app/code/Magento/RecurringPayment/etc/di.xml index b2f1aba96635..447db78390fe 100644 --- a/app/code/Magento/RecurringPayment/etc/di.xml +++ b/app/code/Magento/RecurringPayment/etc/di.xml @@ -47,5 +47,7 @@ - + + + diff --git a/app/code/Magento/RecurringPayment/view/frontend/templates/catalog/product/view/payment/schedule.phtml b/app/code/Magento/RecurringPayment/view/frontend/templates/catalog/product/view/payment/schedule.phtml index f0472591fd0a..5bfe9bb7ba80 100644 --- a/app/code/Magento/RecurringPayment/view/frontend/templates/catalog/product/view/payment/schedule.phtml +++ b/app/code/Magento/RecurringPayment/view/frontend/templates/catalog/product/view/payment/schedule.phtml @@ -27,11 +27,11 @@ * @see \Magento\RecurringPayment\Block\Catalog\Product\View\Payment */ ?> -
    +
    getScheduleInfo() as $term => $definitions): ?> -
    escapeHtml($term); ?>
    +
    escapeHtml($term); ?>
    -
    escapeHtml($definition)?>
    +
    escapeHtml($definition)?>
    diff --git a/app/code/Magento/RecurringPayment/view/frontend/templates/recurring/grid.phtml b/app/code/Magento/RecurringPayment/view/frontend/templates/recurring/grid.phtml index 34a92266f321..6d2199a981f6 100644 --- a/app/code/Magento/RecurringPayment/view/frontend/templates/recurring/grid.phtml +++ b/app/code/Magento/RecurringPayment/view/frontend/templates/recurring/grid.phtml @@ -32,9 +32,6 @@ getGridElements(); ?> - getChildHtml('pager')): ?> -
    getChildHtml('pager'); ?>
    -
    diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json index 394f1be72ebe..a1ffb4336728 100644 --- a/app/code/Magento/Reports/composer.json +++ b/app/code/Magento/Reports/composer.json @@ -2,28 +2,28 @@ "name": "magento/module-reports", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-widget": "0.1.0-alpha89", - "magento/module-log": "0.1.0-alpha89", - "magento/module-wishlist": "0.1.0-alpha89", - "magento/module-review": "0.1.0-alpha89", - "magento/module-catalog-inventory": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-downloadable": "0.1.0-alpha89", - "magento/module-sales-rule": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-widget": "0.1.0-alpha90", + "magento/module-log": "0.1.0-alpha90", + "magento/module-wishlist": "0.1.0-alpha90", + "magento/module-review": "0.1.0-alpha90", + "magento/module-catalog-inventory": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-downloadable": "0.1.0-alpha90", + "magento/module-sales-rule": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Reports/etc/adminhtml/acl.xml b/app/code/Magento/Reports/etc/acl.xml similarity index 97% rename from app/code/Magento/Reports/etc/adminhtml/acl.xml rename to app/code/Magento/Reports/etc/acl.xml index 45984f2766eb..6c65b81e5eb7 100644 --- a/app/code/Magento/Reports/etc/adminhtml/acl.xml +++ b/app/code/Magento/Reports/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml index 532168f0ba5b..595f87c63e85 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml @@ -45,7 +45,14 @@ $rating = 'short'; escapeHtml($item->getName()) ?> - getPriceHtml($item, true, '-' . $type) ?> + getProductPriceHtml( + $item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> getReviewsSummaryHtml($item, $rating) ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index cd799593ddea..3191111afded 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -62,7 +62,14 @@ if ($exist = $this->getRecentlyComparedProducts()) { helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - getPriceHtml($_product, true, '-widget-compared-'.$suffix) ?> + getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-widget-compared-' . $suffix + ] + ) ?> isSaleable()): ?>
    getTypeInstance()->hasRequiredOptions($_product)): ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index 5bda296b6a90..cec10c808cda 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -68,7 +68,14 @@ if ($exist = $this->getRecentlyComparedProducts()) { escapeHtml($_item->getName()) ?> - getPriceHtml($_item, true, '-' . $type) ?> + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> getReviewsSummaryHtml($_item, $rating) ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index 19c06d1021b1..49566e2fb98a 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -68,7 +68,14 @@ if ($exist = $this->getRecentlyComparedProducts()) { escapeHtml($_item->getName()) ?> - getPriceHtml($_item, true, '-' . $type) ?> + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> getReviewsSummaryHtml($_item, $rating) ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index ccf3b04bbcf5..8f9164b5577f 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -69,20 +69,27 @@ if ($exist = $this->getRecentlyViewedProducts()) { helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - getPriceHtml($_product, true, '-widget-viewed-'.$suffix) ?> + getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-widget-viewed-' . $suffix + ] + ) ?>
    isSaleable()): ?>
    - getTypeInstance()->hasRequiredOptions($_item)): ?> + getTypeInstance()->hasRequiredOptions($_product)): ?> helper('Magento\Core\Helper\PostData'); - $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); ?>
    diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index a4696099c4e7..dcef739b2ff3 100644 --- a/app/code/Magento/Rss/composer.json +++ b/app/code/Magento/Rss/composer.json @@ -2,23 +2,23 @@ "name": "magento/module-rss", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-catalog-inventory": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-sales-rule": "0.1.0-alpha89", - "magento/module-wishlist": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-review": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-gift-message": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-catalog-inventory": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-sales-rule": "0.1.0-alpha90", + "magento/module-wishlist": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-review": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-gift-message": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Rss/etc/adminhtml/acl.xml b/app/code/Magento/Rss/etc/acl.xml similarity index 94% rename from app/code/Magento/Rss/etc/adminhtml/acl.xml rename to app/code/Magento/Rss/etc/acl.xml index b3a7b17e76ad..2b86dd15ddbb 100644 --- a/app/code/Magento/Rss/etc/adminhtml/acl.xml +++ b/app/code/Magento/Rss/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index 665db8299cec..c673316805af 100644 --- a/app/code/Magento/Rule/composer.json +++ b/app/code/Magento/Rule/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-rule", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo/Email.php b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo/Email.php index f33ac4e591ad..9de7ad34c381 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo/Email.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo/Email.php @@ -24,6 +24,8 @@ */ namespace Magento\Sales\Controller\Adminhtml\Creditmemo\AbstractCreditmemo; +use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; + class Email extends \Magento\Backend\App\Action { /** @@ -45,7 +47,11 @@ public function execute() if ($creditmemoId) { $creditmemo = $this->_objectManager->create('Magento\Sales\Model\Order\Creditmemo')->load($creditmemoId); if ($creditmemo) { - $creditmemo->sendEmail(); + /** @var CreditmemoSender $creditmemoSender */ + $creditmemoSender = $this->_objectManager + ->create('Magento\Sales\Model\Order\Email\Sender\CreditmemoSender'); + $creditmemoSender->send($creditmemo); + $historyItem = $this->_objectManager->create( 'Magento\Sales\Model\Resource\Order\Status\History\Collection' )->getUnnotifiedForInstance( diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php index dd60dec7ec33..207cbeefdb1a 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice/Email.php @@ -24,6 +24,8 @@ */ namespace Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice; +use Magento\Sales\Model\Order\Email\Sender\InvoiceSender; + abstract class Email extends \Magento\Backend\App\Action { /** @@ -41,25 +43,33 @@ protected function _isAllowed() */ public function execute() { - if ($invoiceId = $this->getRequest()->getParam('invoice_id')) { - if ($invoice = $this->_objectManager->create('Magento\Sales\Model\Order\Invoice')->load($invoiceId)) { - $invoice->sendEmail(); - $historyItem = $this->_objectManager->create( - 'Magento\Sales\Model\Resource\Order\Status\History\Collection' - )->getUnnotifiedForInstance( - $invoice, - \Magento\Sales\Model\Order\Invoice::HISTORY_ENTITY_NAME - ); - if ($historyItem) { - $historyItem->setIsCustomerNotified(1); - $historyItem->save(); - } - $this->messageManager->addSuccess(__('We sent the message.')); - $this->_redirect( - 'sales/invoice/view', - array('order_id' => $invoice->getOrder()->getId(), 'invoice_id' => $invoiceId) - ); - } + $invoiceId = $this->getRequest()->getParam('invoice_id'); + if (!$invoiceId) { + return; + } + $invoice = $this->_objectManager->create('Magento\Sales\Model\Order\Invoice')->load($invoiceId); + if (!$invoice) { + return; + } + + /** @var InvoiceSender $invoiceSender */ + $invoiceSender = $this->_objectManager->create('Magento\Sales\Model\Order\Email\Sender\InvoiceSender'); + $invoiceSender->send($invoice); + + $historyItem = $this->_objectManager->create( + 'Magento\Sales\Model\Resource\Order\Status\History\Collection' + )->getUnnotifiedForInstance( + $invoice, + \Magento\Sales\Model\Order\Invoice::HISTORY_ENTITY_NAME + ); + if ($historyItem) { + $historyItem->setIsCustomerNotified(1); + $historyItem->save(); } + $this->messageManager->addSuccess(__('We sent the message.')); + $this->_redirect( + 'sales/invoice/view', + array('order_id' => $invoice->getOrder()->getId(), 'invoice_id' => $invoiceId) + ); } } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php index 161e89acf41a..ae8584d6809f 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php @@ -25,6 +25,7 @@ namespace Magento\Sales\Controller\Adminhtml\Order; use \Magento\Backend\App\Action; +use Magento\Sales\Model\Order\Email\Sender\OrderCommentSender; class AddComment extends \Magento\Sales\Controller\Adminhtml\Order { @@ -55,7 +56,11 @@ public function execute() $comment = trim(strip_tags($data['comment'])); $order->save(); - $order->sendOrderUpdateEmail($notify, $comment); + /** @var OrderCommentSender $orderCommentSender */ + $orderCommentSender = $this->_objectManager + ->create('Magento\Sales\Model\Order\Email\Sender\OrderCommentSender'); + + $orderCommentSender->send($order, $notify, $comment); $this->_view->loadLayout('empty'); $this->_view->renderLayout(); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php index eba5f4c1422c..02c9c6ea161c 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php @@ -25,6 +25,7 @@ namespace Magento\Sales\Controller\Adminhtml\Order\Creditmemo; use Magento\Backend\App\Action; +use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; class AddComment extends \Magento\Backend\App\Action { @@ -33,15 +34,23 @@ class AddComment extends \Magento\Backend\App\Action */ protected $creditmemoLoader; + /** + * @var CreditmemoSender + */ + protected $creditmemoSender; + /** * @param Action\Context $context * @param \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader + * @param CreditmemoSender $creditmemoSender */ public function __construct( Action\Context $context, - \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader + \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader, + CreditmemoSender $creditmemoSender ) { $this->creditmemoLoader = $creditmemoLoader; + $this->creditmemoSender = $creditmemoSender; parent::__construct($context); } @@ -74,7 +83,8 @@ public function execute() isset($data['is_visible_on_front']) ); $comment->save(); - $creditmemo->sendUpdateEmail(!empty($data['is_customer_notified']), $data['comment']); + + $this->creditmemoSender->send($creditmemo, !empty($data['is_customer_notified']), $data['comment']); $this->_view->loadLayout(); $response = $this->_view->getLayout()->getBlock('creditmemo_comments')->toHtml(); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php index bc9d8d695b57..11021c94b9fe 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php @@ -26,6 +26,7 @@ use \Magento\Sales\Model\Order; use \Magento\Backend\App\Action; +use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; class Save extends \Magento\Backend\App\Action { @@ -34,15 +35,23 @@ class Save extends \Magento\Backend\App\Action */ protected $creditmemoLoader; + /** + * @var CreditmemoSender + */ + protected $creditmemoSender; + /** * @param Action\Context $context * @param \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader + * @param CreditmemoSender $creditmemoSender */ public function __construct( Action\Context $context, - \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader + \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader, + CreditmemoSender $creditmemoSender ) { $this->creditmemoLoader = $creditmemoLoader; + $this->creditmemoSender = $creditmemoSender; parent::__construct($context); } @@ -115,7 +124,8 @@ public function execute() $transactionSave->addObject($creditmemo->getInvoice()); } $transactionSave->save(); - $creditmemo->sendEmail(!empty($data['send_email']), $comment); + $this->creditmemoSender->send($creditmemo, !empty($data['send_email']), $comment); + $this->messageManager->addSuccess(__('You created the credit memo.')); $this->_getSession()->getCommentText(true); $this->_redirect('sales/order/view', array('order_id' => $creditmemo->getOrderId())); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Email.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Email.php index d4c23da395d8..b5492f4f114d 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Email.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Email.php @@ -38,7 +38,12 @@ public function execute() $order = $this->_initOrder(); if ($order) { try { - $order->sendNewOrderEmail(); + /** @var \Magento\Sales\Model\Order\Email\Sender\OrderSender $orderSender */ + $orderSender = $this->_objectManager->create( + 'Magento\Sales\Model\Order\Email\Sender\OrderSender' + ); + $orderSender->send($order); + $historyItem = $this->_objectManager->create( 'Magento\Sales\Model\Resource\Order\Status\History\Collection' )->getUnnotifiedForInstance( diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php index af6483eebe37..1f715e8a264f 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php @@ -26,6 +26,8 @@ use Magento\Backend\App\Action; use \Magento\Framework\Model\Exception; +use \Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender; +use \Magento\Sales\Model\Order\Invoice; class AddComment extends \Magento\Backend\App\Action { @@ -34,15 +36,23 @@ class AddComment extends \Magento\Backend\App\Action */ protected $invoiceLoader; + /** + * @var InvoiceCommentSender + */ + protected $invoiceCommentSender; + /** * @param Action\Context $context * @param \Magento\Sales\Controller\Adminhtml\Order\InvoiceLoader $invoiceLoader + * @param InvoiceCommentSender $invoiceCommentSender */ public function __construct( Action\Context $context, - \Magento\Sales\Controller\Adminhtml\Order\InvoiceLoader $invoiceLoader + \Magento\Sales\Controller\Adminhtml\Order\InvoiceLoader $invoiceLoader, + InvoiceCommentSender $invoiceCommentSender ) { $this->invoiceLoader = $invoiceLoader; + $this->invoiceCommentSender = $invoiceCommentSender; parent::__construct($context); } @@ -68,13 +78,15 @@ public function execute() throw new Exception(__('The Comment Text field cannot be empty.')); } $this->_title->add(__('Invoices')); + /** @var Invoice $invoice */ $invoice = $this->invoiceLoader->load($this->_request); $invoice->addComment( $data['comment'], isset($data['is_customer_notified']), isset($data['is_visible_on_front']) ); - $invoice->sendUpdateEmail(!empty($data['is_customer_notified']), $data['comment']); + + $this->invoiceCommentSender->send($invoice, !empty($data['is_customer_notified']), $data['comment']); $invoice->save(); $this->_view->loadLayout(); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php index 9b08f15f3e84..ac057bc6beaf 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php @@ -26,6 +26,9 @@ use \Magento\Framework\Model\Exception; use Magento\Backend\App\Action; +use \Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender; +use \Magento\Sales\Model\Order\Email\Sender\ShipmentSender; +use \Magento\Sales\Model\Order\Invoice; class Save extends \Magento\Backend\App\Action { @@ -34,15 +37,31 @@ class Save extends \Magento\Backend\App\Action */ protected $invoiceLoader; + /** + * @var InvoiceCommentSender + */ + protected $invoiceCommentSender; + + /** + * @var ShipmentSender + */ + protected $shipmentSender; + /** * @param Action\Context $context * @param \Magento\Sales\Controller\Adminhtml\Order\InvoiceLoader $invoiceLoader + * @param InvoiceCommentSender $invoiceCommentSender + * @param ShipmentSender $shipmentSender */ public function __construct( Action\Context $context, - \Magento\Sales\Controller\Adminhtml\Order\InvoiceLoader $invoiceLoader + \Magento\Sales\Controller\Adminhtml\Order\InvoiceLoader $invoiceLoader, + InvoiceCommentSender $invoiceCommentSender, + ShipmentSender $shipmentSender ) { $this->invoiceLoader = $invoiceLoader; + $this->invoiceCommentSender = $invoiceCommentSender; + $this->shipmentSender = $shipmentSender; parent::__construct($context); } @@ -104,6 +123,7 @@ public function execute() } try { + /** @var Invoice $invoice */ $invoice = $this->invoiceLoader->load($this->_request); if ($invoice) { @@ -164,14 +184,14 @@ public function execute() $comment = $data['comment_text']; } try { - $invoice->sendEmail(!empty($data['send_email']), $comment); + $this->invoiceCommentSender->send($invoice, !empty($data['send_email']), $comment); } catch (\Exception $e) { $this->_objectManager->get('Magento\Framework\Logger')->logException($e); $this->messageManager->addError(__('We can\'t send the invoice email.')); } if ($shipment) { try { - $shipment->sendEmail(!empty($data['send_email'])); + $this->shipmentSender->send($shipment, !empty($data['send_email'])); } catch (\Exception $e) { $this->_objectManager->get('Magento\Framework\Logger')->logException($e); $this->messageManager->addError(__('We can\'t send the shipment.')); diff --git a/app/code/Magento/Sales/Helper/Data.php b/app/code/Magento/Sales/Helper/Data.php index 73c439cfafe5..6a9ebc8661ee 100644 --- a/app/code/Magento/Sales/Helper/Data.php +++ b/app/code/Magento/Sales/Helper/Data.php @@ -62,7 +62,7 @@ public function checkQuoteAmount(\Magento\Sales\Model\Quote $quote, $amount) public function canSendNewOrderConfirmationEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order::XML_PATH_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\OrderIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -88,7 +88,7 @@ public function canSendNewOrderEmail($store = null) public function canSendOrderCommentEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -103,7 +103,7 @@ public function canSendOrderCommentEmail($store = null) public function canSendNewShipmentEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order\Shipment::XML_PATH_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\ShipmentIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -118,7 +118,7 @@ public function canSendNewShipmentEmail($store = null) public function canSendShipmentCommentEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order\Shipment::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -133,7 +133,7 @@ public function canSendShipmentCommentEmail($store = null) public function canSendNewInvoiceEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order\Invoice::XML_PATH_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\InvoiceIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -148,7 +148,7 @@ public function canSendNewInvoiceEmail($store = null) public function canSendInvoiceCommentEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order\Invoice::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -163,7 +163,7 @@ public function canSendInvoiceCommentEmail($store = null) public function canSendNewCreditmemoEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order\Creditmemo::XML_PATH_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -178,7 +178,7 @@ public function canSendNewCreditmemoEmail($store = null) public function canSendCreditmemoCommentEmail($store = null) { return $this->_scopeConfig->isSetFlag( - \Magento\Sales\Model\Order\Creditmemo::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity::XML_PATH_EMAIL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 85b001045236..f28db0b90f94 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -32,6 +32,7 @@ use Magento\Customer\Service\V1\Data\Customer as CustomerDataObject; use Magento\Customer\Model\Metadata\Form as CustomerForm; use Magento\Customer\Service\V1\Data\Address as CustomerAddressDataObject; +use Magento\Sales\Model\Quote\Item; /** * Order create model @@ -202,6 +203,11 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode */ protected $quoteItemUpdater; + /** + * @var \Magento\Framework\Object\Factory + */ + protected $objectFactory; + /** * @param \Magento\Framework\ObjectManager $objectManager * @param \Magento\Framework\Event\ManagerInterface $eventManager @@ -222,7 +228,8 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param EmailSender $emailSender * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService - * @param \Magento\Sales\Model\Quote\Item\Updater $quoteItemUpdater + * @param Item\Updater $quoteItemUpdater + * @param \Magento\Framework\Object\Factory $objectFactory * @param array $data */ public function __construct( @@ -246,6 +253,7 @@ public function __construct( \Magento\Sales\Model\AdminOrder\EmailSender $emailSender, \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService, \Magento\Sales\Model\Quote\Item\Updater $quoteItemUpdater, + \Magento\Framework\Object\Factory $objectFactory, array $data = array() ) { $this->_objectManager = $objectManager; @@ -268,6 +276,7 @@ public function __construct( $this->emailSender = $emailSender; $this->stockItemService = $stockItemService; $this->quoteItemUpdater = $quoteItemUpdater; + $this->objectFactory = $objectFactory; parent::__construct($data); } @@ -998,7 +1007,7 @@ public function updateQuoteItems($items) try { foreach ($items as $itemId => $info) { if (!empty($info['configured'])) { - $item = $this->getQuote()->updateItem($itemId, $this->_objectManager->create($info)); + $item = $this->getQuote()->updateItem($itemId, $this->objectFactory->create($info)); $info['qty'] = (double)$item->getQty(); } else { $item = $this->getQuote()->getItemById($itemId); @@ -1007,7 +1016,7 @@ public function updateQuoteItems($items) } $info['qty'] = (double)$info['qty']; } - $item = $this->quoteItemUpdater->update($item, $info); + $this->quoteItemUpdater->update($item, $info); if ($item && !empty($info['action'])) { $this->moveQuoteItem($item, $info['action'], $item->getQty()); } diff --git a/app/code/Magento/Sales/Model/AdminOrder/EmailSender.php b/app/code/Magento/Sales/Model/AdminOrder/EmailSender.php index 77c549d6f6ca..2bfc9e5c8550 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/EmailSender.php +++ b/app/code/Magento/Sales/Model/AdminOrder/EmailSender.php @@ -26,6 +26,7 @@ use Magento\Framework\Message\ManagerInterface; use Magento\Framework\Logger; use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; /** * Class EmailSender @@ -33,23 +34,30 @@ class EmailSender { /** - * @var \Magento\Framework\Message\ManagerInterface + * @var ManagerInterface */ protected $messageManager; /** - * @var \Magento\Framework\Logger + * @var Logger */ protected $logger; + /** + * @var OrderSender + */ + protected $orderSender; + /** * @param ManagerInterface $messageManager * @param Logger $logger + * @param OrderSender $orderSender */ - public function __construct(ManagerInterface $messageManager, Logger $logger) + public function __construct(ManagerInterface $messageManager, Logger $logger, OrderSender $orderSender) { $this->messageManager = $messageManager; $this->logger = $logger; + $this->orderSender = $orderSender; } /** @@ -62,7 +70,7 @@ public function __construct(ManagerInterface $messageManager, Logger $logger) public function send(Order $order) { try { - $order->sendNewOrderEmail(); + $this->orderSender->send($order); } catch (\Magento\Framework\Mail\Exception $exception) { $this->logger->logException($exception); $this->messageManager->addWarning( diff --git a/app/code/Magento/Sales/Model/Notifier.php b/app/code/Magento/Sales/Model/Notifier.php new file mode 100644 index 000000000000..bbe3ebfa38a0 --- /dev/null +++ b/app/code/Magento/Sales/Model/Notifier.php @@ -0,0 +1,96 @@ +historyCollectionFactory = $historyCollectionFactory; + $this->logger = $logger; + $this->orderSender = $orderSender; + } + + /** + * Notify user + * + * @param Order $order + * @return bool + * @throws \Magento\Framework\Mail\Exception + */ + public function notify(\Magento\Sales\Model\Order $order) + { + try { + $this->orderSender->send($order); + if (!$order->getEmailSent()) { + return false; + } + $historyItem = $this->historyCollectionFactory->create()->getUnnotifiedForInstance( + $order, + \Magento\Sales\Model\Order::HISTORY_ENTITY_NAME + ); + if ($historyItem) { + $historyItem->setIsCustomerNotified(1); + $historyItem->save(); + } + } catch (Exception $e) { + $this->logger->logException($e); + return false; + } + return true; + } +} diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index aa7f6b062367..8a626144a1e5 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -315,33 +315,6 @@ class Order extends \Magento\Sales\Model\AbstractModel { const ENTITY = 'order'; - /** - * XML configuration paths - */ - const XML_PATH_EMAIL_TEMPLATE = 'sales_email/order/template'; - - const XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/order/guest_template'; - - const XML_PATH_EMAIL_IDENTITY = 'sales_email/order/identity'; - - const XML_PATH_EMAIL_COPY_TO = 'sales_email/order/copy_to'; - - const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/order/copy_method'; - - const XML_PATH_EMAIL_ENABLED = 'sales_email/order/enabled'; - - const XML_PATH_UPDATE_EMAIL_TEMPLATE = 'sales_email/order_comment/template'; - - const XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE = 'sales_email/order_comment/guest_template'; - - const XML_PATH_UPDATE_EMAIL_IDENTITY = 'sales_email/order_comment/identity'; - - const XML_PATH_UPDATE_EMAIL_COPY_TO = 'sales_email/order_comment/copy_to'; - - const XML_PATH_UPDATE_EMAIL_COPY_METHOD = 'sales_email/order_comment/copy_method'; - - const XML_PATH_UPDATE_EMAIL_ENABLED = 'sales_email/order_comment/enabled'; - /** * Order states */ @@ -487,27 +460,6 @@ class Order extends \Magento\Sales\Model\AbstractModel */ protected $_historyEntityName = self::HISTORY_ENTITY_NAME; - /** - * Sales data - * - * @var \Magento\Sales\Helper\Data - */ - protected $_salesData; - - /** - * Payment data - * - * @var \Magento\Payment\Helper\Data - */ - protected $_paymentData; - - /** - * Core store config - * - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - /** * @var \Magento\Store\Model\StoreManagerInterface */ @@ -523,11 +475,6 @@ class Order extends \Magento\Sales\Model\AbstractModel */ protected $_productFactory; - /** - * @var \Magento\Framework\Mail\Template\TransportBuilder - */ - protected $_transportBuilder; - /** * @var \Magento\Sales\Model\Resource\Order\Item\CollectionFactory */ @@ -608,13 +555,9 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Order\Config $orderConfig * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param Resource\Order\Item\CollectionFactory $orderItemCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Tax\Model\Calculation $taxCalculation @@ -639,13 +582,9 @@ public function __construct( \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Payment\Helper\Data $paymentData, - \Magento\Sales\Helper\Data $salesData, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Sales\Model\Resource\Order\Item\CollectionFactory $orderItemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Tax\Model\Calculation $taxCalculation, @@ -665,13 +604,10 @@ public function __construct( \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_paymentData = $paymentData; - $this->_salesData = $salesData; - $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_orderConfig = $orderConfig; $this->_productFactory = $productFactory; - $this->_transportBuilder = $transportBuilder; + $this->_orderItemCollectionFactory = $orderItemCollectionFactory; $this->_productVisibility = $productVisibility; $this->_taxCalculation = $taxCalculation; @@ -1506,232 +1442,6 @@ public function getShippingMethod($asObject = false) } } - /** - * Send email with order data - * - * @return $this - */ - public function sendNewOrderEmail() - { - $storeId = $this->getStore()->getId(); - - if (!$this->_salesData->canSendNewOrderEmail($storeId)) { - return $this; - } - - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - - $paymentBlockHtml = $this->_paymentData->getInfoBlockHtml($this->getPayment(), $storeId); - - // Retrieve corresponding email template id and customer name - if ($this->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $this->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $this->getCustomerName(); - } - - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $this, - 'billing' => $this->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $this->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - - // Email copies are sent as separated emails if their copy method is 'copy' - if ($copyTo && $copyMethod == 'copy') { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $this, - 'billing' => $this->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - $this->setEmailSent(true); - $this->_getResource()->saveAttribute($this, 'email_sent'); - - return $this; - } - - /** - * Send email with order update information - * - * @param boolean $notifyCustomer - * @param string $comment - * @return $this - */ - public function sendOrderUpdateEmail($notifyCustomer = true, $comment = '') - { - $storeId = $this->getStore()->getId(); - - if (!$this->_salesData->canSendOrderCommentEmail($storeId)) { - return $this; - } - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - // Check if at least one recipient is found - if (!$notifyCustomer && !$copyTo) { - return $this; - } - - // Retrieve corresponding email template id and customer name - if ($this->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $this->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $this->getCustomerName(); - } - - if ($notifyCustomer) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $this, - 'comment' => $comment, - 'billing' => $this->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $this->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - } - - // Email copies are sent as separated emails if their copy method is - // 'copy' or a customer should not be notified - if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $this, - 'comment' => $comment, - 'billing' => $this->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - return $this; - } - - /** - * @param string $configPath - * @return array|false - */ - protected function _getEmails($configPath) - { - $data = $this->_scopeConfig->getValue( - $configPath, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->getStoreId() - ); - if (!empty($data)) { - return explode(',', $data); - } - return false; - } - /*********************** ADDRESSES ***************************/ /** @@ -2628,13 +2338,4 @@ public function isCanceled() { return $this->getState() === self::STATE_CANCELED; } - - /** - * Protect order delete from not admin scope - * @return $this - */ - protected function _beforeDelete() - { - return parent::_beforeDelete(); - } } diff --git a/app/code/Magento/Sales/Model/Order/Address/Validator.php b/app/code/Magento/Sales/Model/Order/Address/Validator.php new file mode 100644 index 000000000000..13b8b8a5d116 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Address/Validator.php @@ -0,0 +1,70 @@ +'Parent Order Id', + 'postcode' => 'Zip code', + 'lastname' => 'Last name', + 'street' => 'Street', + 'city' => 'City', + 'email' => 'Email', + 'telephone' => 'Telephone', + 'country_id' => 'Country', + 'firstname' => 'First Name', + 'address_type' => 'Address Type' + ]; + + /** + * + * @param \Magento\Sales\Model\Order\Address $address + * @return array + */ + public function validate(Address $address) + { + $warnings = []; + foreach ($this->required as $code => $label) { + if (!$address->hasData($code)) { + $warnings[] = sprintf('%s is a required field', $label); + } + } + if (!filter_var($address->getEmail(), FILTER_VALIDATE_EMAIL)) { + $warnings[] = 'Email has a wrong format'; + } + if (!filter_var(in_array($address->getAddressType(), [Address::TYPE_BILLING, Address::TYPE_SHIPPING]))) { + $warnings[] = 'Address type doesn\'t match required options'; + } + return $warnings; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index efb987cf10c7..98a0c17d3be3 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -128,30 +128,6 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel const STATE_CANCELED = 3; - const XML_PATH_EMAIL_TEMPLATE = 'sales_email/creditmemo/template'; - - const XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/creditmemo/guest_template'; - - const XML_PATH_EMAIL_IDENTITY = 'sales_email/creditmemo/identity'; - - const XML_PATH_EMAIL_COPY_TO = 'sales_email/creditmemo/copy_to'; - - const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/creditmemo/copy_method'; - - const XML_PATH_EMAIL_ENABLED = 'sales_email/creditmemo/enabled'; - - const XML_PATH_UPDATE_EMAIL_TEMPLATE = 'sales_email/creditmemo_comment/template'; - - const XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE = 'sales_email/creditmemo_comment/guest_template'; - - const XML_PATH_UPDATE_EMAIL_IDENTITY = 'sales_email/creditmemo_comment/identity'; - - const XML_PATH_UPDATE_EMAIL_COPY_TO = 'sales_email/creditmemo_comment/copy_to'; - - const XML_PATH_UPDATE_EMAIL_COPY_METHOD = 'sales_email/creditmemo_comment/copy_method'; - - const XML_PATH_UPDATE_EMAIL_ENABLED = 'sales_email/creditmemo_comment/enabled'; - const REPORT_DATE_TYPE_ORDER_CREATED = 'order_created'; const REPORT_DATE_TYPE_REFUND_CREATED = 'refund_created'; @@ -198,27 +174,6 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel */ protected $_eventObject = 'creditmemo'; - /** - * Sales data - * - * @var \Magento\Sales\Helper\Data - */ - protected $_salesData; - - /** - * Payment data - * - * @var \Magento\Payment\Helper\Data - */ - protected $_paymentData; - - /** - * Core store config - * - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - /** * @var \Magento\Sales\Model\Order\Creditmemo\Config */ @@ -254,19 +209,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel */ protected $_commentCollectionFactory; - /** - * @var \Magento\Framework\Mail\Template\TransportBuilder - */ - protected $_transportBuilder; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param Creditmemo\Config $creditmemoConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory @@ -274,7 +221,6 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Creditmemo\CommentFactory $commentFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data @@ -284,9 +230,6 @@ public function __construct( \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Payment\Helper\Data $paymentData, - \Magento\Sales\Helper\Data $salesData, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory, @@ -294,14 +237,10 @@ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory, - \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_paymentData = $paymentData; - $this->_salesData = $salesData; - $this->_scopeConfig = $scopeConfig; $this->_creditmemoConfig = $creditmemoConfig; $this->_orderFactory = $orderFactory; $this->_cmItemCollectionFactory = $cmItemCollectionFactory; @@ -309,7 +248,6 @@ public function __construct( $this->_storeManager = $storeManager; $this->_commentFactory = $commentFactory; $this->_commentCollectionFactory = $commentCollectionFactory; - $this->_transportBuilder = $transportBuilder; parent::__construct($context, $registry, $localeDate, $dateTime, $resource, $resourceCollection, $data); } @@ -864,253 +802,6 @@ public function getCommentsCollection($reload = false) return $this->_comments; } - /** - * Send email with creditmemo data - * - * @param boolean $notifyCustomer - * @param string $comment - * @return $this - */ - public function sendEmail($notifyCustomer = true, $comment = '') - { - $order = $this->getOrder(); - $storeId = $order->getStore()->getId(); - - if (!$this->_salesData->canSendNewCreditmemoEmail($storeId)) { - return $this; - } - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - // Check if at least one recipient is found - if (!$notifyCustomer && !$copyTo) { - return $this; - } - - $paymentBlockHtml = $this->_paymentData->getInfoBlockHtml($order->getPayment(), $storeId); - - // Retrieve corresponding email template id and customer name - if ($order->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getCustomerName(); - } - - if ($notifyCustomer) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'invoice' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $order->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - } - - // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified - if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'invoice' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - $this->setEmailSent(true); - $this->_getResource()->saveAttribute($this, 'email_sent'); - - return $this; - } - - /** - * Send email with creditmemo update information - * - * @param boolean $notifyCustomer - * @param string $comment - * @return $this - */ - public function sendUpdateEmail($notifyCustomer = true, $comment = '') - { - $order = $this->getOrder(); - $storeId = $order->getStore()->getId(); - - if (!$this->_salesData->canSendCreditmemoCommentEmail($storeId)) { - return $this; - } - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - // Check if at least one recipient is found - if (!$notifyCustomer && !$copyTo) { - return $this; - } - - // Retrieve corresponding email template id and customer name - if ($order->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getCustomerName(); - } - - if ($notifyCustomer) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'creditmemo' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $order->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - } - - // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified - if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'creditmemo' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - return $this; - } - - /** - * @param string $configPath - * @return array|bool - */ - protected function _getEmails($configPath) - { - $data = $this->_scopeConfig->getValue( - $configPath, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->getStoreId() - ); - if (!empty($data)) { - return explode(',', $data); - } - return false; - } - - /** - * @return \Magento\Framework\Model\AbstractModel - */ - protected function _beforeDelete() - { - return parent::_beforeDelete(); - } /** * After save object manipulations diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/Container.php b/app/code/Magento/Sales/Model/Order/Email/Container/Container.php new file mode 100644 index 000000000000..af38cf08fa79 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/Container.php @@ -0,0 +1,152 @@ +scopeConfig = $scopeConfig; + $this->storeManager = $storeManager; + } + /** + * Return store configuration value + * + * @param string $path + * @param int $storeId + * @return mixed + */ + protected function getConfigValue($path, $storeId) + { + return $this->scopeConfig->getValue( + $path, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * Set current store + * + * @param Store $store + * @return void + */ + public function setStore(Store $store) + { + $this->store = $store; + } + + /** + * Return store + * + * @return Store + */ + public function getStore() + { + //current store + if ($this->store instanceof Store) { + return $this->store; + } + return $this->storeManager->getStore(); + } + + /** + * Set customer name + * + * @param string $name + * @return void + */ + public function setCustomerName($name) + { + $this->customerName = $name; + } + + /** + * Set customer email + * + * @param string $email + * @return void + */ + public function setCustomerEmail($email) + { + $this->customerEmail = $email; + } + + /** + * Return customer name + * + * @return string + */ + public function getCustomerName() + { + return $this->customerName; + } + + /** + * Return customer email + * + * @return string + */ + public function getCustomerEmail() + { + return $this->customerEmail; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoCommentIdentity.php b/app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoCommentIdentity.php new file mode 100644 index 000000000000..742acef50bb6 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoCommentIdentity.php @@ -0,0 +1,90 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoIdentity.php b/app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoIdentity.php new file mode 100644 index 000000000000..b4f72a566267 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoIdentity.php @@ -0,0 +1,90 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/IdentityInterface.php b/app/code/Magento/Sales/Model/Order/Email/Container/IdentityInterface.php new file mode 100644 index 000000000000..953fc2e4826d --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/IdentityInterface.php @@ -0,0 +1,92 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/InvoiceIdentity.php b/app/code/Magento/Sales/Model/Order/Email/Container/InvoiceIdentity.php new file mode 100644 index 000000000000..74cdbaf12f23 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/InvoiceIdentity.php @@ -0,0 +1,90 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/OrderCommentIdentity.php b/app/code/Magento/Sales/Model/Order/Email/Container/OrderCommentIdentity.php new file mode 100644 index 000000000000..d9efb6d9d8ff --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/OrderCommentIdentity.php @@ -0,0 +1,91 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + + /** + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/OrderIdentity.php b/app/code/Magento/Sales/Model/Order/Email/Container/OrderIdentity.php new file mode 100644 index 000000000000..88f447047f36 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/OrderIdentity.php @@ -0,0 +1,103 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * Return email copy_to list + * + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * Return copy method + * + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + /** + * Return guest template id + * + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * Return template id + * + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * Return email identity + * + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/ShipmentCommentIdentity.php b/app/code/Magento/Sales/Model/Order/Email/Container/ShipmentCommentIdentity.php new file mode 100644 index 000000000000..8cbec3f6c784 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/ShipmentCommentIdentity.php @@ -0,0 +1,90 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/ShipmentIdentity.php b/app/code/Magento/Sales/Model/Order/Email/Container/ShipmentIdentity.php new file mode 100644 index 000000000000..768109203d85 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/ShipmentIdentity.php @@ -0,0 +1,106 @@ +scopeConfig->isSetFlag( + self::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getStoreId() + ); + } + + /** + * Return list of copy_to emails + * + * @return array|bool + */ + public function getEmailCopyTo() + { + $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId()); + if (!empty($data)) { + return explode(',', $data); + } + return false; + } + + /** + * Return email copy method + * + * @return mixed + */ + public function getCopyMethod() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId()); + } + + /** + * Return guest template id + * + * @return mixed + */ + public function getGuestTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * Return template id + * + * @return mixed + */ + public function getTemplateId() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId()); + } + + /** + * Return email identity + * + * @return mixed + */ + public function getEmailIdentity() + { + return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Container/Template.php b/app/code/Magento/Sales/Model/Order/Email/Container/Template.php new file mode 100644 index 000000000000..87ed8416bd0e --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Container/Template.php @@ -0,0 +1,110 @@ +vars = $vars; + } + + /** + * Set email template options + * + * @param array $options + * @return void + */ + public function setTemplateOptions(array $options) + { + $this->options = $options; + } + + /** + * Get email template variables + * + * @return array + */ + public function getTemplateVars() + { + return $this->vars; + } + + /** + * Get email template options + * + * @return array + */ + public function getTemplateOptions() + { + return $this->options; + } + + /** + * Set email template id + * + * @param int $id + * @return void + */ + public function setTemplateId($id) + { + $this->id = $id; + } + + /** + * Get email template id + * + * @return int + */ + public function getTemplateId() + { + return $this->id; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/NotifySender.php b/app/code/Magento/Sales/Model/Order/Email/NotifySender.php new file mode 100644 index 000000000000..ecb7ceaf5020 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/NotifySender.php @@ -0,0 +1,57 @@ +identityContainer->setStore($order->getStore()); + if (!$this->identityContainer->isEnabled()) { + return false; + } + $this->prepareTemplate($order); + + /** @var SenderBuilder $sender */ + $sender = $this->getSender(); + + if ($notify) { + $sender->send(); + } else { + // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified + $sender->sendCopyTo(); + } + + return true; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender.php b/app/code/Magento/Sales/Model/Order/Email/Sender.php new file mode 100644 index 000000000000..4e9dcf986898 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender.php @@ -0,0 +1,127 @@ +templateContainer = $templateContainer; + $this->identityContainer = $identityContainer; + $this->senderBuilderFactory = $senderBuilderFactory; + } + + /** + * @param Order $order + * @return bool + */ + protected function checkAndSend(Order $order) + { + $this->identityContainer->setStore($order->getStore()); + if (!$this->identityContainer->isEnabled()) { + return false; + } + $this->prepareTemplate($order); + + /** @var SenderBuilder $sender */ + $sender = $this->getSender(); + + $sender->send(); + $sender->sendCopyTo(); + + return true; + } + + /** + * @param Order $order + * @return void + */ + protected function prepareTemplate(Order $order) + { + $this->templateContainer->setTemplateOptions($this->getTemplateOptions()); + + if ($order->getCustomerIsGuest()) { + $templateId = $this->identityContainer->getGuestTemplateId(); + $customerName = $order->getBillingAddress()->getName(); + } else { + $templateId = $this->identityContainer->getTemplateId(); + $customerName = $order->getCustomerName(); + } + + $this->identityContainer->setCustomerName($customerName); + $this->identityContainer->setCustomerEmail($order->getCustomerEmail()); + $this->templateContainer->setTemplateId($templateId); + } + + /** + * @return Sender + */ + protected function getSender() + { + return $this->senderBuilderFactory->create( + [ + 'templateContainer' => $this->templateContainer, + 'identityContainer' => $this->identityContainer + ] + ); + } + + /** + * @return array + */ + protected function getTemplateOptions() + { + return [ + 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, + 'store' => $this->identityContainer->getStore()->getStoreId() + ]; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php new file mode 100644 index 000000000000..87134a908bc8 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php @@ -0,0 +1,70 @@ +getOrder(); + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'creditmemo' => $creditmemo, + 'comment' => $comment, + 'billing' => $order->getBillingAddress(), + 'store' => $order->getStore() + ] + ); + + return $this->checkAndSend($order, $notify); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php new file mode 100644 index 000000000000..c06aa8b344bc --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php @@ -0,0 +1,108 @@ +paymentHelper = $paymentHelper; + $this->creditmemoResource = $creditmemoResource; + } + + /** + * Send email to customer + * + * @param Creditmemo $creditmemo + * @param bool $notify + * @param string $comment + * @return bool + */ + public function send(Creditmemo $creditmemo, $notify = true, $comment = '') + { + $order = $creditmemo->getOrder(); + $this->templateContainer->setTemplateVars( + [ + 'order' => $creditmemo->getOrder(), + 'invoice' => $creditmemo, + 'comment' => $comment, + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore() + ] + ); + + $result = $this->checkAndSend($order, $notify); + if ($result) { + $creditmemo->setEmailSent(true); + $this->creditmemoResource->saveAttribute($creditmemo, 'email_sent'); + } + return $result; + } + + /** + * Return payment info block as html + * + * @param Order $order + * @return string + */ + protected function getPaymentHtml(Order $order) + { + return $this->paymentHelper->getInfoBlockHtml( + $order->getPayment(), + $this->identityContainer->getStore()->getStoreId() + ); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php new file mode 100644 index 000000000000..68b8db220778 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php @@ -0,0 +1,69 @@ +getOrder(); + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'invoice' => $invoice, + 'comment' => $comment, + 'billing' => $order->getBillingAddress(), + 'store' => $order->getStore() + ] + ); + return $this->checkAndSend($order, $notify); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php new file mode 100644 index 000000000000..f1591bd0a01e --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php @@ -0,0 +1,107 @@ +paymentHelper = $paymentHelper; + $this->invoiceResource = $invoiceResource; + } + + /** + * Send email to customer + * + * @param Invoice $invoice + * @param bool $notify + * @param string $comment + * @return bool + */ + public function send(Invoice $invoice, $notify = true, $comment = '') + { + $order = $invoice->getOrder(); + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'invoice' => $invoice, + 'comment' => $comment, + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore() + ] + ); + $result = $this->checkAndSend($order, $notify); + if ($result) { + $invoice->setEmailSent(true); + $this->invoiceResource->saveAttribute($invoice, 'email_sent'); + } + return $result; + } + + /** + * Return payment info block as html + * + * @param Order $order + * @return string + */ + protected function getPaymentHtml(Order $order) + { + return $this->paymentHelper->getInfoBlockHtml( + $order->getPayment(), + $this->identityContainer->getStore()->getStoreId() + ); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php new file mode 100644 index 000000000000..652108565973 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php @@ -0,0 +1,66 @@ +templateContainer->setTemplateVars( + [ + 'order' => $order, + 'comment' => $comment, + 'billing' => $order->getBillingAddress(), + 'store' => $order->getStore() + ] + ); + return $this->checkAndSend($order, $notify); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php new file mode 100644 index 000000000000..1e413a3a1dda --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php @@ -0,0 +1,112 @@ +paymentHelper = $paymentHelper; + $this->orderResource = $orderResource; + } + + /** + * Send email to customer + * + * @param Order $order + * @return bool + */ + public function send(Order $order) + { + $result = $this->checkAndSend($order); + if ($result) { + $order->setEmailSent(true); + $this->orderResource->saveAttribute($order, 'email_sent'); + } + return $result; + } + + /** + * Prepare email template with variables + * + * @param Order $order + * @return void + */ + protected function prepareTemplate(Order $order) + { + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore() + ] + ); + parent::prepareTemplate($order); + } + + /** + * Get payment info block as html + * + * @param Order $order + * @return string + */ + protected function getPaymentHtml(Order $order) + { + return $this->paymentHelper->getInfoBlockHtml( + $order->getPayment(), + $this->identityContainer->getStore()->getStoreId() + ); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php new file mode 100644 index 000000000000..4409c9eee3ad --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php @@ -0,0 +1,69 @@ +getOrder(); + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'shipment' => $shipment, + 'comment' => $comment, + 'billing' => $order->getBillingAddress(), + 'store' => $order->getStore() + ] + ); + return $this->checkAndSend($order, $notify); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php new file mode 100644 index 000000000000..1b8380bef971 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php @@ -0,0 +1,107 @@ +paymentHelper = $paymentHelper; + $this->shipmentResource = $shipmentResource; + } + + /** + * Send email to customer + * + * @param Shipment $shipment + * @param bool $notify + * @param string $comment + * @return bool + */ + public function send(Shipment $shipment, $notify = true, $comment = '') + { + $order = $shipment->getOrder(); + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'shipment' => $shipment, + 'comment' => $comment, + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore() + ] + ); + $result = $this->checkAndSend($order, $notify); + if ($result) { + $shipment->setEmailSent(true); + $this->shipmentResource->saveAttribute($shipment, 'email_sent'); + } + return $result; + } + + /** + * Get payment info block as html + * + * @param Order $order + * @return string + */ + protected function getPaymentHtml(Order $order) + { + return $this->paymentHelper->getInfoBlockHtml( + $order->getPayment(), + $this->identityContainer->getStore()->getStoreId() + ); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php new file mode 100644 index 000000000000..68b02e0d0e53 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php @@ -0,0 +1,122 @@ +templateContainer = $templateContainer; + $this->identityContainer = $identityContainer; + $this->transportBuilder = $transportBuilder; + } + + /** + * Prepare and send email message + * + * @return void + */ + public function send() + { + $this->configureEmailTemplate(); + + $this->transportBuilder->addTo( + $this->identityContainer->getCustomerEmail(), + $this->identityContainer->getCustomerName() + ); + + $copyTo = $this->identityContainer->getEmailCopyTo(); + + if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'bcc') { + foreach ($copyTo as $email) { + $this->transportBuilder->addBcc($email); + } + } + + $transport = $this->transportBuilder->getTransport(); + $transport->sendMessage(); + } + + /** + * Prepare and send copy email message + * + * @return void + */ + public function sendCopyTo() + { + $copyTo = $this->identityContainer->getEmailCopyTo(); + + if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'copy') { + foreach ($copyTo as $email) { + $this->configureEmailTemplate(); + + $this->transportBuilder->addTo($email); + + $transport = $this->transportBuilder->getTransport(); + $transport->sendMessage(); + } + } + } + + /** + * Configure email template + * + * @return void + */ + protected function configureEmailTemplate() + { + $this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId()); + $this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions()); + $this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars()); + $this->transportBuilder->setFrom($this->identityContainer->getEmailIdentity()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index 5bdbc6842e50..f337c6130413 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -126,30 +126,6 @@ class Invoice extends \Magento\Sales\Model\AbstractModel const NOT_CAPTURE = 'not_capture'; - const XML_PATH_EMAIL_TEMPLATE = 'sales_email/invoice/template'; - - const XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/invoice/guest_template'; - - const XML_PATH_EMAIL_IDENTITY = 'sales_email/invoice/identity'; - - const XML_PATH_EMAIL_COPY_TO = 'sales_email/invoice/copy_to'; - - const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/invoice/copy_method'; - - const XML_PATH_EMAIL_ENABLED = 'sales_email/invoice/enabled'; - - const XML_PATH_UPDATE_EMAIL_TEMPLATE = 'sales_email/invoice_comment/template'; - - const XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE = 'sales_email/invoice_comment/guest_template'; - - const XML_PATH_UPDATE_EMAIL_IDENTITY = 'sales_email/invoice_comment/identity'; - - const XML_PATH_UPDATE_EMAIL_COPY_TO = 'sales_email/invoice_comment/copy_to'; - - const XML_PATH_UPDATE_EMAIL_COPY_METHOD = 'sales_email/invoice_comment/copy_method'; - - const XML_PATH_UPDATE_EMAIL_ENABLED = 'sales_email/invoice_comment/enabled'; - const REPORT_DATE_TYPE_ORDER_CREATED = 'order_created'; const REPORT_DATE_TYPE_INVOICE_CREATED = 'invoice_created'; @@ -208,27 +184,6 @@ class Invoice extends \Magento\Sales\Model\AbstractModel */ protected $_wasPayCalled = false; - /** - * Sales data - * - * @var \Magento\Sales\Helper\Data - */ - protected $_salesData; - - /** - * Payment data - * - * @var \Magento\Payment\Helper\Data - */ - protected $_paymentData; - - /** - * Core store config - * - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - /** * @var \Magento\Sales\Model\Order\Invoice\Config */ @@ -264,19 +219,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel */ protected $_commentCollectionFactory; - /** - * @var \Magento\Framework\Mail\Template\TransportBuilder - */ - protected $_transportBuilder; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param Invoice\Config $invoiceConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory @@ -284,7 +231,6 @@ class Invoice extends \Magento\Sales\Model\AbstractModel * @param \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory * @param Invoice\CommentFactory $invoiceCommentFactory * @param \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data @@ -294,9 +240,6 @@ public function __construct( \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Payment\Helper\Data $paymentData, - \Magento\Sales\Helper\Data $salesData, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory, @@ -304,14 +247,10 @@ public function __construct( \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory, \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory, \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory, - \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_paymentData = $paymentData; - $this->_salesData = $salesData; - $this->_scopeConfig = $scopeConfig; $this->_invoiceConfig = $invoiceConfig; $this->_orderFactory = $orderFactory; $this->_orderResourceFactory = $orderResourceFactory; @@ -319,7 +258,6 @@ public function __construct( $this->_invoiceItemCollectionFactory = $invoiceItemCollectionFactory; $this->_invoiceCommentFactory = $invoiceCommentFactory; $this->_commentCollectionFactory = $commentCollectionFactory; - $this->_transportBuilder = $transportBuilder; parent::__construct($context, $registry, $localeDate, $dateTime, $resource, $resourceCollection, $data); } @@ -874,254 +812,6 @@ public function getCommentsCollection($reload = false) return $this->_comments; } - /** - * Send email with invoice data - * - * @param bool $notifyCustomer - * @param string $comment - * @return $this - */ - public function sendEmail($notifyCustomer = true, $comment = '') - { - $order = $this->getOrder(); - $storeId = $order->getStore()->getId(); - - if (!$this->_salesData->canSendNewInvoiceEmail($storeId)) { - return $this; - } - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - // Check if at least one recipient is found - if (!$notifyCustomer && !$copyTo) { - return $this; - } - - $paymentBlockHtml = $this->_paymentData->getInfoBlockHtml($order->getPayment(), $storeId); - - // Retrieve corresponding email template id and customer name - if ($order->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getCustomerName(); - } - - if ($notifyCustomer) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'invoice' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $order->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - } - - // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified - if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'invoice' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - $this->setEmailSent(true); - $this->_getResource()->saveAttribute($this, 'email_sent'); - - return $this; - } - - /** - * Send email with invoice update information - * - * @param boolean $notifyCustomer - * @param string $comment - * @return $this - */ - public function sendUpdateEmail($notifyCustomer = true, $comment = '') - { - $order = $this->getOrder(); - $storeId = $order->getStore()->getId(); - - if (!$this->_salesData->canSendInvoiceCommentEmail($storeId)) { - return $this; - } - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - // Check if at least one recipient is found - if (!$notifyCustomer && !$copyTo) { - return $this; - } - - // Retrieve corresponding email template id and customer name - if ($order->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getCustomerName(); - } - - if ($notifyCustomer) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'invoice' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $order->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - } - - // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified - if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'invoice' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - return $this; - } - - /** - * @param string $configPath - * @return array|bool - */ - protected function _getEmails($configPath) - { - $data = $this->_scopeConfig->getValue( - $configPath, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->getStoreId() - ); - if (!empty($data)) { - return explode(',', $data); - } - return false; - } - - /** - * @return \Magento\Framework\Model\AbstractModel - */ - protected function _beforeDelete() - { - return parent::_beforeDelete(); - } - /** * Reset invoice object * diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index eb55571b54c5..a4f64eed4dd7 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -57,30 +57,6 @@ class Shipment extends \Magento\Sales\Model\AbstractModel { const STATUS_NEW = 1; - const XML_PATH_EMAIL_TEMPLATE = 'sales_email/shipment/template'; - - const XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/shipment/guest_template'; - - const XML_PATH_EMAIL_IDENTITY = 'sales_email/shipment/identity'; - - const XML_PATH_EMAIL_COPY_TO = 'sales_email/shipment/copy_to'; - - const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/shipment/copy_method'; - - const XML_PATH_EMAIL_ENABLED = 'sales_email/shipment/enabled'; - - const XML_PATH_UPDATE_EMAIL_TEMPLATE = 'sales_email/shipment_comment/template'; - - const XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE = 'sales_email/shipment_comment/guest_template'; - - const XML_PATH_UPDATE_EMAIL_IDENTITY = 'sales_email/shipment_comment/identity'; - - const XML_PATH_UPDATE_EMAIL_COPY_TO = 'sales_email/shipment_comment/copy_to'; - - const XML_PATH_UPDATE_EMAIL_COPY_METHOD = 'sales_email/shipment_comment/copy_method'; - - const XML_PATH_UPDATE_EMAIL_ENABLED = 'sales_email/shipment_comment/enabled'; - const REPORT_DATE_TYPE_ORDER_CREATED = 'order_created'; const REPORT_DATE_TYPE_SHIPMENT_CREATED = 'shipment_created'; @@ -135,27 +111,6 @@ class Shipment extends \Magento\Sales\Model\AbstractModel */ protected $_eventObject = 'shipment'; - /** - * Sales data - * - * @var \Magento\Sales\Helper\Data - */ - protected $_salesData; - - /** - * Payment data - * - * @var \Magento\Payment\Helper\Data - */ - protected $_paymentData; - - /** - * Core store config - * - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - /** * @var \Magento\Sales\Model\OrderFactory */ @@ -181,25 +136,16 @@ class Shipment extends \Magento\Sales\Model\AbstractModel */ protected $_commentCollectionFactory; - /** - * @var \Magento\Framework\Mail\Template\TransportBuilder - */ - protected $_transportBuilder; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory * @param Shipment\CommentFactory $commentFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data @@ -209,28 +155,20 @@ public function __construct( \Magento\Framework\Registry $registry, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Payment\Helper\Data $paymentData, - \Magento\Sales\Helper\Data $salesData, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory, \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, \Magento\Sales\Model\Order\Shipment\CommentFactory $commentFactory, \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory, - \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_paymentData = $paymentData; - $this->_salesData = $salesData; - $this->_scopeConfig = $scopeConfig; $this->_orderFactory = $orderFactory; $this->_shipmentItemCollectionFactory = $shipmentItemCollectionFactory; $this->_trackCollectionFactory = $trackCollectionFactory; $this->_commentFactory = $commentFactory; $this->_commentCollectionFactory = $commentCollectionFactory; - $this->_transportBuilder = $transportBuilder; parent::__construct($context, $registry, $localeDate, $dateTime, $resource, $resourceCollection, $data); } @@ -536,246 +474,6 @@ public function getCommentsCollection($reload = false) return $this->_comments; } - /** - * Send email with shipment data - * - * @param boolean $notifyCustomer - * @param string $comment - * @return $this - */ - public function sendEmail($notifyCustomer = true, $comment = '') - { - $order = $this->getOrder(); - $storeId = $order->getStore()->getId(); - - if (!$this->_salesData->canSendNewShipmentEmail($storeId)) { - return $this; - } - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - // Check if at least one recipient is found - if (!$notifyCustomer && !$copyTo) { - return $this; - } - - $paymentBlockHtml = $this->_paymentData->getInfoBlockHtml($order->getPayment(), $storeId); - - // Retrieve corresponding email template id and customer name - if ($order->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getCustomerName(); - } - - if ($notifyCustomer) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'shipment' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $order->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - } - - // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified - if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'shipment' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - $this->setEmailSent(true); - $this->_getResource()->saveAttribute($this, 'email_sent'); - - return $this; - } - - /** - * Send email with shipment update information - * - * @param boolean $notifyCustomer - * @param string $comment - * @return $this - */ - public function sendUpdateEmail($notifyCustomer = true, $comment = '') - { - $order = $this->getOrder(); - $storeId = $order->getStore()->getId(); - - if (!$this->_salesData->canSendShipmentCommentEmail($storeId)) { - return $this; - } - // Get the destination email addresses to send copies to - $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - // Check if at least one recipient is found - if (!$notifyCustomer && !$copyTo) { - return $this; - } - - // Retrieve corresponding email template id and customer name - if ($order->getCustomerIsGuest()) { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getBillingAddress()->getName(); - } else { - $templateId = $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ); - $customerName = $order->getCustomerName(); - } - - if ($notifyCustomer) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'shipment' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $order->getCustomerEmail(), - $customerName - ); - if ($copyTo && $copyMethod == 'bcc') { - // Add bcc to customer email - foreach ($copyTo as $email) { - $this->_transportBuilder->addBcc($email); - } - } - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - } - - // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified - if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) { - foreach ($copyTo as $email) { - $this->_transportBuilder->setTemplateIdentifier( - $templateId - )->setTemplateOptions( - array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) - )->setTemplateVars( - array( - 'order' => $order, - 'shipment' => $this, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'store' => $this->getStore() - ) - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UPDATE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) - )->addTo( - $email - )->getTransport()->sendMessage(); - } - } - - return $this; - } - - /** - * @param string $configPath - * @return array|bool - */ - protected function _getEmails($configPath) - { - $data = $this->_scopeConfig->getValue( - $configPath, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->getStoreId() - ); - if (!empty($data)) { - return explode(',', $data); - } - return false; - } - /** * Before object save * diff --git a/app/code/Magento/Sales/Model/Order/Status/History/Validator.php b/app/code/Magento/Sales/Model/Order/Status/History/Validator.php new file mode 100644 index 000000000000..ab9e67851183 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Status/History/Validator.php @@ -0,0 +1,53 @@ + 'Order Id']; + + /** + * @param History $history + * @return array + */ + public function validate(History $history) + { + $warnings = []; + foreach ($this->requiredFields as $code => $label) { + if (!$history->hasData($code)) { + $warnings[] = sprintf('%s is a required field', $label); + } + } + return $warnings; + } +} diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php index a638c071f1df..7759ac6c301c 100644 --- a/app/code/Magento/Sales/Model/Quote/Address.php +++ b/app/code/Magento/Sales/Model/Quote/Address.php @@ -250,6 +250,11 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress */ protected $_customerAdressService; + /** + * @var Address\Validator + */ + protected $validator; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -259,18 +264,19 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Sales\Model\Quote\Address\ItemFactory $addressItemFactory + * @param Address\ItemFactory $addressItemFactory * @param \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory $itemCollectionFactory - * @param \Magento\Sales\Model\Quote\Address\RateFactory $addressRateFactory - * @param \Magento\Sales\Model\Quote\Address\RateCollectorInterfaceFactory $rateCollector + * @param Address\RateFactory $addressRateFactory + * @param Address\RateCollectorInterfaceFactory $rateCollector * @param \Magento\Sales\Model\Resource\Quote\Address\Rate\CollectionFactory $rateCollectionFactory - * @param \Magento\Sales\Model\Quote\Address\RateRequestFactory $rateRequestFactory - * @param \Magento\Sales\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory - * @param \Magento\Sales\Model\Quote\Address\TotalFactory $addressTotalFactory + * @param Address\RateRequestFactory $rateRequestFactory + * @param Address\Total\CollectorFactory $totalCollectorFactory + * @param Address\TotalFactory $addressTotalFactory * @param \Magento\Framework\Object\Copy $objectCopyService - * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory + * @param Address\CarrierFactoryInterface $carrierFactory * @param CustomerAddressBuilder $customerAddressBuilder * @param CustomerAddressServiceInterface $customerAddressService + * @param Address\Validator $validator * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data @@ -296,6 +302,7 @@ public function __construct( \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, CustomerAddressBuilder $customerAddressBuilder, CustomerAddressServiceInterface $customerAddressService, + Address\Validator $validator, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -313,6 +320,7 @@ public function __construct( $this->_carrierFactory = $carrierFactory; $this->_customerAddressBuilder = $customerAddressBuilder; $this->_customerAdressService = $customerAddressService; + $this->validator = $validator; parent::__construct( $context, $registry, @@ -1390,4 +1398,12 @@ public function getSubtotalWithDiscount() { return $this->getSubtotal() + $this->getDiscountAmount(); } + + /** + * {@inheritdoc} + */ + protected function _getValidationRulesBeforeSave() + { + return $this->validator; + } } diff --git a/app/code/Magento/Sales/Model/Quote/Address/Validator.php b/app/code/Magento/Sales/Model/Quote/Address/Validator.php new file mode 100644 index 000000000000..e3e5100dd19f --- /dev/null +++ b/app/code/Magento/Sales/Model/Quote/Address/Validator.php @@ -0,0 +1,76 @@ +countryFactory = $countryFactory; + } + + /** + * Returns true if and only if $value meets the validation requirements + * + * If $value fails validation, then this method returns false, and + * getMessages() will return an array of messages that explain why the + * validation failed. + * + * @param \Magento\Sales\Model\Quote\Address $value + * @return boolean + * @throws Zend_Validate_Exception If validation of $value is impossible + */ + public function isValid($value) + { + $messages = array(); + $email = $value->getEmail(); + if (!empty($email) && !\Zend_Validate::is($email, 'EmailAddress')) { + $messages['invalid_email_format'] = 'Invalid email format'; + } + + $countryId = $value->getCountryId(); + if (!empty($countryId)) { + $country = $this->countryFactory->create(); + $country->load($countryId); + if (!$country->getId()) { + $messages['invalid_country_code'] = 'Invalid country code'; + } + } + + $this->_addMessages($messages); + + return empty($messages); + } +} diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php index dd661f198dcb..7bb0070b82c8 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Address.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php @@ -40,22 +40,31 @@ class Address extends AbstractOrder */ protected $_salesResourceFactory; + /** + * @var \Magento\Sales\Model\Order\Address\Validator + */ + protected $_validator; + /** * @param \Magento\Framework\App\Resource $resource * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory * @param \Magento\Sales\Model\Resource\Factory $salesResourceFactory + * @param \Magento\Sales\Model\Order\Address\Validator $validator */ public function __construct( \Magento\Framework\App\Resource $resource, \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory, - \Magento\Sales\Model\Resource\Factory $salesResourceFactory + \Magento\Sales\Model\Resource\Factory $salesResourceFactory, + \Magento\Sales\Model\Order\Address\Validator $validator ) { + $this->_validator = $validator; parent::__construct($resource, $dateTime, $eventManager, $eavEntityTypeFactory); $this->_salesResourceFactory = $salesResourceFactory; + } /** @@ -91,6 +100,25 @@ public function getAllAttributes() return $attributes; } + /** + * Performs validation before save + * + * @param \Magento\Framework\Model\AbstractModel $object + * @return $this + * @throws \Magento\Framework\Model\Exception + */ + protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) + { + parent::_beforeSave($object); + $warnings = $this->_validator->validate($object); + if (!empty($warnings)) { + throw new \Magento\Framework\Model\Exception( + __("Cannot save address") . ":\n" . implode("\n", $warnings) + ); + } + return $this; + } + /** * Update related grid table after object save * diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php index 87cc3d2f436e..ca4f1d4c1e98 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php @@ -23,6 +23,8 @@ */ namespace Magento\Sales\Model\Resource\Order\Status; +use Magento\Sales\Model\Order\Status\History\Validator; + /** * Flat sales order status history resource * @@ -30,6 +32,29 @@ */ class History extends \Magento\Sales\Model\Resource\Order\AbstractOrder { + /** + * @var Validator + */ + protected $validator; + + /** + * @param \Magento\Framework\App\Resource $resource + * @param \Magento\Framework\Stdlib\DateTime $dateTime + * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory + * @param Validator $validator + */ + public function __construct( + \Magento\Framework\App\Resource $resource, + \Magento\Framework\Stdlib\DateTime $dateTime, + \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory, + Validator $validator + ) { + $this->validator = $validator; + parent::__construct($resource, $dateTime, $eventManager, $eavEntityTypeFactory); + } + /** * Event prefix * @@ -46,4 +71,23 @@ protected function _construct() { $this->_init('sales_flat_order_status_history', 'entity_id'); } + + /** + * Perform actions before object save + * + * @param \Magento\Framework\Model\AbstractModel $object + * @return $this + * @throws \Magento\Framework\Model\Exception + */ + protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) + { + parent::_beforeSave($object); + $warnings = $this->validator->validate($object); + if (!empty($warnings)) { + throw new \Magento\Framework\Model\Exception( + __('Cannot save comment') . ":\n" . implode("\n", $warnings) + ); + } + return $this; + } } diff --git a/app/code/Magento/Sales/Service/V1/Data/Comment.php b/app/code/Magento/Sales/Service/V1/Data/Comment.php new file mode 100644 index 000000000000..bfe5773e92ec --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/Comment.php @@ -0,0 +1,99 @@ +_get(self::COMMENT); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns is_customer_notified + * + * @return int + */ + public function getIsCustomerNotified() + { + return $this->_get(self::IS_CUSTOMER_NOTIFIED); + } + + /** + * Returns is_visible_on_front + * + * @return int + */ + public function getIsVisibleOnFront() + { + return $this->_get(self::IS_VISIBLE_ON_FRONT); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/Creditmemo.php b/app/code/Magento/Sales/Service/V1/Data/Creditmemo.php new file mode 100644 index 000000000000..d43bacf41c2a --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/Creditmemo.php @@ -0,0 +1,753 @@ +_get(self::ADJUSTMENT); + } + + /** + * Returns adjustment_negative + * + * @return float + */ + public function getAdjustmentNegative() + { + return $this->_get(self::ADJUSTMENT_NEGATIVE); + } + + /** + * Returns adjustment_positive + * + * @return float + */ + public function getAdjustmentPositive() + { + return $this->_get(self::ADJUSTMENT_POSITIVE); + } + + /** + * Returns base_adjustment + * + * @return float + */ + public function getBaseAdjustment() + { + return $this->_get(self::BASE_ADJUSTMENT); + } + + /** + * Returns base_adjustment_negative + * + * @return float + */ + public function getBaseAdjustmentNegative() + { + return $this->_get(self::BASE_ADJUSTMENT_NEGATIVE); + } + + /** + * Returns base_adjustment_positive + * + * @return float + */ + public function getBaseAdjustmentPositive() + { + return $this->_get(self::BASE_ADJUSTMENT_POSITIVE); + } + + /** + * Returns base_currency_code + * + * @return string + */ + public function getBaseCurrencyCode() + { + return $this->_get(self::BASE_CURRENCY_CODE); + } + + /** + * Returns base_discount_amount + * + * @return float + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + + /** + * Returns base_grand_total + * + * @return float + */ + public function getBaseGrandTotal() + { + return $this->_get(self::BASE_GRAND_TOTAL); + } + + /** + * Returns base_hidden_tax_amount + * + * @return float + */ + public function getBaseHiddenTaxAmount() + { + return $this->_get(self::BASE_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns base_shipping_amount + * + * @return float + */ + public function getBaseShippingAmount() + { + return $this->_get(self::BASE_SHIPPING_AMOUNT); + } + + /** + * Returns base_shipping_hidden_tax_amnt + * + * @return float + */ + public function getBaseShippingHiddenTaxAmnt() + { + return $this->_get(self::BASE_SHIPPING_HIDDEN_TAX_AMNT); + } + + /** + * Returns base_shipping_incl_tax + * + * @return float + */ + public function getBaseShippingInclTax() + { + return $this->_get(self::BASE_SHIPPING_INCL_TAX); + } + + /** + * Returns base_shipping_tax_amount + * + * @return float + */ + public function getBaseShippingTaxAmount() + { + return $this->_get(self::BASE_SHIPPING_TAX_AMOUNT); + } + + /** + * Returns base_subtotal + * + * @return float + */ + public function getBaseSubtotal() + { + return $this->_get(self::BASE_SUBTOTAL); + } + + /** + * Returns base_subtotal_incl_tax + * + * @return float + */ + public function getBaseSubtotalInclTax() + { + return $this->_get(self::BASE_SUBTOTAL_INCL_TAX); + } + + /** + * Returns base_tax_amount + * + * @return float + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Returns base_to_global_rate + * + * @return float + */ + public function getBaseToGlobalRate() + { + return $this->_get(self::BASE_TO_GLOBAL_RATE); + } + + /** + * Returns base_to_order_rate + * + * @return float + */ + public function getBaseToOrderRate() + { + return $this->_get(self::BASE_TO_ORDER_RATE); + } + + /** + * Returns billing_address_id + * + * @return int + */ + public function getBillingAddressId() + { + return $this->_get(self::BILLING_ADDRESS_ID); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns creditmemo_status + * + * @return int + */ + public function getCreditmemoStatus() + { + return $this->_get(self::CREDITMEMO_STATUS); + } + + /** + * Returns discount_amount + * + * @return float + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Returns discount_description + * + * @return string + */ + public function getDiscountDescription() + { + return $this->_get(self::DISCOUNT_DESCRIPTION); + } + + /** + * Returns email_sent + * + * @return int + */ + public function getEmailSent() + { + return $this->_get(self::EMAIL_SENT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns global_currency_code + * + * @return string + */ + public function getGlobalCurrencyCode() + { + return $this->_get(self::GLOBAL_CURRENCY_CODE); + } + + /** + * Returns grand_total + * + * @return float + */ + public function getGrandTotal() + { + return $this->_get(self::GRAND_TOTAL); + } + + + /** + * Returns hidden_tax_amount + * + * @return float + */ + public function getHiddenTaxAmount() + { + return $this->_get(self::HIDDEN_TAX_AMOUNT); + } + + /** + * Returns increment_id + * + * @return string + */ + public function getIncrementId() + { + return $this->_get(self::INCREMENT_ID); + } + + /** + * Returns invoice_id + * + * @return int + */ + public function getInvoiceId() + { + return $this->_get(self::INVOICE_ID); + } + + /** + * Returns order_currency_code + * + * @return string + */ + public function getOrderCurrencyCode() + { + return $this->_get(self::ORDER_CURRENCY_CODE); + } + + /** + * Returns order_id + * + * @return int + */ + public function getOrderId() + { + return $this->_get(self::ORDER_ID); + } + + /** + * Returns shipping_address_id + * + * @return int + */ + public function getShippingAddressId() + { + return $this->_get(self::SHIPPING_ADDRESS_ID); + } + + /** + * Returns shipping_amount + * + * @return float + */ + public function getShippingAmount() + { + return $this->_get(self::SHIPPING_AMOUNT); + } + + /** + * Returns shipping_hidden_tax_amount + * + * @return float + */ + public function getShippingHiddenTaxAmount() + { + return $this->_get(self::SHIPPING_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns shipping_incl_tax + * + * @return float + */ + public function getShippingInclTax() + { + return $this->_get(self::SHIPPING_INCL_TAX); + } + + /** + * Returns shipping_tax_amount + * + * @return float + */ + public function getShippingTaxAmount() + { + return $this->_get(self::SHIPPING_TAX_AMOUNT); + } + + /** + * Returns state + * + * @return int + */ + public function getState() + { + return $this->_get(self::STATE); + } + + /** + * Returns store_currency_code + * + * @return string + */ + public function getStoreCurrencyCode() + { + return $this->_get(self::STORE_CURRENCY_CODE); + } + + /** + * Returns store_id + * + * @return int + */ + public function getStoreId() + { + return $this->_get(self::STORE_ID); + } + + /** + * Returns store_to_base_rate + * + * @return float + */ + public function getStoreToBaseRate() + { + return $this->_get(self::STORE_TO_BASE_RATE); + } + + /** + * Returns store_to_order_rate + * + * @return float + */ + public function getStoreToOrderRate() + { + return $this->_get(self::STORE_TO_ORDER_RATE); + } + + /** + * Returns subtotal + * + * @return float + */ + public function getSubtotal() + { + return $this->_get(self::SUBTOTAL); + } + + /** + * Returns subtotal_incl_tax + * + * @return float + */ + public function getSubtotalInclTax() + { + return $this->_get(self::SUBTOTAL_INCL_TAX); + } + + /** + * Returns tax_amount + * + * @return float + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } + + /** + * Returns transaction_id + * + * @return string + */ + public function getTransactionId() + { + return $this->_get(self::TRANSACTION_ID); + } + + /** + * Returns updated_at + * + * @return string + */ + public function getUpdatedAt() + { + return $this->_get(self::UPDATED_AT); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/CreditmemoComment.php b/app/code/Magento/Sales/Service/V1/Data/CreditmemoComment.php new file mode 100644 index 000000000000..26e097b26e14 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/CreditmemoComment.php @@ -0,0 +1,122 @@ +_get(self::COMMENT); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns is_customer_notified + * + * @return int + */ + public function getIsCustomerNotified() + { + return $this->_get(self::IS_CUSTOMER_NOTIFIED); + } + + /** + * Returns is_visible_on_front + * + * @return int + */ + public function getIsVisibleOnFront() + { + return $this->_get(self::IS_VISIBLE_ON_FRONT); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php b/app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php new file mode 100644 index 000000000000..6a4a50a1a79a --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php @@ -0,0 +1,527 @@ +_get(self::ADDITIONAL_DATA); + } + + /** + * Returns base_cost + * + * @return float + */ + public function getBaseCost() + { + return $this->_get(self::BASE_COST); + } + + /** + * Returns base_discount_amount + * + * @return float + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + + /** + * Returns base_hidden_tax_amount + * + * @return float + */ + public function getBaseHiddenTaxAmount() + { + return $this->_get(self::BASE_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns base_price + * + * @return float + */ + public function getBasePrice() + { + return $this->_get(self::BASE_PRICE); + } + + /** + * Returns base_price_incl_tax + * + * @return float + */ + public function getBasePriceInclTax() + { + return $this->_get(self::BASE_PRICE_INCL_TAX); + } + + /** + * Returns base_row_total + * + * @return float + */ + public function getBaseRowTotal() + { + return $this->_get(self::BASE_ROW_TOTAL); + } + + /** + * Returns base_row_total_incl_tax + * + * @return float + */ + public function getBaseRowTotalInclTax() + { + return $this->_get(self::BASE_ROW_TOTAL_INCL_TAX); + } + + /** + * Returns base_tax_amount + * + * @return float + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Returns base_weee_tax_applied_amount + * + * @return float + */ + public function getBaseWeeeTaxAppliedAmount() + { + return $this->_get(self::BASE_WEEE_TAX_APPLIED_AMOUNT); + } + + /** + * Returns base_weee_tax_applied_row_amnt + * + * @return float + */ + public function getBaseWeeeTaxAppliedRowAmnt() + { + return $this->_get(self::BASE_WEEE_TAX_APPLIED_ROW_AMNT); + } + + /** + * Returns base_weee_tax_disposition + * + * @return float + */ + public function getBaseWeeeTaxDisposition() + { + return $this->_get(self::BASE_WEEE_TAX_DISPOSITION); + } + + /** + * Returns base_weee_tax_row_disposition + * + * @return float + */ + public function getBaseWeeeTaxRowDisposition() + { + return $this->_get(self::BASE_WEEE_TAX_ROW_DISPOSITION); + } + + /** + * Returns description + * + * @return string + */ + public function getDescription() + { + return $this->_get(self::DESCRIPTION); + } + + /** + * Returns discount_amount + * + * @return float + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns hidden_tax_amount + * + * @return float + */ + public function getHiddenTaxAmount() + { + return $this->_get(self::HIDDEN_TAX_AMOUNT); + } + + /** + * Returns name + * + * @return string + */ + public function getName() + { + return $this->_get(self::NAME); + } + + /** + * Returns order_item_id + * + * @return int + */ + public function getOrderItemId() + { + return $this->_get(self::ORDER_ITEM_ID); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns price + * + * @return float + */ + public function getPrice() + { + return $this->_get(self::PRICE); + } + + /** + * Returns price_incl_tax + * + * @return float + */ + public function getPriceInclTax() + { + return $this->_get(self::PRICE_INCL_TAX); + } + + /** + * Returns product_id + * + * @return int + */ + public function getProductId() + { + return $this->_get(self::PRODUCT_ID); + } + + /** + * Returns qty + * + * @return float + */ + public function getQty() + { + return $this->_get(self::QTY); + } + + /** + * Returns row_total + * + * @return float + */ + public function getRowTotal() + { + return $this->_get(self::ROW_TOTAL); + } + + /** + * Returns row_total_incl_tax + * + * @return float + */ + public function getRowTotalInclTax() + { + return $this->_get(self::ROW_TOTAL_INCL_TAX); + } + + /** + * Returns sku + * + * @return string + */ + public function getSku() + { + return $this->_get(self::SKU); + } + + /** + * Returns tax_amount + * + * @return float + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } + + /** + * Returns weee_tax_applied + * + * @return string + */ + public function getWeeeTaxApplied() + { + return $this->_get(self::WEEE_TAX_APPLIED); + } + + /** + * Returns weee_tax_applied_amount + * + * @return float + */ + public function getWeeeTaxAppliedAmount() + { + return $this->_get(self::WEEE_TAX_APPLIED_AMOUNT); + } + + /** + * Returns weee_tax_applied_row_amount + * + * @return float + */ + public function getWeeeTaxAppliedRowAmount() + { + return $this->_get(self::WEEE_TAX_APPLIED_ROW_AMOUNT); + } + + /** + * Returns weee_tax_disposition + * + * @return float + */ + public function getWeeeTaxDisposition() + { + return $this->_get(self::WEEE_TAX_DISPOSITION); + } + + /** + * Returns weee_tax_row_disposition + * + * @return float + */ + public function getWeeeTaxRowDisposition() + { + return $this->_get(self::WEEE_TAX_ROW_DISPOSITION); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/Invoice.php b/app/code/Magento/Sales/Service/V1/Data/Invoice.php new file mode 100644 index 000000000000..08ed2599cf09 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/Invoice.php @@ -0,0 +1,539 @@ +_get(self::BASE_CURRENCY_CODE); + } + + /** + * Returns base_discount_amount + * + * @return float + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + + /** + * Returns base_grand_total + * + * @return float + */ + public function getBaseGrandTotal() + { + return $this->_get(self::BASE_GRAND_TOTAL); + } + + /** + * Returns base_hidden_tax_amount + * + * @return float + */ + public function getBaseHiddenTaxAmount() + { + return $this->_get(self::BASE_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns base_shipping_amount + * + * @return float + */ + public function getBaseShippingAmount() + { + return $this->_get(self::BASE_SHIPPING_AMOUNT); + } + + /** + * Returns base_shipping_hidden_tax_amnt + * + * @return float + */ + public function getBaseShippingHiddenTaxAmnt() + { + return $this->_get(self::BASE_SHIPPING_HIDDEN_TAX_AMNT); + } + + /** + * Returns base_shipping_incl_tax + * + * @return float + */ + public function getBaseShippingInclTax() + { + return $this->_get(self::BASE_SHIPPING_INCL_TAX); + } + + /** + * Returns base_shipping_tax_amount + * + * @return float + */ + public function getBaseShippingTaxAmount() + { + return $this->_get(self::BASE_SHIPPING_TAX_AMOUNT); + } + + /** + * Returns base_subtotal + * + * @return float + */ + public function getBaseSubtotal() + { + return $this->_get(self::BASE_SUBTOTAL); + } + + /** + * Returns base_subtotal_incl_tax + * + * @return float + */ + public function getBaseSubtotalInclTax() + { + return $this->_get(self::BASE_SUBTOTAL_INCL_TAX); + } + + /** + * Returns base_tax_amount + * + * @return float + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Returns base_total_refunded + * + * @return float + */ + public function getBaseTotalRefunded() + { + return $this->_get(self::BASE_TOTAL_REFUNDED); + } + + /** + * Returns base_to_global_rate + * + * @return float + */ + public function getBaseToGlobalRate() + { + return $this->_get(self::BASE_TO_GLOBAL_RATE); + } + + /** + * Returns base_to_order_rate + * + * @return float + */ + public function getBaseToOrderRate() + { + return $this->_get(self::BASE_TO_ORDER_RATE); + } + + /** + * Returns billing_address_id + * + * @return int + */ + public function getBillingAddressId() + { + return $this->_get(self::BILLING_ADDRESS_ID); + } + + /** + * Returns can_void_flag + * + * @return int + */ + public function getCanVoidFlag() + { + return $this->_get(self::CAN_VOID_FLAG); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns discount_amount + * + * @return float + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Returns discount_description + * + * @return string + */ + public function getDiscountDescription() + { + return $this->_get(self::DISCOUNT_DESCRIPTION); + } + + /** + * Returns email_sent + * + * @return int + */ + public function getEmailSent() + { + return $this->_get(self::EMAIL_SENT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns global_currency_code + * + * @return string + */ + public function getGlobalCurrencyCode() + { + return $this->_get(self::GLOBAL_CURRENCY_CODE); + } + + /** + * Returns grand_total + * + * @return float + */ + public function getGrandTotal() + { + return $this->_get(self::GRAND_TOTAL); + } + + /** + * Returns hidden_tax_amount + * + * @return float + */ + public function getHiddenTaxAmount() + { + return $this->_get(self::HIDDEN_TAX_AMOUNT); + } + + /** + * Returns increment_id + * + * @return string + */ + public function getIncrementId() + { + return $this->_get(self::INCREMENT_ID); + } + + /** + * Returns is_used_for_refund + * + * @return int + */ + public function getIsUsedForRefund() + { + return $this->_get(self::IS_USED_FOR_REFUND); + } + + /** + * Returns order_currency_code + * + * @return string + */ + public function getOrderCurrencyCode() + { + return $this->_get(self::ORDER_CURRENCY_CODE); + } + + /** + * Returns order_id + * + * @return int + */ + public function getOrderId() + { + return $this->_get(self::ORDER_ID); + } + + /** + * Returns shipping_address_id + * + * @return int + */ + public function getShippingAddressId() + { + return $this->_get(self::SHIPPING_ADDRESS_ID); + } + + /** + * Returns shipping_amount + * + * @return float + */ + public function getShippingAmount() + { + return $this->_get(self::SHIPPING_AMOUNT); + } + + /** + * Returns shipping_hidden_tax_amount + * + * @return float + */ + public function getShippingHiddenTaxAmount() + { + return $this->_get(self::SHIPPING_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns shipping_incl_tax + * + * @return float + */ + public function getShippingInclTax() + { + return $this->_get(self::SHIPPING_INCL_TAX); + } + + /** + * Returns shipping_tax_amount + * + * @return float + */ + public function getShippingTaxAmount() + { + return $this->_get(self::SHIPPING_TAX_AMOUNT); + } + + /** + * Returns state + * + * @return int + */ + public function getState() + { + return $this->_get(self::STATE); + } + + /** + * Returns store_currency_code + * + * @return string + */ + public function getStoreCurrencyCode() + { + return $this->_get(self::STORE_CURRENCY_CODE); + } + + /** + * Returns store_id + * + * @return int + */ + public function getStoreId() + { + return $this->_get(self::STORE_ID); + } + + /** + * Returns store_to_base_rate + * + * @return float + */ + public function getStoreToBaseRate() + { + return $this->_get(self::STORE_TO_BASE_RATE); + } + + /** + * Returns store_to_order_rate + * + * @return float + */ + public function getStoreToOrderRate() + { + return $this->_get(self::STORE_TO_ORDER_RATE); + } + + /** + * Returns subtotal + * + * @return float + */ + public function getSubtotal() + { + return $this->_get(self::SUBTOTAL); + } + + /** + * Returns subtotal_incl_tax + * + * @return float + */ + public function getSubtotalInclTax() + { + return $this->_get(self::SUBTOTAL_INCL_TAX); + } + + /** + * Returns tax_amount + * + * @return float + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } + + /** + * Returns total_qty + * + * @return float + */ + public function getTotalQty() + { + return $this->_get(self::TOTAL_QTY); + } + + /** + * Returns transaction_id + * + * @return string + */ + public function getTransactionId() + { + return $this->_get(self::TRANSACTION_ID); + } + + /** + * Returns updated_at + * + * @return string + */ + public function getUpdatedAt() + { + return $this->_get(self::UPDATED_AT); + } + + /** + * Returns invoice items + * + * @return InvoiceItem[] + */ + public function getItems() + { + return $this->_get(self::ITEMS); + } + + /** + * Return invoice comments + * + * @return Comment[] + */ + public function getComments() + { + return $this->_get(self::COMMENTS); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php b/app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php new file mode 100644 index 000000000000..dd3865fe5b9d --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php @@ -0,0 +1,392 @@ +_get(self::ADDITIONAL_DATA); + } + + /** + * Returns base_cost + * + * @return float + */ + public function getBaseCost() + { + return $this->_get(self::BASE_COST); + } + + /** + * Returns base_discount_amount + * + * @return float + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + + /** + * Returns base_hidden_tax_amount + * + * @return float + */ + public function getBaseHiddenTaxAmount() + { + return $this->_get(self::BASE_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns base_price + * + * @return float + */ + public function getBasePrice() + { + return $this->_get(self::BASE_PRICE); + } + + /** + * Returns base_price_incl_tax + * + * @return float + */ + public function getBasePriceInclTax() + { + return $this->_get(self::BASE_PRICE_INCL_TAX); + } + + /** + * Returns base_row_total + * + * @return float + */ + public function getBaseRowTotal() + { + return $this->_get(self::BASE_ROW_TOTAL); + } + + /** + * Returns base_row_total_incl_tax + * + * @return float + */ + public function getBaseRowTotalInclTax() + { + return $this->_get(self::BASE_ROW_TOTAL_INCL_TAX); + } + + /** + * Returns base_tax_amount + * + * @return float + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Returns description + * + * @return string + */ + public function getDescription() + { + return $this->_get(self::DESCRIPTION); + } + + /** + * Returns discount_amount + * + * @return float + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns hidden_tax_amount + * + * @return float + */ + public function getHiddenTaxAmount() + { + return $this->_get(self::HIDDEN_TAX_AMOUNT); + } + + /** + * Returns name + * + * @return string + */ + public function getName() + { + return $this->_get(self::NAME); + } + + /** + * Returns order_item_id + * + * @return int + */ + public function getOrderItemId() + { + return $this->_get(self::ORDER_ITEM_ID); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns price + * + * @return float + */ + public function getPrice() + { + return $this->_get(self::PRICE); + } + + /** + * Returns price_incl_tax + * + * @return float + */ + public function getPriceInclTax() + { + return $this->_get(self::PRICE_INCL_TAX); + } + + /** + * Returns product_id + * + * @return int + */ + public function getProductId() + { + return $this->_get(self::PRODUCT_ID); + } + + /** + * Returns qty + * + * @return float + */ + public function getQty() + { + return $this->_get(self::QTY); + } + + /** + * Returns row_total + * + * @return float + */ + public function getRowTotal() + { + return $this->_get(self::ROW_TOTAL); + } + + /** + * Returns row_total_incl_tax + * + * @return float + */ + public function getRowTotalInclTax() + { + return $this->_get(self::ROW_TOTAL_INCL_TAX); + } + + /** + * Returns sku + * + * @return string + */ + public function getSku() + { + return $this->_get(self::SKU); + } + + /** + * Returns tax_amount + * + * @return float + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/Order.php b/app/code/Magento/Sales/Service/V1/Data/Order.php new file mode 100644 index 000000000000..7205f8c66189 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/Order.php @@ -0,0 +1,1542 @@ +_get(self::ADJUSTMENT_NEGATIVE); + } + + /** + * Returns adjustment_positive + * + * @return float + */ + public function getAdjustmentPositive() + { + return $this->_get(self::ADJUSTMENT_POSITIVE); + } + + /** + * Returns applied_rule_ids + * + * @return string + */ + public function getAppliedRuleIds() + { + return $this->_get(self::APPLIED_RULE_IDS); + } + + /** + * Returns base_adjustment_negative + * + * @return float + */ + public function getBaseAdjustmentNegative() + { + return $this->_get(self::BASE_ADJUSTMENT_NEGATIVE); + } + + /** + * Returns base_adjustment_positive + * + * @return float + */ + public function getBaseAdjustmentPositive() + { + return $this->_get(self::BASE_ADJUSTMENT_POSITIVE); + } + + /** + * Returns base_currency_code + * + * @return string + */ + public function getBaseCurrencyCode() + { + return $this->_get(self::BASE_CURRENCY_CODE); + } + + /** + * Returns base_discount_amount + * + * @return float + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + + /** + * Returns base_discount_canceled + * + * @return float + */ + public function getBaseDiscountCanceled() + { + return $this->_get(self::BASE_DISCOUNT_CANCELED); + } + + /** + * Returns base_discount_invoiced + * + * @return float + */ + public function getBaseDiscountInvoiced() + { + return $this->_get(self::BASE_DISCOUNT_INVOICED); + } + + /** + * Returns base_discount_refunded + * + * @return float + */ + public function getBaseDiscountRefunded() + { + return $this->_get(self::BASE_DISCOUNT_REFUNDED); + } + + /** + * Returns base_grand_total + * + * @return float + */ + public function getBaseGrandTotal() + { + return $this->_get(self::BASE_GRAND_TOTAL); + } + + /** + * Returns base_hidden_tax_amount + * + * @return float + */ + public function getBaseHiddenTaxAmount() + { + return $this->_get(self::BASE_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns base_hidden_tax_invoiced + * + * @return float + */ + public function getBaseHiddenTaxInvoiced() + { + return $this->_get(self::BASE_HIDDEN_TAX_INVOICED); + } + + /** + * Returns base_hidden_tax_refunded + * + * @return float + */ + public function getBaseHiddenTaxRefunded() + { + return $this->_get(self::BASE_HIDDEN_TAX_REFUNDED); + } + + /** + * Returns base_shipping_amount + * + * @return float + */ + public function getBaseShippingAmount() + { + return $this->_get(self::BASE_SHIPPING_AMOUNT); + } + + /** + * Returns base_shipping_canceled + * + * @return float + */ + public function getBaseShippingCanceled() + { + return $this->_get(self::BASE_SHIPPING_CANCELED); + } + + /** + * Returns base_shipping_discount_amount + * + * @return float + */ + public function getBaseShippingDiscountAmount() + { + return $this->_get(self::BASE_SHIPPING_DISCOUNT_AMOUNT); + } + + /** + * Returns base_shipping_hidden_tax_amnt + * + * @return float + */ + public function getBaseShippingHiddenTaxAmnt() + { + return $this->_get(self::BASE_SHIPPING_HIDDEN_TAX_AMNT); + } + + /** + * Returns base_shipping_incl_tax + * + * @return float + */ + public function getBaseShippingInclTax() + { + return $this->_get(self::BASE_SHIPPING_INCL_TAX); + } + + /** + * Returns base_shipping_invoiced + * + * @return float + */ + public function getBaseShippingInvoiced() + { + return $this->_get(self::BASE_SHIPPING_INVOICED); + } + + /** + * Returns base_shipping_refunded + * + * @return float + */ + public function getBaseShippingRefunded() + { + return $this->_get(self::BASE_SHIPPING_REFUNDED); + } + + /** + * Returns base_shipping_tax_amount + * + * @return float + */ + public function getBaseShippingTaxAmount() + { + return $this->_get(self::BASE_SHIPPING_TAX_AMOUNT); + } + + /** + * Returns base_shipping_tax_refunded + * + * @return float + */ + public function getBaseShippingTaxRefunded() + { + return $this->_get(self::BASE_SHIPPING_TAX_REFUNDED); + } + + /** + * Returns base_subtotal + * + * @return float + */ + public function getBaseSubtotal() + { + return $this->_get(self::BASE_SUBTOTAL); + } + + /** + * Returns base_subtotal_canceled + * + * @return float + */ + public function getBaseSubtotalCanceled() + { + return $this->_get(self::BASE_SUBTOTAL_CANCELED); + } + + /** + * Returns base_subtotal_incl_tax + * + * @return float + */ + public function getBaseSubtotalInclTax() + { + return $this->_get(self::BASE_SUBTOTAL_INCL_TAX); + } + + /** + * Returns base_subtotal_invoiced + * + * @return float + */ + public function getBaseSubtotalInvoiced() + { + return $this->_get(self::BASE_SUBTOTAL_INVOICED); + } + + /** + * Returns base_subtotal_refunded + * + * @return float + */ + public function getBaseSubtotalRefunded() + { + return $this->_get(self::BASE_SUBTOTAL_REFUNDED); + } + + /** + * Returns base_tax_amount + * + * @return float + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Returns base_tax_canceled + * + * @return float + */ + public function getBaseTaxCanceled() + { + return $this->_get(self::BASE_TAX_CANCELED); + } + + /** + * Returns base_tax_invoiced + * + * @return float + */ + public function getBaseTaxInvoiced() + { + return $this->_get(self::BASE_TAX_INVOICED); + } + + /** + * Returns base_tax_refunded + * + * @return float + */ + public function getBaseTaxRefunded() + { + return $this->_get(self::BASE_TAX_REFUNDED); + } + + /** + * Returns base_total_canceled + * + * @return float + */ + public function getBaseTotalCanceled() + { + return $this->_get(self::BASE_TOTAL_CANCELED); + } + + /** + * Returns base_total_due + * + * @return float + */ + public function getBaseTotalDue() + { + return $this->_get(self::BASE_TOTAL_DUE); + } + + /** + * Returns base_total_invoiced + * + * @return float + */ + public function getBaseTotalInvoiced() + { + return $this->_get(self::BASE_TOTAL_INVOICED); + } + + /** + * Returns base_total_invoiced_cost + * + * @return float + */ + public function getBaseTotalInvoicedCost() + { + return $this->_get(self::BASE_TOTAL_INVOICED_COST); + } + + /** + * Returns base_total_offline_refunded + * + * @return float + */ + public function getBaseTotalOfflineRefunded() + { + return $this->_get(self::BASE_TOTAL_OFFLINE_REFUNDED); + } + + /** + * Returns base_total_online_refunded + * + * @return float + */ + public function getBaseTotalOnlineRefunded() + { + return $this->_get(self::BASE_TOTAL_ONLINE_REFUNDED); + } + + /** + * Returns base_total_paid + * + * @return float + */ + public function getBaseTotalPaid() + { + return $this->_get(self::BASE_TOTAL_PAID); + } + + /** + * Returns base_total_qty_ordered + * + * @return float + */ + public function getBaseTotalQtyOrdered() + { + return $this->_get(self::BASE_TOTAL_QTY_ORDERED); + } + + /** + * Returns base_total_refunded + * + * @return float + */ + public function getBaseTotalRefunded() + { + return $this->_get(self::BASE_TOTAL_REFUNDED); + } + + /** + * Returns base_to_global_rate + * + * @return float + */ + public function getBaseToGlobalRate() + { + return $this->_get(self::BASE_TO_GLOBAL_RATE); + } + + /** + * Returns base_to_order_rate + * + * @return float + */ + public function getBaseToOrderRate() + { + return $this->_get(self::BASE_TO_ORDER_RATE); + } + + /** + * Returns billing_address_id + * + * @return int + */ + public function getBillingAddressId() + { + return $this->_get(self::BILLING_ADDRESS_ID); + } + + /** + * Returns can_ship_partially + * + * @return int + */ + public function getCanShipPartially() + { + return $this->_get(self::CAN_SHIP_PARTIALLY); + } + + /** + * Returns can_ship_partially_item + * + * @return int + */ + public function getCanShipPartiallyItem() + { + return $this->_get(self::CAN_SHIP_PARTIALLY_ITEM); + } + + /** + * Returns coupon_code + * + * @return string + */ + public function getCouponCode() + { + return $this->_get(self::COUPON_CODE); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns customer_dob + * + * @return string + */ + public function getCustomerDob() + { + return $this->_get(self::CUSTOMER_DOB); + } + + /** + * Returns customer_email + * + * @return string + */ + public function getCustomerEmail() + { + return $this->_get(self::CUSTOMER_EMAIL); + } + + /** + * Returns customer_firstname + * + * @return string + */ + public function getCustomerFirstname() + { + return $this->_get(self::CUSTOMER_FIRSTNAME); + } + + /** + * Returns customer_gender + * + * @return int + */ + public function getCustomerGender() + { + return $this->_get(self::CUSTOMER_GENDER); + } + + /** + * Returns customer_group_id + * + * @return int + */ + public function getCustomerGroupId() + { + return $this->_get(self::CUSTOMER_GROUP_ID); + } + + /** + * Returns customer_id + * + * @return int + */ + public function getCustomerId() + { + return $this->_get(self::CUSTOMER_ID); + } + + /** + * Returns customer_is_guest + * + * @return int + */ + public function getCustomerIsGuest() + { + return $this->_get(self::CUSTOMER_IS_GUEST); + } + + /** + * Returns customer_lastname + * + * @return string + */ + public function getCustomerLastname() + { + return $this->_get(self::CUSTOMER_LASTNAME); + } + + /** + * Returns customer_middlename + * + * @return string + */ + public function getCustomerMiddlename() + { + return $this->_get(self::CUSTOMER_MIDDLENAME); + } + + /** + * Returns customer_note + * + * @return string + */ + public function getCustomerNote() + { + return $this->_get(self::CUSTOMER_NOTE); + } + + /** + * Returns customer_note_notify + * + * @return int + */ + public function getCustomerNoteNotify() + { + return $this->_get(self::CUSTOMER_NOTE_NOTIFY); + } + + /** + * Returns customer_prefix + * + * @return string + */ + public function getCustomerPrefix() + { + return $this->_get(self::CUSTOMER_PREFIX); + } + + /** + * Returns customer_suffix + * + * @return string + */ + public function getCustomerSuffix() + { + return $this->_get(self::CUSTOMER_SUFFIX); + } + + /** + * Returns customer_taxvat + * + * @return string + */ + public function getCustomerTaxvat() + { + return $this->_get(self::CUSTOMER_TAXVAT); + } + + /** + * Returns discount_amount + * + * @return float + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Returns discount_canceled + * + * @return float + */ + public function getDiscountCanceled() + { + return $this->_get(self::DISCOUNT_CANCELED); + } + + /** + * Returns discount_description + * + * @return string + */ + public function getDiscountDescription() + { + return $this->_get(self::DISCOUNT_DESCRIPTION); + } + + /** + * Returns discount_invoiced + * + * @return float + */ + public function getDiscountInvoiced() + { + return $this->_get(self::DISCOUNT_INVOICED); + } + + /** + * Returns discount_refunded + * + * @return float + */ + public function getDiscountRefunded() + { + return $this->_get(self::DISCOUNT_REFUNDED); + } + + /** + * Returns edit_increment + * + * @return int + */ + public function getEditIncrement() + { + return $this->_get(self::EDIT_INCREMENT); + } + + /** + * Returns email_sent + * + * @return int + */ + public function getEmailSent() + { + return $this->_get(self::EMAIL_SENT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns ext_customer_id + * + * @return string + */ + public function getExtCustomerId() + { + return $this->_get(self::EXT_CUSTOMER_ID); + } + + /** + * Returns ext_order_id + * + * @return string + */ + public function getExtOrderId() + { + return $this->_get(self::EXT_ORDER_ID); + } + + /** + * Returns forced_shipment_with_invoice + * + * @return int + */ + public function getForcedShipmentWithInvoice() + { + return $this->_get(self::FORCED_SHIPMENT_WITH_INVOICE); + } + + /** + * Returns global_currency_code + * + * @return string + */ + public function getGlobalCurrencyCode() + { + return $this->_get(self::GLOBAL_CURRENCY_CODE); + } + + /** + * Returns grand_total + * + * @return float + */ + public function getGrandTotal() + { + return $this->_get(self::GRAND_TOTAL); + } + + /** + * Returns hidden_tax_amount + * + * @return float + */ + public function getHiddenTaxAmount() + { + return $this->_get(self::HIDDEN_TAX_AMOUNT); + } + + /** + * Returns hidden_tax_invoiced + * + * @return float + */ + public function getHiddenTaxInvoiced() + { + return $this->_get(self::HIDDEN_TAX_INVOICED); + } + + /** + * Returns hidden_tax_refunded + * + * @return float + */ + public function getHiddenTaxRefunded() + { + return $this->_get(self::HIDDEN_TAX_REFUNDED); + } + + /** + * Returns hold_before_state + * + * @return string + */ + public function getHoldBeforeState() + { + return $this->_get(self::HOLD_BEFORE_STATE); + } + + /** + * Returns hold_before_status + * + * @return string + */ + public function getHoldBeforeStatus() + { + return $this->_get(self::HOLD_BEFORE_STATUS); + } + + /** + * Returns increment_id + * + * @return string + */ + public function getIncrementId() + { + return $this->_get(self::INCREMENT_ID); + } + + /** + * Returns is_virtual + * + * @return int + */ + public function getIsVirtual() + { + return $this->_get(self::IS_VIRTUAL); + } + + /** + * Returns order_currency_code + * + * @return string + */ + public function getOrderCurrencyCode() + { + return $this->_get(self::ORDER_CURRENCY_CODE); + } + + /** + * Returns original_increment_id + * + * @return string + */ + public function getOriginalIncrementId() + { + return $this->_get(self::ORIGINAL_INCREMENT_ID); + } + + /** + * Returns payment_authorization_amount + * + * @return float + */ + public function getPaymentAuthorizationAmount() + { + return $this->_get(self::PAYMENT_AUTHORIZATION_AMOUNT); + } + + /** + * Returns payment_auth_expiration + * + * @return int + */ + public function getPaymentAuthExpiration() + { + return $this->_get(self::PAYMENT_AUTH_EXPIRATION); + } + + /** + * Returns protect_code + * + * @return string + */ + public function getProtectCode() + { + return $this->_get(self::PROTECT_CODE); + } + + /** + * Returns quote_address_id + * + * @return int + */ + public function getQuoteAddressId() + { + return $this->_get(self::QUOTE_ADDRESS_ID); + } + + /** + * Returns quote_id + * + * @return int + */ + public function getQuoteId() + { + return $this->_get(self::QUOTE_ID); + } + + /** + * Returns relation_child_id + * + * @return string + */ + public function getRelationChildId() + { + return $this->_get(self::RELATION_CHILD_ID); + } + + /** + * Returns relation_child_real_id + * + * @return string + */ + public function getRelationChildRealId() + { + return $this->_get(self::RELATION_CHILD_REAL_ID); + } + + /** + * Returns relation_parent_id + * + * @return string + */ + public function getRelationParentId() + { + return $this->_get(self::RELATION_PARENT_ID); + } + + /** + * Returns relation_parent_real_id + * + * @return string + */ + public function getRelationParentRealId() + { + return $this->_get(self::RELATION_PARENT_REAL_ID); + } + + /** + * Returns remote_ip + * + * @return string + */ + public function getRemoteIp() + { + return $this->_get(self::REMOTE_IP); + } + + /** + * Returns shipping_address_id + * + * @return int + */ + public function getShippingAddressId() + { + return $this->_get(self::SHIPPING_ADDRESS_ID); + } + + /** + * Returns shipping_amount + * + * @return float + */ + public function getShippingAmount() + { + return $this->_get(self::SHIPPING_AMOUNT); + } + + /** + * Returns shipping_canceled + * + * @return float + */ + public function getShippingCanceled() + { + return $this->_get(self::SHIPPING_CANCELED); + } + + /** + * Returns shipping_description + * + * @return string + */ + public function getShippingDescription() + { + return $this->_get(self::SHIPPING_DESCRIPTION); + } + + /** + * Returns shipping_discount_amount + * + * @return float + */ + public function getShippingDiscountAmount() + { + return $this->_get(self::SHIPPING_DISCOUNT_AMOUNT); + } + + /** + * Returns shipping_hidden_tax_amount + * + * @return float + */ + public function getShippingHiddenTaxAmount() + { + return $this->_get(self::SHIPPING_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns shipping_incl_tax + * + * @return float + */ + public function getShippingInclTax() + { + return $this->_get(self::SHIPPING_INCL_TAX); + } + + /** + * Returns shipping_invoiced + * + * @return float + */ + public function getShippingInvoiced() + { + return $this->_get(self::SHIPPING_INVOICED); + } + + /** + * Returns shipping_method + * + * @return string + */ + public function getShippingMethod() + { + return $this->_get(self::SHIPPING_METHOD); + } + + /** + * Returns shipping_refunded + * + * @return float + */ + public function getShippingRefunded() + { + return $this->_get(self::SHIPPING_REFUNDED); + } + + /** + * Returns shipping_tax_amount + * + * @return float + */ + public function getShippingTaxAmount() + { + return $this->_get(self::SHIPPING_TAX_AMOUNT); + } + + /** + * Returns shipping_tax_refunded + * + * @return float + */ + public function getShippingTaxRefunded() + { + return $this->_get(self::SHIPPING_TAX_REFUNDED); + } + + /** + * Returns state + * + * @return string + */ + public function getState() + { + return $this->_get(self::STATE); + } + + /** + * Returns status + * + * @return string + */ + public function getStatus() + { + return $this->_get(self::STATUS); + } + + /** + * Returns store_currency_code + * + * @return string + */ + public function getStoreCurrencyCode() + { + return $this->_get(self::STORE_CURRENCY_CODE); + } + + /** + * Returns store_id + * + * @return int + */ + public function getStoreId() + { + return $this->_get(self::STORE_ID); + } + + /** + * Returns store_name + * + * @return string + */ + public function getStoreName() + { + return $this->_get(self::STORE_NAME); + } + + /** + * Returns store_to_base_rate + * + * @return float + */ + public function getStoreToBaseRate() + { + return $this->_get(self::STORE_TO_BASE_RATE); + } + + /** + * Returns store_to_order_rate + * + * @return float + */ + public function getStoreToOrderRate() + { + return $this->_get(self::STORE_TO_ORDER_RATE); + } + + /** + * Returns subtotal + * + * @return float + */ + public function getSubtotal() + { + return $this->_get(self::SUBTOTAL); + } + + /** + * Returns subtotal_canceled + * + * @return float + */ + public function getSubtotalCanceled() + { + return $this->_get(self::SUBTOTAL_CANCELED); + } + + /** + * Returns subtotal_incl_tax + * + * @return float + */ + public function getSubtotalInclTax() + { + return $this->_get(self::SUBTOTAL_INCL_TAX); + } + + /** + * Returns subtotal_invoiced + * + * @return float + */ + public function getSubtotalInvoiced() + { + return $this->_get(self::SUBTOTAL_INVOICED); + } + + /** + * Returns subtotal_refunded + * + * @return float + */ + public function getSubtotalRefunded() + { + return $this->_get(self::SUBTOTAL_REFUNDED); + } + + /** + * Returns tax_amount + * + * @return float + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } + + /** + * Returns tax_canceled + * + * @return float + */ + public function getTaxCanceled() + { + return $this->_get(self::TAX_CANCELED); + } + + /** + * Returns tax_invoiced + * + * @return float + */ + public function getTaxInvoiced() + { + return $this->_get(self::TAX_INVOICED); + } + + /** + * Returns tax_refunded + * + * @return float + */ + public function getTaxRefunded() + { + return $this->_get(self::TAX_REFUNDED); + } + + /** + * Returns total_canceled + * + * @return float + */ + public function getTotalCanceled() + { + return $this->_get(self::TOTAL_CANCELED); + } + + /** + * Returns total_due + * + * @return float + */ + public function getTotalDue() + { + return $this->_get(self::TOTAL_DUE); + } + + /** + * Returns total_invoiced + * + * @return float + */ + public function getTotalInvoiced() + { + return $this->_get(self::TOTAL_INVOICED); + } + + /** + * Returns total_item_count + * + * @return int + */ + public function getTotalItemCount() + { + return $this->_get(self::TOTAL_ITEM_COUNT); + } + + /** + * Returns total_offline_refunded + * + * @return float + */ + public function getTotalOfflineRefunded() + { + return $this->_get(self::TOTAL_OFFLINE_REFUNDED); + } + + /** + * Returns total_online_refunded + * + * @return float + */ + public function getTotalOnlineRefunded() + { + return $this->_get(self::TOTAL_ONLINE_REFUNDED); + } + + /** + * Returns total_paid + * + * @return float + */ + public function getTotalPaid() + { + return $this->_get(self::TOTAL_PAID); + } + + /** + * Returns total_qty_ordered + * + * @return float + */ + public function getTotalQtyOrdered() + { + return $this->_get(self::TOTAL_QTY_ORDERED); + } + + /** + * Returns total_refunded + * + * @return float + */ + public function getTotalRefunded() + { + return $this->_get(self::TOTAL_REFUNDED); + } + + /** + * Returns updated_at + * + * @return string + */ + public function getUpdatedAt() + { + return $this->_get(self::UPDATED_AT); + } + + /** + * Returns weight + * + * @return float + */ + public function getWeight() + { + return $this->_get(self::WEIGHT); + } + + /** + * Returns x_forwarded_for + * + * @return string + */ + public function getXForwardedFor() + { + return $this->_get(self::X_FORWARDED_FOR); + } + + /** + * @return \Magento\Sales\Service\V1\Data\OrderItem[] + */ + public function getItems() + { + return $this->_get(self::ITEMS); + } + + /** + * @return \Magento\Sales\Service\V1\Data\OrderAddress + */ + public function getBillingAddress() + { + return $this->_get(self::BILLING_ADDRESS); + } + + /** + * @return \Magento\Sales\Service\V1\Data\OrderAddress + */ + public function getShippingAddress() + { + return $this->_get(self::SHIPPING_ADDRESS); + } + + /** + * @return \Magento\Sales\Service\V1\Data\OrderPayment[] + */ + public function getPayments() + { + return $this->_get(self::PAYMENTS); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderAddress.php b/app/code/Magento/Sales/Service/V1/Data/OrderAddress.php new file mode 100644 index 000000000000..34d413993fd4 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/OrderAddress.php @@ -0,0 +1,422 @@ +_get(self::ADDRESS_TYPE); + } + + /** + * Returns city + * + * @return string + */ + public function getCity() + { + return $this->_get(self::CITY); + } + + /** + * Returns company + * + * @return string + */ + public function getCompany() + { + return $this->_get(self::COMPANY); + } + + /** + * Returns country_id + * + * @return string + */ + public function getCountryId() + { + return $this->_get(self::COUNTRY_ID); + } + + /** + * Returns customer_address_id + * + * @return int + */ + public function getCustomerAddressId() + { + return $this->_get(self::CUSTOMER_ADDRESS_ID); + } + + /** + * Returns customer_id + * + * @return int + */ + public function getCustomerId() + { + return $this->_get(self::CUSTOMER_ID); + } + + /** + * Returns email + * + * @return string + */ + public function getEmail() + { + return $this->_get(self::EMAIL); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns fax + * + * @return string + */ + public function getFax() + { + return $this->_get(self::FAX); + } + + /** + * Returns firstname + * + * @return string + */ + public function getFirstname() + { + return $this->_get(self::FIRSTNAME); + } + + /** + * Returns lastname + * + * @return string + */ + public function getLastname() + { + return $this->_get(self::LASTNAME); + } + + /** + * Returns middlename + * + * @return string + */ + public function getMiddlename() + { + return $this->_get(self::MIDDLENAME); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns postcode + * + * @return string + */ + public function getPostcode() + { + return $this->_get(self::POSTCODE); + } + + /** + * Returns prefix + * + * @return string + */ + public function getPrefix() + { + return $this->_get(self::PREFIX); + } + + /** + * Returns quote_address_id + * + * @return int + */ + public function getQuoteAddressId() + { + return $this->_get(self::QUOTE_ADDRESS_ID); + } + + /** + * Returns region + * + * @return string + */ + public function getRegion() + { + return $this->_get(self::REGION); + } + + /** + * Returns region_id + * + * @return int + */ + public function getRegionId() + { + return $this->_get(self::REGION_ID); + } + + /** + * Returns street + * + * @return string + */ + public function getStreet() + { + return $this->_get(self::STREET); + } + + /** + * Returns suffix + * + * @return string + */ + public function getSuffix() + { + return $this->_get(self::SUFFIX); + } + + /** + * Returns telephone + * + * @return string + */ + public function getTelephone() + { + return $this->_get(self::TELEPHONE); + } + + /** + * Returns vat_id + * + * @return string + */ + public function getVatId() + { + return $this->_get(self::VAT_ID); + } + + /** + * Returns vat_is_valid + * + * @return int + */ + public function getVatIsValid() + { + return $this->_get(self::VAT_IS_VALID); + } + + /** + * Returns vat_request_date + * + * @return string + */ + public function getVatRequestDate() + { + return $this->_get(self::VAT_REQUEST_DATE); + } + + /** + * Returns vat_request_id + * + * @return string + */ + public function getVatRequestId() + { + return $this->_get(self::VAT_REQUEST_ID); + } + + /** + * Returns vat_request_success + * + * @return int + */ + public function getVatRequestSuccess() + { + return $this->_get(self::VAT_REQUEST_SUCCESS); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderItem.php b/app/code/Magento/Sales/Service/V1/Data/OrderItem.php new file mode 100644 index 000000000000..7969c2e17b2c --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/OrderItem.php @@ -0,0 +1,1167 @@ +_get(self::ADDITIONAL_DATA); + } + + /** + * Returns amount_refunded + * + * @return float + */ + public function getAmountRefunded() + { + return $this->_get(self::AMOUNT_REFUNDED); + } + + /** + * Returns applied_rule_ids + * + * @return string + */ + public function getAppliedRuleIds() + { + return $this->_get(self::APPLIED_RULE_IDS); + } + + /** + * Returns base_amount_refunded + * + * @return float + */ + public function getBaseAmountRefunded() + { + return $this->_get(self::BASE_AMOUNT_REFUNDED); + } + + /** + * Returns base_cost + * + * @return float + */ + public function getBaseCost() + { + return $this->_get(self::BASE_COST); + } + + /** + * Returns base_discount_amount + * + * @return float + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + + /** + * Returns base_discount_invoiced + * + * @return float + */ + public function getBaseDiscountInvoiced() + { + return $this->_get(self::BASE_DISCOUNT_INVOICED); + } + + /** + * Returns base_discount_refunded + * + * @return float + */ + public function getBaseDiscountRefunded() + { + return $this->_get(self::BASE_DISCOUNT_REFUNDED); + } + + /** + * Returns base_hidden_tax_amount + * + * @return float + */ + public function getBaseHiddenTaxAmount() + { + return $this->_get(self::BASE_HIDDEN_TAX_AMOUNT); + } + + /** + * Returns base_hidden_tax_invoiced + * + * @return float + */ + public function getBaseHiddenTaxInvoiced() + { + return $this->_get(self::BASE_HIDDEN_TAX_INVOICED); + } + + /** + * Returns base_hidden_tax_refunded + * + * @return float + */ + public function getBaseHiddenTaxRefunded() + { + return $this->_get(self::BASE_HIDDEN_TAX_REFUNDED); + } + + /** + * Returns base_original_price + * + * @return float + */ + public function getBaseOriginalPrice() + { + return $this->_get(self::BASE_ORIGINAL_PRICE); + } + + /** + * Returns base_price + * + * @return float + */ + public function getBasePrice() + { + return $this->_get(self::BASE_PRICE); + } + + /** + * Returns base_price_incl_tax + * + * @return float + */ + public function getBasePriceInclTax() + { + return $this->_get(self::BASE_PRICE_INCL_TAX); + } + + /** + * Returns base_row_invoiced + * + * @return float + */ + public function getBaseRowInvoiced() + { + return $this->_get(self::BASE_ROW_INVOICED); + } + + /** + * Returns base_row_total + * + * @return float + */ + public function getBaseRowTotal() + { + return $this->_get(self::BASE_ROW_TOTAL); + } + + /** + * Returns base_row_total_incl_tax + * + * @return float + */ + public function getBaseRowTotalInclTax() + { + return $this->_get(self::BASE_ROW_TOTAL_INCL_TAX); + } + + /** + * Returns base_tax_amount + * + * @return float + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Returns base_tax_before_discount + * + * @return float + */ + public function getBaseTaxBeforeDiscount() + { + return $this->_get(self::BASE_TAX_BEFORE_DISCOUNT); + } + + /** + * Returns base_tax_invoiced + * + * @return float + */ + public function getBaseTaxInvoiced() + { + return $this->_get(self::BASE_TAX_INVOICED); + } + + /** + * Returns base_tax_refunded + * + * @return float + */ + public function getBaseTaxRefunded() + { + return $this->_get(self::BASE_TAX_REFUNDED); + } + + /** + * Returns base_weee_tax_applied_amount + * + * @return float + */ + public function getBaseWeeeTaxAppliedAmount() + { + return $this->_get(self::BASE_WEEE_TAX_APPLIED_AMOUNT); + } + + /** + * Returns base_weee_tax_applied_row_amnt + * + * @return float + */ + public function getBaseWeeeTaxAppliedRowAmnt() + { + return $this->_get(self::BASE_WEEE_TAX_APPLIED_ROW_AMNT); + } + + /** + * Returns base_weee_tax_disposition + * + * @return float + */ + public function getBaseWeeeTaxDisposition() + { + return $this->_get(self::BASE_WEEE_TAX_DISPOSITION); + } + + /** + * Returns base_weee_tax_row_disposition + * + * @return float + */ + public function getBaseWeeeTaxRowDisposition() + { + return $this->_get(self::BASE_WEEE_TAX_ROW_DISPOSITION); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns description + * + * @return string + */ + public function getDescription() + { + return $this->_get(self::DESCRIPTION); + } + + /** + * Returns discount_amount + * + * @return float + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Returns discount_invoiced + * + * @return float + */ + public function getDiscountInvoiced() + { + return $this->_get(self::DISCOUNT_INVOICED); + } + + /** + * Returns discount_percent + * + * @return float + */ + public function getDiscountPercent() + { + return $this->_get(self::DISCOUNT_PERCENT); + } + + /** + * Returns discount_refunded + * + * @return float + */ + public function getDiscountRefunded() + { + return $this->_get(self::DISCOUNT_REFUNDED); + } + + /** + * Returns event_id + * + * @return int + */ + public function getEventId() + { + return $this->_get(self::EVENT_ID); + } + + /** + * Returns ext_order_item_id + * + * @return string + */ + public function getExtOrderItemId() + { + return $this->_get(self::EXT_ORDER_ITEM_ID); + } + + /** + * Returns free_shipping + * + * @return int + */ + public function getFreeShipping() + { + return $this->_get(self::FREE_SHIPPING); + } + + /** + * Returns gw_base_price + * + * @return float + */ + public function getGwBasePrice() + { + return $this->_get(self::GW_BASE_PRICE); + } + + /** + * Returns gw_base_price_invoiced + * + * @return float + */ + public function getGwBasePriceInvoiced() + { + return $this->_get(self::GW_BASE_PRICE_INVOICED); + } + + /** + * Returns gw_base_price_refunded + * + * @return float + */ + public function getGwBasePriceRefunded() + { + return $this->_get(self::GW_BASE_PRICE_REFUNDED); + } + + /** + * Returns gw_base_tax_amount + * + * @return float + */ + public function getGwBaseTaxAmount() + { + return $this->_get(self::GW_BASE_TAX_AMOUNT); + } + + /** + * Returns gw_base_tax_amount_invoiced + * + * @return float + */ + public function getGwBaseTaxAmountInvoiced() + { + return $this->_get(self::GW_BASE_TAX_AMOUNT_INVOICED); + } + + /** + * Returns gw_base_tax_amount_refunded + * + * @return float + */ + public function getGwBaseTaxAmountRefunded() + { + return $this->_get(self::GW_BASE_TAX_AMOUNT_REFUNDED); + } + + /** + * Returns gw_id + * + * @return int + */ + public function getGwId() + { + return $this->_get(self::GW_ID); + } + + /** + * Returns gw_price + * + * @return float + */ + public function getGwPrice() + { + return $this->_get(self::GW_PRICE); + } + + /** + * Returns gw_price_invoiced + * + * @return float + */ + public function getGwPriceInvoiced() + { + return $this->_get(self::GW_PRICE_INVOICED); + } + + /** + * Returns gw_price_refunded + * + * @return float + */ + public function getGwPriceRefunded() + { + return $this->_get(self::GW_PRICE_REFUNDED); + } + + /** + * Returns gw_tax_amount + * + * @return float + */ + public function getGwTaxAmount() + { + return $this->_get(self::GW_TAX_AMOUNT); + } + + /** + * Returns gw_tax_amount_invoiced + * + * @return float + */ + public function getGwTaxAmountInvoiced() + { + return $this->_get(self::GW_TAX_AMOUNT_INVOICED); + } + + /** + * Returns gw_tax_amount_refunded + * + * @return float + */ + public function getGwTaxAmountRefunded() + { + return $this->_get(self::GW_TAX_AMOUNT_REFUNDED); + } + + /** + * Returns hidden_tax_amount + * + * @return float + */ + public function getHiddenTaxAmount() + { + return $this->_get(self::HIDDEN_TAX_AMOUNT); + } + + /** + * Returns hidden_tax_canceled + * + * @return float + */ + public function getHiddenTaxCanceled() + { + return $this->_get(self::HIDDEN_TAX_CANCELED); + } + + /** + * Returns hidden_tax_invoiced + * + * @return float + */ + public function getHiddenTaxInvoiced() + { + return $this->_get(self::HIDDEN_TAX_INVOICED); + } + + /** + * Returns hidden_tax_refunded + * + * @return float + */ + public function getHiddenTaxRefunded() + { + return $this->_get(self::HIDDEN_TAX_REFUNDED); + } + + /** + * Returns is_nominal + * + * @return int + */ + public function getIsNominal() + { + return $this->_get(self::IS_NOMINAL); + } + + /** + * Returns is_qty_decimal + * + * @return int + */ + public function getIsQtyDecimal() + { + return $this->_get(self::IS_QTY_DECIMAL); + } + + /** + * Returns is_virtual + * + * @return int + */ + public function getIsVirtual() + { + return $this->_get(self::IS_VIRTUAL); + } + + /** + * Returns item_id + * + * @return int + */ + public function getItemId() + { + return $this->_get(self::ITEM_ID); + } + + /** + * Returns locked_do_invoice + * + * @return int + */ + public function getLockedDoInvoice() + { + return $this->_get(self::LOCKED_DO_INVOICE); + } + + /** + * Returns locked_do_ship + * + * @return int + */ + public function getLockedDoShip() + { + return $this->_get(self::LOCKED_DO_SHIP); + } + + /** + * Returns name + * + * @return string + */ + public function getName() + { + return $this->_get(self::NAME); + } + + /** + * Returns no_discount + * + * @return int + */ + public function getNoDiscount() + { + return $this->_get(self::NO_DISCOUNT); + } + + /** + * Returns order_id + * + * @return int + */ + public function getOrderId() + { + return $this->_get(self::ORDER_ID); + } + + /** + * Returns original_price + * + * @return float + */ + public function getOriginalPrice() + { + return $this->_get(self::ORIGINAL_PRICE); + } + + /** + * Returns parent_item_id + * + * @return int + */ + public function getParentItemId() + { + return $this->_get(self::PARENT_ITEM_ID); + } + + /** + * Returns price + * + * @return float + */ + public function getPrice() + { + return $this->_get(self::PRICE); + } + + /** + * Returns price_incl_tax + * + * @return float + */ + public function getPriceInclTax() + { + return $this->_get(self::PRICE_INCL_TAX); + } + + /** + * Returns product_id + * + * @return int + */ + public function getProductId() + { + return $this->_get(self::PRODUCT_ID); + } + + /** + * Returns product_options + * + * @return string + */ + public function getProductOptions() + { + return $this->_get(self::PRODUCT_OPTIONS); + } + + /** + * Returns product_type + * + * @return string + */ + public function getProductType() + { + return $this->_get(self::PRODUCT_TYPE); + } + + /** + * Returns qty_backordered + * + * @return float + */ + public function getQtyBackordered() + { + return $this->_get(self::QTY_BACKORDERED); + } + + /** + * Returns qty_canceled + * + * @return float + */ + public function getQtyCanceled() + { + return $this->_get(self::QTY_CANCELED); + } + + /** + * Returns qty_invoiced + * + * @return float + */ + public function getQtyInvoiced() + { + return $this->_get(self::QTY_INVOICED); + } + + /** + * Returns qty_ordered + * + * @return float + */ + public function getQtyOrdered() + { + return $this->_get(self::QTY_ORDERED); + } + + /** + * Returns qty_refunded + * + * @return float + */ + public function getQtyRefunded() + { + return $this->_get(self::QTY_REFUNDED); + } + + /** + * Returns qty_returned + * + * @return float + */ + public function getQtyReturned() + { + return $this->_get(self::QTY_RETURNED); + } + + /** + * Returns qty_shipped + * + * @return float + */ + public function getQtyShipped() + { + return $this->_get(self::QTY_SHIPPED); + } + + /** + * Returns quote_item_id + * + * @return int + */ + public function getQuoteItemId() + { + return $this->_get(self::QUOTE_ITEM_ID); + } + + /** + * Returns row_invoiced + * + * @return float + */ + public function getRowInvoiced() + { + return $this->_get(self::ROW_INVOICED); + } + + /** + * Returns row_total + * + * @return float + */ + public function getRowTotal() + { + return $this->_get(self::ROW_TOTAL); + } + + /** + * Returns row_total_incl_tax + * + * @return float + */ + public function getRowTotalInclTax() + { + return $this->_get(self::ROW_TOTAL_INCL_TAX); + } + + /** + * Returns row_weight + * + * @return float + */ + public function getRowWeight() + { + return $this->_get(self::ROW_WEIGHT); + } + + /** + * Returns sku + * + * @return string + */ + public function getSku() + { + return $this->_get(self::SKU); + } + + /** + * Returns store_id + * + * @return int + */ + public function getStoreId() + { + return $this->_get(self::STORE_ID); + } + + /** + * Returns tax_amount + * + * @return float + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } + + /** + * Returns tax_before_discount + * + * @return float + */ + public function getTaxBeforeDiscount() + { + return $this->_get(self::TAX_BEFORE_DISCOUNT); + } + + /** + * Returns tax_canceled + * + * @return float + */ + public function getTaxCanceled() + { + return $this->_get(self::TAX_CANCELED); + } + + /** + * Returns tax_invoiced + * + * @return float + */ + public function getTaxInvoiced() + { + return $this->_get(self::TAX_INVOICED); + } + + /** + * Returns tax_percent + * + * @return float + */ + public function getTaxPercent() + { + return $this->_get(self::TAX_PERCENT); + } + + /** + * Returns tax_refunded + * + * @return float + */ + public function getTaxRefunded() + { + return $this->_get(self::TAX_REFUNDED); + } + + /** + * Returns updated_at + * + * @return string + */ + public function getUpdatedAt() + { + return $this->_get(self::UPDATED_AT); + } + + /** + * Returns weee_tax_applied + * + * @return string + */ + public function getWeeeTaxApplied() + { + return $this->_get(self::WEEE_TAX_APPLIED); + } + + /** + * Returns weee_tax_applied_amount + * + * @return float + */ + public function getWeeeTaxAppliedAmount() + { + return $this->_get(self::WEEE_TAX_APPLIED_AMOUNT); + } + + /** + * Returns weee_tax_applied_row_amount + * + * @return float + */ + public function getWeeeTaxAppliedRowAmount() + { + return $this->_get(self::WEEE_TAX_APPLIED_ROW_AMOUNT); + } + + /** + * Returns weee_tax_disposition + * + * @return float + */ + public function getWeeeTaxDisposition() + { + return $this->_get(self::WEEE_TAX_DISPOSITION); + } + + /** + * Returns weee_tax_row_disposition + * + * @return float + */ + public function getWeeeTaxRowDisposition() + { + return $this->_get(self::WEEE_TAX_ROW_DISPOSITION); + } + + /** + * Returns weight + * + * @return float + */ + public function getWeight() + { + return $this->_get(self::WEIGHT); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderMapper.php b/app/code/Magento/Sales/Service/V1/Data/OrderMapper.php new file mode 100644 index 000000000000..38a6e49d4f32 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/OrderMapper.php @@ -0,0 +1,144 @@ +orderBuilder = $orderBuilder; + $this->orderItemMapper = $orderItemMapper; + $this->orderPaymentMapper = $orderPaymentMapper; + $this->orderAddressMapper = $orderAddressMapper; + } + + /** + * Returns array of items + * + * @param \Magento\Sales\Model\Order $object + * @return OrderItem[] + */ + protected function getItems(\Magento\Sales\Model\Order $object) + { + $items = []; + foreach ($object->getItemsCollection() as $item) { + $items[] = $this->orderItemMapper->extractDto($item); + } + return $items; + } + + /** + * Returns array of payments + * + * @param \Magento\Sales\Model\Order $object + * @return OrderPayment[] + */ + protected function getPayments(\Magento\Sales\Model\Order $object) + { + $payments = []; + foreach ($object->getPaymentsCollection() as $payment) { + $payments[] = $this->orderPaymentMapper->extractDto($payment); + } + return $payments; + } + + /** + * Return billing address + * + * @param \Magento\Sales\Model\Order $object + * @return OrderAddress|null + */ + protected function getBillingAddress(\Magento\Sales\Model\Order $object) + { + $billingAddress = null; + if ($object->getBillingAddress()) { + $billingAddress = $this->orderAddressMapper->extractDto($object->getBillingAddress()); + } + return $billingAddress; + } + + /** + * Returns shipping address + * + * @param \Magento\Sales\Model\Order $object + * @return OrderAddress|null + */ + protected function getShippingAddress(\Magento\Sales\Model\Order $object) + { + $shippingAddress = null; + if ($object->getShippingAddress()) { + $shippingAddress = $this->orderAddressMapper->extractDto($object->getShippingAddress()); + } + return $shippingAddress; + } + + /** + * @param \Magento\Sales\Model\Order $object + * @return \Magento\Framework\Service\Data\AbstractObject + */ + public function extractDto(\Magento\Sales\Model\Order $object) + { + $this->orderBuilder->populateWithArray($object->getData()); + $this->orderBuilder->setItems($this->getItems($object)); + $this->orderBuilder->setPayments($this->getPayments($object)); + $this->orderBuilder->setBillingAddress($this->getBillingAddress($object)); + $this->orderBuilder->setShippingAddress($this->getShippingAddress($object)); + return $this->orderBuilder->create(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php b/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php new file mode 100644 index 000000000000..a076f2ab30e7 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php @@ -0,0 +1,842 @@ +_get(self::ACCOUNT_STATUS); + } + + /** + * Returns additional_data + * + * @return string + */ + public function getAdditionalData() + { + return $this->_get(self::ADDITIONAL_DATA); + } + + /** + * Returns additional_information + * + * @return string + */ + public function getAdditionalInformation() + { + return $this->_get(self::ADDITIONAL_INFORMATION); + } + + /** + * Returns address_status + * + * @return string + */ + public function getAddressStatus() + { + return $this->_get(self::ADDRESS_STATUS); + } + + /** + * Returns amount_authorized + * + * @return float + */ + public function getAmountAuthorized() + { + return $this->_get(self::AMOUNT_AUTHORIZED); + } + + /** + * Returns amount_canceled + * + * @return float + */ + public function getAmountCanceled() + { + return $this->_get(self::AMOUNT_CANCELED); + } + + /** + * Returns amount_ordered + * + * @return float + */ + public function getAmountOrdered() + { + return $this->_get(self::AMOUNT_ORDERED); + } + + /** + * Returns amount_paid + * + * @return float + */ + public function getAmountPaid() + { + return $this->_get(self::AMOUNT_PAID); + } + + /** + * Returns amount_refunded + * + * @return float + */ + public function getAmountRefunded() + { + return $this->_get(self::AMOUNT_REFUNDED); + } + + /** + * Returns anet_trans_method + * + * @return string + */ + public function getAnetTransMethod() + { + return $this->_get(self::ANET_TRANS_METHOD); + } + + /** + * Returns base_amount_authorized + * + * @return float + */ + public function getBaseAmountAuthorized() + { + return $this->_get(self::BASE_AMOUNT_AUTHORIZED); + } + + /** + * Returns base_amount_canceled + * + * @return float + */ + public function getBaseAmountCanceled() + { + return $this->_get(self::BASE_AMOUNT_CANCELED); + } + + /** + * Returns base_amount_ordered + * + * @return float + */ + public function getBaseAmountOrdered() + { + return $this->_get(self::BASE_AMOUNT_ORDERED); + } + + /** + * Returns base_amount_paid + * + * @return float + */ + public function getBaseAmountPaid() + { + return $this->_get(self::BASE_AMOUNT_PAID); + } + + /** + * Returns base_amount_paid_online + * + * @return float + */ + public function getBaseAmountPaidOnline() + { + return $this->_get(self::BASE_AMOUNT_PAID_ONLINE); + } + + /** + * Returns base_amount_refunded + * + * @return float + */ + public function getBaseAmountRefunded() + { + return $this->_get(self::BASE_AMOUNT_REFUNDED); + } + + /** + * Returns base_amount_refunded_online + * + * @return float + */ + public function getBaseAmountRefundedOnline() + { + return $this->_get(self::BASE_AMOUNT_REFUNDED_ONLINE); + } + + /** + * Returns base_shipping_amount + * + * @return float + */ + public function getBaseShippingAmount() + { + return $this->_get(self::BASE_SHIPPING_AMOUNT); + } + + /** + * Returns base_shipping_captured + * + * @return float + */ + public function getBaseShippingCaptured() + { + return $this->_get(self::BASE_SHIPPING_CAPTURED); + } + + /** + * Returns base_shipping_refunded + * + * @return float + */ + public function getBaseShippingRefunded() + { + return $this->_get(self::BASE_SHIPPING_REFUNDED); + } + + /** + * Returns cc_approval + * + * @return string + */ + public function getCcApproval() + { + return $this->_get(self::CC_APPROVAL); + } + + /** + * Returns cc_avs_status + * + * @return string + */ + public function getCcAvsStatus() + { + return $this->_get(self::CC_AVS_STATUS); + } + + /** + * Returns cc_cid_status + * + * @return string + */ + public function getCcCidStatus() + { + return $this->_get(self::CC_CID_STATUS); + } + + /** + * Returns cc_debug_request_body + * + * @return string + */ + public function getCcDebugRequestBody() + { + return $this->_get(self::CC_DEBUG_REQUEST_BODY); + } + + /** + * Returns cc_debug_response_body + * + * @return string + */ + public function getCcDebugResponseBody() + { + return $this->_get(self::CC_DEBUG_RESPONSE_BODY); + } + + /** + * Returns cc_debug_response_serialized + * + * @return string + */ + public function getCcDebugResponseSerialized() + { + return $this->_get(self::CC_DEBUG_RESPONSE_SERIALIZED); + } + + /** + * Returns cc_exp_month + * + * @return string + */ + public function getCcExpMonth() + { + return $this->_get(self::CC_EXP_MONTH); + } + + /** + * Returns cc_exp_year + * + * @return string + */ + public function getCcExpYear() + { + return $this->_get(self::CC_EXP_YEAR); + } + + /** + * Returns cc_last4 + * + * @return string + */ + public function getCcLast4() + { + return $this->_get(self::CC_LAST4); + } + + /** + * Returns cc_number_enc + * + * @return string + */ + public function getCcNumberEnc() + { + return $this->_get(self::CC_NUMBER_ENC); + } + + /** + * Returns cc_owner + * + * @return string + */ + public function getCcOwner() + { + return $this->_get(self::CC_OWNER); + } + + /** + * Returns cc_secure_verify + * + * @return string + */ + public function getCcSecureVerify() + { + return $this->_get(self::CC_SECURE_VERIFY); + } + + /** + * Returns cc_ss_issue + * + * @return string + */ + public function getCcSsIssue() + { + return $this->_get(self::CC_SS_ISSUE); + } + + /** + * Returns cc_ss_start_month + * + * @return string + */ + public function getCcSsStartMonth() + { + return $this->_get(self::CC_SS_START_MONTH); + } + + /** + * Returns cc_ss_start_year + * + * @return string + */ + public function getCcSsStartYear() + { + return $this->_get(self::CC_SS_START_YEAR); + } + + /** + * Returns cc_status + * + * @return string + */ + public function getCcStatus() + { + return $this->_get(self::CC_STATUS); + } + + /** + * Returns cc_status_description + * + * @return string + */ + public function getCcStatusDescription() + { + return $this->_get(self::CC_STATUS_DESCRIPTION); + } + + /** + * Returns cc_trans_id + * + * @return string + */ + public function getCcTransId() + { + return $this->_get(self::CC_TRANS_ID); + } + + /** + * Returns cc_type + * + * @return string + */ + public function getCcType() + { + return $this->_get(self::CC_TYPE); + } + + /** + * Returns echeck_account_name + * + * @return string + */ + public function getEcheckAccountName() + { + return $this->_get(self::ECHECK_ACCOUNT_NAME); + } + + /** + * Returns echeck_account_type + * + * @return string + */ + public function getEcheckAccountType() + { + return $this->_get(self::ECHECK_ACCOUNT_TYPE); + } + + /** + * Returns echeck_bank_name + * + * @return string + */ + public function getEcheckBankName() + { + return $this->_get(self::ECHECK_BANK_NAME); + } + + /** + * Returns echeck_routing_number + * + * @return string + */ + public function getEcheckRoutingNumber() + { + return $this->_get(self::ECHECK_ROUTING_NUMBER); + } + + /** + * Returns echeck_type + * + * @return string + */ + public function getEcheckType() + { + return $this->_get(self::ECHECK_TYPE); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns last_trans_id + * + * @return string + */ + public function getLastTransId() + { + return $this->_get(self::LAST_TRANS_ID); + } + + /** + * Returns method + * + * @return string + */ + public function getMethod() + { + return $this->_get(self::METHOD); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns po_number + * + * @return string + */ + public function getPoNumber() + { + return $this->_get(self::PO_NUMBER); + } + + /** + * Returns protection_eligibility + * + * @return string + */ + public function getProtectionEligibility() + { + return $this->_get(self::PROTECTION_ELIGIBILITY); + } + + /** + * Returns quote_payment_id + * + * @return int + */ + public function getQuotePaymentId() + { + return $this->_get(self::QUOTE_PAYMENT_ID); + } + + /** + * Returns shipping_amount + * + * @return float + */ + public function getShippingAmount() + { + return $this->_get(self::SHIPPING_AMOUNT); + } + + /** + * Returns shipping_captured + * + * @return float + */ + public function getShippingCaptured() + { + return $this->_get(self::SHIPPING_CAPTURED); + } + + /** + * Returns shipping_refunded + * + * @return float + */ + public function getShippingRefunded() + { + return $this->_get(self::SHIPPING_REFUNDED); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php b/app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php new file mode 100644 index 000000000000..4e22c6f7bf33 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php @@ -0,0 +1,121 @@ +_get(self::COMMENT); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns entity_name + * + * @return string + */ + public function getEntityName() + { + return $this->_get(self::ENTITY_NAME); + } + + /** + * Returns is_customer_notified + * + * @return int + */ + public function getIsCustomerNotified() + { + return $this->_get(self::IS_CUSTOMER_NOTIFIED); + } + + /** + * Returns is_visible_on_front + * + * @return int + */ + public function getIsVisibleOnFront() + { + return $this->_get(self::IS_VISIBLE_ON_FRONT); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns status + * + * @return string + */ + public function getStatus() + { + return $this->_get(self::STATUS); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/Shipment.php b/app/code/Magento/Sales/Service/V1/Data/Shipment.php new file mode 100644 index 000000000000..814b6472c937 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/Shipment.php @@ -0,0 +1,257 @@ +_get(self::BILLING_ADDRESS_ID); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns customer_id + * + * @return int + */ + public function getCustomerId() + { + return $this->_get(self::CUSTOMER_ID); + } + + /** + * Returns email_sent + * + * @return int + */ + public function getEmailSent() + { + return $this->_get(self::EMAIL_SENT); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns increment_id + * + * @return string + */ + public function getIncrementId() + { + return $this->_get(self::INCREMENT_ID); + } + + /** + * Returns order_id + * + * @return int + */ + public function getOrderId() + { + return $this->_get(self::ORDER_ID); + } + + /** + * Returns packages + * + * @return string + */ + public function getPackages() + { + return $this->_get(self::PACKAGES); + } + + /** + * Returns shipment_status + * + * @return int + */ + public function getShipmentStatus() + { + return $this->_get(self::SHIPMENT_STATUS); + } + + /** + * Returns shipping_address_id + * + * @return int + */ + public function getShippingAddressId() + { + return $this->_get(self::SHIPPING_ADDRESS_ID); + } + + /** + * Returns shipping_label + * + * @return string + */ + public function getShippingLabel() + { + return $this->_get(self::SHIPPING_LABEL); + } + + /** + * Returns store_id + * + * @return int + */ + public function getStoreId() + { + return $this->_get(self::STORE_ID); + } + + /** + * Returns total_qty + * + * @return float + */ + public function getTotalQty() + { + return $this->_get(self::TOTAL_QTY); + } + + /** + * Returns total_weight + * + * @return float + */ + public function getTotalWeight() + { + return $this->_get(self::TOTAL_WEIGHT); + } + + /** + * Returns updated_at + * + * @return string + */ + public function getUpdatedAt() + { + return $this->_get(self::UPDATED_AT); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php b/app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php new file mode 100644 index 000000000000..4c5eb9f556ab --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php @@ -0,0 +1,213 @@ +_get(self::ADDITIONAL_DATA); + } + + /** + * Returns description + * + * @return string + */ + public function getDescription() + { + return $this->_get(self::DESCRIPTION); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns name + * + * @return string + */ + public function getName() + { + return $this->_get(self::NAME); + } + + /** + * Returns order_item_id + * + * @return int + */ + public function getOrderItemId() + { + return $this->_get(self::ORDER_ITEM_ID); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns price + * + * @return float + */ + public function getPrice() + { + return $this->_get(self::PRICE); + } + + /** + * Returns product_id + * + * @return int + */ + public function getProductId() + { + return $this->_get(self::PRODUCT_ID); + } + + /** + * Returns qty + * + * @return float + */ + public function getQty() + { + return $this->_get(self::QTY); + } + + /** + * Returns row_total + * + * @return float + */ + public function getRowTotal() + { + return $this->_get(self::ROW_TOTAL); + } + + /** + * Returns sku + * + * @return string + */ + public function getSku() + { + return $this->_get(self::SKU); + } + + /** + * Returns weight + * + * @return float + */ + public function getWeight() + { + return $this->_get(self::WEIGHT); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php b/app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php new file mode 100644 index 000000000000..5038db1869f8 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php @@ -0,0 +1,198 @@ +_get(self::CARRIER_CODE); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns description + * + * @return string + */ + public function getDescription() + { + return $this->_get(self::DESCRIPTION); + } + + /** + * Returns entity_id + * + * @return int + */ + public function getEntityId() + { + return $this->_get(self::ENTITY_ID); + } + + /** + * Returns order_id + * + * @return int + */ + public function getOrderId() + { + return $this->_get(self::ORDER_ID); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns qty + * + * @return float + */ + public function getQty() + { + return $this->_get(self::QTY); + } + + /** + * Returns title + * + * @return string + */ + public function getTitle() + { + return $this->_get(self::TITLE); + } + + /** + * Returns track_number + * + * @return string + */ + public function getTrackNumber() + { + return $this->_get(self::TRACK_NUMBER); + } + + /** + * Returns updated_at + * + * @return string + */ + public function getUpdatedAt() + { + return $this->_get(self::UPDATED_AT); + } + + /** + * Returns weight + * + * @return float + */ + public function getWeight() + { + return $this->_get(self::WEIGHT); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderAddressUpdate.php b/app/code/Magento/Sales/Service/V1/OrderAddressUpdate.php new file mode 100644 index 000000000000..0ee239faf420 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderAddressUpdate.php @@ -0,0 +1,59 @@ +addressConverter = $addressConverter; + } + + /** + * Invoke order address update service + * + * @param \Magento\Sales\Service\V1\Data\OrderAddress $orderAddress + * @return bool + */ + public function invoke(OrderAddress $orderAddress) + { + $orderAddressModel = $this->addressConverter->getModel($orderAddress); + return (bool)$orderAddressModel->save(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderAddressUpdateInterface.php b/app/code/Magento/Sales/Service/V1/OrderAddressUpdateInterface.php new file mode 100644 index 000000000000..16237cbe85e5 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderAddressUpdateInterface.php @@ -0,0 +1,40 @@ +orderRepository = $orderRepository; + } + + /** + * Invoke getOrder service + * + * @param int $id + * @return bool + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function invoke($id) + { + return (bool)$this->orderRepository->get($id)->cancel(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderCancelInterface.php b/app/code/Magento/Sales/Service/V1/OrderCancelInterface.php new file mode 100644 index 000000000000..6fcdae3e1477 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderCancelInterface.php @@ -0,0 +1,39 @@ +historyRepository = $historyRepository; + $this->historyMapper = $historyMapper; + $this->criteriaBuilder = $criteriaBuilder; + $this->filterBuilder = $filterBuilder; + $this->searchResultsBuilder = $searchResultsBuilder; + } + + /** + * Invoke OrderCommentsList service + * + * @param int $id + * @return \Magento\Sales\Service\V1\Data\OrderStatusHistorySearchResults + */ + public function invoke($id) + { + $this->criteriaBuilder->addFilter( + ['eq' => $this->filterBuilder->setField('parent_id')->setValue($id)->create()] + ); + $criteria = $this->criteriaBuilder->create(); + $comments = []; + foreach ($this->historyRepository->find($criteria) as $comment) { + $comments[] = $this->historyMapper->extractDto($comment); + } + return $this->searchResultsBuilder->setItems($comments) + ->setSearchCriteria($criteria) + ->setTotalCount(count($comments)) + ->create(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderCommentsListInterface.php b/app/code/Magento/Sales/Service/V1/OrderCommentsListInterface.php new file mode 100644 index 000000000000..64de1d900671 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderCommentsListInterface.php @@ -0,0 +1,38 @@ +orderRepository = $orderRepository; + $this->orderMapper = $orderMapper; + } + + /** + * Invoke getOrder service + * + * @param int $id + * @return \Magento\Sales\Service\V1\Data\Order + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function invoke($id) + { + $order = $this->orderRepository->get($id); + return $this->orderMapper->extractDto($order); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderGetInterface.php b/app/code/Magento/Sales/Service/V1/OrderGetInterface.php new file mode 100644 index 000000000000..edc166d4782f --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderGetInterface.php @@ -0,0 +1,39 @@ +_connections = array('read' => new MysqlStub(), 'write' => new MysqlStub()); - } + protected $orderRepository; /** - * Save option value price data - * - * @param \Magento\Framework\Model\AbstractModel $object + * @param OrderRepository $orderRepository */ - public function saveValueTitles(\Magento\Framework\Model\AbstractModel $object) + public function __construct(OrderRepository $orderRepository) { - $this->_saveValueTitles($object); + $this->orderRepository = $orderRepository; } /** - * We should stub to not use db + * Retrieve order status by id * - * @param string $tableName + * @param int $id * @return string + * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function getTable($tableName) + public function invoke($id) { - return $tableName; + return $this->orderRepository->get($id)->getStatus(); } } diff --git a/app/code/Magento/Sales/Service/V1/OrderGetStatusInterface.php b/app/code/Magento/Sales/Service/V1/OrderGetStatusInterface.php new file mode 100644 index 000000000000..821a64129ae2 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderGetStatusInterface.php @@ -0,0 +1,40 @@ +orderRepository = $orderRepository; + } + + /** + * Invoke orderHold service + * + * @param int $id + * @return bool + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function invoke($id) + { + return (bool)$this->orderRepository->get($id)->hold(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderHoldInterface.php b/app/code/Magento/Sales/Service/V1/OrderHoldInterface.php new file mode 100644 index 000000000000..0ba9ba3733c1 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderHoldInterface.php @@ -0,0 +1,39 @@ +orderRepository = $orderRepository; + $this->orderMapper = $orderMapper; + $this->searchResultsBuilder = $searchResultsBuilder; + } + + /** + * Invoke OrderList service + * + * @param SearchCriteria $searchCriteria + * @return \Magento\Framework\Service\V1\Data\SearchResults + */ + public function invoke(SearchCriteria $searchCriteria) + { + $orders = []; + foreach ($this->orderRepository->find($searchCriteria) as $order) { + $orders[] = $this->orderMapper->extractDto($order); + } + return $this->searchResultsBuilder->setItems($orders) + ->setTotalCount(count($order)) + ->setSearchCriteria($searchCriteria) + ->create(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderListInterface.php b/app/code/Magento/Sales/Service/V1/OrderListInterface.php new file mode 100644 index 000000000000..508fd35e1f54 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderListInterface.php @@ -0,0 +1,40 @@ +session = $session; + $this->orderRepository = $orderRepository; + $this->notifier = $notifier; } /** - * Initiate a session for unregistered users. Send back the session id. + * Invoke notifyUser service * - * @return void + * @param int $id + * @return bool */ - public function execute() + public function invoke($id) { - $this->session->start('frontend'); - $this->session->setUserId(0); - $this->session->setUserType(UserIdentifier::USER_TYPE_GUEST); - $this->session->regenerateId(true); + /** @var \Magento\Sales\Model\Order $order */ + $order = $this->orderRepository->get($id); + return $this->notifier->notify($order); } } diff --git a/app/code/Magento/Sales/Service/V1/OrderNotifyUserInterface.php b/app/code/Magento/Sales/Service/V1/OrderNotifyUserInterface.php new file mode 100644 index 000000000000..2ed67edf6cc9 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderNotifyUserInterface.php @@ -0,0 +1,38 @@ +orderRepository = $orderRepository; + $this->historyConverter = $historyConverter; + } + + /** + * Invoke service + * + * @param int $id + * @param \Magento\Sales\Service\V1\Data\OrderStatusHistory $statusHistory + * @return bool + */ + public function invoke($id, OrderStatusHistory $statusHistory) + { + $order = $this->orderRepository->get($id); + $order->addStatusHistory($this->historyConverter->getModel($statusHistory)); + $order->save(); + return true; + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderStatusHistoryAddInterface.php b/app/code/Magento/Sales/Service/V1/OrderStatusHistoryAddInterface.php new file mode 100644 index 000000000000..d02279df3f8c --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderStatusHistoryAddInterface.php @@ -0,0 +1,42 @@ +orderRepository = $orderRepository; + } + + /** + * Invoke orderUnHold service + * + * @param int $id + * @return bool + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function invoke($id) + { + return (bool)$this->orderRepository->get($id)->unhold(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/OrderUnHoldInterface.php b/app/code/Magento/Sales/Service/V1/OrderUnHoldInterface.php new file mode 100644 index 000000000000..720df5f28b4c --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/OrderUnHoldInterface.php @@ -0,0 +1,39 @@ + - + diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 3dbae800e8d0..991b5f78ecf1 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -24,7 +24,17 @@ */ --> - + + + + + + + + + + + pdf.xml diff --git a/app/code/Magento/Sales/etc/webapi.xml b/app/code/Magento/Sales/etc/webapi.xml new file mode 100644 index 000000000000..fa435cb99b52 --- /dev/null +++ b/app/code/Magento/Sales/etc/webapi.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml index 668272440338..cc6aec52007f 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml @@ -21,8 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ +/** @var \Magento\Sales\Block\Adminhtml\Order\Create\Form $this */ ?> - + getBlockHtml('formkey')?>
    getChildHtml('message') ?> diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/form.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/form.js index b833d6459ae7..9edde1d0be67 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/form.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/form.js @@ -35,7 +35,7 @@ define([ return; } - config = $el.data('order-config'), + config = $el.data('order-config'); baseUrl = $el.data('load-base-url'); order = new AdminOrder(config); diff --git a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml index ef5880704054..ea69f6635dd6 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml @@ -25,9 +25,6 @@ getOrders(); ?> getChildHtml('info');?> getSize()): ?> - getPagerHtml()): ?> -
    getPagerHtml(); ?>
    -
    diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index 5881306da23d..5c5e2f7a7871 100644 --- a/app/code/Magento/SalesRule/composer.json +++ b/app/code/Magento/SalesRule/composer.json @@ -2,28 +2,28 @@ "name": "magento/module-sales-rule", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-rule": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-shipping": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-reports": "0.1.0-alpha89", - "magento/module-catalog-rule": "0.1.0-alpha89", - "magento/module-widget": "0.1.0-alpha89", - "magento/module-cron": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-rule": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-shipping": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-reports": "0.1.0-alpha90", + "magento/module-catalog-rule": "0.1.0-alpha90", + "magento/module-widget": "0.1.0-alpha90", + "magento/module-cron": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/SalesRule/etc/adminhtml/acl.xml b/app/code/Magento/SalesRule/etc/acl.xml similarity index 95% rename from app/code/Magento/SalesRule/etc/adminhtml/acl.xml rename to app/code/Magento/SalesRule/etc/acl.xml index b23b3d35206e..f11abdd73719 100644 --- a/app/code/Magento/SalesRule/etc/adminhtml/acl.xml +++ b/app/code/Magento/SalesRule/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json index ce7c55ff2947..2f7f51b67ec1 100644 --- a/app/code/Magento/Sendfriend/composer.json +++ b/app/code/Magento/Sendfriend/composer.json @@ -2,17 +2,17 @@ "name": "magento/module-sendfriend", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-theme": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-theme": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php index d69935e42ce1..6807412a6a51 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php @@ -25,6 +25,7 @@ namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment; use Magento\Backend\App\Action; +use \Magento\Sales\Model\Order\Email\Sender\ShipmentSender; class AddComment extends \Magento\Backend\App\Action { @@ -33,15 +34,23 @@ class AddComment extends \Magento\Backend\App\Action */ protected $shipmentLoader; + /** + * @var ShipmentSender + */ + protected $shipmentSender; + /** * @param Action\Context $context * @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader + * @param ShipmentSender $shipmentSender */ public function __construct( Action\Context $context, - \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader + \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader, + ShipmentSender $shipmentSender ) { $this->shipmentLoader = $shipmentLoader; + $this->shipmentSender = $shipmentSender; parent::__construct($context); } @@ -73,7 +82,8 @@ public function execute() isset($data['is_customer_notified']), isset($data['is_visible_on_front']) ); - $shipment->sendUpdateEmail(!empty($data['is_customer_notified']), $data['comment']); + + $this->shipmentSender->send($shipment, !empty($data['is_customer_notified']), $data['comment']); $shipment->save(); $this->_view->loadLayout(false); diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Email.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Email.php index 13365a269215..62af1f588270 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Email.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Email.php @@ -25,6 +25,7 @@ namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment; use \Magento\Backend\App\Action; +use \Magento\Sales\Model\Order\Email\Sender\ShipmentSender; class Email extends \Magento\Backend\App\Action { @@ -33,15 +34,23 @@ class Email extends \Magento\Backend\App\Action */ protected $shipmentLoader; + /** + * @var ShipmentSender + */ + protected $shipmentSender; + /** * @param Action\Context $context * @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader + * @param ShipmentSender $shipmentSender */ public function __construct( Action\Context $context, - \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader + \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader, + ShipmentSender $shipmentSender ) { $this->shipmentLoader = $shipmentLoader; + $this->shipmentSender = $shipmentSender; parent::__construct($context); } @@ -63,7 +72,9 @@ public function execute() try { $shipment = $this->shipmentLoader->load($this->_request); if ($shipment) { - $shipment->sendEmail(true)->setEmailSent(true)->save(); + $this->shipmentSender->send($shipment, true); + $shipment->save(); + $historyItem = $this->_objectManager->create( 'Magento\Sales\Model\Resource\Order\Status\History\Collection' )->getUnnotifiedForInstance( diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php index a8e1ef003675..8bdd3ed7fca4 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php @@ -25,6 +25,7 @@ namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment; use \Magento\Backend\App\Action; +use \Magento\Sales\Model\Order\Email\Sender\ShipmentSender; class Save extends \Magento\Backend\App\Action { @@ -38,18 +39,26 @@ class Save extends \Magento\Backend\App\Action */ protected $labelGenerator; + /** + * @var ShipmentSender + */ + protected $shipmentSender; + /** * @param Action\Context $context * @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader * @param \Magento\Shipping\Model\Shipping\LabelGenerator $labelGenerator + * @param ShipmentSender $shipmentSender */ public function __construct( Action\Context $context, \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader, - \Magento\Shipping\Model\Shipping\LabelGenerator $labelGenerator + \Magento\Shipping\Model\Shipping\LabelGenerator $labelGenerator, + ShipmentSender $shipmentSender ) { $this->shipmentLoader = $shipmentLoader; $this->labelGenerator = $labelGenerator; + $this->shipmentSender = $shipmentSender; parent::__construct($context); } @@ -128,7 +137,7 @@ public function execute() $this->_saveShipment($shipment); - $shipment->sendEmail(!empty($data['send_email']), $comment); + $this->shipmentSender->send($shipment, !empty($data['send_email']), $comment); $shipmentCreatedMessage = __('The shipment has been created.'); $labelCreatedMessage = __('You created the shipping label.'); diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index 6e53c76cf9dd..fc4e89cab74e 100644 --- a/app/code/Magento/Shipping/composer.json +++ b/app/code/Magento/Shipping/composer.json @@ -2,24 +2,24 @@ "name": "magento/module-shipping", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-sales": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-contact": "0.1.0-alpha89", - "magento/module-customer": "0.1.0-alpha89", - "magento/module-payment": "0.1.0-alpha89", - "magento/module-tax": "0.1.0-alpha89", - "magento/module-catalog-inventory": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-sales": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-contact": "0.1.0-alpha90", + "magento/module-customer": "0.1.0-alpha90", + "magento/module-payment": "0.1.0-alpha90", + "magento/module-tax": "0.1.0-alpha90", + "magento/module-catalog-inventory": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "ext-gd": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Shipping/etc/adminhtml/acl.xml b/app/code/Magento/Shipping/etc/acl.xml similarity index 94% rename from app/code/Magento/Shipping/etc/adminhtml/acl.xml rename to app/code/Magento/Shipping/etc/acl.xml index 277cd0ce9f79..fd54affe77ea 100644 --- a/app/code/Magento/Shipping/etc/adminhtml/acl.xml +++ b/app/code/Magento/Shipping/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index 8e78eedc06c5..11958116c049 100644 --- a/app/code/Magento/Sitemap/composer.json +++ b/app/code/Magento/Sitemap/composer.json @@ -2,18 +2,18 @@ "name": "magento/module-sitemap", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-store": "0.1.0-alpha89", - "magento/module-catalog": "0.1.0-alpha89", - "magento/module-core": "0.1.0-alpha89", - "magento/module-eav": "0.1.0-alpha89", - "magento/module-cms": "0.1.0-alpha89", - "magento/module-backend": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-store": "0.1.0-alpha90", + "magento/module-catalog": "0.1.0-alpha90", + "magento/module-core": "0.1.0-alpha90", + "magento/module-eav": "0.1.0-alpha90", + "magento/module-cms": "0.1.0-alpha90", + "magento/module-backend": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Sitemap/etc/adminhtml/acl.xml b/app/code/Magento/Sitemap/etc/acl.xml similarity index 95% rename from app/code/Magento/Sitemap/etc/adminhtml/acl.xml rename to app/code/Magento/Sitemap/etc/acl.xml index 5d5c2b7c7c97..b4684b364969 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/acl.xml +++ b/app/code/Magento/Sitemap/etc/acl.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - + diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index aa8356e9d1a7..47e2308ae586 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -2,15 +2,15 @@ "name": "magento/module-store", "description": "N/A", "require": { - "php": "5.4.*|5.5.*", - "magento/module-core": "0.1.0-alpha89", - "magento/module-directory": "0.1.0-alpha89", - "magento/module-index": "0.1.0-alpha89", - "magento/framework": "0.1.0-alpha89", + "php": "~5.4.11|~5.5.0", + "magento/module-core": "0.1.0-alpha90", + "magento/module-directory": "0.1.0-alpha90", + "magento/module-index": "0.1.0-alpha90", + "magento/framework": "0.1.0-alpha90", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha89", + "version": "0.1.0-alpha90", "extra": { "map": [ [ diff --git a/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml b/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml index e076840edbc4..19a91b1044d8 100644 --- a/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml +++ b/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml @@ -29,19 +29,26 @@ ?> getStores())>1): ?> -
    - -