Easy Digital Downloads - Version 2.9.10

Version Description

Download this release

Release Info

Developer cklosows
Plugin Icon 128x128 Easy Digital Downloads
Version 2.9.10
Comparing to
See all releases

Code changes from version 2.9.9 to 2.9.10

easy-digital-downloads.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: The easiest way to sell digital products with WordPress.
6
  * Author: Easy Digital Downloads
7
  * Author URI: https://easydigitaldownloads.com
8
- * Version: 2.9.9
9
  * Text Domain: easy-digital-downloads
10
  * Domain Path: languages
11
  *
@@ -25,7 +25,7 @@
25
  * @package EDD
26
  * @category Core
27
  * @author Pippin Williamson
28
- * @version 2.9.9
29
  */
30
 
31
  // Exit if accessed directly.
@@ -206,7 +206,7 @@ final class Easy_Digital_Downloads {
206
 
207
  // Plugin version.
208
  if ( ! defined( 'EDD_VERSION' ) ) {
209
- define( 'EDD_VERSION', '2.9.9' );
210
  }
211
 
212
  // Plugin Folder Path.
5
  * Description: The easiest way to sell digital products with WordPress.
6
  * Author: Easy Digital Downloads
7
  * Author URI: https://easydigitaldownloads.com
8
+ * Version: 2.9.10
9
  * Text Domain: easy-digital-downloads
10
  * Domain Path: languages
11
  *
25
  * @package EDD
26
  * @category Core
27
  * @author Pippin Williamson
28
+ * @version 2.9.10
29
  */
30
 
31
  // Exit if accessed directly.
206
 
207
  // Plugin version.
208
  if ( ! defined( 'EDD_VERSION' ) ) {
209
+ define( 'EDD_VERSION', '2.9.10' );
210
  }
211
 
212
  // Plugin Folder Path.
includes/gateways/paypal-standard.php CHANGED
@@ -929,19 +929,79 @@ function edd_paypal_process_pdt_on_return() {
929
  $debug_args['body']['at'] = str_pad( substr( $debug_args['body']['at'], -6 ), strlen( $debug_args['body']['at'] ), '*', STR_PAD_LEFT );
930
  edd_debug_log( 'Attempting to verify PayPal payment with PDT. Args: ' . print_r( $debug_args, true ) );
931
 
932
- $request = wp_remote_post( edd_get_paypal_redirect( true, true ), $remote_post_vars );
 
 
933
 
934
  if ( ! is_wp_error( $request ) ) {
935
 
936
  $body = wp_remote_retrieve_body( $request );
937
 
938
- if( false !== strpos( $body, 'SUCCESS' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939
 
940
- // Purchase verified, set to completed
941
- $payment->status = 'publish';
942
  $payment->transaction_id = sanitize_text_field( $_GET['tx'] );
943
  $payment->save();
944
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
945
  }
946
 
947
  } else {
929
  $debug_args['body']['at'] = str_pad( substr( $debug_args['body']['at'], -6 ), strlen( $debug_args['body']['at'] ), '*', STR_PAD_LEFT );
930
  edd_debug_log( 'Attempting to verify PayPal payment with PDT. Args: ' . print_r( $debug_args, true ) );
931
 
932
+ edd_debug_log( 'Sending PDT Verification request to ' . edd_get_paypal_redirect() );
933
+
934
+ $request = wp_remote_post( edd_get_paypal_redirect(), $remote_post_vars );
935
 
936
  if ( ! is_wp_error( $request ) ) {
937
 
938
  $body = wp_remote_retrieve_body( $request );
939
 
940
+ // parse the data
941
+ $lines = explode( "\n", trim( $body ) );
942
+ $data = array();
943
+ if ( strcmp ( $lines[0], "SUCCESS" ) == 0 ) {
944
+
945
+ for ( $i = 1; $i < count( $lines ); $i++ ) {
946
+ $parsed_line = explode( "=", $lines[ $i ],2 );
947
+ $data[ urldecode( $parsed_line[0] ) ] = urldecode( $parsed_line[1] );
948
+ }
949
+
950
+ if ( ! isset( $data['payment_gross'] ) ) {
951
+
952
+ edd_debug_log( 'Attempt to verify PayPal payment with PDT failed due to payment total missing' );
953
+ $payment->add_note( __( 'Payment failed while validating PayPal PDT. Missing payment_gross.', 'easy-digital-downloads' ) );
954
+ $payment->status = 'failed';
955
+
956
+ } elseif ( (float) $data['payment_gross'] < (float) $payment->total ) {
957
+
958
+ /**
959
+ * Here we account for payments that are less than the expected results only. There are times that
960
+ * PayPal will sometimes round and have $0.01 more than the amount. The goal here is to protect store owners
961
+ * from getting paid less than expected.
962
+ */
963
+ edd_debug_log( 'Attempt to verify PayPal payment with PDT failed due to payment total discrepancy' );
964
+ $payment->add_note( sprintf( __( 'Payment failed while validating PayPal PDT. Amount expected: %f. Amount Received: %f', 'easy-digital-downloads' ), $payment->total, $data['payment_gross'] ) );
965
+ $payment->status = 'failed';
966
+
967
+ } else {
968
+
969
+ // Verify the status
970
+ switch( strtolower( $data['payment_status'] ) ) {
971
+
972
+ case 'completed':
973
+ $payment->status = 'publish';
974
+ break;
975
+
976
+ case 'failed':
977
+ $payment->status = 'failed';
978
+ break;
979
+
980
+ default:
981
+ $payment->status = 'pending';
982
+ break;
983
+
984
+ }
985
+
986
+ }
987
 
 
 
988
  $payment->transaction_id = sanitize_text_field( $_GET['tx'] );
989
  $payment->save();
990
 
991
+ } elseif ( strcmp ( $lines[0], "FAIL" ) == 0 ) {
992
+
993
+ edd_debug_log( 'Attempt to verify PayPal payment with PDT failed due to PDT failure response: ' . print_r( $body, true ) );
994
+ $payment->add_note( __( 'Payment failed while validating PayPal PDT.', 'easy-digital-downloads' ) );
995
+ $payment->status = 'failed';
996
+ $payment->save();
997
+
998
+ } else {
999
+
1000
+ edd_debug_log( 'Attempt to verify PayPal payment with PDT met with an unexpected result: ' . print_r( $body, true ) );
1001
+ $payment->add_note( __( 'PayPal PDT encountered an unexpected result, payment set to pending', 'easy-digital-downloads' ) );
1002
+ $payment->status = 'pending';
1003
+ $payment->save();
1004
+
1005
  }
1006
 
1007
  } else {
languages/easy-digital-downloads.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2018 Easy Digital Downloads
2
  # This file is distributed under the same license as the Easy Digital Downloads package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Easy Digital Downloads 2.9.8\n"
6
  "Report-Msgid-Bugs-To: https://easydigitaldownloads.com/\n"
7
- "POT-Creation-Date: 2018-12-01 06:17:31+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: WP-Translations (http://wp-translations.org/)\n"
13
  "Language-Team: WP-Translations <wpt@wp-translations.org>\n"
14
  "Language: en_US\n"
@@ -6842,19 +6842,37 @@ msgstr ""
6842
  msgid "PayPal Refund Transaction ID: %s"
6843
  msgstr ""
6844
 
6845
- #: includes/gateways/paypal-standard.php:1026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6846
  msgid "Refund Payment in PayPal"
6847
  msgstr ""
6848
 
6849
- #: includes/gateways/paypal-standard.php:1173
6850
  msgid "PayPal refund failed for unknown reason."
6851
  msgstr ""
6852
 
6853
- #: includes/gateways/paypal-standard.php:1183
6854
  msgid "PayPal refund transaction ID: %s"
6855
  msgstr ""
6856
 
6857
- #: includes/gateways/paypal-standard.php:1187
6858
  msgid "PayPal refund failed: %s"
6859
  msgstr ""
6860
 
1
+ # Copyright (C) 2019 Easy Digital Downloads
2
  # This file is distributed under the same license as the Easy Digital Downloads package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Easy Digital Downloads 2.9.10\n"
6
  "Report-Msgid-Bugs-To: https://easydigitaldownloads.com/\n"
7
+ "POT-Creation-Date: 2019-01-04 21:24:46+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: WP-Translations (http://wp-translations.org/)\n"
13
  "Language-Team: WP-Translations <wpt@wp-translations.org>\n"
14
  "Language: en_US\n"
6842
  msgid "PayPal Refund Transaction ID: %s"
6843
  msgstr ""
6844
 
6845
+ #: includes/gateways/paypal-standard.php:953
6846
+ msgid "Payment failed while validating PayPal PDT. Missing payment_gross."
6847
+ msgstr ""
6848
+
6849
+ #: includes/gateways/paypal-standard.php:964
6850
+ msgid ""
6851
+ "Payment failed while validating PayPal PDT. Amount expected: %f. Amount "
6852
+ "Received: %f"
6853
+ msgstr ""
6854
+
6855
+ #: includes/gateways/paypal-standard.php:994
6856
+ msgid "Payment failed while validating PayPal PDT."
6857
+ msgstr ""
6858
+
6859
+ #: includes/gateways/paypal-standard.php:1001
6860
+ msgid "PayPal PDT encountered an unexpected result, payment set to pending"
6861
+ msgstr ""
6862
+
6863
+ #: includes/gateways/paypal-standard.php:1086
6864
  msgid "Refund Payment in PayPal"
6865
  msgstr ""
6866
 
6867
+ #: includes/gateways/paypal-standard.php:1233
6868
  msgid "PayPal refund failed for unknown reason."
6869
  msgstr ""
6870
 
6871
+ #: includes/gateways/paypal-standard.php:1243
6872
  msgid "PayPal refund transaction ID: %s"
6873
  msgstr ""
6874
 
6875
+ #: includes/gateways/paypal-standard.php:1247
6876
  msgid "PayPal refund failed: %s"
6877
  msgstr ""
6878
 
readme.txt CHANGED
@@ -5,8 +5,8 @@ Contributors: easydigitaldownloads, mordauk, sunnyratilal, chriscct7, section214
5
  Donate link: https://easydigitaldownloads.com/donate/
6
  Tags: download, downloads, e-store, eshop, digital downloads, e-commerce, wp-ecommerce, wp ecommerce, ecommerce, ebook
7
  Requires at least: 4.4
8
- Tested up to: 5.0
9
- Stable Tag: 2.9.9
10
  License: GNU Version 2 or Any Later Version
11
 
12
  The easiest way to sell digital products with WordPress.
@@ -189,6 +189,9 @@ Yes. Easy Digital Downloads also includes default support for Amazon Payments an
189
 
190
  == Changelog ==
191
 
 
 
 
192
  = 2.9.9, December 3, 2018 =
193
  * Fix: State/province cannot be updated on order details screen when country is changed.
194
  * Fix: "Show Privacy Policy" text link is positioned incorrectly.
5
  Donate link: https://easydigitaldownloads.com/donate/
6
  Tags: download, downloads, e-store, eshop, digital downloads, e-commerce, wp-ecommerce, wp ecommerce, ecommerce, ebook
7
  Requires at least: 4.4
8
+ Tested up to: 5.0.2
9
+ Stable Tag: 2.9.10
10
  License: GNU Version 2 or Any Later Version
11
 
12
  The easiest way to sell digital products with WordPress.
189
 
190
  == Changelog ==
191
 
192
+ = 2.9.10, January 4, 2019 =
193
+ * Security Fix: Avoid a possible PayPal Standard price manipulation when using PDT (Payment Data Transfer)
194
+
195
  = 2.9.9, December 3, 2018 =
196
  * Fix: State/province cannot be updated on order details screen when country is changed.
197
  * Fix: "Show Privacy Policy" text link is positioned incorrectly.