From 1b64033ae45785406633021d233efc05f278f4b4 Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Wed, 21 Feb 2018 16:27:55 +0530 Subject: [PATCH] Express Checkout - JSv4, ref #997 --- ...ateway-paypal-express-helper-angelleye.php | 3 ++ assets/js/angelleye-admin.js | 16 +++--- assets/js/angelleye-in-context-checkout.js | 3 +- .../wc-gateway-paypal-express-angelleye.php | 49 ++++++++++++------- 4 files changed, 46 insertions(+), 25 deletions(-) diff --git a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php index b111accc9..cbd4e5b54 100644 --- a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php +++ b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php @@ -463,6 +463,9 @@ public function ec_enqueue_scripts_product_page() { $this->button_size = 'medium'; } } + if($this->button_label == 'credit') { + $this->button_color = ''; + } $js_value = array('is_page_name' => '', 'enable_in_context_checkout_flow' => ( $this->enable_in_context_checkout_flow == 'yes' ? 'yes' : 'no')); if ($this->angelleye_is_in_context_enable() == true && ( is_checkout() || is_product() || is_cart())) { wp_enqueue_script('angelleye-in-context-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true); diff --git a/assets/js/angelleye-admin.js b/assets/js/angelleye-admin.js index f4c91c3c1..c1af50e0b 100644 --- a/assets/js/angelleye-admin.js +++ b/assets/js/angelleye-admin.js @@ -330,12 +330,16 @@ jQuery(document).ready(function ($) { if(angelleye_layout === 'vertical') { - angelleye_label = ''; - angelleye_tagline = ''; - if( angelleye_size === 'small' ) { - angelleye_size = 'medium'; - } - } + angelleye_label = ''; + angelleye_tagline = ''; + if( angelleye_size === 'small' ) { + angelleye_size = 'medium'; + } + } + + if(angelleye_label === 'credit') { + angelleye_color = ''; + } diff --git a/assets/js/angelleye-in-context-checkout.js b/assets/js/angelleye-in-context-checkout.js index ac66ef889..bbc6d613c 100644 --- a/assets/js/angelleye-in-context-checkout.js +++ b/assets/js/angelleye-in-context-checkout.js @@ -29,7 +29,8 @@ allowed: JSON.parse(angelleye_in_content_param.allowed_funding_methods) }, client: { - sandbox: angelleye_in_content_param.payer_id + sandbox: angelleye_in_content_param.payer_id, + production: angelleye_in_content_param.payer_id }, payment: function () { $(selector).block({ diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index 2d599787d..ec94c5249 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -280,6 +280,18 @@ function callback_onsuccess_production(containerId) { jQuery('#woocommerce_paypal_express_pending_authorization_order_status').closest('tr').hide(); } }).change(); + + jQuery('#woocommerce_paypal_express_button_label').change(function () { + if ( this.value === 'credit' ) { + jQuery('#woocommerce_paypal_express_button_color').closest('tr').hide(); + } else { + jQuery('#woocommerce_paypal_express_button_color').closest('tr').show(); + + } + }).change(); + + + var display_disable_terms = ""; jQuery("#woocommerce_paypal_express_skip_final_review").prop("checked", false); @@ -865,15 +877,32 @@ public function init_form_fields() { 'title' => __('Button Size', 'paypal-for-woocommerce'), 'type' => 'select', 'class' => 'wc-enhanced-select in_context_checkout_part', - 'description' => __('Type of PayPal Button Size (small | medium | responsive).', 'paypal-for-woocommerce'), + 'description' => __('Type of PayPal Button Size (small | medium | large | responsive).', 'paypal-for-woocommerce'), 'default' => 'medium', 'desc_tip' => true, 'options' => array( 'small' => __('Small', 'paypal-for-woocommerce'), 'medium' => __('Medium', 'paypal-for-woocommerce'), + 'large' => __('Large', 'paypal-for-woocommerce'), 'responsive' => __('Responsive', 'paypal-for-woocommerce'), ), ), + 'button_label' => array( + 'title' => __('Button Label', 'paypal-for-woocommerce'), + 'type' => 'select', + 'class' => 'wc-enhanced-select in_context_checkout_part', + 'description' => __('Type of PayPal Button Label (checkout | credit | pay | buynow | paypal).', 'paypal-for-woocommerce'), + 'default' => 'checkout', + 'desc_tip' => true, + 'options' => array( + 'checkout' => __('Checkout', 'paypal-for-woocommerce'), + 'credit' => __('Credit', 'paypal-for-woocommerce'), + 'pay' => __('Pay', 'paypal-for-woocommerce'), + 'buynow' => __('Buynow', 'paypal-for-woocommerce'), + 'paypal' => __('Paypal', 'paypal-for-woocommerce') + + ), + ), 'button_color' => array( 'title' => __('Button Color', 'paypal-for-woocommerce'), 'type' => 'select', @@ -899,22 +928,6 @@ public function init_form_fields() { 'rect' => __('Rect', 'paypal-for-woocommerce') ), ), - 'button_label' => array( - 'title' => __('Button Label', 'paypal-for-woocommerce'), - 'type' => 'select', - 'class' => 'wc-enhanced-select in_context_checkout_part', - 'description' => __('Type of PayPal Button Label (checkout | credit | pay | buynow | paypal).', 'paypal-for-woocommerce'), - 'default' => 'checkout', - 'desc_tip' => true, - 'options' => array( - 'checkout' => __('Checkout', 'paypal-for-woocommerce'), - 'credit' => __('Credit', 'paypal-for-woocommerce'), - 'pay' => __('Pay', 'paypal-for-woocommerce'), - 'buynow' => __('Buynow', 'paypal-for-woocommerce'), - 'paypal' => __('Paypal', 'paypal-for-woocommerce') - - ), - ), 'button_tagline' => array( 'title' => __('Button Tagline ', 'paypal-for-woocommerce'), 'type' => 'select', @@ -931,7 +944,7 @@ public function init_form_fields() { 'title' => __('', 'paypal-for-woocommerce'), 'type' => 'title', 'class' => '', - 'description' => '
Wow
Wow
', + 'description' => '
', ), );