mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 04:58:28 +08:00
Consider funding sources for Pay Later preview
This commit is contained in:
parent
fb43730ddb
commit
7a463e10fe
1 changed files with 6 additions and 4 deletions
|
@ -62,7 +62,7 @@ import MessageRenderer from "../../../ppcp-button/resources/js/modules/Renderer/
|
|||
|
||||
function getPaypalScriptSettings() {
|
||||
const disableFundingInput = jQuery('[name="ppcp[disable_funding][]"]');
|
||||
const disabledSources = disableFundingInput.length > 0 ? disableFundingInput.val() : PayPalCommerceGatewaySettings.disabled_sources;
|
||||
let disabledSources = disableFundingInput.length > 0 ? disableFundingInput.val() : PayPalCommerceGatewaySettings.disabled_sources;
|
||||
const isPayLaterButtonEnabled = payLaterButtonInput ? payLaterButtonInput.checked : PayPalCommerceGatewaySettings.is_pay_later_button_enabled
|
||||
const settings = {
|
||||
'client-id': PayPalCommerceGatewaySettings.client_id,
|
||||
|
@ -72,13 +72,15 @@ import MessageRenderer from "../../../ppcp-button/resources/js/modules/Renderer/
|
|||
'enable-funding': ['venmo', 'paylater'],
|
||||
'buyer-country': PayPalCommerceGatewaySettings.country,
|
||||
};
|
||||
|
||||
if (!isPayLaterButtonEnabled) {
|
||||
disabledSources = disabledSources.concat('credit')
|
||||
}
|
||||
|
||||
if (disabledSources?.length) {
|
||||
settings['disable-funding'] = disabledSources;
|
||||
}
|
||||
|
||||
if (!isPayLaterButtonEnabled) {
|
||||
settings['disable-funding'] = 'credit';
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue