Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geo Zone restriction seems to have no effect #27

Closed
mehov opened this issue Oct 12, 2021 · 3 comments
Closed

Geo Zone restriction seems to have no effect #27

mehov opened this issue Oct 12, 2021 · 3 comments

Comments

@mehov
Copy link

mehov commented Oct 12, 2021

What I did:

  • Enabled and configured the extension for one of our merchant IDs (we were assigned multiple for different countries we operate in, and I used the Danish one)
  • Scrolled to the "Geo Zone (Define the geographic zones the payment module is displayed)" option and chose our custom Geo Zone "Danmark"
    bambora_settings
  • Went to the checkout of one of our stores (we have a multistore) that's assigned to France

What happened:

The Bambora payment method appears as available and successfully accepts payments.

What I expected to happen:

The Bambora payment method does not appear as available. It appears as available and successfully accepts payments only on our site that's assigned to a country that's attached to the allowed Geo Zone (in this case, Denmark).

What I double-checked:

  • Confirmed the same happens on our German store (again, within the same multistore)
  • Made sure the "Danmark" zone indeed includes only Denmark
    bambora_danmark
  • Made sure there's only one zone with such name
  • Made sure the French store I tested with is indeed assigned to France
    bambora_store
  • Made sure the billing address country selected during checkout is not Denmark
@mehov
Copy link
Author

mehov commented Oct 12, 2021

Solution: make sure the name of the Geo Zone input in the admin configuration form ends with _id to match what you're grabbing in catalog/model/extension/payment/bambora_online_checkout.php#L42.

Here are the admin inputs with incorrect names:

Here's the full diff from the local fix that worked for us:

---
 .../view/template/extension/payment/bambora_online_checkout.tpl | 2 +-
 .../template/extension/payment/bambora_online_checkout.twig     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/admin/view/template/extension/payment/bambora_online_checkout.tpl b/admin/view/template/extension/payment/bambora_online_checkout.tpl
index 8babb8f4..644e8500 100644
--- a/admin/view/template/extension/payment/bambora_online_checkout.tpl
+++ b/admin/view/template/extension/payment/bambora_online_checkout.tpl
@@ -232,7 +232,7 @@ echo $column_left;
           <div class="form-group">
             <label class="col-sm-2 control-label" for="input-geo-zone"><span data-toggle="tooltip" title="<?php echo $help_geo_zone; ?>"><?php echo $entry_geo_zone; ?></span></label>
             <div class="col-sm-10">
-              <select name="bambora_online_checkout_geo_zone" id="input-geo-zone" class="form-control">
+              <select name="bambora_online_checkout_geo_zone_id" id="input-geo-zone" class="form-control">
                 <option value="0"><?php echo $text_all_zones; ?></option>
                 
                 <?php foreach($geo_zones as $geo_zone) { 
diff --git a/admin/view/template/extension/payment/bambora_online_checkout.twig b/admin/view/template/extension/payment/bambora_online_checkout.twig
index 4e3f09ed..f1031a7d 100644
--- a/admin/view/template/extension/payment/bambora_online_checkout.twig
+++ b/admin/view/template/extension/payment/bambora_online_checkout.twig
@@ -254,7 +254,7 @@
           <div class="form-group">
             <label class="col-sm-2 control-label" for="input-geo-zone"><span data-toggle="tooltip" title="{{ help_geo_zone }}">{{ entry_geo_zone }}</span></label>
             <div class="col-sm-10">
-              <select name="payment_bambora_online_checkout_geo_zone" id="input-geo-zone" class="form-control">
+              <select name="payment_bambora_online_checkout_geo_zone_id" id="input-geo-zone" class="form-control">
                 <option value="0">{{ text_all_zones }}</option>
                 
                 {% for geo_zone in geo_zones %}
-- 
---
 admin/controller/extension/payment/bambora_online_checkout.php  | 2 +-
 .../view/template/extension/payment/bambora_online_checkout.tpl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/admin/controller/extension/payment/bambora_online_checkout.php b/admin/controller/extension/payment/bambora_online_checkout.php
index 2b11b662..2d14b173 100644
--- a/admin/controller/extension/payment/bambora_online_checkout.php
+++ b/admin/controller/extension/payment/bambora_online_checkout.php
@@ -214,7 +214,7 @@ class ControllerExtensionPaymentBamboraOnlineCheckout extends Controller
             'payment_method_update',
             'total',
             'order_status_completed',
-            'geo_zone',
+            'geo_zone_id',
             'sort_order',
          );
 
diff --git a/admin/view/template/extension/payment/bambora_online_checkout.tpl b/admin/view/template/extension/payment/bambora_online_checkout.tpl
index 644e8500..b48ef319 100644
--- a/admin/view/template/extension/payment/bambora_online_checkout.tpl
+++ b/admin/view/template/extension/payment/bambora_online_checkout.tpl
@@ -236,7 +236,7 @@ echo $column_left;
                 <option value="0"><?php echo $text_all_zones; ?></option>
                 
                 <?php foreach($geo_zones as $geo_zone) { 
-                if($geo_zone['geo_zone_id'] == $bambora_online_checkout_geo_zone) {?>
+                if($geo_zone['geo_zone_id'] == $bambora_online_checkout_geo_zone_id) {?>
                 
                 <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option>
                 
-- 

@sessan
Copy link
Contributor

sessan commented Oct 20, 2021

@mehov Could you create a pull request instead? :)

@sessan
Copy link
Contributor

sessan commented May 12, 2023

Added in 1.5.0

@sessan sessan closed this as completed May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants