Skip to content

Commit a0ffb9f

Browse files
authored
[PT-560] Added filters for buyer_fee_cents and order_data (#120)
1 parent 6ef95c5 commit a0ffb9f

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

README.txt

+1-1
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.1
6+
Stable tag: 3.0.2
77
Requires PHP: 7.4
88
License: GPLv3
99
License URI: https://www.gnu.org/licenses/gpl-3.0.html

changelog.txt

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
== Changelog ==
22

3+
= 3.0.2 =
4+
5+
* Added filters for buyer_fee_cents and whole order_data
6+
7+
= 3.0.1 =
8+
9+
* Reworked Credit Note flow
10+
11+
= 3.0.0 =
12+
13+
* Improve plugin code standards
14+
15+
= 2.2.0 =
16+
17+
* Compatibility for high performance order storage and cart checkout blocks
18+
319
= 2.1.7 =
420

521
* Bugfixes and improvements

mondu-buy-now-pay-later.php

+2-2
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.1
6+
* Version: 3.0.2
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.1' );
30+
define( 'MONDU_PLUGIN_VERSION', '3.0.2' );
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

+12-1
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,21 @@ 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+
144151
$order_data = [
145152
'payment_method' => array_flip( Plugin::PAYMENT_METHODS )[ $order->get_payment_method() ],
146153
'currency' => get_woocommerce_currency(),
147154
'external_reference_id' => (string) $order->get_order_number(),
148155
'gross_amount_cents' => round( (float) $order->get_total() * 100),
149156
'net_price_cents' => round( (float) $order->get_subtotal() * 100),
150157
'tax_cents' => round( (float) $order->get_total_tax() * 100),
158+
'buyer_fee_cents' => $buyer_fee_cents,
151159
'buyer' => [
152160
'first_name' => isset($billing_first_name) && Helper::not_null_or_empty($billing_first_name) ? $billing_first_name : null,
153161
'last_name' => isset($billing_last_name) && Helper::not_null_or_empty($billing_last_name) ? $billing_last_name : null,
@@ -169,7 +177,10 @@ public static function order_data_from_wc_order( WC_Order $order ) {
169177
'lines' => self::get_lines_from_order( $order ),
170178
];
171179

172-
return $order_data;
180+
/**
181+
* @since 3.0.2
182+
*/
183+
return apply_filters('mondu_order_data', $order_data, $order);
173184
}
174185

175186
/**

0 commit comments

Comments
 (0)