diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 720848b9..b233c7f6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,6 +14,12 @@ on: pull_request: branches: [master, dev] + paths-ignore: + - '.github/**' + - 'docs/**' + - 'build/**' + - 'README.md' + - 'LICENSE' jobs: ci: diff --git a/assets/js/account/account-profile-update.js b/assets/js/account/account-profile-update.js index 7e78f7ee..b75546bf 100644 --- a/assets/js/account/account-profile-update.js +++ b/assets/js/account/account-profile-update.js @@ -42,7 +42,10 @@ angular.module('storefront.account') .then(function (result) { if (!result.succeeded) { $ctrl.phoneNumber = null; + } else { + $ctrl.customer.phoneNumber = $ctrl.phoneNumber; } + }); }; @@ -50,6 +53,7 @@ angular.module('storefront.account') $ctrl.accountManager.deletePhoneNumber().then(function (result) { if (result.succeeded) { $ctrl.phoneNumber = null; + $ctrl.customer.phoneNumber = null; } }); }; @@ -66,6 +70,7 @@ angular.module('storefront.account') } if (result.succeeded) { $ctrl.twoFactorEnabled = toogledTwoFactorEnabledValue; + $ctrl.customer.twoFactorEnabled = toogledTwoFactorEnabledValue; } }); }; diff --git a/assets/js/account/account-profile-update.tpl.liquid b/assets/js/account/account-profile-update.tpl.liquid index 2bf845ac..ff0eba1a 100644 --- a/assets/js/account/account-profile-update.tpl.liquid +++ b/assets/js/account/account-profile-update.tpl.liquid @@ -11,7 +11,7 @@
- + Invalid phone number
diff --git a/assets/js/checkout/checkout-shippingMethods.js b/assets/js/checkout/checkout-shippingMethods.js index 6b35f4fa..b3d3f892 100644 --- a/assets/js/checkout/checkout-shippingMethods.js +++ b/assets/js/checkout/checkout-shippingMethods.js @@ -8,7 +8,8 @@ storefrontApp.component('vcCheckoutShippingMethods', { bindings: { shipment: '=', getAvailShippingMethods: '&', - onSelectShippingMethod: '&' + onSelectShippingMethod: '&', + loading: '=' }, controller: [function () { @@ -42,8 +43,11 @@ storefrontApp.component('vcCheckoutShippingMethods', { } ctrl.selectMethod = function (method) { - ctrl.selectedMethod = method; - ctrl.onSelectShippingMethod({ shippingMethod: method }); + if (!ctrl.loading) + { + ctrl.selectedMethod = method; + ctrl.onSelectShippingMethod({ shippingMethod: method }); + } }; ctrl.validate = function () { diff --git a/assets/js/checkout/checkout-shippingMethods.tpl.liquid b/assets/js/checkout/checkout-shippingMethods.tpl.liquid index 5f47d132..7ff4dc3e 100644 --- a/assets/js/checkout/checkout-shippingMethods.tpl.liquid +++ b/assets/js/checkout/checkout-shippingMethods.tpl.liquid @@ -6,7 +6,7 @@
-
+
diff --git a/assets/js/checkout/checkout.js b/assets/js/checkout/checkout.js index d33babb3..ef6b69ee 100644 --- a/assets/js/checkout/checkout.js +++ b/assets/js/checkout/checkout.js @@ -56,7 +56,7 @@ angular.module(moduleName, ['credit-cards', 'angular.filter']) } } } - $scope.checkout.billingAddressEqualsShipping = cart.hasPhysicalProducts && !angular.isObject($scope.checkout.payment.billingAddress); + $scope.checkout.billingAddressEqualsShipping = cart.hasPhysicalProducts && (!angular.isObject($scope.checkout.payment.billingAddress) || $scope.checkout.shipment.deliveryAddress.type === 'BillingAndShipping'); $scope.checkout.canCartBeRecurring = $scope.customer.isRegisteredUser && _.all(cart.items, function(x) { return !x.isReccuring }); @@ -103,15 +103,6 @@ angular.module(moduleName, ['credit-cards', 'angular.filter']) }); } - $scope.selectPaymentMethod = function(paymentMethod) { - angular.extend($scope.checkout.payment, paymentMethod); - $scope.checkout.payment.paymentGatewayCode = paymentMethod.code; - $scope.checkout.payment.amount = angular.copy($scope.checkout.cart.total); - $scope.checkout.payment.amount.amount += paymentMethod.totalWithTax.amount; - - updatePayment($scope.checkout.payment); - }; - function getAvailCountries() { //Load avail countries return cartService.getCountries().then(function(response) { @@ -154,24 +145,43 @@ angular.module(moduleName, ['credit-cards', 'angular.filter']) }; $scope.updateShipment = function(shipment) { + return updateShipmentAndReloadCart(shipment, true); + } + + function updateShipmentWithoutReloadCart(shipment) { + return updateShipmentAndReloadCart(shipment, false); + } + + function updateShipmentAndReloadCart(shipment, reloadCart) { if (shipment.deliveryAddress) { - $scope.checkout.shipment.deliveryAddress.type = 'Shipping'; + if ($scope.checkout.billingAddressEqualsShipping) { + $scope.checkout.shipment.deliveryAddress.type = 'BillingAndShipping'; + } + else { + $scope.checkout.shipment.deliveryAddress.type = 'Shipping'; + } }; //Does not pass validation errors to API shipment.validationErrors = undefined; return wrapLoading(function() { - return cartService.addOrUpdateShipment(shipment).then($scope.reloadCart); + if (reloadCart) { + return cartService.addOrUpdateShipment(shipment).then($scope.reloadCart); + } else { + return cartService.addOrUpdateShipment(shipment); + } }); }; $scope.createOrder = function() { - updatePayment($scope.checkout.payment).then(function() { - $scope.checkout.loading = true; - cartService.createOrder($scope.checkout.paymentMethod.card || []).then(function(response) { - var order = response.data.order; - var orderProcessingResult = response.data.orderProcessingResult; - var paymentMethod = response.data.paymentMethod; - handlePostPaymentResult(order, orderProcessingResult, paymentMethod); + updatePaymentWithoutReloadCart($scope.checkout.payment).then(function() { + updateShipmentWithoutReloadCart($scope.checkout.shipment).then(function() { + $scope.checkout.loading = true; + cartService.createOrder($scope.checkout.paymentMethod.card || []).then(function(response) { + var order = response.data.order; + var orderProcessingResult = response.data.orderProcessingResult; + var paymentMethod = response.data.paymentMethod; + handlePostPaymentResult(order, orderProcessingResult, paymentMethod); + }); }); }); }; @@ -198,16 +208,42 @@ angular.module(moduleName, ['credit-cards', 'angular.filter']) } }; + $scope.selectPaymentMethod = function(paymentMethod) { + angular.extend($scope.checkout.payment, paymentMethod); + $scope.checkout.payment.paymentGatewayCode = paymentMethod.code; + $scope.checkout.payment.amount = angular.copy($scope.checkout.cart.total); + $scope.checkout.payment.amount.amount += paymentMethod.totalWithTax.amount; + + updatePayment($scope.checkout.payment); + }; + function updatePayment(payment) { + return updatePaymentAndReloadCart(payment, true); + } + + function updatePaymentWithoutReloadCart(payment) { + return updatePaymentAndReloadCart(payment, false); + } + + function updatePaymentAndReloadCart(payment, reloadCart) { if ($scope.checkout.billingAddressEqualsShipping) { - payment.billingAddress = undefined; + if ($scope.checkout.shipment.deliveryAddress.type === 'BillingAndShipping') + { + payment.billingAddress = angular.copy($scope.checkout.shipment.deliveryAddress); + } + else { + payment.billingAddress = undefined; + } } - - if (payment.billingAddress) { - payment.billingAddress.type = 'Billing'; + else if (payment.billingAddress) { + payment.billingAddress.type = 'Billing'; } return wrapLoading(function() { - return cartService.addOrUpdatePayment(payment).then($scope.reloadCart); + if (reloadCart) { + return cartService.addOrUpdatePayment(payment).then($scope.reloadCart); + } else { + return cartService.addOrUpdatePayment(payment); + } }); } diff --git a/package.json b/package.json index 149fbde1..c1831e77 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "2.1.10", + "version": "2.1.11", "name": "vc-theme-default", "author": "VirtoCommerce", "description": "Default theme for Storefront", diff --git a/templates/checkout.liquid b/templates/checkout.liquid index ed531957..3c2b74f2 100644 --- a/templates/checkout.liquid +++ b/templates/checkout.liquid @@ -101,7 +101,7 @@

{{ 'checkout.shipping_method.title' | t }}

- +
diff --git a/templates/customers/forgot_password_code.liquid b/templates/customers/forgot_password_code.liquid index 4e68c6b2..6fbfa140 100644 --- a/templates/customers/forgot_password_code.liquid +++ b/templates/customers/forgot_password_code.liquid @@ -3,8 +3,8 @@
- {% form 'forgot_password_code' %} - +
+

{{ 'customer.forgot_password_code.title' | t }}

@@ -20,7 +20,7 @@
- {% endform %} +
\ No newline at end of file diff --git a/templates/json-preview.liquid b/templates/json-preview.liquid index 61057216..c5623725 100644 --- a/templates/json-preview.liquid +++ b/templates/json-preview.liquid @@ -2,7 +2,7 @@