diff --git a/README.txt b/README.txt index bd57702..aec0635 100644 --- a/README.txt +++ b/README.txt @@ -3,7 +3,7 @@ Contributors: mondu-ai, arthurmmoreira, tikohov20 Tags: mondu, woocommerce, e-commerce, ecommerce, store, sales, sell, woo, woo commerce, shop, cart, shopping cart, sell online, checkout, payment, payments, bnpl, b2b Requires at least: 5.9.0 Tested up to: 6.5.3 -Stable tag: 3.0.2 +Stable tag: 3.0.3 Requires PHP: 7.4 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html diff --git a/changelog.txt b/changelog.txt index 4166809..92cf17d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ == Changelog == += 3.0.3 = + +* Bugfix - buyer_fee_cents should be on lines level + = 3.0.2 = * Added filters for buyer_fee_cents and whole order_data diff --git a/mondu-buy-now-pay-later.php b/mondu-buy-now-pay-later.php index 2721b3b..fb53074 100644 --- a/mondu-buy-now-pay-later.php +++ b/mondu-buy-now-pay-later.php @@ -3,7 +3,7 @@ * Plugin Name: Mondu Buy Now Pay Later * Plugin URI: https://github.com/mondu-ai/bnpl-checkout-woocommerce/releases * Description: Mondu provides B2B E-commerce and B2B marketplaces with an online payment solution to buy now and pay later. - * Version: 3.0.2 + * Version: 3.0.3 * Author: Mondu * Author URI: https://mondu.ai * @@ -27,7 +27,7 @@ die( 'Direct access not allowed' ); } -define( 'MONDU_PLUGIN_VERSION', '3.0.2' ); +define( 'MONDU_PLUGIN_VERSION', '3.0.3' ); define( 'MONDU_PLUGIN_FILE', __FILE__ ); define( 'MONDU_PLUGIN_PATH', __DIR__ ); define( 'MONDU_PLUGIN_BASENAME', plugin_basename(MONDU_PLUGIN_FILE) ); diff --git a/src/Mondu/Mondu/Support/OrderData.php b/src/Mondu/Mondu/Support/OrderData.php index 592611a..f7ffda2 100644 --- a/src/Mondu/Mondu/Support/OrderData.php +++ b/src/Mondu/Mondu/Support/OrderData.php @@ -141,13 +141,6 @@ public static function order_data_from_wc_order( WC_Order $order ) { $billing_zip_code = $order->get_billing_postcode(); $billing_country_code = $order->get_billing_country(); - /** - * @since 3.0.2 - * - * Can be used to include any additional costs that are not included by default. - */ - $buyer_fee_cents = apply_filters('mondu_buyer_fee_cents', 0, $order); - $order_data = [ 'payment_method' => array_flip( Plugin::PAYMENT_METHODS )[ $order->get_payment_method() ], 'currency' => get_woocommerce_currency(), @@ -155,7 +148,6 @@ public static function order_data_from_wc_order( WC_Order $order ) { 'gross_amount_cents' => round( (float) $order->get_total() * 100), 'net_price_cents' => round( (float) $order->get_subtotal() * 100), 'tax_cents' => round( (float) $order->get_total_tax() * 100), - 'buyer_fee_cents' => $buyer_fee_cents, 'buyer' => [ 'first_name' => isset($billing_first_name) && Helper::not_null_or_empty($billing_first_name) ? $billing_first_name : null, 'last_name' => isset($billing_last_name) && Helper::not_null_or_empty($billing_last_name) ? $billing_last_name : null, @@ -249,8 +241,16 @@ private static function get_shipping_address_from_order( WC_Order $order ) { * @return array */ private static function get_lines_from_order( WC_Order $order ) { + /** + * @since 3.0.2 + * + * Can be used to include any additional costs that are not included by default. + */ + $buyer_fee_cents = apply_filters('mondu_buyer_fee_cents', 0, $order); + $line = [ 'discount_cents' => round($order->get_discount_total() * 100), + 'buyer_fee_cents' => $buyer_fee_cents, 'shipping_price_cents' => round( (float) ( $order->get_shipping_total() + $order->get_shipping_tax() ) * 100), # Considering that is not possible to save taxes that does not belongs to products, sums shipping taxes here 'line_items' => [], ];