We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit f354e475 authored by Rik ter Beek's avatar Rik ter Beek

minor fixes optimalizations

parent 1b91df43
...@@ -42,7 +42,7 @@ define( ...@@ -42,7 +42,7 @@ define(
var brandCode = ko.observable(null); var brandCode = ko.observable(null);
var paymentMethod = ko.observable(null); var paymentMethod = ko.observable(null);
var dfValue = ko.observable(null); var dfValue = ko.observable(null);
var messageComponents;
return Component.extend({ return Component.extend({
self: this, self: this,
defaults: { defaults: {
...@@ -128,35 +128,33 @@ define( ...@@ -128,35 +128,33 @@ define(
document.body.appendChild(dfScriptTag); document.body.appendChild(dfScriptTag);
waitForDfSet(); waitForDfSet();
// create component needs to be in initialize method
var messageComponents = {};
_.map(response, function (value) {
var messageContainer = new Messages();
var name = 'messages-' + value.brandCode;
var messagesComponent = {
parent: self.name,
name: 'messages-' + value.brandCode,
displayArea: 'messages-' + value.brandCode,
component: 'Magento_Ui/js/view/messages',
config: {
messageContainer: messageContainer
}
};
layout([messagesComponent]);
messageComponents[name] = messageContainer;
});
self.messageComponents = messageComponents;
fullScreenLoader.stopLoader(); fullScreenLoader.stopLoader();
} }
).fail(function (error) { ).fail(function (error) {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
fullScreenLoader.stopLoader(); fullScreenLoader.stopLoader();
}); });
// create component needs to be in initialize method
var messageComponents = {};
var paymentMethods = adyenPaymentService.getAvailablePaymentMethods();
_.map(paymentMethods, function (value) {
var messageContainer = new Messages();
var name = 'messages-' + value.brandCode;
var messagesComponent = {
parent: self.name,
name: 'messages-' + value.brandCode,
displayArea: 'messages-' + value.brandCode,
component: 'Magento_Ui/js/view/messages',
config: {
messageContainer: messageContainer
}
};
layout([messagesComponent]);
messageComponents[name] = messageContainer;
});
this.messageComponents = messageComponents;
}, },
getAdyenHppPaymentMethods: function () { getAdyenHppPaymentMethods: function () {
var self = this; var self = this;
...@@ -320,7 +318,6 @@ define( ...@@ -320,7 +318,6 @@ define(
this.isPlaceOrderActionAllowed(false); this.isPlaceOrderActionAllowed(false);
fullScreenLoader.startLoader(); fullScreenLoader.startLoader();
$.when( $.when(
placeOrderAction(data, messageContainer) placeOrderAction(data, messageContainer)
).fail( ).fail(
......
...@@ -297,21 +297,12 @@ define( ...@@ -297,21 +297,12 @@ define(
self.expiry(true); self.expiry(true);
return true; return true;
}, },
getRegion: function (name) {
self.getRegion(name);
},
getMessageName: function () { getMessageName: function () {
return 'messages-' + value.reference_id; return 'messages-' + value.reference_id;
}, },
getMessageContainer: function () { getMessageContainer: function () {
return messageContainer; return messageContainer;
}, },
/**
* @return {String}
*/
getBillingAddressFormName: function () {
return 'billing-address-form-' + self.item.method;
}
} }
}); });
return paymentList; return paymentList;
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<!--/ko--> <!--/ko-->
<div class="payment-method-billing-address"> <div class="payment-method-billing-address">
<!-- ko foreach: $parents[1].getRegion(getBillingAddressFormName()) --> <!-- ko foreach: $parents[1].getRegion($parent.getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko --> <!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko--> <!--/ko-->
</div> </div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment