-
Notifications
You must be signed in to change notification settings - Fork 3
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
Retrying subscription transactions with increasing delays #90
Conversation
… get an Invalid OTS Token due to an overloaded Auth.net service.
Assigning to @witekdev and @jessesnyder since you both know this code better than I do and I haven't tested it and don't know how to test it. I'm a bit disconcerted that the docker build github action |
jazkarta.shop Run #65
Run Properties:
|
Project |
jazkarta.shop
|
Branch Review |
nci-issues/336-recurring-donation-delay
|
Run status |
Failed #65
|
Run duration | 00m 19s |
Commit |
ced32958c8: fix comment
|
Committer | witekdev |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
2
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
1
|
View all changes introduced in this branch ↗︎ |
Tests for review
cypress/integration/first_spec.js • 2 failed tests • UI - Chrome
Test | Artifacts | |
---|---|---|
Admin operations > creates a buyable product |
Screenshots
Video
|
|
Admin operations > buys one product |
Screenshots
Video
|
I've done a little testing now and it seems to work well in the sandbox and when I raise an artificial error. Not sure about these test failures, but they seem to be related to infrastructure setup or similar. |
@alecpm this looks structurally good to me I couldn't test locally with an NCI instance, because I got https://github.com/jazkarta/nci.content/commit/c72f2eb1441433b0a4b27d3ed466ebf90efef5a9
https://github.com/jazkarta/nci.content/blob/master/nci/content/browser/donation.py
jazkarta.shop itself only has these defaults:
Using this online python parser I created this dummy test case to test the logic of your code, it seems good
The way you have it setup now it will try max four times, that is probably a good first step to see if this solves the issue they are having. try 1st try 2nd try 3rd try 4th |
For testing code that requires SSL, I find Thanks for looking into this. If you think it’s suitable to merge, can you approve the PR? |
Good to know, thanks!
Sure, happy to merge.
Or do you want to leave it in? |
I don’t think it’s redundant. That line should immediately raise any exceptions that aren’t “Invalid OTS Token”. We only want to retry when we hit that specific exception message. |
I think you're right 👍 I didn't think of it that way, but it makes sense. |
See jazkarta/nci.content#336 and specifically this comment
Apparently Authorize.net AcceptJS will sometimes just fail to recognize a valid subscription payment nonce token when it's busy and it may be necessary to retry the transaction with a delay of up to 10 seconds. Right now NCI has a 5 second delay on the client side to aid with this, which impacts all transactions. However, since this issue seems specific to subscription transactions and a silent delay on the client seems disconcerting (especially if longer than 5 seconds), I think the delay probably belongs in jaz.shop. Additionally, it's only really possible to implement further incremental delays and retries on the server side.
This should repeat the transaction when it fails with a specific error code up to 4 times with a delay that increments by 2 seconds on each repeat. So if needed, the final transaction should occur 12 seconds after the initial try.