Skip to content

Commit

Permalink
Hot Fix: don't prevent PayPal donations from getting finished when th…
Browse files Browse the repository at this point in the history
…ere is no Billing Address block in the form (#7416)

Co-authored-by: Jon Waldstein <[email protected]>
  • Loading branch information
glaubersilva and Jon Waldstein authored Jun 19, 2024
1 parent 221edce commit 69f920a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
4 changes: 2 additions & 2 deletions give.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: GiveWP
* Author URI: https://givewp.com/
* Version: 3.12.2
* Version: 3.12.3
* Requires at least: 6.3
* Requires PHP: 7.2
* Text Domain: give
Expand Down Expand Up @@ -404,7 +404,7 @@ private function setup_constants()
{
// Plugin version.
if (!defined('GIVE_VERSION')) {
define('GIVE_VERSION', '3.12.2');
define('GIVE_VERSION', '3.12.3');
}

// Plugin Root File.
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding
Requires at least: 6.3
Tested up to: 6.5
Requires PHP: 7.2
Stable tag: 3.12.2
Stable tag: 3.12.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -262,6 +262,9 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri
10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on.

== Changelog ==
= 3.12.3: June 19th, 2024 =
* Fix: Resolved an issue where PayPal was not processing donations due to missing billing address fields

= 3.12.2: June 11th, 2024 =
* Fix: Resolved an issue where only the donation amount was sent to PayPal, ignoring event ticket values for one-time donations.
* Fix: Resolved an issue where donations were processed on PayPal but not recorded in GiveWP due to missing city, state, and zip fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,37 @@ import {PayPalSubscriber} from './types';
* when the donation is already created on the PayPal side. This way, we need the conditions below to check it earlier
* and prevent the donation creation on the PayPal side if the required billing address fields are missing.
*/
if (city.length === 0 && isCityRequired()) {
setError('city', {type: 'custom', message: getRequiredValidationMessage()}, {shouldFocus: true});
return actions.reject();
}
if (country) {
if (city.length === 0 && isCityRequired()) {
setError(
'city',
{
type: 'custom',
message: getRequiredValidationMessage(),
},
{shouldFocus: true}
);
return actions.reject();
}

if (state.length === 0 && isStateRequired()) {
setError('state', {type: 'custom', message: getRequiredValidationMessage()}, {shouldFocus: true});
// As the state is a hidden field we need to use this workaround because the "shouldFocus" option does not work in hidden fields.
document.querySelector('.givewp-fields-select-state').scrollIntoView({behavior: 'smooth'});
return actions.reject();
}
if (state.length === 0 && isStateRequired()) {
setError(
'state',
{
type: 'custom',
message: getRequiredValidationMessage(),
},
{shouldFocus: true}
);
// As the state is a hidden field we need to use this workaround because the "shouldFocus" option does not work in hidden fields.
document.querySelector('.givewp-fields-select-state').scrollIntoView({behavior: 'smooth'});
return actions.reject();
}

if (postalCode.length === 0 && isZipRequired()) {
setError('zip', {type: 'custom', message: getRequiredValidationMessage()}, {shouldFocus: true});
return actions.reject();
if (postalCode.length === 0 && isZipRequired()) {
setError('zip', {type: 'custom', message: getRequiredValidationMessage()}, {shouldFocus: true});
return actions.reject();
}
}

orderCreated = true;
Expand Down

0 comments on commit 69f920a

Please sign in to comment.