Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
PayPalView.prototype._initialize = function () {
var paypalButton;
BasePaymentMethodView.prototype._initialize.apply(this, arguments);
this._createPayPalButton();
this.model.asyncDependencyStarting();
PayPal.create({client: this.options.client}, function (err, paypalInstance) {
if (err) {
// TODO: handle errors in PayPal creation
console.error(err);
return;
}
this.paypalInstance = paypalInstance;
paypalButton = this.getElementById('paypal-button');
paypalButton.addEventListener('click', this._tokenize.bind(this));
this.model.asyncDependencyReady();
}.bind(this));
};