Skip to content

Commit

Permalink
Merge pull request #204 from lemked/pre_1.2.6
Browse files Browse the repository at this point in the history
Revert province/region changes of 1.2.5
  • Loading branch information
danielneu authored Mar 5, 2018
2 parents 5adfdde + 386e0a1 commit 5402c9d
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 110 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amzn/amazon-pay-and-login-magento-2-module",
"description": "Official Magento2 Plugin to integrate with Amazon Pay and Login with Amazon",
"type": "magento2-module",
"version": "1.2.5",
"version": "1.2.6",
"license": [
"Apache-2.0"
],
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
# built documents.
#
# The short X.Y version.
version = u'1.2.5'
version = u'1.2.6'
# The full version, including alpha/beta/rc tags.
release = u'1.2.5'
release = u'1.2.6'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ In case you are not able or willing to use the web installation, you can install

* Sign in to your server via SSH
* `cd` into you Magento installation directory
* Install the extension via composer: `composer require amzn/amazon-payments-magento-2-plugin:^1.2.5`
* Install the extension via composer: `composer require amzn/amazon-payments-magento-2-plugin:^1.2.6`
* Enable the extension: `php bin/magento module:enable Amazon_Core Amazon_Login Amazon_Payment`
* Upgrade the Magento installation: `php bin/magento setup:upgrade`
* Follow any advice the upgrade routine provides

.. note:: `composer require amzn/amazon-payments-magento-2-plugin:^1.2.5` will always install the most current, non-breaking, Amazon Pay extension for you, when you run an update. To fix it to a specifix version, please remove the `^`
.. note:: `composer require amzn/amazon-payments-magento-2-plugin:^1.2.6` will always install the most current, non-breaking, Amazon Pay extension for you, when you run an update. To fix it to a specifix version, please remove the `^`

In production mode, you will also have to compile the code and the dependency injection (DI) configuration and deploy static content

Expand Down
8 changes: 4 additions & 4 deletions marketplace-composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "amzn/amazon-pay-and-login-magento-2-module",
"description": "Official Magento2 Plugin to integrate with Amazon Pay and Login with Amazon",
"type": "metapackage",
"version": "1.2.5",
"version": "1.2.6",
"license": [
"Apache-2.0"
],
"require": {
"amzn/amazon-pay-and-login-with-amazon-core-module": "1.2.5",
"amzn/login-with-amazon-module": "1.2.5",
"amzn/amazon-pay-module": "1.2.5"
"amzn/amazon-pay-and-login-with-amazon-core-module": "1.2.6",
"amzn/login-with-amazon-module": "1.2.6",
"amzn/amazon-pay-module": "1.2.6"
}
}
2 changes: 1 addition & 1 deletion src/Core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amzn/amazon-pay-and-login-with-amazon-core-module",
"description": "Shared functionality for Amazon Pay and Login with Amazon modules",
"type": "magento2-module",
"version": "1.2.5",
"version": "1.2.6",
"license": [
"Apache-2.0"
],
Expand Down
2 changes: 1 addition & 1 deletion src/Core/etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Amazon_Core" setup_version="1.2.5">
<module name="Amazon_Core" setup_version="1.2.6">
<sequence>
<module name="Magento_Store"/>
<module name="Magento_Customer"/>
Expand Down
4 changes: 2 additions & 2 deletions src/Login/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "amzn/login-with-amazon-module",
"description": "Login with Amazon module",
"type": "magento2-module",
"version": "1.2.5",
"version": "1.2.6",
"license": [
"Apache-2.0"
],
"require": {
"amzn/amazon-pay-and-login-with-amazon-core-module": "^1.2.5",
"amzn/amazon-pay-and-login-with-amazon-core-module": "^1.2.6",
"magento/module-customer": "^100.1.0|^101.0.0",
"magento/module-checkout": "^100.1.0|^100.2.0"

Expand Down
6 changes: 3 additions & 3 deletions src/Payment/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "amzn/amazon-pay-module",
"description": "Amazon Pay module",
"type": "magento2-module",
"version": "1.2.5",
"version": "1.2.6",
"license": [
"Apache-2.0"
],
"require": {
"amzn/amazon-pay-and-login-with-amazon-core-module": "^1.2.5",
"amzn/login-with-amazon-module": "^1.2.5",
"amzn/amazon-pay-and-login-with-amazon-core-module": "^1.2.6",
"amzn/login-with-amazon-module": "^1.2.6",
"magento/module-eav": "^100.1.0|^101.0.0",
"magento/module-sales": "^100.1.0|^101.0.0",
"magento/module-quote": "^100.1.0|^101.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define(
$.extend({}, checkoutProvider.get('shippingAddress'), shippingAddressData)
);
});
$("#co-shipping-form").css("display", "none");

checkoutDataResolver.resolveShippingAddress();
}

Expand All @@ -45,7 +45,16 @@ define(
* @private
*/
return function () {
populateShippingForm();
//check to see if user is logged out of amazon (otherwise shipping form won't be in DOM)
if (!amazonStorage.isAmazonAccountLoggedIn) {
populateShippingForm();
}
//subscribe to logout and trigger shippingform population when logged out.
amazonStorage.isAmazonAccountLoggedIn.subscribe(function (loggedIn) {
if (!loggedIn) {
populateShippingForm();
}
});
}
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ define(
'Magento_Checkout/js/model/url-builder',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/checkout-data-resolver',
'uiRegistry',
'Amazon_Payment/js/action/populate-shipping-address'
'uiRegistry'
],
function (
$,
Expand All @@ -40,8 +39,7 @@ define(
urlBuilder,
checkoutData,
checkoutDataResolver,
registry,
populateShippingAddressAction
registry
) {
'use strict';
var self;
Expand Down Expand Up @@ -121,7 +119,6 @@ define(
}
checkoutData.setShippingAddressFromData(addressConverter.quoteAddressToFormAddressData(addressData));
checkoutDataResolver.resolveEstimationAddress();
populateShippingAddressAction();
}
).fail(
function (response) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
define([
'jquery',
'uiComponent',
'ko',
'Amazon_Payment/js/model/storage'
], function ($, Component, ko, amazonStorage) {
], function (Component, ko, amazonStorage) {
'use strict';
return Component.extend({
defaults: {
template: 'Amazon_Payment/shipping-address/inline-form',
formSelector: '#co-shipping-form'
formSelector: 'co-shipping-form'
},
initObservable: function () {
this._super();
Expand All @@ -22,22 +21,9 @@ define([
},
manipulateInlineForm: function () {
if (amazonStorage.isAmazonAccountLoggedIn()) {
var errorCount = 0;
$(this.formSelector).find(".field").each(function () {
if ($(this).hasClass('_error')) {
errorCount ++;
$(this).show();
} else {
$(this).css("display", "none");
}
});
var elem = $(this.formSelector);
var elem = document.getElementById(this.formSelector);
if (elem) {
if (errorCount > 0) {
$(this.formSelector).show();
} else {
$(this.formSelector).hide();
}
document.getElementById(this.formSelector).style.display = 'none';
}
}
}
Expand Down
73 changes: 4 additions & 69 deletions src/Payment/view/frontend/web/js/view/shipping.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ define(
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/action/set-shipping-information',
'Magento_Checkout/js/model/step-navigator',
'Amazon_Payment/js/model/storage',
'Magento_Customer/js/model/address-list',
'Magento_Checkout/js/model/quote'
'Amazon_Payment/js/model/storage'
],
function (
$,
Expand All @@ -20,15 +18,10 @@ define(
customer,
setShippingInformationAction,
stepNavigator,
amazonStorage,
addressList,
quote
amazonStorage
) {
'use strict';
return Component.extend({
isFormInline: ko.observable(addressList().length == 0),
formSelector: '#co-shipping-form',

initialize: function () {
this._super();
this.isNewAddressAdded(amazonStorage.isAmazonAccountLoggedIn());
Expand All @@ -55,12 +48,9 @@ define(
);
}
if (amazonStorage.isAmazonAccountLoggedIn() && customer.isLoggedIn()) {
this.isFormInline(true);
if (this.validateShippingInformation()) {
setShippingInformationAmazon();
}
setShippingInformationAmazon();
} else if (amazonStorage.isAmazonAccountLoggedIn() && !customer.isLoggedIn()) {
if (this.validateGuestEmail() && this.validateShippingInformation()) {
if (this.validateGuestEmail()) {
setShippingInformationAmazon();
}
} else {
Expand All @@ -69,61 +59,6 @@ define(
setShippingInformationAmazon();
}
}
},

validateShippingInformation: function () {
var shippingAddress,
addressData,
loginFormSelector = 'form[data-role=email-with-possible-login]',
emailValidationResult = customer.isLoggedIn();

if (!quote.shippingMethod()) {
this.errorValidationMessage($t('Please specify a shipping method.'));

return false;
}

if (!customer.isLoggedIn()) {
$(loginFormSelector).validation();
emailValidationResult = Boolean($(loginFormSelector + ' input[name=username]').valid());
}

if (this.isFormInline()) {
this.source.set('params.invalid', false);
this.source.trigger('shippingAddress.data.validate');

if (this.source.get('shippingAddress.custom_attributes')) {
this.source.trigger('shippingAddress.custom_attributes.data.validate');
}

if (this.source.get('params.invalid') ||
!quote.shippingMethod().method_code ||
!quote.shippingMethod().carrier_code ||
!emailValidationResult
) {
var errorCount = 0;
$(this.formSelector).find(".field").each(function () {
if ($(this).hasClass('_error')) {
errorCount ++;
$(this).show();
} else {
$(this).css("display", "none");
}
});
var elem = $(this.formSelector);
if (elem) {
if (errorCount > 0) {
$(this.formSelector).show();
} else {
$(this.formSelector).hide();
}
}
return false;
}


}
return this._super();
}
});
}
Expand Down

0 comments on commit 5402c9d

Please sign in to comment.