Skip to content

Commit 53c683e

Browse files
committed
Release 1.1.6
1 parent eec0769 commit 53c683e

7 files changed

+85
-28
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ This repository contains the wallee Subscriptions addon that enables WooCommerce
99

1010
* [Wordpress](https://wordpress.org/) 4.4 or later.
1111
* [Woocommerce](https://woocommerce.com/) 3.0 or later
12-
* [wallee Plugin](../../../woocommerce/) 1.2 or later
12+
* [wallee Plugin](../../../woocommerce/) 3.2.0 or later
1313
* [Woocommerce Subscriptions Plugin](https://woocommerce.com/products/woocommerce-subscriptions/) 2.2 or later
1414
* [PHP](http://php.net/) 5.6 or later
1515

1616
## License
1717

18-
Please see the [license file](https://github.com/wallee-payment/woocommerce-subscription/blob/1.1.5/LICENSE) for more information.
18+
Please see the [license file](https://github.com/wallee-payment/woocommerce-subscription/blob/1.1.6/LICENSE) for more information.
1919

changelog.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,12 @@ Bug fix, if space_view_id is not set, it does not send it to the service portal.
8787
- [Tested Against] WooCommerce 8.9.1
8888
- [Tested Against] Woo Subscriptions 5.5.0
8989

90+
= 1.1.6 - Mar 6 2025 =
91+
- [BugFix] Fixed usage of newly introduced constants on version 3.2.0
92+
- [BugFix] Improved subscription handling: Optimized the processing of subscription data for better reliability and performance.
93+
94+
- [Tested Against] PHP 8.2
95+
- [Tested Against] Wordpress 6.8.0
96+
- [Tested Against] WooCommerce 9.8.0
97+
- [Tested Against] Woo Subscriptions 7.2.1
98+

docs/en/documentation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h2>Documentation</h2> </div>
2323
</a>
2424
</li>
2525
<li>
26-
<a href="https://github.com/wallee-payment/woocommerce-subscription/releases/tag/1.1.5/">
26+
<a href="https://github.com/wallee-payment/woocommerce-subscription/releases/tag/1.1.6/">
2727
Source
2828
</a>
2929
</li>

includes/class-wc-wallee-subscription-gateway.php

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,11 @@ public function __construct( WC_Wallee_Gateway $gateway ) {
9898
*/
9999
public function process_scheduled_subscription_payment( $amount_to_charge, WC_Order $order ) {
100100
try {
101-
$token_space_id = get_post_meta( $order->get_id(), '_wallee_subscription_space_id', true );
102-
$token_id = get_post_meta( $order->get_id(), '_wallee_subscription_token_id', true );
101+
$token_data = $this->get_token_data_from_order($order);
102+
103+
$token_space_id = $token_data['_wallee_subscription_space_id'];
104+
$token_id = $token_data['_wallee_subscription_token_id'];
103105

104-
if ( empty( $token_space_id ) || get_option( WooCommerce_Wallee::CK_SPACE_ID ) != $token_space_id ) {
105-
$order->update_status( 'failed', __( 'The token space and the configured space are not equal.', 'woo-wallee-subscription' ) );
106-
return;
107-
}
108-
if ( empty( $token_id ) ) {
109-
$order->update_status( 'failed', __( 'There is no token associated with this subscription.', 'woo-wallee-subscription' ) );
110-
return;
111-
}
112106
$transaction_service = WC_Wallee_Subscription_Service_Transaction::instance();
113107

114108
$transaction_info = WC_Wallee_Entity_Transaction_Info::load_by_order_id( $order->get_id() );
@@ -134,6 +128,57 @@ public function process_scheduled_subscription_payment( $amount_to_charge, WC_Or
134128
}
135129
}
136130

131+
/**
132+
* Get token data from original order
133+
*
134+
* @param WC_Order $order Order.
135+
* @return array
136+
*/
137+
private function get_token_data_from_order($order)
138+
{
139+
$order_id = $order->get_id();
140+
$token_data = [];
141+
$token_data['_wallee_subscription_space_id'] = get_post_meta( $order_id, '_wallee_subscription_space_id', true );
142+
$token_data['_wallee_subscription_token_id'] = get_post_meta( $order_id, '_wallee_subscription_token_id', true );
143+
144+
if( ! isset($token_data['_wallee_subscription_space_id']) || isset($token_data['_wallee_subscription_token_id']) ) {
145+
146+
$subscriptions = wcs_get_subscriptions_for_renewal_order( $order_id );
147+
// In theory, each of the array elements should contain the same token and space data
148+
$subscription_object = array_pop($subscriptions);
149+
$subscription_meta = $subscription_object->get_meta_data();
150+
$token_data = [];
151+
$wallee_subscription_keys = [
152+
'_wallee_subscription_space_id',
153+
'_wallee_subscription_token_id'
154+
];
155+
156+
foreach( $subscription_meta as $meta_data ) {
157+
$contained_data = $meta_data->get_data();
158+
if ( in_array($contained_data['key'], $wallee_subscription_keys ) ) {
159+
$token_data[$contained_data['key']] = $contained_data['value'];
160+
}
161+
}
162+
}
163+
164+
if( ! isset($token_data['_wallee_subscription_space_id']) ) {
165+
$order->update_status( 'failed', __( 'No space ID is found.', 'woo-wallee-subscription' ) );
166+
throw new Exception('Missing space id details');
167+
}
168+
169+
if( ! isset($token_data['_wallee_subscription_token_id']) ) {
170+
$order->update_status( 'failed', __( 'No token ID is found.', 'woo-wallee-subscription' ) );
171+
throw new Exception('Missing token id');
172+
}
173+
174+
if ( get_option( WooCommerce_Wallee::WALLEE_CK_SPACE_ID ) != $token_data['_wallee_subscription_space_id'] ) {
175+
$order->update_status( 'failed', __( 'The token space and the configured space are not equal.', 'woo-wallee-subscription' ) );
176+
throw new Exception('Token space does not match configured space');
177+
}
178+
179+
return $token_data;
180+
}
181+
137182

138183
/**
139184
* Update payment method.
@@ -261,7 +306,7 @@ public function validate_subscription_payment_meta( $payment_method_id, $payment
261306
if ( $this->gateway->id === $payment_method_id ) {
262307
if ( ! isset( $payment_meta['post_meta']['_wallee_subscription_space_id']['value'] ) || empty( $payment_meta['post_meta']['_wallee_subscription_space_id']['value'] ) ) {
263308
throw new Exception( __( 'The wallee Space Id value is required.', 'woo-wallee-subscription' ) );
264-
} elseif ( get_option( WooCommerce_Wallee::CK_SPACE_ID ) != $payment_meta['post_meta']['_wallee_subscription_space_id']['value'] ) {
309+
} elseif ( get_option( WooCommerce_Wallee::WALLEE_CK_SPACE_ID ) != $payment_meta['post_meta']['_wallee_subscription_space_id']['value'] ) {
265310
throw new Exception( __( 'The wallee Space Id needs to be in the same space as configured in the main configuration.', 'woo-wallee-subscription' ) );
266311
}
267312
if ( ! isset( $payment_meta['post_meta']['_wallee_subscription_token_id']['value'] ) || empty( $payment_meta['post_meta']['_wallee_subscription_token_id']['value'] ) ) {

includes/service/class-wc-wallee-subscription-service-transaction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class WC_Wallee_Subscription_Service_Transaction extends WC_Wallee_Service_Trans
3333
* If the transaction being created is not valid.
3434
*/
3535
public function create_transaction_by_renewal_order( WC_Order $order, $order_total, $token_id ) {
36-
$space_id = get_option( WooCommerce_Wallee::CK_SPACE_ID );
36+
$space_id = get_option( WooCommerce_Wallee::WALLEE_CK_SPACE_ID );
3737
$create_transaction = new \Wallee\Sdk\Model\TransactionCreate();
3838
$create_transaction->setCustomersPresence( \Wallee\Sdk\Model\CustomersPresence::VIRTUAL_PRESENT );
39-
$space_view_id = get_option( WooCommerce_Wallee::CK_SPACE_VIEW_ID );
39+
$space_view_id = get_option( WooCommerce_Wallee::WALLEE_CK_SPACE_VIEW_ID );
4040
if ( is_numeric( $space_view_id ) ) {
4141
$create_transaction->setSpaceViewId( $space_view_id );
4242
}

readme.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: customwebgmbh
33
Tags: woocommerce wallee, woocommerce, wallee, payment, e-commerce, webshop, psp, subscription, recurring payment, processing
44
Requires at least: 4.7
55
Tested up to: 6.5.3
6-
Stable tag: 1.1.5
6+
Stable tag: 1.1.6
77
License: Apache 2
88
License URI: http://www.apache.org/licenses/LICENSE-2.0
99

@@ -49,9 +49,11 @@ Therefore, it is necessary that you install the this plugin as well.
4949

5050
== Changelog ==
5151

52-
= 1.1.5 - Jun 3 2024 =
53-
- [Feature] Added compatibilities with WordPress 6.5.3 and the new WooCommerce version 8.9.1
54-
- [Tested Against] PHP 8.0
55-
- [Tested Against] Wordpress 6.5.3
56-
- [Tested Against] WooCommerce 8.9.1
57-
- [Tested Against] Woo Subscriptions 5.5.0
52+
= 1.1.6 - Mar 6 2025 =
53+
- [BugFix] Fixed usage of newly introduced constants on version 3.2.0
54+
- [BugFix] Improved subscription handling: Optimized the processing of subscription data for better reliability and performance.
55+
56+
- [Tested Against] PHP 8.2
57+
- [Tested Against] Wordpress 6.8.0
58+
- [Tested Against] WooCommerce 9.8.0
59+
- [Tested Against] Woo Subscriptions 7.2.1

woocommerce-wallee-subscription.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
* Plugin Name: wallee Subscription
44
* Plugin URI: https://wordpress.org/plugins/woo-wallee-subscription
55
* Description: Addon to process WooCommerce Subscriptions with wallee
6-
* Version: 1.1.5
6+
* Version: 1.1.6
77
* License: Apache2
88
* License URI: http://www.apache.org/licenses/LICENSE-2.0
99
* Author: wallee AG
1010
* Author URI: https://www.wallee.com
1111
* Requires at least: 4.7
12-
* Tested up to: 6.5.3
13-
* WC requires at least: 3.0.0
14-
* WC tested up to: 8.9.1
12+
* Tested up to: 6.7.2
13+
* WC requires at least: 3.2.0
14+
* WC tested up to: 9.7.0
15+
* Requires Plugins: woo-wallee
1516
*
1617
* Text Domain: woo-wallee-subscription
1718
* Domain Path: /languages/
@@ -36,7 +37,7 @@ final class WooCommerce_Wallee_Subscription {
3637
*
3738
* @var string
3839
*/
39-
private $version = '1.1.5';
40+
private $version = '1.1.6';
4041

4142
/**
4243
* The single instance of the class.

0 commit comments

Comments
 (0)