From eb462e18aefb433bda1134030af12eb50daccdef Mon Sep 17 00:00:00 2001 From: Tony Smedal Date: Wed, 10 May 2023 15:26:02 -0400 Subject: [PATCH] v2.1.3 release Bugfix to disallow gift card payments on orders containing subscriptions --- README.md | 4 ++++ ...class-wc-gateway-securesubmit-giftcards.php | 18 +----------------- gateway-securesubmit.php | 4 ++-- readme.txt | 5 ++++- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d0f296d..969b1e5 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ Download the contents and extract to your WordPress plugin folder. Activate. ## Changelog +#### 2.1.3 + +* Bugfix to disallow gift card payments on orders containing subscriptions + #### 2.1.2 * Bugfix for some orders that include failed transaction attempts diff --git a/classes/class-wc-gateway-securesubmit-giftcards.php b/classes/class-wc-gateway-securesubmit-giftcards.php index d2fb363..a35175c 100644 --- a/classes/class-wc-gateway-securesubmit-giftcards.php +++ b/classes/class-wc-gateway-securesubmit-giftcards.php @@ -312,7 +312,7 @@ public function giftCardsAllowed() return false; } } else { - return ($this->cartHasSubscriptionProducts()) ? false : true; + return (WC_Subscriptions_Cart::cart_contains_subscription()) ? false : true; } } @@ -328,22 +328,6 @@ protected function subscriptionsActive() return false; } - protected function cartHasSubscriptionProducts() - { - $cart = WC()->cart->get_cart(); - - foreach ($cart as $cart_item) { - $productType = WC_SecureSubmit_Util::getData($cart_item['data'], 'get_type', 'product_type'); - $subscription_position = strpos($productType, 'subscription'); - - if ($subscription_position !== false) { - return true; - } - } - - return false; - } - protected function updateGiftCardTotals() { $gift_cards_applied = WC()->session->get('securesubmit_gift_card_applied'); diff --git a/gateway-securesubmit.php b/gateway-securesubmit.php index d0e4cd8..dba63bc 100755 --- a/gateway-securesubmit.php +++ b/gateway-securesubmit.php @@ -3,8 +3,8 @@ Plugin Name: WooCommerce SecureSubmit Gateway Plugin URI: https://developer.heartlandpaymentsystems.com/SecureSubmit/ Description: Heartland Payment Systems gateway for WooCommerce. -Version: 2.1.2 -WC tested up to: 7.3.0 +Version: 2.2 +WC tested up to: 7.7.0 Author: SecureSubmit Author URI: https://developer.heartlandpaymentsystems.com/SecureSubmit/ */ diff --git a/readme.txt b/readme.txt index 2cbe131..f1a178c 100755 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === WooCommerce SecureSubmit Gateway === Contributors: markhagan, marksmedal Tags: woocommerce, woo, commerce, heartland, payment, systems, gateway, token, tokenize, save cards -Tested up to: 6.1.1 +Tested up to: 6.2 Stable tag: trunk License: GPLv2 License URI: https://github.com/hps/heartland-woocommerce-plugin/blob/master/LICENSE.md @@ -35,6 +35,9 @@ Get your Certification (Dev/Sandbox) Api Keys by creating an account on https:// 3. A view of the Manage Cards section == Changelog == += 2.1.3 = +* Bugfix to disallow gift card payments on orders containing subscriptions + = 2.1.2 = * Bugfix for some orders that include failed transaction attempts