Skip to content

Commit

Permalink
fix: fixed an issue where initialCharge.description was empty. It c…
Browse files Browse the repository at this point in the history
…annot be empty under any circumstances
  • Loading branch information
Marcuzz committed Dec 22, 2021
1 parent 106ac42 commit c2a3690
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ Alternatively you could look into using WooCommerce "Early renewals": [https://d

== Changelog ==

= 1.12.2 =
* Fixed: Fixed an issue where `initialCharge.description` was empty. It cannot be empty under any circumstances.

==== End Log ====

= 1.12.1 =
* Fixed: A bug in Klarna Checkout where it would attempt to use Vipps Recurring Payments instead of Vipps Checkout when you're only purchasing one time payment products.
* Fixed: Descriptions of products you are not paying for right away is no longer included in initialCharge's description.
Expand Down
2 changes: 1 addition & 1 deletion includes/wc-gateway-vipps-recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ public function process_payment( $order_id, bool $retry = true, bool $previous_e

if ( ! $is_zero_amount ) {
$initial_charge_description = WC_Vipps_Recurring_Helper::get_product_description( $parent_product ) . ' + ' . $extra_initial_charge_description;
if ( $has_campaign ) {
if ( $has_campaign && ! empty( $extra_initial_charge_description ) ) {
$initial_charge_description = $extra_initial_charge_description;
}

Expand Down
4 changes: 3 additions & 1 deletion includes/wc-vipps-recurring-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ private function process_agreement_body( $body ): array {
}

if ( isset( $body['initialCharge']['description'] ) ) {
$charge_description = $body['initialCharge']['description'];
$charge_description = ! empty( $body['initialCharge']['description'] )
? $body['initialCharge']['description']
: 'Mangler produktbeskrivelse';

if ( strlen( $charge_description ) > 45 ) {
$body['initialCharge']['description'] = mb_substr( $charge_description, 0, 42 ) . '...';
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 for WooCommerce Subscriptions
* Author: Everyday AS
* Author URI: https://everyday.no
* Version: 1.12.1
* Version: 1.12.2
* Requires at least: 4.4
* Tested up to: 5.8
* WC tested up to: 6.0
Expand All @@ -17,7 +17,7 @@

// phpcs:disable WordPress.Files.FileName

define( 'WC_VIPPS_RECURRING_VERSION', '1.12.1' );
define( 'WC_VIPPS_RECURRING_VERSION', '1.12.2' );

add_action( 'plugins_loaded', 'woocommerce_gateway_vipps_recurring_init' );

Expand Down

0 comments on commit c2a3690

Please sign in to comment.