-
Notifications
You must be signed in to change notification settings - Fork 20
Fix handling of empty payment IDs #621
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
Klakurka
merged 2 commits into
PayButton:master
from
Fabcien:dont_match_undefined_paymentid
Feb 20, 2026
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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.
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.
🧩 Analysis chain
🏁 Script executed:
rg -n --type=ts -A 10 -B 2 'shouldTriggerOnSuccess\s*\('Repository: PayButton/paybutton
Length of output: 15179
🏁 Script executed:
rg -n --type=ts -C 5 'disablePaymentId'Repository: PayButton/paybutton
Length of output: 50375
🏁 Script executed:
sed -n '87,113p' react/lib/tests/util/validate.test.tsRepository: PayButton/paybutton
Length of output: 975
🏁 Script executed:
sed -n '42,85p' react/lib/tests/util/validate.test.tsRepository: PayButton/paybutton
Length of output: 1407
🏁 Script executed:
sed -n '87,115p' react/lib/tests/util/validate.test.tsRepository: PayButton/paybutton
Length of output: 1131
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 2735
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 645
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 45
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 2377
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 3742
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 1488
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 872
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 505
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 149
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 282
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 45
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 1509
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 45
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 45
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 2127
🏁 Script executed:
# Get the full context of WidgetContainer to understand the complete flow from start to when shouldTriggerOnSuccess is called wc -l react/lib/components/Widget/WidgetContainer.tsxRepository: PayButton/paybutton
Length of output: 114
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 981
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 868
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 1340
🏁 Script executed:
Repository: PayButton/paybutton
Length of output: 45
Verify that WidgetContainer honors the implicit
disablePaymentId = truecontract whenexpectedPaymentIdis absent.The fix correctly prevents false positives by requiring
expectedPaymentIdto be truthy before matching. However, it introduces a critical implicit contract: whenexpectedPaymentIdis absent or empty anddisablePaymentIdisfalse(its default),isPaymentIdValidbecomesfalse, permanently blocking all transactions from triggering success.This is safe in PayButton (which calls
getPaymentId()to either fetch a valid paymentId or return undefined whendisablePaymentIdis true), but WidgetContainer violates it. WidgetContainer defaultsdisablePaymentIdtofalseviaisPropsTrue(props.disablePaymentId)(line 111) and acceptspaymentIdas an optional prop without fetching it. When WidgetContainer is instantiated without providing apaymentIdand without explicitly settingdisablePaymentId = true, every transaction will be rejected.The test at lines 87-120 confirms this contract is intentional—the comment states: "Payment IDs are not set when the button is built so any tx with the same address and amount could match." Ensure WidgetContainer always sets
disablePaymentId = truewhen no paymentId is provided or will be fetched.🤖 Prompt for AI Agents