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

Missmatch Portugal ZIP Code Matching #34271

Closed
4 tasks
mklooss opened this issue Oct 7, 2021 · 13 comments
Closed
4 tasks

Missmatch Portugal ZIP Code Matching #34271

mklooss opened this issue Oct 7, 2021 · 13 comments
Assignees
Labels
Area: Tax Issue: ready for confirmation Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@mklooss
Copy link

mklooss commented Oct 7, 2021

Missmatch Portugal ZIP Code Matching - ( #14220 )

Issue description: irrespective of zip code & tax rate set , tax gets calculated only default is 23% which is zip code set '* '.

the Issues will be produced by this method: https://github.com/magento/magento2/blob/2.4/app/code/Magento/Tax/Model/ResourceModel/Calculation.php#L345-L355

Preconditions (*)

  1. Magento 2.4.3
  2. Tax Calculation Rule:
+-------------------------+----------------+---------------+--------------+-----------------------+---------+--------------+----------+--------+
| tax_calculation_rate_id | tax_country_id | tax_region_id | tax_postcode | code                  | rate    | zip_is_range | zip_from | zip_to |
+-------------------------+----------------+---------------+--------------+-----------------------+---------+--------------+----------+--------+
|                      54 | PT             |             0 | *            | TAX Portugal       | 23.0000 |         NULL |     NULL |   NULL |
|                     136 | PT             |             0 | 96*          | 0% TAX - PT/A2-96% |  1.0000 |         NULL |     NULL |   NULL |
|                     137 | PT             |             0 | 97*          | 0% TAX - PT/A2-97% |  0.0000 |         NULL |     NULL |   NULL |
+-------------------------+----------------+---------------+--------------+-----------------------+---------+--------------+----------+--------+

Steps to reproduce (*)

  1. Create 3 known Rules as mentioned in above grid.
  2. Try to Checkout anything with an Address from the Range (eg: 9610-111) and Country Portugal.

Expected result (*)

  1. Tax Should be 0 % = 0 €

Actual result (*)

  1. Tax will be applied from 54 but Never from 136

Additional Info (*)

  1. By choosing an 96XXXX code, the applied tax is turning to 24% (Where 23% is from * rule, and 1% from 96*)

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [x ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Oct 7, 2021

Hi @mklooss. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@mklooss
Copy link
Author

mklooss commented Oct 7, 2021

Simple Workaround / Patch for just PT

--- a/Model/ResourceModel/Calculation.php	2021-10-07 13:14:39.696529241 +0200
+++ b/Model/ResourceModel/Calculation.php	2021-10-07 13:15:13.316749197 +0200
@@ -353,6 +353,12 @@
                     $zipTo = $matches[2];
                 }
             }
+            if ($countryId == 'PT')
+            {
+                $postcodeIsRange = false;
+                $zipFrom = NULL;
+                $zipTo = NULL;
+            }
 
             if ($postcodeIsNumeric || $postcodeIsRange) {
                 $selectClone = clone $select;

@m2-assistant
Copy link

m2-assistant bot commented Oct 8, 2021

Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta
Copy link
Contributor

Hi @mklooss ,
We tried to replicate it on Magento 2.4 Develop latest branch. Unfortunately we could not find the zip-codes which provided in the ticket.
Link# https://en.wikipedia.org/wiki/Postal_codes_in_Portugal.
Hence request to review it once again.

@engcom-Delta engcom-Delta added Issue: needs update Additional information is require, waiting for response and removed Issue: ready for confirmation labels Nov 2, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Nov 2, 2021
@mklooss
Copy link
Author

mklooss commented Nov 2, 2021

@engcom-Delta just take a look at the list on wikipedia: "Postal regions (first digit of postal code)" -> "9. (brown) - Madeira Islands and Azores" and also at the Image on the right side of the article: https://en.wikipedia.org/wiki/Postal_codes_in_Portugal#/media/File:Postal_Codes_of_Portugal.png
There you can found the data, of this postal codes.

Example: https://en.wikipedia.org/wiki/Ribeira_Grande,_Azores

@engcom-Delta
Copy link
Contributor

Hi mklooss,
We tried to reproduce the issue as per provided steps , we could see the difference in tax calculation for PT country .Hence added label 'Issue confirmed'.
PT_taxRule

Tax_applied_PT

@engcom-Delta engcom-Delta added Area: Tax and removed Issue: needs update Additional information is require, waiting for response labels Dec 2, 2021
@m2-community-project m2-community-project bot moved this from Needs Update to Ready for Confirmation in Issue Confirmation and Triage Board Dec 2, 2021
@engcom-Delta engcom-Delta added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch and removed Issue: ready for confirmation labels Dec 2, 2021
@engcom-Delta engcom-Delta added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Issue: ready for confirmation labels Dec 2, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Dec 2, 2021
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-1925 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Dec 2, 2021

✅ Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Alfa engcom-Alfa removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Dec 6, 2021
@m2-community-project m2-community-project bot moved this from Confirmed to Ready for Confirmation in Issue Confirmation and Triage Board Dec 6, 2021
@engcom-Alfa
Copy link
Contributor

@mklooss
Thanks for your contribution, and reported issue is in discussion
Thanks for your patience!

@engcom-Hotel
Please look into the code how it is working, and needs to confirm the actual behaviour by looking into the documentation.

@m2-assistant
Copy link

m2-assistant bot commented Dec 6, 2021

Hi @engcom-Alfa. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@m2-assistant
Copy link

m2-assistant bot commented Dec 6, 2021

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@github-jira-sync-bot github-jira-sync-bot added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Dec 8, 2021
@m2-community-project m2-community-project bot added this to Dev In Progress in High Priority Backlog Dec 8, 2021
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Dec 8, 2021
@engcom-Delta
Copy link
Contributor

Hi @mklooss,

Please find attached proofs for reference and updated issue description.

Issue description: irrespective of zip code & tax rule , tax gets calculated only default is 23% which is zip code set '* '.

Screenshots:
PT_taxRule_star_configured
PT_taxRule_Star
PT_taxrule_96_configured
PT_taxrule_96
PT_taxRule
Tax_applied_PT
Tax_rule_97zipcode

@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Mar 15, 2022
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Apr 20, 2022
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Apr 20, 2022
@engcom-Alfa
Copy link
Contributor

engcom-Alfa commented May 20, 2022

Hello @mklooss

As I can see this issue got fixed in the scope of the internal Jira ticket AC-1925 by the internal team
Related commits: b092dd6

Based on Jira target version is 2.4.5

@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Tax Issue: ready for confirmation Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

No branches or pull requests

5 participants