Version Description
- Fix - Title/Description fields in the settings should appear based on Enable PayPal Express Checkout.
- Add - Invoice Prefix now has the ability to be empty.
- Fix - Additional compatibility fixes for line items.
- Fix - PHP notice for Subscription id.
Download this release
Release Info
| Developer | bor0 |
| Plugin | |
| Version | 1.4.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.4 to 1.4.5
- includes/abstracts/abstract-wc-gateway-ppec.php +1 -1
- includes/class-wc-gateway-ppec-address.php +57 -1
- includes/class-wc-gateway-ppec-checkout-handler.php +8 -3
- includes/class-wc-gateway-ppec-client.php +4 -2
- includes/class-wc-gateway-ppec-with-paypal-addons.php +2 -2
- includes/settings/settings-ppec.php +1 -1
- readme.txt +8 -2
- woocommerce-gateway-paypal-express-checkout.php +2 -2
includes/abstracts/abstract-wc-gateway-ppec.php
CHANGED
|
@@ -50,7 +50,7 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
|
|
| 50 |
}
|
| 51 |
|
| 52 |
$this->debug = 'yes' === $this->get_option( 'debug', 'no' );
|
| 53 |
-
$this->invoice_prefix = $this->get_option( 'invoice_prefix', '
|
| 54 |
$this->instant_payments = 'yes' === $this->get_option( 'instant_payments', 'no' );
|
| 55 |
$this->require_billing = 'yes' === $this->get_option( 'require_billing', 'no' );
|
| 56 |
$this->paymentaction = $this->get_option( 'paymentaction', 'sale' );
|
| 50 |
}
|
| 51 |
|
| 52 |
$this->debug = 'yes' === $this->get_option( 'debug', 'no' );
|
| 53 |
+
$this->invoice_prefix = $this->get_option( 'invoice_prefix', '' );
|
| 54 |
$this->instant_payments = 'yes' === $this->get_option( 'instant_payments', 'no' );
|
| 55 |
$this->require_billing = 'yes' === $this->get_option( 'require_billing', 'no' );
|
| 56 |
$this->paymentaction = $this->get_option( 'paymentaction', 'sale' );
|
includes/class-wc-gateway-ppec-address.php
CHANGED
|
@@ -357,7 +357,7 @@ class PayPal_Address {
|
|
| 357 |
|
| 358 |
$translation_table = array();
|
| 359 |
|
| 360 |
-
if ( 'US' == $this->
|
| 361 |
$translation_table = array(
|
| 362 |
'alabama' => 'AL',
|
| 363 |
'alaska' => 'AK',
|
|
@@ -581,6 +581,59 @@ class PayPal_Address {
|
|
| 581 |
'zeeland' => 'ZE',
|
| 582 |
'zuid-holland' => 'ZH'
|
| 583 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
}
|
| 585 |
|
| 586 |
if ( array_key_exists( strtolower( trim( $this->_state ) ), $translation_table ) ) {
|
|
@@ -641,6 +694,9 @@ class PayPal_Address {
|
|
| 641 |
}
|
| 642 |
}
|
| 643 |
|
|
|
|
|
|
|
|
|
|
| 644 |
return $found_any;
|
| 645 |
}
|
| 646 |
}
|
| 357 |
|
| 358 |
$translation_table = array();
|
| 359 |
|
| 360 |
+
if ( 'US' == $this->_country ) {
|
| 361 |
$translation_table = array(
|
| 362 |
'alabama' => 'AL',
|
| 363 |
'alaska' => 'AK',
|
| 581 |
'zeeland' => 'ZE',
|
| 582 |
'zuid-holland' => 'ZH'
|
| 583 |
);
|
| 584 |
+
} elseif ( 'IE' == $this->_country ) {
|
| 585 |
+
$translation_table = array(
|
| 586 |
+
'co clare' => 'CE',
|
| 587 |
+
'co cork' => 'CK',
|
| 588 |
+
'co cavan' => 'CN',
|
| 589 |
+
'co carlow' => 'CW',
|
| 590 |
+
'co donegal' => 'DL',
|
| 591 |
+
// All of these should be mapped to Dublin start
|
| 592 |
+
'co dublin' => 'DN',
|
| 593 |
+
'dublin 1' => 'DN',
|
| 594 |
+
'dublin 2' => 'DN',
|
| 595 |
+
'dublin 3' => 'DN',
|
| 596 |
+
'dublin 4' => 'DN',
|
| 597 |
+
'dublin 5' => 'DN',
|
| 598 |
+
'dublin 6' => 'DN',
|
| 599 |
+
'dublin 6w' => 'DN',
|
| 600 |
+
'dublin 7' => 'DN',
|
| 601 |
+
'dublin 8' => 'DN',
|
| 602 |
+
'dublin 9' => 'DN',
|
| 603 |
+
'dublin 10' => 'DN',
|
| 604 |
+
'dublin 11' => 'DN',
|
| 605 |
+
'dublin 12' => 'DN',
|
| 606 |
+
'dublin 13' => 'DN',
|
| 607 |
+
'dublin 14' => 'DN',
|
| 608 |
+
'dublin 15' => 'DN',
|
| 609 |
+
'dublin 16' => 'DN',
|
| 610 |
+
'dublin 17' => 'DN',
|
| 611 |
+
'dublin 18' => 'DN',
|
| 612 |
+
'dublin 20' => 'DN',
|
| 613 |
+
'dublin 22' => 'DN',
|
| 614 |
+
'dublin 24' => 'DN',
|
| 615 |
+
// All of these should be mapped to Dublin end
|
| 616 |
+
'co galway' => 'GY',
|
| 617 |
+
'co kildare' => 'KE',
|
| 618 |
+
'co kilkenny' => 'KK',
|
| 619 |
+
'co kerry' => 'KY',
|
| 620 |
+
'co longford' => 'LD',
|
| 621 |
+
'co louth' => 'LH',
|
| 622 |
+
'co limerick' => 'LK',
|
| 623 |
+
'co leitrim' => 'LM',
|
| 624 |
+
'co laois' => 'LS',
|
| 625 |
+
'co meath' => 'MH',
|
| 626 |
+
'co monaghan' => 'MN',
|
| 627 |
+
'co mayo' => 'MO',
|
| 628 |
+
'co offaly' => 'OY',
|
| 629 |
+
'co roscommon' => 'RN',
|
| 630 |
+
'co sligo' => 'SO',
|
| 631 |
+
'co tipperary' => 'TY',
|
| 632 |
+
'co waterford' => 'WD',
|
| 633 |
+
'co westmeath' => 'WH',
|
| 634 |
+
'co wicklow' => 'WW',
|
| 635 |
+
'co wexford' => 'WX',
|
| 636 |
+
);
|
| 637 |
}
|
| 638 |
|
| 639 |
if ( array_key_exists( strtolower( trim( $this->_state ) ), $translation_table ) ) {
|
| 694 |
}
|
| 695 |
}
|
| 696 |
|
| 697 |
+
// After the state has been set, attempt to normalize (in case it comes from a PayPal response)
|
| 698 |
+
$this->normalizeState();
|
| 699 |
+
|
| 700 |
return $found_any;
|
| 701 |
}
|
| 702 |
}
|
includes/class-wc-gateway-ppec-checkout-handler.php
CHANGED
|
@@ -115,7 +115,7 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
| 115 |
*/
|
| 116 |
public function filter_default_address_fields( $fields ) {
|
| 117 |
if ( method_exists( WC()->cart, 'needs_shipping' ) && ! WC()->cart->needs_shipping() ) {
|
| 118 |
-
$not_required_fields = array( 'address_1', 'city', '
|
| 119 |
foreach ( $not_required_fields as $not_required_field ) {
|
| 120 |
if ( array_key_exists( $not_required_field, $fields ) ) {
|
| 121 |
$fields[ $not_required_field ]['required'] = false;
|
|
@@ -123,6 +123,11 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
| 123 |
}
|
| 124 |
}
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
return $fields;
|
| 127 |
|
| 128 |
}
|
|
@@ -146,7 +151,7 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
| 146 |
|
| 147 |
if ( array_key_exists( 'billing_phone', $billing_fields ) ) {
|
| 148 |
$billing_fields['billing_phone']['required'] = 'yes' === $require_phone_number;
|
| 149 |
-
}
|
| 150 |
|
| 151 |
return $billing_fields;
|
| 152 |
}
|
|
@@ -758,7 +763,7 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
| 758 |
$billing_agreement_id = $old_wc ? get_post_meta( $order_id, '_ppec_billing_agreement_id', true ) : $order->get_meta( '_ppec_billing_agreement_id', true );
|
| 759 |
|
| 760 |
foreach ( $subscriptions as $subscription ) {
|
| 761 |
-
update_post_meta( $subscription->id, '_ppec_billing_agreement_id', $billing_agreement_id );
|
| 762 |
}
|
| 763 |
}
|
| 764 |
|
| 115 |
*/
|
| 116 |
public function filter_default_address_fields( $fields ) {
|
| 117 |
if ( method_exists( WC()->cart, 'needs_shipping' ) && ! WC()->cart->needs_shipping() ) {
|
| 118 |
+
$not_required_fields = array( 'address_1', 'city', 'postcode', 'country' );
|
| 119 |
foreach ( $not_required_fields as $not_required_field ) {
|
| 120 |
if ( array_key_exists( $not_required_field, $fields ) ) {
|
| 121 |
$fields[ $not_required_field ]['required'] = false;
|
| 123 |
}
|
| 124 |
}
|
| 125 |
|
| 126 |
+
// Regardless of shipping, PP doesn't have the county required (e.g. using Ireland without a county is acceptable)
|
| 127 |
+
if ( array_key_exists( 'state', $fields ) ) {
|
| 128 |
+
$fields['state']['required'] = false;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
return $fields;
|
| 132 |
|
| 133 |
}
|
| 151 |
|
| 152 |
if ( array_key_exists( 'billing_phone', $billing_fields ) ) {
|
| 153 |
$billing_fields['billing_phone']['required'] = 'yes' === $require_phone_number;
|
| 154 |
+
}
|
| 155 |
|
| 156 |
return $billing_fields;
|
| 157 |
}
|
| 763 |
$billing_agreement_id = $old_wc ? get_post_meta( $order_id, '_ppec_billing_agreement_id', true ) : $order->get_meta( '_ppec_billing_agreement_id', true );
|
| 764 |
|
| 765 |
foreach ( $subscriptions as $subscription ) {
|
| 766 |
+
update_post_meta( is_callable( array( $subscription, 'get_id' ) ) ? $subscription->get_id() : $subscription->id, '_ppec_billing_agreement_id', $billing_agreement_id );
|
| 767 |
}
|
| 768 |
}
|
| 769 |
|
includes/class-wc-gateway-ppec-client.php
CHANGED
|
@@ -548,12 +548,14 @@ class WC_Gateway_PPEC_Client {
|
|
| 548 |
// if they do not match, check to see what the merchant would like to do.
|
| 549 |
// Options are to remove line items or add a line item to adjust for
|
| 550 |
// the difference.
|
|
|
|
|
|
|
| 551 |
if ( $details['total_item_amount'] != $rounded_total ) {
|
| 552 |
if ( 'add' === $settings->get_subtotal_mismatch_behavior() ) {
|
| 553 |
// Add line item to make up different between WooCommerce
|
| 554 |
// calculations and PayPal calculations.
|
| 555 |
$diff = round( $details['total_item_amount'] - $rounded_total, $decimals );
|
| 556 |
-
if ( abs( $diff ) > 0.000001 ) {
|
| 557 |
$extra_line_item = $this->_get_extra_offset_line_item( $diff );
|
| 558 |
|
| 559 |
$details['items'][] = $extra_line_item;
|
|
@@ -611,7 +613,7 @@ class WC_Gateway_PPEC_Client {
|
|
| 611 |
}
|
| 612 |
}
|
| 613 |
|
| 614 |
-
if ( abs( $lisum ) > 0.000001 ) {
|
| 615 |
$details['items'][] = $this->_get_extra_offset_line_item( $details['total_item_amount'] - $lisum );
|
| 616 |
}
|
| 617 |
|
| 548 |
// if they do not match, check to see what the merchant would like to do.
|
| 549 |
// Options are to remove line items or add a line item to adjust for
|
| 550 |
// the difference.
|
| 551 |
+
$diff = 0;
|
| 552 |
+
|
| 553 |
if ( $details['total_item_amount'] != $rounded_total ) {
|
| 554 |
if ( 'add' === $settings->get_subtotal_mismatch_behavior() ) {
|
| 555 |
// Add line item to make up different between WooCommerce
|
| 556 |
// calculations and PayPal calculations.
|
| 557 |
$diff = round( $details['total_item_amount'] - $rounded_total, $decimals );
|
| 558 |
+
if ( abs( $diff ) > 0.000001 && 0.0 !== (float) $diff ) {
|
| 559 |
$extra_line_item = $this->_get_extra_offset_line_item( $diff );
|
| 560 |
|
| 561 |
$details['items'][] = $extra_line_item;
|
| 613 |
}
|
| 614 |
}
|
| 615 |
|
| 616 |
+
if ( abs( $lisum ) > 0.000001 && 0.0 !== (float) $diff ) {
|
| 617 |
$details['items'][] = $this->_get_extra_offset_line_item( $details['total_item_amount'] - $lisum );
|
| 618 |
}
|
| 619 |
|
includes/class-wc-gateway-ppec-with-paypal-addons.php
CHANGED
|
@@ -98,7 +98,7 @@ class WC_Gateway_PPEC_With_PayPal_Addons extends WC_Gateway_PPEC_With_PayPal {
|
|
| 98 |
// because it's not available during subscription creation.
|
| 99 |
foreach ( $subscriptions as $subscription ) {
|
| 100 |
wcs_copy_order_address( $order, $subscription );
|
| 101 |
-
update_post_meta( $subscription->id, '_ppec_billing_agreement_id', $billing_agreement_id );
|
| 102 |
}
|
| 103 |
|
| 104 |
return $resp;
|
|
@@ -199,6 +199,6 @@ class WC_Gateway_PPEC_With_PayPal_Addons extends WC_Gateway_PPEC_With_PayPal {
|
|
| 199 |
* automatic payment)
|
| 200 |
*/
|
| 201 |
public function update_failing_payment_method( $subscription, $renewal_order ) {
|
| 202 |
-
update_post_meta( $subscription->id, '_ppec_billing_agreement_id', $renewal_order->ppec_billing_agreement_id );
|
| 203 |
}
|
| 204 |
}
|
| 98 |
// because it's not available during subscription creation.
|
| 99 |
foreach ( $subscriptions as $subscription ) {
|
| 100 |
wcs_copy_order_address( $order, $subscription );
|
| 101 |
+
update_post_meta( is_callable( array( $subscription, 'get_id' ) ) ? $subscription->get_id() : $subscription->id, '_ppec_billing_agreement_id', $billing_agreement_id );
|
| 102 |
}
|
| 103 |
|
| 104 |
return $resp;
|
| 199 |
* automatic payment)
|
| 200 |
*/
|
| 201 |
public function update_failing_payment_method( $subscription, $renewal_order ) {
|
| 202 |
+
update_post_meta( is_callable( array( $subscription, 'get_id' ) ) ? $subscription->get_id() : $subscription->id, '_ppec_billing_agreement_id', $renewal_order->ppec_billing_agreement_id );
|
| 203 |
}
|
| 204 |
}
|
includes/settings/settings-ppec.php
CHANGED
|
@@ -77,7 +77,7 @@ wc_enqueue_js( "
|
|
| 77 |
}
|
| 78 |
}).change();
|
| 79 |
|
| 80 |
-
$( '#
|
| 81 |
if ( $( this ).is( ':checked' ) ) {
|
| 82 |
$( ppec_mark_fields ).closest( 'tr' ).show();
|
| 83 |
} else {
|
| 77 |
}
|
| 78 |
}).change();
|
| 79 |
|
| 80 |
+
$( '#woocommerce_ppec_paypal_enabled' ).change(function(){
|
| 81 |
if ( $( this ).is( ':checked' ) ) {
|
| 82 |
$( ppec_mark_fields ).closest( 'tr' ).show();
|
| 83 |
} else {
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring
|
| 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.
|
| 6 |
-
Stable tag: 1.4.
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
|
@@ -85,6 +85,12 @@ https://gist.github.com/mikejolley/ad2ecc286c9ad6cefbb7065ba6dfef48
|
|
| 85 |
|
| 86 |
== Changelog ==
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
= 1.4.4 =
|
| 89 |
* Fix - PayPal error (10431).
|
| 90 |
* Fix - PHP notices.
|
| 2 |
Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring
|
| 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.9.0
|
| 6 |
+
Stable tag: 1.4.5
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
| 85 |
|
| 86 |
== Changelog ==
|
| 87 |
|
| 88 |
+
= 1.4.5 =
|
| 89 |
+
* Fix - Title/Description fields in the settings should appear based on Enable PayPal Express Checkout.
|
| 90 |
+
* Add - Invoice Prefix now has the ability to be empty.
|
| 91 |
+
* Fix - Additional compatibility fixes for line items.
|
| 92 |
+
* Fix - PHP notice for Subscription id.
|
| 93 |
+
|
| 94 |
= 1.4.4 =
|
| 95 |
* Fix - PayPal error (10431).
|
| 96 |
* Fix - PHP notices.
|
woocommerce-gateway-paypal-express-checkout.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: WooCommerce PayPal Express Checkout Gateway
|
| 4 |
* Plugin URI: https://woocommerce.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).
|
| 6 |
-
* Version: 1.4.
|
| 7 |
* Author: WooCommerce
|
| 8 |
* Author URI: https://woocommerce.com
|
| 9 |
* Copyright: © 2017 WooCommerce / PayPal.
|
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
| 27 |
exit; // Exit if accessed directly
|
| 28 |
}
|
| 29 |
|
| 30 |
-
define( 'WC_GATEWAY_PPEC_VERSION', '1.4.
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Return instance of WC_Gateway_PPEC_Plugin.
|
| 3 |
* Plugin Name: WooCommerce PayPal Express Checkout Gateway
|
| 4 |
* Plugin URI: https://woocommerce.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).
|
| 6 |
+
* Version: 1.4.5
|
| 7 |
* Author: WooCommerce
|
| 8 |
* Author URI: https://woocommerce.com
|
| 9 |
* Copyright: © 2017 WooCommerce / PayPal.
|
| 27 |
exit; // Exit if accessed directly
|
| 28 |
}
|
| 29 |
|
| 30 |
+
define( 'WC_GATEWAY_PPEC_VERSION', '1.4.5' );
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Return instance of WC_Gateway_PPEC_Plugin.
|
