Skip to content

Commit

Permalink
Merge pull request #201 from hps/tsmedal-fix_subscription_logic
Browse files Browse the repository at this point in the history
v2.1.3 release
  • Loading branch information
securesubmit-buildmaster authored May 11, 2023
2 parents de6df84 + eb462e1 commit 8d8f3a2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 1 addition & 17 deletions classes/class-wc-gateway-securesubmit-giftcards.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function giftCardsAllowed()
return false;
}
} else {
return ($this->cartHasSubscriptionProducts()) ? false : true;
return (WC_Subscriptions_Cart::cart_contains_subscription()) ? false : true;
}
}

Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions gateway-securesubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/
*/
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8d8f3a2

Please sign in to comment.