Skip to content

Commit

Permalink
Merge pull request #51 from vippsas/release/1.9.1
Browse files Browse the repository at this point in the history
Release/1.9.1
  • Loading branch information
Marcuzz authored Oct 19, 2021
2 parents c8c01aa + 35f8589 commit f9fdc97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ Alternatively you could look into using WooCommerce "Early renewals": [https://d

== Changelog ==

= 1.9.1 =
* Fix: Renewal orders will no longer transition to `completed` when the setting for this is turned off.
* Fix: Fixed a problem where our `_vipps_recurring_waiting_for_gateway_change` was never processed for orders where the subscription was not `wc-active`. Added `wc-on-hold` and `wc-pending` to this list.

= 1.9.0 =
* Enhancement: Added a setting for what sort order we should check charges by.
* Enhancement: Added a setting for how many charges we should check at a time.
Expand Down
8 changes: 4 additions & 4 deletions includes/wc-gateway-vipps-recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ public function complete_order( $order, $transaction_id ) {

// controlled by the `transition_renewals_to_completed` setting
// only applicable to renewal orders
if ( $this->transition_renewals_to_completed && wcs_order_contains_renewal( $order ) ) {
if ( $this->transition_renewals_to_completed === "yes" && wcs_order_contains_renewal( $order ) ) {
$order->update_status( 'wc-completed' );
}

Expand Down Expand Up @@ -845,7 +845,7 @@ public function cancel_subscription( $subscription ) {
return;
}

set_transient( 'cancel_subscription_lock' . $subscription_id, uniqid(), 30 );
set_transient( 'cancel_subscription_lock' . $subscription_id, uniqid( '', true ), 30 );

$agreement_id = WC_Vipps_Recurring_Helper::get_agreement_id_from_order( $subscription );
$agreement = $this->api->get_agreement( $agreement_id );
Expand Down Expand Up @@ -956,7 +956,7 @@ public function process_subscription_payment( $amount, $renewal_order ): bool {
return true;
}

set_transient( 'order_lock_' . $renewal_order_id, uniqid(), 30 );
set_transient( 'order_lock_' . $renewal_order_id, uniqid( '', true ), 30 );

WC_Vipps_Recurring_Logger::log( sprintf( '[%s] process_subscription_payment attempting to create charge', $renewal_order->get_id() ) );

Expand Down Expand Up @@ -1858,7 +1858,7 @@ public function maybe_cancel_due_charge( $order_id ) {
return;
}

set_transient( 'maybe_cancel_due_charge_lock' . $order_id, uniqid(), 30 );
set_transient( 'maybe_cancel_due_charge_lock' . $order_id, uniqid( '', true ), 30 );

$charge = $this->api->get_charge( $agreement_id, $charge_id );
if ( in_array( $charge['status'], [ 'DUE', 'PENDING' ] ) ) {
Expand Down
8 changes: 4 additions & 4 deletions woo-vipps-recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Offer recurring payments with Vipps for WooCommerce Subscriptions
* Author: Everyday AS
* Author URI: https://everyday.no
* Version: 1.9.0
* Version: 1.9.1
* Requires at least: 4.4
* Tested up to: 5.8
* WC tested up to: 5.6.0
Expand All @@ -17,7 +17,7 @@

// phpcs:disable WordPress.Files.FileName

define( 'WC_VIPPS_RECURRING_VERSION', '1.9.0' );
define( 'WC_VIPPS_RECURRING_VERSION', '1.9.1' );

add_action( 'plugins_loaded', 'woocommerce_gateway_vipps_recurring_init' );

Expand Down Expand Up @@ -680,13 +680,13 @@ public function check_gateway_change_agreement_statuses() {

$posts = get_posts( [
'post_type' => 'shop_subscription',
'post_status' => 'wc-active',
'post_status' => [ 'wc-active', 'wc-pending', 'wc-on-hold' ],
'meta_key' => WC_Vipps_Recurring_Helper::META_SUBSCRIPTION_WAITING_FOR_GATEWAY_CHANGE,
'meta_compare' => '=',
'meta_value' => 1,
'return' => 'ids',
] );

foreach ( $posts as $post ) {
// check charge status
$gateway->maybe_process_gateway_change( $post->ID );
Expand Down

0 comments on commit f9fdc97

Please sign in to comment.