Skip to content

Commit

Permalink
fix: do not run handle_payment in Checkout when the agreement id is n…
Browse files Browse the repository at this point in the history
…ot set
  • Loading branch information
Marcuzz committed Oct 24, 2024
1 parent 16324eb commit 4f55c76
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: EverydayAS
Tags: vipps, mobilepay, recurring payments, subscriptions, woocommerce subscriptions
Requires at least: 5.0
Tested up to: 6.6
Stable tag: 2.0.2
Stable tag: 2.0.3
Requires PHP: 7.4
License: AGPLv3.0 or later
License URI: https://www.gnu.org/licenses/agpl-3.0.html
Expand Down Expand Up @@ -162,6 +162,10 @@ Alternatively you could look into using WooCommerce "Early renewals": [https://d

== Changelog ==

= 2.0.3 =
* Fixed: Uploaded the newest assets.
* Fixed: A fatal error that may occur in a faulty state that could only happen when Checkout is enabled in versions 2.0.0 and 2.0.1.

= 2.0.2 =
* Fixed: Resubscribing to expired subscriptions is now possible when Checkout is enabled.
* Fixed: You are now informed that a Merchant Serial Number is required in order to enable Checkout.
Expand Down
4 changes: 4 additions & 0 deletions includes/wc-vipps-recurring-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,10 @@ public function handle_payment( WC_Order $order, array $session ): void {
$agreement_id = $session['subscriptionDetails']['agreementId'];
$status = $session['sessionState'];

if ( empty( $agreement_id ) ) {
return;
}

WC_Vipps_Recurring_Logger::log( sprintf( "[%s] Handling Vipps/MobilePay Checkout payment for agreement ID %s with status %s", $order_id, $agreement_id, $status ) );

// This makes sure we are covered by all our normal cron checks as well
Expand Down
4 changes: 2 additions & 2 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 MobilePay for WooCommerce Subscriptions
* Author: Everyday AS
* Author URI: https://everyday.no
* Version: 2.0.2
* Version: 2.0.3
* Requires Plugins: woocommerce
* Requires at least: 6.1
* Tested up to: 6.6
Expand All @@ -18,7 +18,7 @@

// phpcs:disable WordPress.Files.FileName

define( 'WC_VIPPS_RECURRING_VERSION', '2.0.2' );
define( 'WC_VIPPS_RECURRING_VERSION', '2.0.3' );

/**
* Polyfills
Expand Down

0 comments on commit 4f55c76

Please sign in to comment.