Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [3.8.1]
- Fix: Order line calculations when a cart discount is applied.

## [3.8.0]
- Add support for the new PayPal Integration.

Expand Down
8 changes: 4 additions & 4 deletions altapay.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* Author URI: https://altapay.com
* Text Domain: altapay
* Domain Path: /languages
* Version: 3.8.0
* Version: 3.8.1
* Name: SDM_Altapay
* WC requires at least: 3.9.0
* WC tested up to: 9.8.5
* WC tested up to: 9.9.4
*
* @package Altapay
*/
Expand Down Expand Up @@ -41,7 +41,7 @@
}

if ( ! defined( 'ALTAPAY_PLUGIN_VERSION' ) ) {
define( 'ALTAPAY_PLUGIN_VERSION', '3.8.0' );
define( 'ALTAPAY_PLUGIN_VERSION', '3.8.1' );
}

// Include the autoloader, so we can dynamically include the rest of the classes.
Expand Down Expand Up @@ -734,7 +734,7 @@ function altapayRefundCallback() {

$refund = altapayRefundPayment( $orderID, $amount, null, true );

if ( $refund['success'] === true ) {
if ( isset( $refund['success'] ) && $refund['success'] === true ) {
wp_send_json_success( $refund );
} else {
$error = $refund['error'] ?? 'Error in the refund operation.';
Expand Down
2 changes: 1 addition & 1 deletion assets/js/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jQuery( document ).ready(
capture: function (element) {
var amount = parseFloat( $( '#capture-amount' ).val() );
var productsArrData = [];
if ($( "#ap-allow-orderlines" ).attr( "checked" ) === "checked") {
if ($( "#ap-allow-orderlines" ).prop("checked")) {
$( '.ap-orderlines-capture:has(input)' ).each(
function () {
var productArrData = [];
Expand Down
2 changes: 1 addition & 1 deletion assets/js/refund.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jQuery( document ).ready(
var goodwillrefund = 'no';
var amount = parseFloat( $( '#refund-amount' ).val() );
var productsArrData = [];
if ($( "#ap-allow-refund-orderlines" ).attr( "checked" ) === "checked") {
if ($("#ap-allow-refund-orderlines").prop("checked")) {
$( '.ap-orderlines-refund:has(input)' ).each(
function () {
var productArrData = [];
Expand Down
10 changes: 7 additions & 3 deletions classes/util/UtilMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ public function createOrderLines( $order, $products = array(), $wcRefund = false
$orderLines [] = $shippingDetails;
}

if ( $order->get_total_discount() ) {
$discount_total = (float) $order->get_discount_total();
$discount_tax = (float) $order->get_discount_tax();
$total_discount = round( $discount_total + $discount_tax, 2 );

if ( $total_discount ) {
$orderLine = new OrderLine(
'Discount',
'discount',
1,
-abs( $order->get_total_discount() )
-abs( $total_discount )
);
$orderLine->taxAmount = 0;
$orderLine->unitCode = 'unit';
Expand Down Expand Up @@ -125,7 +129,7 @@ private function getOrderLine( $item, $isSubscription = false ) {
$orderLine->unitCode = $quantity > 1 ? 'units' : 'unit';

if ( ! $isSubscription ) {
$orderLine->taxAmount = round( $item->get_total_tax(), 2 );
$orderLine->taxAmount = round( $item->get_subtotal_tax(), 2 );
}

$goodsType = ( $isSubscription ) ? 'subscription_model' : 'item';
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Tags: AltaPay, Gateway, Payments, WooCommerce, Payment Card Industry
Requires PHP: 7.4
Requires at least: 5.0
Tested up to: 6.8.1
Stable tag: 3.8.0
Stable tag: 3.8.1
License: MIT
WC requires at least: 3.9.0
WC tested up to: 9.8.5
WC tested up to: 9.9.4
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A plugin that integrates your WooCommerce web shop to the AltaPay payments gateway.
Expand Down Expand Up @@ -39,6 +39,9 @@ AltaPay's Payment Gateway for WooCommerce provides merchants with access to a fu

== Changelog ==

= 3.8.1 =
* Fix: Order line calculations when a cart discount is applied.

= 3.8.0 =
* Add support for the new PayPal Integration.

Expand Down
4 changes: 2 additions & 2 deletions wiki.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,13 @@ The new credentials can now be used as the API Username and API Password in your

Minimum system requirements are:
- WordPress min. 5.0 – max. 6.8.1
- WooCommerce min. 3.9.0 – max. 9.8.5
- WooCommerce min. 3.9.0 – max. 9.9.4
- PHP 7.4 and above
- PHP-bcmath library installed.
- PHP-curl MUST be enabled.

The latest tested version is:
- WordPress 6.8.1, WooCommerce 9.8.5 and PHP 8.2
- WordPress 6.8.1, WooCommerce 9.9.4 and PHP 8.2


## Troubleshooting
Expand Down
Loading