Skip to content
Snippets Groups Projects
Commit 78bee8b0 authored by Iurii Ivashchenko's avatar Iurii Ivashchenko
Browse files

Merge branch 'MAGETWO-58670' into MPI-PR-bugfixes

parents 12602c40 1986c70a
Branches
No related merge requests found
......@@ -25,6 +25,9 @@ define(
) {
'use strict';
// State of PayPal module initialization
var clientInit = false;
return Component.extend({
defaults: {
......@@ -93,15 +96,26 @@ define(
* @returns {Object}
*/
initClient: function () {
var selector = '#' + this.getButtonId();
_.each(this.clientConfig, function (fn, name) {
if (typeof fn === 'function') {
this.clientConfig[name] = fn.bind(this);
}
}, this);
domObserver.get('#' + this.getButtonId(), function () {
paypalExpressCheckout.checkout.setup(this.merchantId, this.clientConfig);
}.bind(this));
if (!clientInit) {
domObserver.get(selector, function () {
paypalExpressCheckout.checkout.setup(this.merchantId, this.clientConfig);
clientInit = true;
domObserver.off(selector);
}.bind(this));
} else {
domObserver.get(selector, function () {
$(selector).on('click', this.clientConfig.click);
domObserver.off(selector);
}.bind(this));
}
return this;
},
......
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