WooCommerce PayPal Express Checkout Payment Gateway - Version 1.0.4

Version Description

  • Fix - Wrong section slug / tab after redirected from connect.woocommerce.com
  • Fix - Make sure to check if credentials were set in cart and checkout pages
  • Fix - Removed configuration of chipers to use for TLS
Download this release

Release Info

Developer akeda
Plugin Icon 128x128 WooCommerce PayPal Express Checkout Payment Gateway
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

includes/abstracts/abstract-wc-gateway-ppec-client-credential.php CHANGED
@@ -122,6 +122,5 @@ abstract class WC_Gateway_PPEC_Client_Credential {
122
  */
123
  public function configure_curl( $handle, $r, $url ) {
124
  curl_setopt( $handle, CURLOPT_CAINFO, wc_gateway_ppec()->includes_path . 'pem/bundle.pem' );
125
- curl_setopt( $handle, CURLOPT_SSL_CIPHER_LIST, 'TLSv1' );
126
  }
127
  }
122
  */
123
  public function configure_curl( $handle, $r, $url ) {
124
  curl_setopt( $handle, CURLOPT_CAINFO, wc_gateway_ppec()->includes_path . 'pem/bundle.pem' );
 
125
  }
126
  }
includes/abstracts/abstract-wc-gateway-ppec.php CHANGED
@@ -846,4 +846,23 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
846
  return parent::get_transaction_url( $order );
847
  }
848
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  }
846
  return parent::get_transaction_url( $order );
847
  }
848
 
849
+ /**
850
+ * Check if this gateway is enabled.
851
+ *
852
+ * @return bool
853
+ */
854
+ public function is_available() {
855
+ $settings = wc_gateway_ppec()->settings->loadSettings();
856
+ if ( ! $settings->enabled ) {
857
+ return false;
858
+ }
859
+
860
+ $api_credentials = $settings->getActiveApiCredentials();
861
+ if ( ! is_callable( array( $api_credentials, 'get_payer_id' ) ) ) {
862
+ return false;
863
+ }
864
+
865
+ return true;
866
+ }
867
+
868
  }
includes/class-wc-gateway-ppec-admin-handler.php CHANGED
@@ -214,17 +214,14 @@ class WC_Gateway_PPEC_Admin_Handler {
214
  /**
215
  * Get admin URL for this gateway setting.
216
  *
 
 
217
  * @return string URL
218
  */
219
  public function gateway_admin_url( $gateway_class ) {
220
- return add_query_arg(
221
- array(
222
- 'page' => 'wc-settings',
223
- 'tab' => 'checkout',
224
- 'section' => strtolower( $gateway_class ),
225
- ),
226
- admin_url( 'admin.php' )
227
- );
228
  }
229
 
230
  /**
214
  /**
215
  * Get admin URL for this gateway setting.
216
  *
217
+ * @deprecated
218
+ *
219
  * @return string URL
220
  */
221
  public function gateway_admin_url( $gateway_class ) {
222
+ _deprecated_function( 'WC_Gateway_PPEC_Admin_Handler::gateway_admin_url', '1.0.4', 'wc_gateway_ppec()->get_admin_setting_link' );
223
+
224
+ return wc_gateway_ppec()->get_admin_setting_link();
 
 
 
 
 
225
  }
226
 
227
  /**
includes/class-wc-gateway-ppec-cart-handler.php CHANGED
@@ -61,13 +61,18 @@ class WC_Gateway_PPEC_Cart_Handler {
61
  return;
62
  }
63
 
 
 
 
 
 
64
  if ( version_compare( WC()->version, '2.3', '>' ) ) {
65
  $class = 'woo_pp_cart_buttons_div';
66
  } else {
67
  $class = 'woo_pp_checkout_buttons_div';
68
  }
69
 
70
- if ( $settings->enableInContextCheckout && $settings->getActiveApiCredentials()->get_payer_id() ) {
71
  $class .= ' paypal-button-hidden';
72
  }
73
 
@@ -102,8 +107,8 @@ class WC_Gateway_PPEC_Cart_Handler {
102
  </div>
103
 
104
  <?php
105
- if ( $settings->enableInContextCheckout && $settings->getActiveApiCredentials()->get_payer_id() ) {
106
- $payer_id = $settings->getActiveApiCredentials()->get_payer_id();
107
  $setup_args = array(
108
  // 'button' => array( 'woo_pp_ec_button', 'woo_pp_ppc_button' ),
109
  'buttons' => array(
@@ -130,13 +135,21 @@ class WC_Gateway_PPEC_Cart_Handler {
130
  return;
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
133
  wp_enqueue_style( 'wc-gateway-ppec-frontend-cart', wc_gateway_ppec()->plugin_url . 'assets/css/wc-gateway-ppec-frontend-cart.css' );
134
 
135
- $settings = wc_gateway_ppec()->settings->loadSettings();
136
- if ( $settings->enabled && $settings->enableInContextCheckout && $settings->getActiveApiCredentials()->get_payer_id() ) {
137
  wp_enqueue_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
138
  }
139
-
140
  }
141
 
142
  /**
61
  return;
62
  }
63
 
64
+ $api_credentials = $settings->getActiveApiCredentials();
65
+ if ( ! is_callable( array( $api_credentials, 'get_payer_id' ) ) ) {
66
+ return;
67
+ }
68
+
69
  if ( version_compare( WC()->version, '2.3', '>' ) ) {
70
  $class = 'woo_pp_cart_buttons_div';
71
  } else {
72
  $class = 'woo_pp_checkout_buttons_div';
73
  }
74
 
75
+ if ( $settings->enableInContextCheckout ) {
76
  $class .= ' paypal-button-hidden';
77
  }
78
 
107
  </div>
108
 
109
  <?php
110
+ if ( $settings->enableInContextCheckout ) {
111
+ $payer_id = $api_credentials->get_payer_id();
112
  $setup_args = array(
113
  // 'button' => array( 'woo_pp_ec_button', 'woo_pp_ppc_button' ),
114
  'buttons' => array(
135
  return;
136
  }
137
 
138
+ $settings = wc_gateway_ppec()->settings->loadSettings();
139
+ if ( ! $settings->enabled ) {
140
+ return;
141
+ }
142
+
143
+ $api_credentials = $settings->getActiveApiCredentials();
144
+ if ( ! is_callable( array( $api_credentials, 'get_payer_id' ) ) ) {
145
+ return;
146
+ }
147
+
148
  wp_enqueue_style( 'wc-gateway-ppec-frontend-cart', wc_gateway_ppec()->plugin_url . 'assets/css/wc-gateway-ppec-frontend-cart.css' );
149
 
150
+ if ( $settings->enableInContextCheckout ) {
 
151
  wp_enqueue_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
152
  }
 
153
  }
154
 
155
  /**
includes/class-wc-gateway-ppec-checkout-handler.php CHANGED
@@ -205,8 +205,16 @@ class WC_Gateway_PPEC_Checkout_Handler {
205
  */
206
  public function after_checkout_form() {
207
  $settings = wc_gateway_ppec()->settings->loadSettings();
 
 
 
208
 
209
- if ( $settings->enabled && $settings->enableInContextCheckout && $settings->getActiveApiCredentials()->get_payer_id() ) {
 
 
 
 
 
210
  $session = WC()->session->paypal;
211
 
212
  // Make sure no session being set from cart.
@@ -244,10 +252,15 @@ class WC_Gateway_PPEC_Checkout_Handler {
244
  return;
245
  }
246
 
 
 
 
 
 
247
  wp_enqueue_style( 'wc-gateway-ppec-frontend-checkout', wc_gateway_ppec()->plugin_url . 'assets/css/wc-gateway-ppec-frontend-checkout.css', array(), wc_gateway_ppec()->version );
248
 
249
  // On the checkout page, only load the JS if we plan on sending them over to PayPal.
250
- $payer_id = $settings->getActiveApiCredentials()->get_payer_id();
251
  if ( $settings->enableInContextCheckout && ! empty( $payer_id ) ) {
252
  $session = WC()->session->paypal;
253
  if ( ! $session
205
  */
206
  public function after_checkout_form() {
207
  $settings = wc_gateway_ppec()->settings->loadSettings();
208
+ if ( ! $settings->enabled ) {
209
+ return;
210
+ }
211
 
212
+ $api_credentials = $settings->getActiveApiCredentials();
213
+ if ( ! is_callable( array( $api_credentials, 'get_payer_id' ) ) ) {
214
+ return;
215
+ }
216
+
217
+ if ( $settings->enableInContextCheckout ) {
218
  $session = WC()->session->paypal;
219
 
220
  // Make sure no session being set from cart.
252
  return;
253
  }
254
 
255
+ $api_credentials = $settings->getActiveApiCredentials();
256
+ if ( ! is_callable( array( $api_credentials, 'get_payer_id' ) ) ) {
257
+ return;
258
+ }
259
+
260
  wp_enqueue_style( 'wc-gateway-ppec-frontend-checkout', wc_gateway_ppec()->plugin_url . 'assets/css/wc-gateway-ppec-frontend-checkout.css', array(), wc_gateway_ppec()->version );
261
 
262
  // On the checkout page, only load the JS if we plan on sending them over to PayPal.
263
+ $payer_id = $api_credentials->get_payer_id();
264
  if ( $settings->enableInContextCheckout && ! empty( $payer_id ) ) {
265
  $session = WC()->session->paypal;
266
  if ( ! $session
includes/class-wc-gateway-ppec-ips-handler.php CHANGED
@@ -54,7 +54,7 @@ class WC_Gateway_PPEC_IPS_Handler {
54
  'env' => $env,
55
  'wc_ppec_ips_admin_nonce' => wp_create_nonce( 'wc_ppec_ips' ),
56
  ),
57
- wc_gateway_ppec()->admin->gateway_admin_url( 'WC_Gateway_PPEC_With_PayPal' )
58
  );
59
  }
60
 
@@ -115,7 +115,7 @@ class WC_Gateway_PPEC_IPS_Handler {
115
  }
116
 
117
  add_option( 'woo_pp_admin_error', $error_msgs );
118
- wp_safe_redirect( wc_gateway_ppec()->admin->gateway_admin_url( 'WC_Gateway_PPEC_With_PayPal' ) );
119
  exit;
120
  }
121
 
54
  'env' => $env,
55
  'wc_ppec_ips_admin_nonce' => wp_create_nonce( 'wc_ppec_ips' ),
56
  ),
57
+ wc_gateway_ppec()->get_admin_setting_link()
58
  );
59
  }
60
 
115
  }
116
 
117
  add_option( 'woo_pp_admin_error', $error_msgs );
118
+ wp_safe_redirect( wc_gateway_ppec()->get_admin_setting_link() );
119
  exit;
120
  }
121
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy,
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
  Tested up to: 4.4
6
- Stable tag: 1.0.3
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -80,6 +80,12 @@ New feature requests and bugs reports can be made in the plugin forum.
80
 
81
  == Changelog ==
82
 
 
 
 
 
 
 
83
  = 1.0.3 =
84
 
85
  * Fix - Issue where missing rounding two decimal digits of tax causing transaction being refused
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
  Tested up to: 4.4
6
+ Stable tag: 1.0.4
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
80
 
81
  == Changelog ==
82
 
83
+ = 1.0.4 =
84
+
85
+ * Fix - Wrong section slug / tab after redirected from connect.woocommerce.com
86
+ * Fix - Make sure to check if credentials were set in cart and checkout pages
87
+ * Fix - Removed configuration of chipers to use for TLS
88
+
89
  = 1.0.3 =
90
 
91
  * Fix - Issue where missing rounding two decimal digits of tax causing transaction being refused
woocommerce-gateway-paypal-express-checkout.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce PayPal Express Checkout Gateway
4
- * Plugin URI: https://woothemes.com
5
  * Description: A payment gateway for PayPal Express Checkout ( https://www.paypal.com/us/webapps/mpp/express-checkout ). Requires WC 2.5+
6
- * Version: 1.0.3
7
  * Author: Automattic/WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2016 WooCommerce / PayPal.
@@ -36,7 +36,7 @@ function wc_gateway_ppec() {
36
  if ( ! isset( $plugin ) ) {
37
  require_once( 'includes/class-wc-gateway-ppec-plugin.php' );
38
 
39
- $plugin = new WC_Gateway_PPEC_Plugin( __FILE__, '1.0.3' );
40
  }
41
 
42
  return $plugin;
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce PayPal Express Checkout Gateway
4
+ * Plugin URI: https://www.woothemes.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: A payment gateway for PayPal Express Checkout ( https://www.paypal.com/us/webapps/mpp/express-checkout ). Requires WC 2.5+
6
+ * Version: 1.0.4
7
  * Author: Automattic/WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2016 WooCommerce / PayPal.
36
  if ( ! isset( $plugin ) ) {
37
  require_once( 'includes/class-wc-gateway-ppec-plugin.php' );
38
 
39
+ $plugin = new WC_Gateway_PPEC_Plugin( __FILE__, '1.0.4' );
40
  }
41
 
42
  return $plugin;