add disable funding setting // PCP-10

This commit is contained in:
David Remer 2020-04-16 09:29:02 +03:00
parent 6a6e088846
commit d18b60061a
2 changed files with 29 additions and 1 deletions

View file

@ -128,13 +128,17 @@ class SmartButton implements SmartButtonInterface
'integration-date' => date('Y-m-d'),
'components' => 'marks,buttons',
//ToDo: Probably only needed, when DCC
'vault' => 'true',
'vault' => 'false',
'commit' => is_checkout() ? 'true' : 'false',
];
$payee = $this->payeeRepository->payee();
if ($payee->merchantId()) {
$params['merchant-id'] = $payee->merchantId();
}
$disableFunding = $this->settings->get('disable_funding');
if (is_array($disableFunding) && count($disableFunding)) {
$params['disable-funding'] = implode(',', $disableFunding);
}
$smartButtonUrl = add_query_arg($params, 'https://www.paypal.com/sdk/js');
return $smartButtonUrl;
}

View file

@ -131,6 +131,30 @@ class SettingsFields
'rect' => __('Rectangle', 'woocommerce-paypal-gateway'),
],
],
'disable_funding' => [
'title' => __('Disable funding sources', 'woocommerce-paypal-gateway'),
'type' => 'multiselect',
'class' => 'wc-enhanced-select',
'default' => [],
'desc_tip' => true,
'description' => __(
'By default all possible funding sources will be shown. You can disable some sources, if you wish.',
'woocommerce-paypal-gateway'
),
'options' => [
'card' => _x('Credit or debit cards', 'Name of payment method', 'woocommerce-paypal-gateway'),
'credit' => _x('PayPal Credit', 'Name of payment method', 'woocommerce-paypal-gateway'),
'venmo' => _x('Venmo', 'Name of payment method', 'woocommerce-paypal-gateway'),
'sepa' => _x('SEPA-Lastschrift', 'Name of payment method', 'woocommerce-paypal-gateway'),
'bancontact' => _x('Bancontact', 'Name of payment method', 'woocommerce-paypal-gateway'),
'eps' => _x('eps', 'Name of payment method', 'woocommerce-paypal-gateway'),
'giropay' => _x('giropay', 'Name of payment method', 'woocommerce-paypal-gateway'),
'ideal' => _x('iDEAL', 'Name of payment method', 'woocommerce-paypal-gateway'),
'mybank' => _x('MyBank', 'Name of payment method', 'woocommerce-paypal-gateway'),
'p24' => _x('Przelewy24', 'Name of payment method', 'woocommerce-paypal-gateway'),
'sofort' => _x('Sofort', 'Name of payment method', 'woocommerce-paypal-gateway'),
]
]
];
}
}