Skip to content

Commit

Permalink
feat(common): PAYPAL-7 Pass in merchant ID on PayPal button script fo…
Browse files Browse the repository at this point in the history
…r PayPal Express Checkout

- CR fixes
  • Loading branch information
bc-fetisov committed Oct 22, 2019
1 parent fc9e7c9 commit bdfbcd5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/script-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ export default class ScriptLoader {
if (!this._scripts[src]) {
this._scripts[src] = new Promise((resolve, reject) => {
const script = document.createElement('script') as LegacyHTMLScriptElement;
const { async = false } = options || {};
const scriptAttributes = options && options.attributes;
const { async = false, attributes = {} } = options || {};

for (const key in scriptAttributes) {
if (scriptAttributes.hasOwnProperty(key)) {
script.setAttribute(key, scriptAttributes[key]);
}
}
Object.keys(attributes)
.forEach(key => {
script.setAttribute(key, attributes[key]);
});

script.onload = () => resolve();
script.onreadystatechange = () => resolve();
Expand Down

0 comments on commit bdfbcd5

Please sign in to comment.