Skip to content

Commit

Permalink
Merge pull request #162 from johann-lr/payment-option-configuration
Browse files Browse the repository at this point in the history
Add possibility to enable/disable payment options
  • Loading branch information
dimasch authored Jun 18, 2021
2 parents a745bf3 + 37f58b9 commit 760ac89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $ git clone git@github.com:develodesign/vsf-payment-paypal.git ./vue-storefront/
```json
"paypal": {
"clientId": "",
"disabledMethods": ["giropay", "sofort", "card", "credit", "mybank", "sepa"],
"addJsToGlobalHead": true,
"endpoint": {
"complete": "/api/ext/paypal/complete",
Expand Down
3 changes: 2 additions & 1 deletion hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export function beforeRegistration(config, store) {
const storeView = currentStoreView()
const { currencyCode } = storeView.i18n
const clientId = config.paypal.hasOwnProperty('clientId') ? config.paypal.clientId : ''
const sdkUrl = `https://www.paypal.com/sdk/js?client-id=${clientId}&currency=${currencyCode}&disable-funding=card,credit,mybank,sofort`
const disabledPaymentOptions = config.paypal.disabledMethods ? config.paypal.disabledMethods.join(',') : 'card,credit,mybank,sofort'
const sdkUrl = `https://www.paypal.com/sdk/js?client-id=${clientId}&currency=${currencyCode}&disable-funding=${disabledPaymentOptions}`
var script = document.createElement('script')
script.setAttribute('src', sdkUrl)
document.head.appendChild(script)
Expand Down

0 comments on commit 760ac89

Please sign in to comment.