From 33ad1543860b39f36a71911863f0d4b38b698ddb Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Wed, 14 Mar 2018 17:31:44 +0530 Subject: [PATCH] Express Checkout - JSv4, ref #997 --- assets/js/angelleye-in-context-checkout.js | 5 ----- classes/wc-gateway-paypal-express-angelleye.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/assets/js/angelleye-in-context-checkout.js b/assets/js/angelleye-in-context-checkout.js index 227150e14..9da8c8f4d 100644 --- a/assets/js/angelleye-in-context-checkout.js +++ b/assets/js/angelleye-in-context-checkout.js @@ -79,9 +79,7 @@ request_from: 'JSv4' }; - console.log(params); paypal.request.post(data.returnUrl, params).then(function (res) { - console.log(res); data.returnUrl = res.url; actions.redirect(); }); @@ -178,7 +176,6 @@ var params = { request_from: 'JSv4' }; - console.log(params); return paypal.request.post(data.url, params).then(function (res) { return res.token; }); @@ -191,10 +188,8 @@ token: data.paymentToken, request_from: 'JSv4' }; - console.log(params); paypal.request.post(data.returnUrl, params).then(function (res) { data.returnUrl = res.url; - console.log(res); actions.redirect(); }); }, diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index b60d4b143..0e8451d81 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -400,6 +400,16 @@ function is_funding_icon_should_show_php() { } }).change(); jQuery('#woocommerce_paypal_express_disallowed_funding_methods').change(function () { + if( jQuery.inArray('credit', jQuery('#woocommerce_paypal_express_disallowed_funding_methods').val()) ) { + + if( jQuery("#woocommerce_paypal_express_button_label option[value='credit']").length === 0) { + jQuery('#woocommerce_paypal_express_button_label').append(jQuery("").attr("value","credit").text("Credit")); + } + + } else { + jQuery('#woocommerce_paypal_express_button_label option[value="credit"]').remove(); + } + if( is_funding_icon_should_show_php() === false) { jQuery("#woocommerce_paypal_express_button_fundingicons").closest('tr').hide(); if( jQuery('#woocommerce_paypal_express_button_label').val() !== 'buynow' ) {