Skip to content

Commit f447319

Browse files
PT-3161: Plugin limits usage of Mondu to some countries (#125)
1 parent 235b001 commit f447319

File tree

5 files changed

+8
-32
lines changed

5 files changed

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

assets/src/js/mondublocks.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
const { registerPaymentMethodExtensionCallbacks } = window.wc.wcBlocksRegistry;
77
const settings = window.wc.wcSettings.getSetting( 'mondu_blocks_data', {} );
88

9-
settings.available_countries = settings.available_countries || [];
10-
settings.gateways = settings.gateways || {};
9+
settings.gateways = settings.gateways || {};
1110

1211
// This is not used anywhere, it's added for automatic translation generation with wp cli command
1312
const translations = [
@@ -57,7 +56,7 @@
5756
registerPaymentMethodExtensionCallbacks('mondu',
5857
Object.keys(settings.gateways).reduce((previousValue, currentValue) => {
5958
previousValue[currentValue] = function (arg) {
60-
return settings.available_countries.includes(arg.billingAddress.country)
59+
return true;
6160
}
6261

6362
return previousValue;

mondu-buy-now-pay-later.php

Lines changed: 3 additions & 3 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.3
6+
* Version: 3.0.4
77
* Author: Mondu
88
* Author URI: https://mondu.ai
99
*
@@ -18,7 +18,7 @@
1818
* License: GPLv3
1919
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
2020
*
21-
* Copyright 2024 Mondu
21+
* Copyright 2025 Mondu
2222
*/
2323

2424
use Automattic\WooCommerce\Utilities\FeaturesUtil;
@@ -27,7 +27,7 @@
2727
die( 'Direct access not allowed' );
2828
}
2929

30-
define( 'MONDU_PLUGIN_VERSION', '3.0.3' );
30+
define( 'MONDU_PLUGIN_VERSION', '3.0.4' );
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/Blocks/MonduBlocksSupport.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ public function get_payment_method_data() {
8686
}, []);
8787

8888
return [
89-
'gateways' => $gateways,
90-
'available_countries' => Plugin::AVAILABLE_COUNTRIES,
89+
'gateways' => $gateways
9190
];
9291
}
9392
}

src/Mondu/Plugin.php

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ class Plugin {
5656
'installment_by_invoice' => 'mondu_installment_by_invoice',
5757
];
5858

59-
/**
60-
* Available Countries
61-
*/
62-
const AVAILABLE_COUNTRIES = [ 'DE', 'AT', 'NL', 'FR', 'BE', 'GB' ];
63-
6459
/**
6560
* Global Settings
6661
*
@@ -246,9 +241,7 @@ public function remove_gateway_if_country_unavailable( $available_gateways ) {
246241

247242
foreach ( self::PAYMENT_METHODS as $payment_method => $woo_payment_method ) {
248243
$customer = $this->get_wc_customer();
249-
if ( !$this->is_country_available( $customer->get_billing_country() )
250-
|| !in_array( $payment_method, $mondu_payments, true )
251-
) {
244+
if (!in_array( $payment_method, $mondu_payments, true )) {
252245
if ( isset( $available_gateways[ self::PAYMENT_METHODS[ $payment_method ] ] ) ) {
253246
unset( $available_gateways[ self::PAYMENT_METHODS[ $payment_method ] ] );
254247
}
@@ -310,11 +303,6 @@ public function validate_required_fields( array $fields, WP_Error $errors ) {
310303
/* translators: %s: Company */
311304
$errors->add('validation', sprintf(__('%s is a required field for Mondu payments.', 'mondu'), '<strong>' . __('Company', 'mondu') . '</strong>'));
312305
}
313-
314-
if ( !$this->is_country_available($fields['billing_country']) ) {
315-
/* translators: %s: Billing country */
316-
$errors->add('validation', sprintf(__('%s not available for Mondu Payments.', 'mondu'), '<strong>' . __('Billing country', 'mondu') . '</strong>'));
317-
}
318306
}
319307

320308
/**
@@ -503,16 +491,6 @@ public function woocommerce_notice() {
503491
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
504492
}
505493

506-
/**
507-
* Check if the country is available
508-
*
509-
* @param $country
510-
* @return bool
511-
*/
512-
private function is_country_available( $country ) {
513-
return in_array( $country, self::AVAILABLE_COUNTRIES, true );
514-
}
515-
516494
/**
517495
* Get the WC Customer object
518496
*

0 commit comments

Comments
 (0)