diff --git a/give.php b/give.php index 13333a5500..29936ae05d 100644 --- a/give.php +++ b/give.php @@ -391,7 +391,7 @@ private function setup_constants() { // Plugin version. if (!defined('GIVE_VERSION')) { - define('GIVE_VERSION', '3.0.0'); + define('GIVE_VERSION', '2.33.1'); } // Plugin Root File. diff --git a/readme.txt b/readme.txt index 5334735b68..782583629f 100644 --- a/readme.txt +++ b/readme.txt @@ -258,9 +258,6 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri 8. GiveWP has a dedicated support team to help answer any questions you may have and help you through stumbling blocks. == Changelog == -= 3.0.0: August 15th, 2023 = -* New: GiveWP 3.0 is here! This is a major release that includes a new visual form builder and many more. Read more about it [on our website](https://go.givewp.com/corenextgen). - = 2.33.1: August 31st, 2023 = * Security: The donor default user role has been sanitized to prevent privilege escalation diff --git a/src/DonationForms/V2/ValueObjects/DonationFormStatus.php b/src/DonationForms/V2/ValueObjects/DonationFormStatus.php index 60e837da4f..652d9ec38c 100644 --- a/src/DonationForms/V2/ValueObjects/DonationFormStatus.php +++ b/src/DonationForms/V2/ValueObjects/DonationFormStatus.php @@ -17,7 +17,7 @@ * @method bool isPublished() * @method bool isPrivate() * @method bool isDraft() - * @method bool isTrashed() + * @method bool isTrash() * @method bool isUpgraded() */ class DonationFormStatus extends Enum diff --git a/src/LegacyPaymentGateways/Adapters/LegacyPaymentGatewayAdapter.php b/src/LegacyPaymentGateways/Adapters/LegacyPaymentGatewayAdapter.php index 410a8a3c08..c2487030d9 100644 --- a/src/LegacyPaymentGateways/Adapters/LegacyPaymentGatewayAdapter.php +++ b/src/LegacyPaymentGateways/Adapters/LegacyPaymentGatewayAdapter.php @@ -3,6 +3,7 @@ namespace Give\LegacyPaymentGateways\Adapters; use Exception; +use Give\DonationForms\V2\Models\DonationForm; use Give\Donations\Models\Donation; use Give\Donations\ValueObjects\DonationType; use Give\Donors\Models\Donor; @@ -62,6 +63,9 @@ public function handleBeforeGateway(array $legacyDonationData, PaymentGateway $r $formData = FormData::fromRequest($legacyDonationData); $this->validateGatewayNonce($formData->gatewayNonce); + + $this->validateDonationFormStatus($formData->formId); + $donor = $this->getOrCreateDonor( $formData->donorInfo->wpUserId, $formData->donorInfo->email, @@ -234,6 +238,27 @@ private function validateGatewayNonce(string $gatewayNonce) } } + /** + * Validate Donation Form Status + * + * @since 2.33.2 + */ + private function validateDonationFormStatus(int $formId) + { + $donationForm = DonationForm::find($formId); + + if (!$donationForm || $donationForm->status->isTrash()) { + wp_die( + esc_html__( + 'This donation form is not accepting donations.', + 'give' + ), + esc_html__('Error', 'give'), + ['response' => 403] + ); + } + } + /** * Set donation id to purchase session for use in the donation receipt. *