Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
akak1977 committed Sep 16, 2020
2 parents 309922c + 771c40d commit fa416ec
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ on:
pull_request:
branches:
[master, dev]
paths-ignore:
- '.github/**'
- 'docs/**'
- 'build/**'
- 'README.md'
- 'LICENSE'

jobs:
ci:
Expand Down
5 changes: 5 additions & 0 deletions assets/js/account/account-profile-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ angular.module('storefront.account')
.then(function (result) {
if (!result.succeeded) {
$ctrl.phoneNumber = null;
} else {
$ctrl.customer.phoneNumber = $ctrl.phoneNumber;
}

});
};

$ctrl.deletePhoneNumber = function () {
$ctrl.accountManager.deletePhoneNumber().then(function (result) {
if (result.succeeded) {
$ctrl.phoneNumber = null;
$ctrl.customer.phoneNumber = null;
}
});
};
Expand All @@ -66,6 +70,7 @@ angular.module('storefront.account')
}
if (result.succeeded) {
$ctrl.twoFactorEnabled = toogledTwoFactorEnabledValue;
$ctrl.customer.twoFactorEnabled = toogledTwoFactorEnabledValue;
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion assets/js/account/account-profile-update.tpl.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</button>
</form>
<form name="phone">
<vc-labeled-input name="PhoneNumber" placeholder="{{ 'contact.form.phone' | t }}" value="$ctrl.phoneNumber" ng-model="$ctrl.phoneNumber" ng-pattern="/^[+]?[0-9]?[(]?[0-9]{0,3}[)]?[0-9]{0,7}$/" ng-class="{'form-group error': phone.$invalid}"></vc-labeled-input>
<vc-labeled-input name="PhoneNumber" placeholder="{{ 'contact.form.phone' | t }}" value="$ctrl.phoneNumber" ng-model="$ctrl.phoneNumber" ng-pattern="/^[+]?[0-9]?[(]?[0-9]{0,4}[)]?[0-9]{0,8}$/" ng-class="{'form-group error': phone.$invalid}"></vc-labeled-input>
<span ng-if="phone.$invalid" ng-class="{'form-error': phone.$invalid}">Invalid phone number</span>
</form>
<div>
Expand Down
10 changes: 7 additions & 3 deletions assets/js/checkout/checkout-shippingMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ storefrontApp.component('vcCheckoutShippingMethods', {
bindings: {
shipment: '=',
getAvailShippingMethods: '&',
onSelectShippingMethod: '&'
onSelectShippingMethod: '&',
loading: '='
},
controller: [function () {

Expand Down Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/checkout/checkout-shippingMethods.tpl.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
<div class="content-box" ng-repeat="(key, value) in $ctrl.availShippingMethods | groupBy: 'shipmentMethodCode' ">
<div class="content-box__row" ng-repeat="method in value">
<div class="radio-wrapper">
<div class="radio-wrapper" ng-class="{ 'disabled': $ctrl.loading }" ng-disabled="$ctrl.loading">
<div class="radio__input">
<input class="input-radio" id="{% raw %}{{ method.id }}{% endraw %}" name="ShipmentMethodCode" type="radio" required="required" ng-value="method" ng-model="$ctrl.selectedMethod" ng-change="$ctrl.selectMethod(method)" />
</div>
Expand Down
84 changes: 60 additions & 24 deletions assets/js/checkout/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
});
});
});
};
Expand All @@ -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);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.1.10",
"version": "2.1.11",
"name": "vc-theme-default",
"author": "VirtoCommerce",
"description": "Default theme for Storefront",
Expand Down
2 changes: 1 addition & 1 deletion templates/checkout.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<h2 class="section__title">{{ 'checkout.shipping_method.title' | t }}</h2>
</div>
<div class="section__content">
<vc-checkout-shipping-methods shipment="checkout.shipment" on-select-shipping-method="selectShippingMethod(shippingMethod)" get-avail-shipping-methods="getAvailShippingMethods(checkout.shipment)"></vc-checkout-shipping-methods>
<vc-checkout-shipping-methods loading="checkout.loading" shipment="checkout.shipment" on-select-shipping-method="selectShippingMethod(shippingMethod)" get-avail-shipping-methods="getAvailShippingMethods(checkout.shipment)"></vc-checkout-shipping-methods>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/customers/forgot_password_code.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<div class="grid">
<div class="grid-item large--one-third push--large--one-third">

{% form 'forgot_password_code' %}

<form accept-charset="UTF-8" action="{{ '~/account/forgotpasswordbycode' | absolute_url }}" method="post" id="recover_customer_password" name="recover_customer_password">
<input type="hidden" value="{{ form.email }}" name="customer[email]">

<h1>{{ 'customer.forgot_password_code.title' | t }}</h1>
Expand All @@ -20,7 +20,7 @@
<input type="submit" class="btn" value="{{ 'customer.forgot_password_code.submit' | t }}">
</div>

{% endform %}
</form>

</div>
</div>
2 changes: 1 addition & 1 deletion templates/json-preview.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<script>
var platformUrl = window.location.search.substr(1).split('&').find(q => q.startsWith('ep=')).substr(3);
var relativeUrl = (platformUrl.endsWith('/') ? '' : '/') + 'Modules/VirtoCommerce.PageBuilderModule/Content/store/designer.bundle.js';
var relativeUrl = (platformUrl.endsWith('/') ? '' : '/') + 'Modules/$(VirtoCommerce.PageBuilderModule)/Content/store/designer.bundle.js';
var script = document.createElement("script");
script.type = "text/javascript";
script.src = platformUrl + relativeUrl;
Expand Down

0 comments on commit fa416ec

Please sign in to comment.