-
Notifications
You must be signed in to change notification settings - Fork 126
Fix: Retry ViesCheck after rescuing from any Valvat Maintenance exception #3844
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mariohd
requested changes
Jun 17, 2025
@mariohd There are some overthinking from my end 💥 |
groyoh
reviewed
Jun 18, 2025
We created an helper that might be useful on this ConcurrencyThrottlable, have a look to check if it's useful |
groyoh
approved these changes
Jun 19, 2025
groyoh
approved these changes
Jun 20, 2025
mariohd
approved these changes
Jun 20, 2025
diegocharles
added a commit
that referenced
this pull request
Jul 11, 2025
…tion (#3844) ## Fix VIES Maintenance exceptions handling ### Problem `Valvat::MemberStateUnavailable` exceptions weren't being raised properly, preventing fallback mechanisms from triggering when VIES is unavailable. Some countries won't accept requests during the weekend of after the business hour. Check the table here https://ec.europa.eu/taxation_customs/vies/#/help ### Solution 1. Added `raise_error: true` to Valvat calls in `Customers::EuAutoTaxesService` to ensure exceptions are properly raised and caught by the existing rescue block 2. Update the wait time from 30 seconds to 15.minutes, in order to avoid overheads in the Sidekiq, since the job will run until it gets the information. ### Next steps: Rethink the retry logic to make it exponential using the Sidekiq built-in helper, or create a table with the working hours for each country. ### Testing - ✅ All existing tests pass - ✅ VIES exceptions now properly trigger fallback mechanism - ✅ Webhook notifications work correctly - ✅ Retry job scheduling functions as expected ### Impact Better reliability for German customers when VIES service is temporarily unavailable, ensuring consistent tax application through proper fallback mechanisms. --- **Context:** ```ruby # Before: Exception not raised Valvat.new("DE199896394").exists?(detail: true) # After: Exception properly raised and handled Valvat.new("DE199896394").exists?(detail: true, raise_error: true) ``` **What happens now:** 1. When VIES is unavailable, `Valvat::MemberStateUnavailable` is properly raised 3. Existing rescue block captures the exception 4. Webhook is sent with error details 5. Retry job is scheduled for 30 seconds later
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix VIES Maintenance exceptions handling
Problem
Valvat::MemberStateUnavailable
exceptions weren't being raised properly, preventing fallback mechanisms from triggering when VIES is unavailable.Some countries won't accept requests during the weekend of after the business hour.
Check the table here https://ec.europa.eu/taxation_customs/vies/#/help
Solution
raise_error: true
to Valvat calls inCustomers::EuAutoTaxesService
to ensure exceptions are properly raised and caught by the existing rescue blockNext steps:
Rethink the retry logic to make it exponential using the Sidekiq built-in helper, or create a table with the working hours for each country.
Testing
Impact
Better reliability for German customers when VIES service is temporarily unavailable, ensuring consistent tax application through proper fallback mechanisms.
Context:
What happens now:
Valvat::MemberStateUnavailable
is properly raised