Version Description
Download this release
Release Info
Developer | cklosows |
Plugin | Easy Digital Downloads |
Version | 2.11.1 |
Comparing to | |
See all releases |
Code changes from version 2.11 to 2.11.1
- assets/js/paypal-checkout.js +10 -0
- assets/js/paypal-checkout.min.js +1 -1
- easy-digital-downloads.php +3 -3
- includes/gateways/paypal/admin/connect.php +9 -6
- includes/gateways/paypal/buy-now.php +2 -0
- includes/gateways/paypal/checkout-actions.php +28 -11
- includes/gateways/paypal/scripts.php +0 -1
- languages/easy-digital-downloads.pot +40 -37
- readme.txt +9 -3
- templates/history-downloads.php +4 -0
assets/js/paypal-checkout.js
CHANGED
@@ -100,6 +100,7 @@ var EDD_PayPal = {
|
|
100 |
var errorWrapper = ( 'checkout' === context ) ? form.querySelector( '#edd-paypal-errors-wrap' ) : form.querySelector( '.edd-paypal-checkout-buy-now-error-wrapper' );
|
101 |
var spinner = ( 'checkout' === context ) ? document.getElementById( 'edd-paypal-spinner' ) : form.querySelector( '.edd-paypal-spinner' );
|
102 |
var nonceEl = form.querySelector( 'input[name="edd_process_paypal_nonce"]' );
|
|
|
103 |
var createFunc = ( 'subscription' === eddPayPalVars.intent ) ? 'createSubscription' : 'createOrder';
|
104 |
|
105 |
var buttonArgs = {
|
@@ -107,6 +108,8 @@ var EDD_PayPal = {
|
|
107 |
var formData = new FormData();
|
108 |
formData.append( 'action', eddPayPalVars.approvalAction );
|
109 |
formData.append( 'edd_process_paypal_nonce', nonceEl.value );
|
|
|
|
|
110 |
|
111 |
if ( data.orderID ) {
|
112 |
formData.append( 'paypal_order_id', data.orderID );
|
@@ -181,11 +184,18 @@ var EDD_PayPal = {
|
|
181 |
return response.json();
|
182 |
} ).then( function( orderData ) {
|
183 |
if ( orderData.data && orderData.data.paypal_order_id ) {
|
|
|
184 |
// Add the nonce to the form so we can validate it later.
|
185 |
if ( orderData.data.nonce ) {
|
186 |
nonceEl.value = orderData.data.nonce;
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
return orderData.data.paypal_order_id;
|
190 |
} else {
|
191 |
// Error message.
|
100 |
var errorWrapper = ( 'checkout' === context ) ? form.querySelector( '#edd-paypal-errors-wrap' ) : form.querySelector( '.edd-paypal-checkout-buy-now-error-wrapper' );
|
101 |
var spinner = ( 'checkout' === context ) ? document.getElementById( 'edd-paypal-spinner' ) : form.querySelector( '.edd-paypal-spinner' );
|
102 |
var nonceEl = form.querySelector( 'input[name="edd_process_paypal_nonce"]' );
|
103 |
+
var tokenEl = form.querySelector( 'input[name="edd-process-paypal-token"]' );
|
104 |
var createFunc = ( 'subscription' === eddPayPalVars.intent ) ? 'createSubscription' : 'createOrder';
|
105 |
|
106 |
var buttonArgs = {
|
108 |
var formData = new FormData();
|
109 |
formData.append( 'action', eddPayPalVars.approvalAction );
|
110 |
formData.append( 'edd_process_paypal_nonce', nonceEl.value );
|
111 |
+
formData.append( 'token', tokenEl.getAttribute('data-token') );
|
112 |
+
formData.append( 'timestamp', tokenEl.getAttribute('data-timestamp' ) );
|
113 |
|
114 |
if ( data.orderID ) {
|
115 |
formData.append( 'paypal_order_id', data.orderID );
|
184 |
return response.json();
|
185 |
} ).then( function( orderData ) {
|
186 |
if ( orderData.data && orderData.data.paypal_order_id ) {
|
187 |
+
|
188 |
// Add the nonce to the form so we can validate it later.
|
189 |
if ( orderData.data.nonce ) {
|
190 |
nonceEl.value = orderData.data.nonce;
|
191 |
}
|
192 |
|
193 |
+
// Add the token to the form so we can validate it later.
|
194 |
+
if ( orderData.data.token ) {
|
195 |
+
jQuery(tokenEl).attr( 'data-token', orderData.data.token );
|
196 |
+
jQuery(tokenEl).attr( 'data-timestamp', orderData.data.timestamp );
|
197 |
+
}
|
198 |
+
|
199 |
return orderData.data.paypal_order_id;
|
200 |
} else {
|
201 |
// Error message.
|
assets/js/paypal-checkout.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var EDD_PayPal={isMounted:!1,init:function(){document.getElementById("edd-paypal-container")&&this.initButtons("#edd-paypal-container","checkout"),jQuery(document.body).on("edd_discount_applied",this.maybeRefreshPage),jQuery(document.body).on("edd_discount_removed",this.maybeRefreshPage)},isPayPal:function(){var chosenGateway=!1;return jQuery("select#edd-gateway, input.edd-gateway").length&&(chosenGateway=jQuery("meta[name='edd-chosen-gateway']").attr("content")),!chosenGateway&&edd_scripts.default_gateway&&(chosenGateway=edd_scripts.default_gateway),"paypal_commerce"===chosenGateway},maybeRefreshPage:function(e,data){0===data.total_plain&&EDD_PayPal.isPayPal()?window.location.reload():!EDD_PayPal.isMounted&&EDD_PayPal.isPayPal()&&0<data.total_plain&&window.location.reload()},setErrorHtml:function(container,context,errorHtml){if("checkout"===context&&"undefined"!=typeof edd_global_vars&&edd_global_vars.checkout_error_anchor)(errorWrapper=document.getElementById("edd-paypal-errors-wrap"))&&(errorWrapper.innerHTML=errorHtml);else if("buy_now"===context){var errorWrapper,form=container.closest(".edd_download_purchase_form");(errorWrapper=!!form&&form.querySelector(".edd-paypal-checkout-buy-now-error-wrapper"))&&(errorWrapper.innerHTML=errorHtml)}jQuery(document.body).trigger("edd_checkout_error",[errorHtml])},initButtons:function(container,context){EDD_PayPal.isMounted=!0,paypal.Buttons(EDD_PayPal.getButtonArgs(container,context)).render(container),document.dispatchEvent(new CustomEvent("edd_paypal_buttons_mounted"))},getButtonArgs:function(container,context){var form="checkout"===context?document.getElementById("edd_purchase_form"):container.closest(".edd_download_purchase_form"),errorWrapper="checkout"===context?form.querySelector("#edd-paypal-errors-wrap"):form.querySelector(".edd-paypal-checkout-buy-now-error-wrapper"),spinner="checkout"===context?document.getElementById("edd-paypal-spinner"):form.querySelector(".edd-paypal-spinner"),nonceEl=form.querySelector('input[name="edd_process_paypal_nonce"]'),createFunc="subscription"===eddPayPalVars.intent?"createSubscription":"createOrder",buttonArgs={onApprove:function(data,actions){var formData=new FormData;return formData.append("action",eddPayPalVars.approvalAction),formData.append("edd_process_paypal_nonce",nonceEl.value),data.orderID&&formData.append("paypal_order_id",data.orderID),data.subscriptionID&&formData.append("paypal_subscription_id",data.subscriptionID),fetch(edd_scripts.ajaxurl,{method:"POST",body:formData}).then(function(response){return response.json()}).then(function(responseData){if(responseData.success&&responseData.data.redirect_url)window.location=responseData.data.redirect_url;else{spinner.style.display="none";var errorHtml=responseData.data.message?responseData.data.message:eddPayPalVars.defaultError;if(EDD_PayPal.setErrorHtml(container,context,errorHtml),responseData.data.retry)return actions.restart()}})},onError:function(error){spinner.style.display="none",error.name="",EDD_PayPal.setErrorHtml(container,context,error)},onCancel:function(data){spinner.style.display="none"}};return eddPayPalVars.style&&(buttonArgs.style=eddPayPalVars.style),buttonArgs[createFunc]=function(data,actions){return spinner.style.display="block",errorWrapper&&(errorWrapper.innerHTML=""),fetch(edd_scripts.ajaxurl,{method:"POST",body:new FormData(form)}).then(function(response){return response.json()}).then(function(orderData){if(orderData.data&&orderData.data.paypal_order_id)return orderData.data.nonce&&(nonceEl.value=orderData.data.nonce),orderData.data.paypal_order_id;var errorHtml=eddPayPalVars.defaultError;return orderData.data&&"string"==typeof orderData.data?errorHtml=orderData.data:"string"==typeof orderData&&(errorHtml=orderData),new Promise(function(resolve,reject){reject(new Error(errorHtml))})})},buttonArgs}};jQuery(document.body).on("edd_gateway_loaded",function(e,gateway){"paypal_commerce"===gateway&&EDD_PayPal.init()}),jQuery(document).ready(function($){for(var buyButtons=document.querySelectorAll(".edd-paypal-checkout-buy-now"),i=0;i<buyButtons.length;i++){var element=buyButtons[i];if(element.classList.contains("edd-free-download"))return;var wrapper=element.closest(".edd_purchase_submit_wrapper");if(!wrapper)return;wrapper.innerHTML="";var errorNode=document.createElement("div");errorNode.classList.add("edd-paypal-checkout-buy-now-error-wrapper"),wrapper.before(errorNode);var spinnerWrap=document.createElement("span");spinnerWrap.classList.add("edd-paypal-spinner","edd-loading-ajax","edd-loading"),spinnerWrap.style.display="none",wrapper.after(spinnerWrap),EDD_PayPal.initButtons(wrapper,"buy_now")}});
|
1 |
+
var EDD_PayPal={isMounted:!1,init:function(){document.getElementById("edd-paypal-container")&&this.initButtons("#edd-paypal-container","checkout"),jQuery(document.body).on("edd_discount_applied",this.maybeRefreshPage),jQuery(document.body).on("edd_discount_removed",this.maybeRefreshPage)},isPayPal:function(){var chosenGateway=!1;return jQuery("select#edd-gateway, input.edd-gateway").length&&(chosenGateway=jQuery("meta[name='edd-chosen-gateway']").attr("content")),!chosenGateway&&edd_scripts.default_gateway&&(chosenGateway=edd_scripts.default_gateway),"paypal_commerce"===chosenGateway},maybeRefreshPage:function(e,data){0===data.total_plain&&EDD_PayPal.isPayPal()?window.location.reload():!EDD_PayPal.isMounted&&EDD_PayPal.isPayPal()&&0<data.total_plain&&window.location.reload()},setErrorHtml:function(container,context,errorHtml){if("checkout"===context&&"undefined"!=typeof edd_global_vars&&edd_global_vars.checkout_error_anchor)(errorWrapper=document.getElementById("edd-paypal-errors-wrap"))&&(errorWrapper.innerHTML=errorHtml);else if("buy_now"===context){var errorWrapper,form=container.closest(".edd_download_purchase_form");(errorWrapper=!!form&&form.querySelector(".edd-paypal-checkout-buy-now-error-wrapper"))&&(errorWrapper.innerHTML=errorHtml)}jQuery(document.body).trigger("edd_checkout_error",[errorHtml])},initButtons:function(container,context){EDD_PayPal.isMounted=!0,paypal.Buttons(EDD_PayPal.getButtonArgs(container,context)).render(container),document.dispatchEvent(new CustomEvent("edd_paypal_buttons_mounted"))},getButtonArgs:function(container,context){var form="checkout"===context?document.getElementById("edd_purchase_form"):container.closest(".edd_download_purchase_form"),errorWrapper="checkout"===context?form.querySelector("#edd-paypal-errors-wrap"):form.querySelector(".edd-paypal-checkout-buy-now-error-wrapper"),spinner="checkout"===context?document.getElementById("edd-paypal-spinner"):form.querySelector(".edd-paypal-spinner"),nonceEl=form.querySelector('input[name="edd_process_paypal_nonce"]'),tokenEl=form.querySelector('input[name="edd-process-paypal-token"]'),createFunc="subscription"===eddPayPalVars.intent?"createSubscription":"createOrder",buttonArgs={onApprove:function(data,actions){var formData=new FormData;return formData.append("action",eddPayPalVars.approvalAction),formData.append("edd_process_paypal_nonce",nonceEl.value),formData.append("token",tokenEl.getAttribute("data-token")),formData.append("timestamp",tokenEl.getAttribute("data-timestamp")),data.orderID&&formData.append("paypal_order_id",data.orderID),data.subscriptionID&&formData.append("paypal_subscription_id",data.subscriptionID),fetch(edd_scripts.ajaxurl,{method:"POST",body:formData}).then(function(response){return response.json()}).then(function(responseData){if(responseData.success&&responseData.data.redirect_url)window.location=responseData.data.redirect_url;else{spinner.style.display="none";var errorHtml=responseData.data.message?responseData.data.message:eddPayPalVars.defaultError;if(EDD_PayPal.setErrorHtml(container,context,errorHtml),responseData.data.retry)return actions.restart()}})},onError:function(error){spinner.style.display="none",error.name="",EDD_PayPal.setErrorHtml(container,context,error)},onCancel:function(data){spinner.style.display="none"}};return eddPayPalVars.style&&(buttonArgs.style=eddPayPalVars.style),buttonArgs[createFunc]=function(data,actions){return spinner.style.display="block",errorWrapper&&(errorWrapper.innerHTML=""),fetch(edd_scripts.ajaxurl,{method:"POST",body:new FormData(form)}).then(function(response){return response.json()}).then(function(orderData){if(orderData.data&&orderData.data.paypal_order_id)return orderData.data.nonce&&(nonceEl.value=orderData.data.nonce),orderData.data.token&&(jQuery(tokenEl).attr("data-token",orderData.data.token),jQuery(tokenEl).attr("data-timestamp",orderData.data.timestamp)),orderData.data.paypal_order_id;var errorHtml=eddPayPalVars.defaultError;return orderData.data&&"string"==typeof orderData.data?errorHtml=orderData.data:"string"==typeof orderData&&(errorHtml=orderData),new Promise(function(resolve,reject){reject(new Error(errorHtml))})})},buttonArgs}};jQuery(document.body).on("edd_gateway_loaded",function(e,gateway){"paypal_commerce"===gateway&&EDD_PayPal.init()}),jQuery(document).ready(function($){for(var buyButtons=document.querySelectorAll(".edd-paypal-checkout-buy-now"),i=0;i<buyButtons.length;i++){var element=buyButtons[i];if(element.classList.contains("edd-free-download"))return;var wrapper=element.closest(".edd_purchase_submit_wrapper");if(!wrapper)return;wrapper.innerHTML="";var errorNode=document.createElement("div");errorNode.classList.add("edd-paypal-checkout-buy-now-error-wrapper"),wrapper.before(errorNode);var spinnerWrap=document.createElement("span");spinnerWrap.classList.add("edd-paypal-spinner","edd-loading-ajax","edd-loading"),spinnerWrap.style.display="none",wrapper.after(spinnerWrap),EDD_PayPal.initButtons(wrapper,"buy_now")}});
|
easy-digital-downloads.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: The easiest way to sell digital products with WordPress.
|
6 |
* Author: Sandhills Development, LLC
|
7 |
* Author URI: https://sandhillsdev.com
|
8 |
-
* Version: 2.11
|
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.11
|
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.11' );
|
210 |
}
|
211 |
|
212 |
// Plugin Folder Path.
|
5 |
* Description: The easiest way to sell digital products with WordPress.
|
6 |
* Author: Sandhills Development, LLC
|
7 |
* Author URI: https://sandhillsdev.com
|
8 |
+
* Version: 2.11.1
|
9 |
* Text Domain: easy-digital-downloads
|
10 |
* Domain Path: languages
|
11 |
*
|
25 |
* @package EDD
|
26 |
* @category Core
|
27 |
* @author Pippin Williamson
|
28 |
+
* @version 2.11.1
|
29 |
*/
|
30 |
|
31 |
// Exit if accessed directly.
|
206 |
|
207 |
// Plugin version.
|
208 |
if ( ! defined( 'EDD_VERSION' ) ) {
|
209 |
+
define( 'EDD_VERSION', '2.11.1' );
|
210 |
}
|
211 |
|
212 |
// Plugin Folder Path.
|
includes/gateways/paypal/admin/connect.php
CHANGED
@@ -399,12 +399,15 @@ function get_account_info() {
|
|
399 |
$account_status .= ob_get_clean();
|
400 |
|
401 |
if ( ! edd_is_gateway_active( 'paypal_commerce' ) ) {
|
402 |
-
$account_status .=
|
403 |
-
/* Translators: %1$s opening anchor tag; %2$s closing anchor tag */
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
|
|
|
|
408 |
}
|
409 |
|
410 |
wp_send_json_success( array(
|
399 |
$account_status .= ob_get_clean();
|
400 |
|
401 |
if ( ! edd_is_gateway_active( 'paypal_commerce' ) ) {
|
402 |
+
$account_status .= sprintf(
|
403 |
+
/* Translators: %1$s opening anchor tag; %2$s closing anchor tag; %3$s: opening line item/status/strong tags; %4$s closing strong tag; %5$s: closing list item tag */
|
404 |
+
__( '%3$sGateway Status: %4$s PayPal is not currently active. %1$sEnable PayPal%2$s in the general gateway settings to start using it.%5$s', 'easy-digital-downloads' ),
|
405 |
+
'<a href="' . esc_url( admin_url( 'edit.php?post_type=download&page=edd-settings&tab=gateways§ion=main' ) ) . '">',
|
406 |
+
'</a>',
|
407 |
+
'<li><span class="dashicons dashicons-no"></span><strong>',
|
408 |
+
'</strong>',
|
409 |
+
'</li>'
|
410 |
+
);
|
411 |
}
|
412 |
|
413 |
wp_send_json_success( array(
|
includes/gateways/paypal/buy-now.php
CHANGED
@@ -94,8 +94,10 @@ add_filter( 'edd_purchase_link_args', __NAMESPACE__ . '\maybe_add_purchase_link_
|
|
94 |
function maybe_enable_buy_now_js( $download_id, $args ) {
|
95 |
if ( ! empty( $args['direct'] ) && is_buy_now_enabled() ) {
|
96 |
register_js( true );
|
|
|
97 |
?>
|
98 |
<input type="hidden" name="edd_process_paypal_nonce" value="<?php echo esc_attr( wp_create_nonce( 'edd_process_paypal' ) ); ?>">
|
|
|
99 |
<?php
|
100 |
}
|
101 |
}
|
94 |
function maybe_enable_buy_now_js( $download_id, $args ) {
|
95 |
if ( ! empty( $args['direct'] ) && is_buy_now_enabled() ) {
|
96 |
register_js( true );
|
97 |
+
$timestamp = time();
|
98 |
?>
|
99 |
<input type="hidden" name="edd_process_paypal_nonce" value="<?php echo esc_attr( wp_create_nonce( 'edd_process_paypal' ) ); ?>">
|
100 |
+
<input type="hidden" name="edd-process-paypal-token" data-timestamp="<?php echo esc_attr( $timestamp ); ?>" data-token="<?php echo esc_attr( \EDD\Utils\Tokenizer::tokenize( $timestamp ) ); ?>" />
|
101 |
<?php
|
102 |
}
|
103 |
}
|
includes/gateways/paypal/checkout-actions.php
CHANGED
@@ -36,7 +36,9 @@ function override_purchase_button( $button ) {
|
|
36 |
ob_start();
|
37 |
if ( ready_to_accept_payments() ) {
|
38 |
wp_nonce_field( 'edd_process_paypal', 'edd_process_paypal_nonce' );
|
|
|
39 |
?>
|
|
|
40 |
<div id="edd-paypal-errors-wrap"></div>
|
41 |
<div id="edd-paypal-container"></div>
|
42 |
<div id="edd-paypal-spinner" style="display: none;">
|
@@ -238,10 +240,13 @@ function create_order( $purchase_data ) {
|
|
238 |
* If the user was just logged into a new account, the previously sent nonce may have
|
239 |
* become invalid.
|
240 |
*/
|
|
|
241 |
wp_send_json_success( array(
|
242 |
'paypal_order_id' => $response->id,
|
243 |
'edd_order_id' => $payment_id,
|
244 |
-
'nonce' => wp_create_nonce( 'edd_process_paypal' )
|
|
|
|
|
245 |
) );
|
246 |
} catch ( Authentication_Exception $e ) {
|
247 |
throw new Gateway_Exception( __( 'An authentication error occurred. Please try again.', 'easy-digital-downloads' ), $e->getCode(), $e->getMessage() );
|
@@ -271,19 +276,31 @@ add_action( 'edd_gateway_paypal_commerce', __NAMESPACE__ . '\create_order', 9 );
|
|
271 |
function capture_order() {
|
272 |
edd_debug_log( 'PayPal - capture_order()' );
|
273 |
try {
|
274 |
-
if ( empty( $_POST['edd_process_paypal_nonce'] ) ) {
|
275 |
-
throw new Gateway_Exception(
|
276 |
-
__( 'A validation error occurred. Please try again.', 'easy-digital-downloads' ),
|
277 |
-
400,
|
278 |
-
'Missing approval nonce.'
|
279 |
-
);
|
280 |
-
}
|
281 |
|
282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
throw new Gateway_Exception(
|
284 |
__( 'A validation error occurred. Please try again.', 'easy-digital-downloads' ),
|
285 |
-
|
286 |
-
'
|
287 |
);
|
288 |
}
|
289 |
|
36 |
ob_start();
|
37 |
if ( ready_to_accept_payments() ) {
|
38 |
wp_nonce_field( 'edd_process_paypal', 'edd_process_paypal_nonce' );
|
39 |
+
$timestamp = time();
|
40 |
?>
|
41 |
+
<input type="hidden" name="edd-process-paypal-token" data-timestamp="<?php echo esc_attr( $timestamp ); ?>" data-token="<?php echo esc_attr( \EDD\Utils\Tokenizer::tokenize( $timestamp ) ); ?>" />
|
42 |
<div id="edd-paypal-errors-wrap"></div>
|
43 |
<div id="edd-paypal-container"></div>
|
44 |
<div id="edd-paypal-spinner" style="display: none;">
|
240 |
* If the user was just logged into a new account, the previously sent nonce may have
|
241 |
* become invalid.
|
242 |
*/
|
243 |
+
$timestamp = time();
|
244 |
wp_send_json_success( array(
|
245 |
'paypal_order_id' => $response->id,
|
246 |
'edd_order_id' => $payment_id,
|
247 |
+
'nonce' => wp_create_nonce( 'edd_process_paypal' ),
|
248 |
+
'timestamp' => $timestamp,
|
249 |
+
'token' => \EDD\Utils\Tokenizer::tokenize( $timestamp ),
|
250 |
) );
|
251 |
} catch ( Authentication_Exception $e ) {
|
252 |
throw new Gateway_Exception( __( 'An authentication error occurred. Please try again.', 'easy-digital-downloads' ), $e->getCode(), $e->getMessage() );
|
276 |
function capture_order() {
|
277 |
edd_debug_log( 'PayPal - capture_order()' );
|
278 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
+
$token = isset( $_POST['token'] ) ? sanitize_text_field( $_POST['token'] ) : '';
|
281 |
+
$timestamp = isset( $_POST['timestamp'] ) ? sanitize_text_field( $_POST['timestamp'] ) : '';
|
282 |
+
|
283 |
+
if ( ! empty( $timestamp ) && ! empty( $token ) ) {
|
284 |
+
if ( !\EDD\Utils\Tokenizer::is_token_valid( $token, $timestamp ) ) {
|
285 |
+
throw new Gateway_Exception(
|
286 |
+
__('A validation error occurred. Please try again.', 'easy-digital-downloads'),
|
287 |
+
403,
|
288 |
+
'Token validation failed.'
|
289 |
+
);
|
290 |
+
}
|
291 |
+
} elseif ( empty( $token ) && ! empty( $_POST['edd_process_paypal_nonce'] ) ) {
|
292 |
+
if ( ! wp_verify_nonce( $_POST['edd_process_paypal_nonce'], 'edd_process_paypal' ) ) {
|
293 |
+
throw new Gateway_Exception(
|
294 |
+
__( 'A validation error occurred. Please try again.', 'easy-digital-downloads' ),
|
295 |
+
403,
|
296 |
+
'Nonce validation failed.'
|
297 |
+
);
|
298 |
+
}
|
299 |
+
} else {
|
300 |
throw new Gateway_Exception(
|
301 |
__( 'A validation error occurred. Please try again.', 'easy-digital-downloads' ),
|
302 |
+
400,
|
303 |
+
'Missing validation fields.'
|
304 |
);
|
305 |
}
|
306 |
|
includes/gateways/paypal/scripts.php
CHANGED
@@ -79,7 +79,6 @@ function register_js( $force_load = false ) {
|
|
79 |
*/
|
80 |
$sdk_query_args = apply_filters( 'edd_paypal_js_sdk_query_args', array(
|
81 |
'client-id' => urlencode( $api->client_id ),
|
82 |
-
'locale' => urlencode( get_locale() ),
|
83 |
'currency' => urlencode( strtoupper( edd_get_currency() ) ),
|
84 |
'intent' => 'capture',
|
85 |
'disable-funding' => 'card,credit,bancontact,blik,eps,giropay,ideal,mercadopago,mybank,p24,sepa,sofort,venmo'
|
79 |
*/
|
80 |
$sdk_query_args = apply_filters( 'edd_paypal_js_sdk_query_args', array(
|
81 |
'client-id' => urlencode( $api->client_id ),
|
|
|
82 |
'currency' => urlencode( strtoupper( edd_get_currency() ) ),
|
83 |
'intent' => 'capture',
|
84 |
'disable-funding' => 'card,credit,bancontact,blik,eps,giropay,ideal,mercadopago,mybank,p24,sepa,sofort,venmo'
|
languages/easy-digital-downloads.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
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.11\n"
|
6 |
"Report-Msgid-Bugs-To: https://easydigitaldownloads.com/\n"
|
7 |
-
"POT-Creation-Date: 2021-08-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -106,9 +106,9 @@ msgstr ""
|
|
106 |
#: includes/emails/actions.php:53 includes/emails/template.php:243
|
107 |
#: includes/error-tracking.php:60 includes/gateways/functions.php:243
|
108 |
#: includes/gateways/manual.php:33
|
109 |
-
#: includes/gateways/paypal/admin/connect.php:
|
110 |
-
#: includes/gateways/paypal/admin/connect.php:
|
111 |
-
#: includes/gateways/paypal/admin/connect.php:
|
112 |
#: includes/gateways/paypal-standard.php:172
|
113 |
#: includes/gateways/stripe/includes/admin/upgrade-functions.php:57
|
114 |
#: includes/gateways/stripe/includes/payment-actions.php:1403
|
@@ -2563,12 +2563,12 @@ msgstr ""
|
|
2563 |
#: includes/gateways/paypal/admin/connect.php:106
|
2564 |
#: includes/gateways/paypal/admin/connect.php:182
|
2565 |
#: includes/gateways/paypal/admin/connect.php:292
|
2566 |
-
#: includes/gateways/paypal/admin/connect.php:
|
2567 |
-
#: includes/gateways/paypal/admin/connect.php:
|
2568 |
-
#: includes/gateways/paypal/admin/connect.php:
|
2569 |
-
#: includes/gateways/paypal/admin/connect.php:
|
2570 |
-
#: includes/gateways/paypal/admin/connect.php:
|
2571 |
-
#: includes/gateways/paypal/admin/connect.php:
|
2572 |
msgid "You do not have permission to perform this action."
|
2573 |
msgstr ""
|
2574 |
|
@@ -6696,7 +6696,7 @@ msgid "Quantity"
|
|
6696 |
msgstr ""
|
6697 |
|
6698 |
#: includes/emails/class-edd-email-tags.php:467
|
6699 |
-
#: templates/history-downloads.php:
|
6700 |
msgid "No downloadable files found."
|
6701 |
msgstr ""
|
6702 |
|
@@ -7110,13 +7110,15 @@ msgid "Webhook successfully configured for the following events:"
|
|
7110 |
msgstr ""
|
7111 |
|
7112 |
#: includes/gateways/paypal/admin/connect.php:404
|
7113 |
-
#. Translators: %1$s opening anchor tag; %2$s closing anchor tag
|
|
|
|
|
7114 |
msgid ""
|
7115 |
-
"PayPal is not currently active. %1$sEnable
|
7116 |
-
"gateway settings to start using it
|
7117 |
msgstr ""
|
7118 |
|
7119 |
-
#: includes/gateways/paypal/admin/connect.php:
|
7120 |
msgid "No merchant ID saved. Please reconnect to PayPal."
|
7121 |
msgstr ""
|
7122 |
|
@@ -7198,58 +7200,59 @@ msgid ""
|
|
7198 |
"target=\"_blank\">SSL setup article</a>."
|
7199 |
msgstr ""
|
7200 |
|
7201 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7202 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7203 |
msgid "Please connect your PayPal account in the gateway settings."
|
7204 |
msgstr ""
|
7205 |
|
7206 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7207 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7208 |
msgid "Unexpected authentication error. Please contact a site administrator."
|
7209 |
msgstr ""
|
7210 |
|
7211 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7212 |
#: includes/gateways/paypal/exceptions/class-gateway-exception.php:48
|
7213 |
msgid "PayPal Gateway Error"
|
7214 |
msgstr ""
|
7215 |
|
7216 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7217 |
msgid "Account not ready to accept payments."
|
7218 |
msgstr ""
|
7219 |
|
7220 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7221 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7222 |
-
#: includes/gateways/paypal/scripts.php:
|
7223 |
msgid "An unexpected error occurred. Please try again."
|
7224 |
msgstr ""
|
7225 |
|
7226 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7227 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7228 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7229 |
msgid "An error occurred while communicating with PayPal. Please try again."
|
7230 |
msgstr ""
|
7231 |
|
7232 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7233 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7234 |
msgid "An authentication error occurred. Please try again."
|
7235 |
msgstr ""
|
7236 |
|
7237 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7238 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
|
|
7239 |
msgid "A validation error occurred. Please try again."
|
7240 |
msgstr ""
|
7241 |
|
7242 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7243 |
msgid "Failed to process payment. Please try again."
|
7244 |
msgstr ""
|
7245 |
|
7246 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7247 |
msgid ""
|
7248 |
"Unable to complete your order with your chosen payment method. Please "
|
7249 |
"choose a new funding source."
|
7250 |
msgstr ""
|
7251 |
|
7252 |
-
#: includes/gateways/paypal/checkout-actions.php:
|
7253 |
#: includes/gateways/paypal-standard.php:671
|
7254 |
#: tests/helpers/class-helper-payment.php:131
|
7255 |
#: tests/helpers/class-helper-payment.php:234
|
@@ -9952,11 +9955,11 @@ msgstr ""
|
|
9952 |
msgid "Download Name"
|
9953 |
msgstr ""
|
9954 |
|
9955 |
-
#: templates/history-downloads.php:
|
9956 |
msgid "Payment status is %s"
|
9957 |
msgstr ""
|
9958 |
|
9959 |
-
#: templates/history-downloads.php:
|
9960 |
msgid "You have not purchased any downloads"
|
9961 |
msgstr ""
|
9962 |
|
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.11.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://easydigitaldownloads.com/\n"
|
7 |
+
"POT-Creation-Date: 2021-08-30 23:22:18+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
106 |
#: includes/emails/actions.php:53 includes/emails/template.php:243
|
107 |
#: includes/error-tracking.php:60 includes/gateways/functions.php:243
|
108 |
#: includes/gateways/manual.php:33
|
109 |
+
#: includes/gateways/paypal/admin/connect.php:455
|
110 |
+
#: includes/gateways/paypal/admin/connect.php:459
|
111 |
+
#: includes/gateways/paypal/admin/connect.php:592
|
112 |
#: includes/gateways/paypal-standard.php:172
|
113 |
#: includes/gateways/stripe/includes/admin/upgrade-functions.php:57
|
114 |
#: includes/gateways/stripe/includes/payment-actions.php:1403
|
2563 |
#: includes/gateways/paypal/admin/connect.php:106
|
2564 |
#: includes/gateways/paypal/admin/connect.php:182
|
2565 |
#: includes/gateways/paypal/admin/connect.php:292
|
2566 |
+
#: includes/gateways/paypal/admin/connect.php:455
|
2567 |
+
#: includes/gateways/paypal/admin/connect.php:459
|
2568 |
+
#: includes/gateways/paypal/admin/connect.php:506
|
2569 |
+
#: includes/gateways/paypal/admin/connect.php:540
|
2570 |
+
#: includes/gateways/paypal/admin/connect.php:563
|
2571 |
+
#: includes/gateways/paypal/admin/connect.php:592
|
2572 |
msgid "You do not have permission to perform this action."
|
2573 |
msgstr ""
|
2574 |
|
6696 |
msgstr ""
|
6697 |
|
6698 |
#: includes/emails/class-edd-email-tags.php:467
|
6699 |
+
#: templates/history-downloads.php:78 templates/shortcode-receipt.php:207
|
6700 |
msgid "No downloadable files found."
|
6701 |
msgstr ""
|
6702 |
|
7110 |
msgstr ""
|
7111 |
|
7112 |
#: includes/gateways/paypal/admin/connect.php:404
|
7113 |
+
#. Translators: %1$s opening anchor tag; %2$s closing anchor tag; %3$s: opening
|
7114 |
+
#. line item/status/strong tags; %4$s closing strong tag; %5$s: closing list
|
7115 |
+
#. item tag
|
7116 |
msgid ""
|
7117 |
+
"%3$sGateway Status: %4$s PayPal is not currently active. %1$sEnable "
|
7118 |
+
"PayPal%2$s in the general gateway settings to start using it.%5$s"
|
7119 |
msgstr ""
|
7120 |
|
7121 |
+
#: includes/gateways/paypal/admin/connect.php:513
|
7122 |
msgid "No merchant ID saved. Please reconnect to PayPal."
|
7123 |
msgstr ""
|
7124 |
|
7200 |
"target=\"_blank\">SSL setup article</a>."
|
7201 |
msgstr ""
|
7202 |
|
7203 |
+
#: includes/gateways/paypal/checkout-actions.php:56
|
7204 |
+
#: includes/gateways/paypal/checkout-actions.php:121
|
7205 |
msgid "Please connect your PayPal account in the gateway settings."
|
7206 |
msgstr ""
|
7207 |
|
7208 |
+
#: includes/gateways/paypal/checkout-actions.php:57
|
7209 |
+
#: includes/gateways/paypal/checkout-actions.php:122
|
7210 |
msgid "Unexpected authentication error. Please contact a site administrator."
|
7211 |
msgstr ""
|
7212 |
|
7213 |
+
#: includes/gateways/paypal/checkout-actions.php:116
|
7214 |
#: includes/gateways/paypal/exceptions/class-gateway-exception.php:48
|
7215 |
msgid "PayPal Gateway Error"
|
7216 |
msgstr ""
|
7217 |
|
7218 |
+
#: includes/gateways/paypal/checkout-actions.php:117
|
7219 |
msgid "Account not ready to accept payments."
|
7220 |
msgstr ""
|
7221 |
|
7222 |
+
#: includes/gateways/paypal/checkout-actions.php:148
|
7223 |
+
#: includes/gateways/paypal/checkout-actions.php:309
|
7224 |
+
#: includes/gateways/paypal/scripts.php:118
|
7225 |
msgid "An unexpected error occurred. Please try again."
|
7226 |
msgstr ""
|
7227 |
|
7228 |
+
#: includes/gateways/paypal/checkout-actions.php:224
|
7229 |
+
#: includes/gateways/paypal/checkout-actions.php:254
|
7230 |
+
#: includes/gateways/paypal/checkout-actions.php:408
|
7231 |
msgid "An error occurred while communicating with PayPal. Please try again."
|
7232 |
msgstr ""
|
7233 |
|
7234 |
+
#: includes/gateways/paypal/checkout-actions.php:252
|
7235 |
+
#: includes/gateways/paypal/checkout-actions.php:406
|
7236 |
msgid "An authentication error occurred. Please try again."
|
7237 |
msgstr ""
|
7238 |
|
7239 |
+
#: includes/gateways/paypal/checkout-actions.php:286
|
7240 |
+
#: includes/gateways/paypal/checkout-actions.php:294
|
7241 |
+
#: includes/gateways/paypal/checkout-actions.php:301
|
7242 |
msgid "A validation error occurred. Please try again."
|
7243 |
msgstr ""
|
7244 |
|
7245 |
+
#: includes/gateways/paypal/checkout-actions.php:322
|
7246 |
msgid "Failed to process payment. Please try again."
|
7247 |
msgstr ""
|
7248 |
|
7249 |
+
#: includes/gateways/paypal/checkout-actions.php:331
|
7250 |
msgid ""
|
7251 |
"Unable to complete your order with your chosen payment method. Please "
|
7252 |
"choose a new funding source."
|
7253 |
msgstr ""
|
7254 |
|
7255 |
+
#: includes/gateways/paypal/checkout-actions.php:396
|
7256 |
#: includes/gateways/paypal-standard.php:671
|
7257 |
#: tests/helpers/class-helper-payment.php:131
|
7258 |
#: tests/helpers/class-helper-payment.php:234
|
9955 |
msgid "Download Name"
|
9956 |
msgstr ""
|
9957 |
|
9958 |
+
#: templates/history-downloads.php:83
|
9959 |
msgid "Payment status is %s"
|
9960 |
msgstr ""
|
9961 |
|
9962 |
+
#: templates/history-downloads.php:110
|
9963 |
msgid "You have not purchased any downloads"
|
9964 |
msgstr ""
|
9965 |
|
readme.txt
CHANGED
@@ -3,11 +3,11 @@ Author URI: https://easydigitaldownloads.com
|
|
3 |
Plugin URI: https://easydigitaldownloads.com
|
4 |
Contributors: easydigitaldownloads, mordauk, sunnyratilal, chriscct7, section214, sumobi, sdavis2702, cklosows, mindctrl, sksmatt, SpencerFinnell, johnstonphilip, brashrebel, drewapicture, johnjamesjacoby, nosegraze, littlerchicken, lisacee
|
5 |
Donate link: https://easydigitaldownloads.com/donate/
|
6 |
-
Tags: ecommerce,
|
7 |
Requires at least: 4.4
|
8 |
Tested up to: 5.8
|
9 |
Requires PHP: 5.3
|
10 |
-
Stable Tag: 2.11
|
11 |
License: GNU Version 2 or Any Later Version
|
12 |
|
13 |
Sell your digital products the simple way. Easily build an online store complete with a cart system, checkout forms, reports, coupons, and more!
|
@@ -82,7 +82,7 @@ Easy Digital Downloads is a verified member of the [Stripe partner program](http
|
|
82 |
With add-on plugins from our [extensions catalogue](https://easydigitaldownloads.com/downloads/?utm_source=extensions&utm_medium=description_tab&utm_content=extensions&utm_campaign=readme) you can super-charge your digital store. Some of our extension highlights include:
|
83 |
|
84 |
* [Stripe Pro](https://easydigitaldownloads.com/downloads/stripe-gateway/?utm_source=extension&utm_medium=description_tab&utm_content=stripe-pro&utm_campaign=readme) removes the additional 2% processing fee as well as adds the ability to accept pre-approved payments (extension must be installed and activated)
|
85 |
-
|
86 |
* [Software Licensing](https://easydigitaldownloads.com/downloads/software-licensing/?utm_source=extension&utm_medium=description_tab&utm_content=software-licensing&utm_campaign=readme) provides a complete solution for selling software license keys and distributing software updates to customers
|
87 |
* [Recurring Payments](https://easydigitaldownloads.com/downloads/recurring-payments/?utm_source=extension&utm_medium=description_tab&utm_content=recurring-payments&utm_campaign=readme) allows store owners to sell recurring subscriptions for digital products using payment gateways like Stripe and PayPal
|
88 |
* [Frontend Submissions](https://easydigitaldownloads.com/downloads/frontend-submissions/?utm_source=extension&utm_medium=description_tab&utm_content=frontend-submissions&utm_campaign=readme) transforms your store into a full-featured multi-vendor marketplace
|
@@ -246,6 +246,12 @@ Yes, through the use of our commercial addon called [Recurring Payments](https:/
|
|
246 |
13. Pay with PayPal modal
|
247 |
|
248 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
= 2.11, August 19, 2021 =
|
250 |
* New: Introducing the new PayPal Commerce gateway integration.
|
251 |
* New: System info page now shows Plugin Author or Update URI
|
3 |
Plugin URI: https://easydigitaldownloads.com
|
4 |
Contributors: easydigitaldownloads, mordauk, sunnyratilal, chriscct7, section214, sumobi, sdavis2702, cklosows, mindctrl, sksmatt, SpencerFinnell, johnstonphilip, brashrebel, drewapicture, johnjamesjacoby, nosegraze, littlerchicken, lisacee
|
5 |
Donate link: https://easydigitaldownloads.com/donate/
|
6 |
+
Tags: ecommerce, downloads, e-commerce, checkout, digital store
|
7 |
Requires at least: 4.4
|
8 |
Tested up to: 5.8
|
9 |
Requires PHP: 5.3
|
10 |
+
Stable Tag: 2.11.1
|
11 |
License: GNU Version 2 or Any Later Version
|
12 |
|
13 |
Sell your digital products the simple way. Easily build an online store complete with a cart system, checkout forms, reports, coupons, and more!
|
82 |
With add-on plugins from our [extensions catalogue](https://easydigitaldownloads.com/downloads/?utm_source=extensions&utm_medium=description_tab&utm_content=extensions&utm_campaign=readme) you can super-charge your digital store. Some of our extension highlights include:
|
83 |
|
84 |
* [Stripe Pro](https://easydigitaldownloads.com/downloads/stripe-gateway/?utm_source=extension&utm_medium=description_tab&utm_content=stripe-pro&utm_campaign=readme) removes the additional 2% processing fee as well as adds the ability to accept pre-approved payments (extension must be installed and activated)
|
85 |
+
* [PayPal Commerce Pro](https://easydigitaldownloads.com/downloads/paypal-commerce-pro/?utm_source=extension&utm_medium=description_tab&utm_content=paypal-commerce-pro&utm_campaign=readme) allows customers to pay by debit or credit card as well as alternative payments such as Sofort, iDEAL, Bancontact, and Giropay (extension must be installed and activated)
|
86 |
* [Software Licensing](https://easydigitaldownloads.com/downloads/software-licensing/?utm_source=extension&utm_medium=description_tab&utm_content=software-licensing&utm_campaign=readme) provides a complete solution for selling software license keys and distributing software updates to customers
|
87 |
* [Recurring Payments](https://easydigitaldownloads.com/downloads/recurring-payments/?utm_source=extension&utm_medium=description_tab&utm_content=recurring-payments&utm_campaign=readme) allows store owners to sell recurring subscriptions for digital products using payment gateways like Stripe and PayPal
|
88 |
* [Frontend Submissions](https://easydigitaldownloads.com/downloads/frontend-submissions/?utm_source=extension&utm_medium=description_tab&utm_content=frontend-submissions&utm_campaign=readme) transforms your store into a full-featured multi-vendor marketplace
|
246 |
13. Pay with PayPal modal
|
247 |
|
248 |
== Changelog ==
|
249 |
+
= 2.11.1, August 30, 2021 =
|
250 |
+
* Improved: Better compatibility with caching when using PayPal Commerce.
|
251 |
+
* Improved: Made it more clear when PayPal Commerce is successfully connected, but not set as an active gaetway.
|
252 |
+
* Fix: PayPal Commerce - Rely on end-user locale when loading the PayPal Javascript SDK.
|
253 |
+
* Fix: The download history shortcode was not aware of bundles with variable prices.
|
254 |
+
|
255 |
= 2.11, August 19, 2021 =
|
256 |
* New: Introducing the new PayPal Commerce gateway integration.
|
257 |
* New: System info page now shows Plugin Author or Update URI
|
templates/history-downloads.php
CHANGED
@@ -36,6 +36,10 @@ if ( $purchases ) :
|
|
36 |
<tr class="edd_download_history_row">
|
37 |
<?php
|
38 |
$price_id = edd_get_cart_item_price_id( $download );
|
|
|
|
|
|
|
|
|
39 |
$download_files = edd_get_download_files( $download['id'], $price_id );
|
40 |
$name = $download['name'];
|
41 |
|
36 |
<tr class="edd_download_history_row">
|
37 |
<?php
|
38 |
$price_id = edd_get_cart_item_price_id( $download );
|
39 |
+
// Get price ID of product with variable prices included in Bundle
|
40 |
+
if ( ! empty( $download['in_bundle'] ) && edd_has_variable_prices( $download['id'] ) ) {
|
41 |
+
$price_id = edd_get_bundle_item_price_id( $download['id'] );
|
42 |
+
}
|
43 |
$download_files = edd_get_download_files( $download['id'], $price_id );
|
44 |
$name = $download['name'];
|
45 |
|