-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app): restored code to libs/payments.js
- Loading branch information
1 parent
503fd93
commit 7d0ce8a
Showing
1 changed file
with
14 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
// import getStore from '@/store'; | ||
import getStore from '@/store'; | ||
|
||
export function setup () { // eslint-disable-line import/prefer-default-export | ||
// const store = getStore(); | ||
const store = getStore(); | ||
|
||
// // Set Amazon Payments as ready in the store, | ||
// // Added here to make sure the listener is registered before the script can be executed | ||
// window.onAmazonLoginReady = () => { | ||
// store.state.isAmazonReady = true; | ||
// window.amazon.Login.setClientId(process.env.AMAZON_PAYMENTS_CLIENT_ID); | ||
// }; | ||
window.onAmazonLoginReady = () => { | ||
store.state.isAmazonReady = true; | ||
window.amazon.Login.setClientId(process.env.AMAZON_PAYMENTS_CLIENT_ID); | ||
}; | ||
|
||
// Load the scripts | ||
|
||
// Amazon Payments | ||
// const amazonScript = document.createElement('script'); | ||
// let firstScript = document.getElementsByTagName('script')[0]; | ||
// amazonScript.type = 'text/javascript'; | ||
// amazonScript.async = true; | ||
// amazonScript.src = `https://static-na.payments-amazon.com/OffAmazonPayments/us/${(process.env.AMAZON_PAYMENTS_MODE === 'sandbox' ? 'sandbox/' : '')}js/Widgets.js`; | ||
// firstScript.parentNode.insertBefore(amazonScript, firstScript); | ||
const amazonScript = document.createElement('script'); | ||
let firstScript = document.getElementsByTagName('script')[0]; | ||
amazonScript.type = 'text/javascript'; | ||
amazonScript.async = true; | ||
amazonScript.src = `https://static-na.payments-amazon.com/OffAmazonPayments/us/${(process.env.AMAZON_PAYMENTS_MODE === 'sandbox' ? 'sandbox/' : '')}js/Widgets.js`; | ||
firstScript.parentNode.insertBefore(amazonScript, firstScript); | ||
|
||
// Stripe | ||
const stripeScript = document.createElement('script'); | ||
// [firstScript] = document.getElementsByTagName('script'); | ||
[firstScript] = document.getElementsByTagName('script'); | ||
stripeScript.async = true; | ||
stripeScript.src = 'https://js.stripe.com/v3/'; | ||
// firstScript.parentNode.insertBefore(stripeScript, firstScript); | ||
firstScript.parentNode.insertBefore(stripeScript, firstScript); | ||
} |