Skip to content

Commit

Permalink
fix: pass arguments to wc_vipps_recurring_transaction_id_for_order
Browse files Browse the repository at this point in the history
…in the correct order
  • Loading branch information
Marcuzz committed Feb 18, 2022
1 parent fc03094 commit 11df0a9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Available filters:

`wc_vipps_recurring_merchant_redirect_url(string $url)`

`wc_vipps_recurring_transaction_id_for_order(WC_Order $order, string $transaction_id)`
`wc_vipps_recurring_transaction_id_for_order(string $transaction_id, WC_Order $order)`

- Determines the return value of `WC_Vipps_Recurring_Helper::get_transaction_id_for_order`

Expand Down
3 changes: 3 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ Alternatively you could look into using WooCommerce "Early renewals": [https://d

== Changelog ==

= 1.13.1 =
* Fixed: Pass arguments to `wc_vipps_recurring_transaction_id_for_order` in the correct order.

= 1.13.0 =
* Added: `wc_vipps_recurring_merchant_agreement_url` filter.
* Added: `wc_vipps_recurring_merchant_redirect_url` filter.
Expand Down
2 changes: 1 addition & 1 deletion includes/compat/wc-vipps-recurring-kc-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function init() {
/**
* Klarna messes up our transaction id by inserting their own. We don't want theirs!
*/
public static function fix_transaction_id( $order, $transaction_id ) {
public static function fix_transaction_id( $transaction_id, $order ) {
$_wc_klarna_order_id = WC_Vipps_Recurring_Helper::get_meta( $order, '_wc_klarna_order_id' );
if ( $_wc_klarna_order_id === $transaction_id ) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion includes/wc-vipps-recurring-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public static function get_transaction_id_for_order( $order ) {
$transaction_id = false;
}

return apply_filters( 'wc_vipps_recurring_transaction_id_for_order', $order, $transaction_id );
return apply_filters( 'wc_vipps_recurring_transaction_id_for_order', $transaction_id, $order );
}

/**
Expand Down
22 changes: 11 additions & 11 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.13.0
* Version: 1.13.1
* Requires at least: 4.4
* Tested up to: 5.9
* WC tested up to: 6.1
Expand All @@ -17,7 +17,7 @@

// phpcs:disable WordPress.Files.FileName

define( 'WC_VIPPS_RECURRING_VERSION', '1.13.0' );
define( 'WC_VIPPS_RECURRING_VERSION', '1.13.1' );

add_action( 'plugins_loaded', 'woocommerce_gateway_vipps_recurring_init' );

Expand Down Expand Up @@ -446,7 +446,7 @@ public function handle_check_statuses_bulk_action(): string {
*/
public function setup_screen() {
global $wc_vipps_recurring_list_table_pending_charges,
$wc_vipps_recurring_list_table_failed_charges;
$wc_vipps_recurring_list_table_failed_charges;

$screen_id = false;

Expand All @@ -472,16 +472,16 @@ public function setup_screen() {
}

if ( $wc_vipps_recurring_list_table_pending_charges
&& $wc_vipps_recurring_list_table_pending_charges->current_action()
&& $wc_vipps_recurring_list_table_pending_charges->current_action() === 'check_status' ) {
&& $wc_vipps_recurring_list_table_pending_charges->current_action()
&& $wc_vipps_recurring_list_table_pending_charges->current_action() === 'check_status' ) {
$sendback = $this->handle_check_statuses_bulk_action();

wp_redirect( $sendback );
}

if ( $wc_vipps_recurring_list_table_failed_charges
&& $wc_vipps_recurring_list_table_failed_charges->current_action()
&& $wc_vipps_recurring_list_table_failed_charges->current_action() === 'check_status' ) {
&& $wc_vipps_recurring_list_table_failed_charges->current_action()
&& $wc_vipps_recurring_list_table_failed_charges->current_action() === 'check_status' ) {
$sendback = $this->handle_check_statuses_bulk_action();

wp_redirect( $sendback );
Expand Down Expand Up @@ -619,10 +619,10 @@ public function order_item_add_capture_button( $order ) {

$order_status = $order->get_status();
$show_capture_button = ( ! in_array( $order_status, $this->gateway->statuses_to_attempt_capture, true ) )
&& ! (int) WC_Vipps_Recurring_Helper::is_charge_captured_for_order( $order )
&& ! (int) WC_Vipps_Recurring_Helper::is_charge_failed_for_order( $order )
&& ! wcs_order_contains_renewal( $order )
&& ! (int) WC_Vipps_Recurring_Helper::get_meta( $order, WC_Vipps_Recurring_Helper::META_ORDER_ZERO_AMOUNT );
&& ! (int) WC_Vipps_Recurring_Helper::is_charge_captured_for_order( $order )
&& ! (int) WC_Vipps_Recurring_Helper::is_charge_failed_for_order( $order )
&& ! wcs_order_contains_renewal( $order )
&& ! (int) WC_Vipps_Recurring_Helper::get_meta( $order, WC_Vipps_Recurring_Helper::META_ORDER_ZERO_AMOUNT );

if ( ! apply_filters( 'wc_vipps_recurring_show_capture_button', $show_capture_button, $order ) ) {
return;
Expand Down

0 comments on commit 11df0a9

Please sign in to comment.