Skip to content

Commit 235b001

Browse files
authored
PT-560 buyer_fee_cents bugfix (#122)
1 parent a0ffb9f commit 235b001

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: mondu-ai, arthurmmoreira, tikohov20
33
Tags: mondu, woocommerce, e-commerce, ecommerce, store, sales, sell, woo, woo commerce, shop, cart, shopping cart, sell online, checkout, payment, payments, bnpl, b2b
44
Requires at least: 5.9.0
55
Tested up to: 6.5.3
6-
Stable tag: 3.0.2
6+
Stable tag: 3.0.3
77
Requires PHP: 7.4
88
License: GPLv3
99
License URI: https://www.gnu.org/licenses/gpl-3.0.html

changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
== Changelog ==
22

3+
= 3.0.3 =
4+
5+
* Bugfix - buyer_fee_cents should be on lines level
6+
37
= 3.0.2 =
48

59
* Added filters for buyer_fee_cents and whole order_data

mondu-buy-now-pay-later.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Mondu Buy Now Pay Later
44
* Plugin URI: https://github.com/mondu-ai/bnpl-checkout-woocommerce/releases
55
* Description: Mondu provides B2B E-commerce and B2B marketplaces with an online payment solution to buy now and pay later.
6-
* Version: 3.0.2
6+
* Version: 3.0.3
77
* Author: Mondu
88
* Author URI: https://mondu.ai
99
*
@@ -27,7 +27,7 @@
2727
die( 'Direct access not allowed' );
2828
}
2929

30-
define( 'MONDU_PLUGIN_VERSION', '3.0.2' );
30+
define( 'MONDU_PLUGIN_VERSION', '3.0.3' );
3131
define( 'MONDU_PLUGIN_FILE', __FILE__ );
3232
define( 'MONDU_PLUGIN_PATH', __DIR__ );
3333
define( 'MONDU_PLUGIN_BASENAME', plugin_basename(MONDU_PLUGIN_FILE) );

src/Mondu/Mondu/Support/OrderData.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,21 +141,13 @@ public static function order_data_from_wc_order( WC_Order $order ) {
141141
$billing_zip_code = $order->get_billing_postcode();
142142
$billing_country_code = $order->get_billing_country();
143143

144-
/**
145-
* @since 3.0.2
146-
*
147-
* Can be used to include any additional costs that are not included by default.
148-
*/
149-
$buyer_fee_cents = apply_filters('mondu_buyer_fee_cents', 0, $order);
150-
151144
$order_data = [
152145
'payment_method' => array_flip( Plugin::PAYMENT_METHODS )[ $order->get_payment_method() ],
153146
'currency' => get_woocommerce_currency(),
154147
'external_reference_id' => (string) $order->get_order_number(),
155148
'gross_amount_cents' => round( (float) $order->get_total() * 100),
156149
'net_price_cents' => round( (float) $order->get_subtotal() * 100),
157150
'tax_cents' => round( (float) $order->get_total_tax() * 100),
158-
'buyer_fee_cents' => $buyer_fee_cents,
159151
'buyer' => [
160152
'first_name' => isset($billing_first_name) && Helper::not_null_or_empty($billing_first_name) ? $billing_first_name : null,
161153
'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 ) {
249241
* @return array
250242
*/
251243
private static function get_lines_from_order( WC_Order $order ) {
244+
/**
245+
* @since 3.0.2
246+
*
247+
* Can be used to include any additional costs that are not included by default.
248+
*/
249+
$buyer_fee_cents = apply_filters('mondu_buyer_fee_cents', 0, $order);
250+
252251
$line = [
253252
'discount_cents' => round($order->get_discount_total() * 100),
253+
'buyer_fee_cents' => $buyer_fee_cents,
254254
'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
255255
'line_items' => [],
256256
];

0 commit comments

Comments
 (0)