Version Description
Download this release
Release Info
Developer | akeda |
Plugin | WooCommerce PayPal Express Checkout Payment Gateway |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
includes/abstracts/abstract-wc-gateway-ppec.php
CHANGED
@@ -430,7 +430,7 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
|
|
430 |
$subtotal_mismatch_behavior = $settings->subtotalMismatchBehavior;
|
431 |
}
|
432 |
|
433 |
-
$help_image_url =
|
434 |
$ips_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_gateway_ppec_with_paypal&ips-signup=true' );
|
435 |
add_thickbox();
|
436 |
|
430 |
$subtotal_mismatch_behavior = $settings->subtotalMismatchBehavior;
|
431 |
}
|
432 |
|
433 |
+
$help_image_url = WC()->plugin_url() . '/assets/images/help.png';
|
434 |
$ips_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_gateway_ppec_with_paypal&ips-signup=true' );
|
435 |
add_thickbox();
|
436 |
|
includes/class-wc-gateway-ppec-cart-handler.php
CHANGED
@@ -470,7 +470,7 @@ class WC_Gateway_PPEC_Cart_Handler {
|
|
470 |
foreach ( $this->items as $line_item_key => $values ) {
|
471 |
$lineItemParams = array(
|
472 |
'L_PAYMENTREQUEST_0_NAME' . $count => $values['name'],
|
473 |
-
'L_PAYMENTREQUEST_0_DESC' . $count => ! empty( $values['description'] ) ? $values['description'] : '',
|
474 |
'L_PAYMENTREQUEST_0_QTY' . $count => $values['quantity'],
|
475 |
'L_PAYMENTREQUEST_0_AMT' . $count => $values['amount']
|
476 |
);
|
470 |
foreach ( $this->items as $line_item_key => $values ) {
|
471 |
$lineItemParams = array(
|
472 |
'L_PAYMENTREQUEST_0_NAME' . $count => $values['name'],
|
473 |
+
'L_PAYMENTREQUEST_0_DESC' . $count => ! empty( $values['description'] ) ? strip_tags( $values['description'] ) : '',
|
474 |
'L_PAYMENTREQUEST_0_QTY' . $count => $values['quantity'],
|
475 |
'L_PAYMENTREQUEST_0_AMT' . $count => $values['amount']
|
476 |
);
|
includes/class-wc-gateway-ppec-plugin.php
CHANGED
@@ -9,6 +9,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
9 |
|
10 |
class WC_Gateway_PPEC_Plugin {
|
11 |
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
* Filepath of main plugin file.
|
14 |
*
|
@@ -88,16 +92,26 @@ class WC_Gateway_PPEC_Plugin {
|
|
88 |
public function bootstrap() {
|
89 |
try {
|
90 |
if ( $this->_bootstrapped ) {
|
91 |
-
throw new Exception( __( '%s in WooCommerce Gateway PayPal Express Checkout plugin can only be called once', 'woocommerce-gateway-paypal-express-checkout' ) );
|
92 |
}
|
93 |
|
94 |
$this->_check_dependencies();
|
95 |
$this->_run();
|
|
|
96 |
|
97 |
$this->_bootstrapped = true;
|
98 |
delete_option( 'wc_gateway_ppce_bootstrap_warning_message' );
|
|
|
99 |
} catch ( Exception $e ) {
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
add_action( 'admin_notices', array( $this, 'show_bootstrap_warning' ) );
|
102 |
}
|
103 |
}
|
@@ -113,6 +127,17 @@ class WC_Gateway_PPEC_Plugin {
|
|
113 |
</div>
|
114 |
<?php
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
/**
|
@@ -122,30 +147,46 @@ class WC_Gateway_PPEC_Plugin {
|
|
122 |
*/
|
123 |
protected function _check_dependencies() {
|
124 |
if ( ! function_exists( 'WC' ) ) {
|
125 |
-
throw new Exception( __( 'WooCommerce Gateway PayPal Express Checkout requires WooCommerce to be activated', 'woocommerce-gateway-paypal-express-checkout' ) );
|
126 |
}
|
127 |
|
128 |
if ( version_compare( WC()->version, '2.5', '<' ) ) {
|
129 |
-
throw new Exception( __( 'WooCommerce Gateway PayPal Express Checkout requires WooCommerce version 2.5 or greater', 'woocommerce-gateway-paypal-express-checkout' ) );
|
130 |
}
|
131 |
|
132 |
if ( ! function_exists( 'curl_init' ) ) {
|
133 |
-
throw new Exception( __( 'WooCommerce Gateway PayPal Express Checkout requires cURL to be installed on your server', 'woocommerce-gateway-paypal-express-checkout' ) );
|
134 |
}
|
135 |
|
136 |
$openssl_warning = __( 'WooCommerce Gateway PayPal Express Checkout requires OpenSSL >= 1.0.1 to be installed on your server', 'woocommerce-gateway-paypal-express-checkout' );
|
137 |
if ( ! defined( 'OPENSSL_VERSION_TEXT' ) ) {
|
138 |
-
throw new Exception( $openssl_warning );
|
139 |
}
|
140 |
|
141 |
preg_match( '/^OpenSSL ([\d.]+)/', OPENSSL_VERSION_TEXT, $matches );
|
142 |
if ( empty( $matches[1] ) ) {
|
143 |
-
throw new Exception( $openssl_warning );
|
144 |
}
|
145 |
|
146 |
|
147 |
if ( ! version_compare( $matches[1], '1.0.1', '>=' ) ) {
|
148 |
-
throw new Exception( $openssl_warning );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
}
|
151 |
|
@@ -162,6 +203,7 @@ class WC_Gateway_PPEC_Plugin {
|
|
162 |
*/
|
163 |
public function activate() {
|
164 |
// Enable some options that we recommend for all merchants.
|
|
|
165 |
add_option( 'pp_woo_allowGuestCheckout', true );
|
166 |
add_option( 'pp_woo_enableInContextCheckout', true );
|
167 |
/* defer ppc for next next release.
|
@@ -218,17 +260,26 @@ class WC_Gateway_PPEC_Plugin {
|
|
218 |
* @since 1.0.0
|
219 |
*/
|
220 |
public function plugin_action_links( $links ) {
|
221 |
-
|
222 |
-
$section_slug = strtolower( 'WC_Gateway_PPEC_With_PayPal' );
|
223 |
|
224 |
$plugin_links = array(
|
225 |
-
'<a href="' .
|
226 |
'<a href="http://docs.woothemes.com/document/woocommerce-gateway-paypal-express-checkout/">' . __( 'Docs', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>',
|
227 |
'<a href="http://support.woothemes.com/">' . __( 'Support', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>',
|
228 |
);
|
229 |
return array_merge( $plugin_links, $links );
|
230 |
}
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
/**
|
233 |
* Allow PayPal domains for redirect.
|
234 |
*
|
9 |
|
10 |
class WC_Gateway_PPEC_Plugin {
|
11 |
|
12 |
+
const ALREADY_BOOTSTRAPED = 1;
|
13 |
+
const DEPENDENCIES_UNSATISFIED = 2;
|
14 |
+
const NOT_CONNECTED = 3;
|
15 |
+
|
16 |
/**
|
17 |
* Filepath of main plugin file.
|
18 |
*
|
92 |
public function bootstrap() {
|
93 |
try {
|
94 |
if ( $this->_bootstrapped ) {
|
95 |
+
throw new Exception( __( '%s in WooCommerce Gateway PayPal Express Checkout plugin can only be called once', 'woocommerce-gateway-paypal-express-checkout' ), self::ALREADY_BOOTSTRAPED );
|
96 |
}
|
97 |
|
98 |
$this->_check_dependencies();
|
99 |
$this->_run();
|
100 |
+
$this->_check_credentials();
|
101 |
|
102 |
$this->_bootstrapped = true;
|
103 |
delete_option( 'wc_gateway_ppce_bootstrap_warning_message' );
|
104 |
+
delete_option( 'wc_gateway_ppce_prompt_to_connect' );
|
105 |
} catch ( Exception $e ) {
|
106 |
+
if ( in_array( $e->getCode(), array( self::ALREADY_BOOTSTRAPED, self::DEPENDENCIES_UNSATISFIED ) ) ) {
|
107 |
+
|
108 |
+
update_option( 'wc_gateway_ppce_bootstrap_warning_message', $e->getMessage() );
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( self::NOT_CONNECTED === $e->getCode() ) {
|
112 |
+
update_option( 'wc_gateway_ppce_prompt_to_connect', $e->getMessage() );
|
113 |
+
}
|
114 |
+
|
115 |
add_action( 'admin_notices', array( $this, 'show_bootstrap_warning' ) );
|
116 |
}
|
117 |
}
|
127 |
</div>
|
128 |
<?php
|
129 |
}
|
130 |
+
|
131 |
+
$prompt_connect = get_option( 'wc_gateway_ppce_prompt_to_connect', '' );
|
132 |
+
if ( ! empty( $prompt_connect ) ) {
|
133 |
+
?>
|
134 |
+
<div class="notice notice-warning">
|
135 |
+
<p>
|
136 |
+
<strong><?php echo wp_kses( $prompt_connect, array( 'a' => array( 'href' => array() ) ) ); ?></strong>
|
137 |
+
</p>
|
138 |
+
</div>
|
139 |
+
<?php
|
140 |
+
}
|
141 |
}
|
142 |
|
143 |
/**
|
147 |
*/
|
148 |
protected function _check_dependencies() {
|
149 |
if ( ! function_exists( 'WC' ) ) {
|
150 |
+
throw new Exception( __( 'WooCommerce Gateway PayPal Express Checkout requires WooCommerce to be activated', 'woocommerce-gateway-paypal-express-checkout' ), self::DEPENDENCIES_UNSATISFIED );
|
151 |
}
|
152 |
|
153 |
if ( version_compare( WC()->version, '2.5', '<' ) ) {
|
154 |
+
throw new Exception( __( 'WooCommerce Gateway PayPal Express Checkout requires WooCommerce version 2.5 or greater', 'woocommerce-gateway-paypal-express-checkout' ), self::DEPENDENCIES_UNSATISFIED );
|
155 |
}
|
156 |
|
157 |
if ( ! function_exists( 'curl_init' ) ) {
|
158 |
+
throw new Exception( __( 'WooCommerce Gateway PayPal Express Checkout requires cURL to be installed on your server', 'woocommerce-gateway-paypal-express-checkout' ), self::DEPENDENCIES_UNSATISFIED );
|
159 |
}
|
160 |
|
161 |
$openssl_warning = __( 'WooCommerce Gateway PayPal Express Checkout requires OpenSSL >= 1.0.1 to be installed on your server', 'woocommerce-gateway-paypal-express-checkout' );
|
162 |
if ( ! defined( 'OPENSSL_VERSION_TEXT' ) ) {
|
163 |
+
throw new Exception( $openssl_warning, self::DEPENDENCIES_UNSATISFIED );
|
164 |
}
|
165 |
|
166 |
preg_match( '/^OpenSSL ([\d.]+)/', OPENSSL_VERSION_TEXT, $matches );
|
167 |
if ( empty( $matches[1] ) ) {
|
168 |
+
throw new Exception( $openssl_warning, self::DEPENDENCIES_UNSATISFIED );
|
169 |
}
|
170 |
|
171 |
|
172 |
if ( ! version_compare( $matches[1], '1.0.1', '>=' ) ) {
|
173 |
+
throw new Exception( $openssl_warning, self::DEPENDENCIES_UNSATISFIED );
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Check credentials. If it's not client credential it means it's not set
|
179 |
+
* and will prompt admin to connect.
|
180 |
+
*
|
181 |
+
* @see https://github.com/woothemes/woocommerce-gateway-paypal-express-checkout/issues/112
|
182 |
+
*
|
183 |
+
* @throws Exception
|
184 |
+
*/
|
185 |
+
protected function _check_credentials() {
|
186 |
+
$credential = $this->settings->getActiveApiCredentials();
|
187 |
+
if ( ! is_a( $credential, 'WC_Gateway_PPEC_Client_Credential' ) ) {
|
188 |
+
$setting_link = $this->get_admin_setting_link();
|
189 |
+
throw new Exception( __( 'PayPal Express Checkout is almost ready. To get started, <a href="' . $setting_link . '">connect your PayPal account</a>.', 'woocommerce-gateway-paypal-express-checkout' ), self::NOT_CONNECTED );
|
190 |
}
|
191 |
}
|
192 |
|
203 |
*/
|
204 |
public function activate() {
|
205 |
// Enable some options that we recommend for all merchants.
|
206 |
+
add_option( 'pp_woo_enabled', true );
|
207 |
add_option( 'pp_woo_allowGuestCheckout', true );
|
208 |
add_option( 'pp_woo_enableInContextCheckout', true );
|
209 |
/* defer ppc for next next release.
|
260 |
* @since 1.0.0
|
261 |
*/
|
262 |
public function plugin_action_links( $links ) {
|
263 |
+
$setting_link = $this->get_admin_setting_link();
|
|
|
264 |
|
265 |
$plugin_links = array(
|
266 |
+
'<a href="' . $setting_link . '">' . __( 'Settings', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>',
|
267 |
'<a href="http://docs.woothemes.com/document/woocommerce-gateway-paypal-express-checkout/">' . __( 'Docs', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>',
|
268 |
'<a href="http://support.woothemes.com/">' . __( 'Support', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>',
|
269 |
);
|
270 |
return array_merge( $plugin_links, $links );
|
271 |
}
|
272 |
|
273 |
+
public function get_admin_setting_link() {
|
274 |
+
if ( version_compare( WC()->version, '2.6', '>=' ) ) {
|
275 |
+
$section_slug = 'ppec_paypal';
|
276 |
+
} else {
|
277 |
+
$section_slug = strtolower( 'WC_Gateway_PPEC_With_PayPal' );
|
278 |
+
}
|
279 |
+
|
280 |
+
return admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . $section_slug );
|
281 |
+
}
|
282 |
+
|
283 |
/**
|
284 |
* Allow PayPal domains for redirect.
|
285 |
*
|
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.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -80,6 +80,14 @@ New feature requests and bugs reports can be made in the plugin forum.
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
= 1.0.1
|
84 |
* Fix - Make sure OpenSSL is installed with 1.0.1 as the minium required version, otherwise display warning
|
85 |
* Fix - Make sure cURL transport is available for WP HTTP API, otherwise display warning
|
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.2
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 1.0.2
|
84 |
+
|
85 |
+
* Fix - Strip out HTML tags from item descriptions to prevent warning from PayPal
|
86 |
+
* Fix - Issue of incorrect plugin's setting link from admin plugins page when using WooCommerce 2.6
|
87 |
+
* Tweak - Make enabled option to default to true
|
88 |
+
* Fix - Issue of missing help icon when plugin directory is not the same as plugin's slug.
|
89 |
+
* Tweak - Add admin notice to setup / connect after plugin is activated.
|
90 |
+
|
91 |
= 1.0.1
|
92 |
* Fix - Make sure OpenSSL is installed with 1.0.1 as the minium required version, otherwise display warning
|
93 |
* Fix - Make sure cURL transport is available for WP HTTP API, otherwise display warning
|
woocommerce-gateway-paypal-express-checkout.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.
|
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.
|
40 |
}
|
41 |
|
42 |
return $plugin;
|
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.2
|
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.2' );
|
40 |
}
|
41 |
|
42 |
return $plugin;
|