Skip to content

Commit

Permalink
fix: now sets the correct order status for RESERVED payments when pay…
Browse files Browse the repository at this point in the history
…ing with Vipps through KCO
  • Loading branch information
Marcuzz committed Feb 16, 2022
1 parent ba3e592 commit 6752ed8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ After 2 days it will move to the "Processing" status. You can however change the

Alternatively you could look into using WooCommerce "Early renewals": [https://docs.woocommerce.com/document/subscriptions/early-renewal/](https://docs.woocommerce.com/document/subscriptions/early-renewal/) if ensuring the status of a charge is fully completed before a specific date is of up-most importance.

== Known bugs ==

* Synchronized products can not be paid via Vipps when using KCO if the price at this moment in time is 0.

== Changelog ==

= 1.13.0 =
Expand All @@ -164,6 +168,7 @@ Alternatively you could look into using WooCommerce "Early renewals": [https://d
* Fixed: KCO compatibility `headers already output` notice no longer shows on every page when debug mode is enabled.
* Fixed: Set payment method to Vipps Recurring on the subscription after paying with the Vipps Recurring EPM in KCO. This is likely caused by a WooCommerce bug.
* Refactor: `capture_payment` should no longer create a charge if a RESERVED charge does not exist.
* Fixed: Now sets the correct order status for RESERVED payments when paying with Vipps through KCO.

= 1.12.4 =
* Fixed: Product names no longer use the default context, meaning it will no longer get overridden by themes or plugins and show HTML in the Vipps app or app-switch screen.
Expand Down
4 changes: 2 additions & 2 deletions includes/compat/wc-vipps-recurring-kc-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function create_vipps_recurring_order( $create ) {

$kco_settings = get_option( 'woocommerce_kco_settings' );

$activate = ! isset( $kco_settings['epm_vipps_recurring_activate'] ) || $kco_settings['epm_vipps_recurring_activate'] === 'yes';
$activate = ! isset( $kco_settings['epm_vipps_recurring_activate'] ) || $kco_settings['epm_vipps_recurring_activate'] === 'yes';
$activate = apply_filters( 'wc_vipps_recurring_activate_kco_external_payment', ( $activate && WC_Vipps_Recurring::get_instance()->gateway->is_available() ) );

if ( ! isset( $create['external_payment_methods'] ) || ! is_array( $create['external_payment_methods'] ) ) {
Expand Down Expand Up @@ -139,7 +139,7 @@ public static function add_vipps_recurring_payment_method() {
}

public static function reset_default_payment_method() {
if ( WC()->session->get( 'vipps_via_klarna' ) ) {
if ( WC()->session && WC()->session->get( 'vipps_via_klarna' ) ) {
WC()->session->set( 'chosen_payment_method', 'kco' );
WC()->session->set( 'vipps_via_klarna', 0 );
}
Expand Down
7 changes: 6 additions & 1 deletion includes/wc-vipps-recurring-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public static function set_transaction_id_for_order( $order, $transaction_id ) {
/**
* @param $order
*
* @return mixed
* @return false|mixed
*/
public static function get_transaction_id_for_order( $order ) {
$transaction_id = self::is_wc_lt( '3.0' )
Expand All @@ -272,6 +272,11 @@ public static function get_transaction_id_for_order( $order ) {
return false;
}

$_wc_klarna_order_id = self::get_meta( $order, '_wc_klarna_order_id' );
if ( $_wc_klarna_order_id === $transaction_id ) {
return false;
}

return $transaction_id;
}

Expand Down

0 comments on commit 6752ed8

Please sign in to comment.