Skip to content

Commit

Permalink
v2.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
iverok committed Aug 23, 2024
1 parent f9a0d9f commit d558bfe
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
27 changes: 16 additions & 11 deletions VippsApi.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,20 +263,22 @@ public function get_receipt_data($order) {
if ($product) {
$url = get_permalink($prodid);
}
$taxpercentageraw = 0;
if ($subtotalNoTax == 0) {
$taxpercentage = 0;
$taxpercentageraw = 0;
} else {
$taxpercentage = (($subtotal - $subtotalNoTax) / $subtotalNoTax)*100;
$taxpercentageraw = (($subtotal - $subtotalNoTax) / $subtotalNoTax)*100;
}
$taxpercentage = abs(round($taxpercentage));
$taxrate = abs(round(100*$taxpercentageraw));
$taxpercentage = abs(round($taxpercentageraw));
$unitInfo = [];
$orderline['name'] = $order_item->get_name();
$orderline['id'] = strval($prodid);
$orderline['totalAmount'] = round($total*100);
$orderline['totalAmountExcludingTax'] = round($totalNoTax*100);
$orderline['totalTaxAmount'] = round($tax*100);

$orderline['taxPercentage'] = $taxpercentage;
$orderline['taxRate'] = $taxrate;
$unitinfo['unitPrice'] = round($unitprice*100);
$unitinfo['quantity'] = strval($quantity);
$unitinfo['quantityUnit'] = 'PCS';
Expand All @@ -293,8 +295,9 @@ public function get_receipt_data($order) {
$tax = $order_item->get_total_tax();
$total = $tax+$totalNoTax;
$quantity = 1;
$taxpercentage = (($total - $totalNoTax) / $totalNoTax)*100;
$taxpercentage = abs(round($taxpercentage));
$taxpercentageraw = (($total - $totalNoTax) / $totalNoTax)*100;
$taxrate = abs(round(100*$taxpercentageraw));
$taxpercentage = abs(round($taxpercentageraw));
$unitInfo = [];
$orderline['name'] = $order_item->get_name();
$orderline['id'] = substr(sanitize_title($orderline['name']), 0, 254);
Expand All @@ -303,7 +306,7 @@ public function get_receipt_data($order) {
$orderline['totalTaxAmount'] = round($tax*100);
$orderline['discount'] = 0;

$orderline['taxPercentage'] = $taxpercentage;
$orderline['taxRate'] = $taxrate;
$orderlines[] = $orderline;
}

Expand All @@ -324,17 +327,19 @@ public function get_receipt_data($order) {
$subtotalTax = $tax;
$subtotal = $subtotalNoTax + $subtotalTax;

$taxpercentageraw = 0;
if ($subtotalNoTax == 0) {
$taxpercentage = 0;
$taxpercentageraw = 0;
} else {
$taxpercentage = (($subtotal - $subtotalNoTax) / $subtotalNoTax)*100;
$taxpercentageraw = (($subtotal - $subtotalNoTax) / $subtotalNoTax)*100;
}
$taxpercentage = abs(round($taxpercentage));
$taxpercentage = abs(round($taxpercentageraw));
$taxrate= abs(round($taxpercentageraw * 100));

$orderline['totalAmount'] = round($total*100);
$orderline['totalAmountExcludingTax'] = round($totalNoTax*100);
$orderline['totalTaxAmount'] = round($tax*100);
$orderline['taxPercentage'] = $taxpercentage;
$orderline['taxRate'] = $taxrate;

$unitinfo = [];

Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: wphostingdev, iverok, perwilhelmsen, nikolaidev
Tags: woocommerce, vipps, mobilepay
Tags: woocommerce, vipps
Version: 2.1.7
Stable tag: 2.1.7
Version: 2.1.8
Stable tag: 2.1.8
Requires at least: 4.7
Tested up to: 6.6.1
Requires PHP: 7.0
Expand Down Expand Up @@ -94,6 +94,7 @@ Shareable links and QR codes can be generated from the Vipps tab on the product
This project is hosted on Github at: https://github.com/vippsas/vipps-woocommerce

== Upgrade Notice ==
Version 2.1.8 supports the upcoming Finnish VAT change
Cancelling _completed_ orders will normally also refund these orders if the refund has been captured; but we now implement a cutoff for this so that this does not happen for orders older than 30 days (tunable by the 'woo_vipps_cancel_refund_days_threshold' filter). This is a safety measure to avoid accidental refunds of archived orders. You can still use the 'refund' status or refund the orders manually.
Allow Klarna as an external payment method for norway
Fix issue with webhook callbacks to unknown Vipps orders
Expand Down Expand Up @@ -238,6 +239,9 @@ From version 1.1.13 you can also modify the javascript using the new WP hooks li

== Changelog ==

= 2024-08-26 version 2.1.7 =
Change API to use taxRate instead of taxPercent to allow for VAT change in Finland 1. sep 2024.

= 2024-08-16 version 2.1.7 =
Allow Klarna as external payment method in Checkout
Fix issue with session handling that would break shipping in Checkout in Woo 9.2
Expand Down
6 changes: 3 additions & 3 deletions woo-vipps.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
Author URI: https://www.wp-hosting.no/
Text-domain: woo-vipps
Domain Path: /languages
Version: 2.1.7
Stable tag: 2.1.7
Version: 2.1.8
Stable tag: 2.1.8
Requires at least: 4.7
Tested up to: 6.6.1
Requires PHP: 7.0
Expand Down Expand Up @@ -49,7 +49,7 @@


// Report version externally
define('WOO_VIPPS_VERSION', '2.1.7');
define('WOO_VIPPS_VERSION', '2.1.8');

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
Expand Down

0 comments on commit d558bfe

Please sign in to comment.