-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feat/improve payment detected behavior #403
Conversation
Yes |
Fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add some tests for this branch.
We can talk about it together with @chedieck to see what we can + should do. It's tedious and unreliable to be testing things manually. The bug with the editable dialog is an example of something that is easy to miss during manual testing.
cc23896
to
bf722dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some remarks about test naming, also pushed a commit improving a little on a test
I found that in the button generator:
- Editable toggle set to false still allows it to be editable
- Sending a TX to the address with the same amount, same payment id (in the opReturn) but different data (so different opReturn but same paymentId) triggers onSuccess, not onTransaction. For what I gathered from Ensure proper thing happens when payment is received #378 this is not desired behavior.
- If we have paymentId disabled, then sending the tx with the correct amount and no paymentId still doesn't trigger onSuccess. My suspicion is that the "shouldTriggerOnSuccess" function is comparing undefined with
''
or smth like that.
When solving the bugs above, make sure you first write tests that catch them, then solve them.
Finally, would be good to also:
- add the
yarn test:coverage
command to the root folder - put min=0 in the amount & goal amount fields of the button generator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this happens on master too, I believe It is due to having a widget and a button with the same address in the same page, they are not isolated. For example, when you pay in the widget and you have two widgets to the same address both will change the qrcode to the check mark, this is why the callback is called twice. |
Okay, so let's start by breaking this into multiple PRs. I see some changes are really isolated from the rest, so separating those should be easy. By just reading the PR description, I would suggest:
1
2
2
1
2
1
1
3
3
4 ... where 1-4 are branches which each of these changes should belong to. Bear in mind this is just a suggestion by reading what are the changes, I may well be putting together things that having nothing to do with each other (diffwise) and separating things that do. |
thanks for the suggestion, breaking up these changes in smaller branches sounds like a good plan, will work on that, thanks |
445f519
to
e32950c
Compare
ec82fda
to
efc4545
Compare
cb5f3ba
to
5809521
Compare
Now what I get is that success is not triggered on neither. |
This was due to rawMessage not being returned from server, when I tested on local server on master it works because local server returned rawMessage. Even though I did a change to consider the message if there is no rawMessage in transaction. |
Conflicts. |
6c62da8
to
4516f81
Compare
4516f81
to
89e269b
Compare
Same issue as before when I tested. This was tested in my localhost, having paybutton-server running locally. Receiving a 20XEC tx activates success in a paybutton with 20USD of amount. Even if there is only the 20USD widget there. This is wrong not only because the amount is not being taken into account to activate it, but neither is the paymentId. |
Can you provide more info on this ? like the code you used to test it like the html code ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Related to #378
Description
Test plan
Open the project, run
yarn clean:build
make a payment and check if we trigger success correctly as described here #378