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

Add digit handling for country-specific currencies #288

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

kohe
Copy link

@kohe kohe commented Feb 15, 2025

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

This pull request adds digit handling for country-specific currencies, addressing an issue with Japanese Yen (JPY) credit card transactions. It ensures correct handling for currencies that do not require division by 100.

Closes # .

Steps to test the changes in this Pull Request:

  1. Attempt a credit card transaction using Japanese Yen.
  2. Verify that the amount is not divided by 100 and is processed correctly.
  3. Test with other currencies to ensure no regression.

Changelog entry

Add - Digit handling for country-specific currencies to prevent incorrect division by 100 for currencies like Japanese Yen.

@vikrampm1 vikrampm1 requested a review from dkotter February 17, 2025 00:40
@vikrampm1 vikrampm1 added this to the Future Release milestone Feb 17, 2025
Copy link
Contributor

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some formatting issues here that need cleaned up, likely a tabs vs spaces thing

@kohe
Copy link
Author

kohe commented Feb 19, 2025

Replaced spaces with tabs. Please review when you have a moment.

Copy link
Contributor

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some additional lint errors that need cleaned up. See https://github.com/woocommerce/woocommerce-square/actions/runs/13407493861/job/37497707380?pr=288

@kohe
Copy link
Author

kohe commented Feb 20, 2025

I have fixed the code to resolve the lint errors. Please review it again.

@dkotter dkotter added the needs: UAT The Issue/PR needs to go through UAT label Feb 20, 2025
@qasumitbagthariya
Copy link
Contributor

QA Update: ⚠️

@kohe

I created a Japan sandbox and attempted to reproduce the issue, but I wasn't able to replicate it.

I purchased a product priced at 100, reviewed the order page, and also checked the Square transaction. The amount wasn't split or altered—it remained 100 as expected, and I didn't notice any discrepancies.

Please correct me if I’m missing something, and if possible, could you provide detailed steps to reproduce the issue?

image
Screen.Recording.2025-02-24.at.6.12.03.PM.mov

Testing Environment

  • WordPress: 6.7.2
  • Theme: Twenty Twenty-Four 1.3
  • WooCommerce - 9.6.2
  • PHP: 8.0.30
  • Web Server: Nginx 1.20.2
  • Browser: Chrome
  • OS: macOS 15.2
  • Square Branch: trunk

@kohe
Copy link
Author

kohe commented Feb 24, 2025

@qasumitbagthariya Thank you for checking. The error doesn't occur with 100 yen because it's divisible by 100. Please try making a payment with an amount that isn't divisible by 100, such as 90 yen or 150 yen. Since these would contain decimal points when processed, Square should reject these transactions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: UAT The Issue/PR needs to go through UAT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants