-
Notifications
You must be signed in to change notification settings - Fork 879
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
'Insufficient Funds' notification now will not show if balance will cover verified sites. #2208
Conversation
bc4f7fb
to
a84d5f3
Compare
9145189
to
9901b73
Compare
e6074e7
to
770e09b
Compare
96083bd
to
2fcdb85
Compare
7ebc1c7
to
471778d
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.
Current call flow is like this:
- HasSufficientBalance (calls AC list)
- GetVerifiedAutoAmount (gets AC amount and calls recurring)
- GetVerifiedRecurringAmount (gets recurring amount and calls balance)
- OnFetchWalletProperties (return if sufficient balance)
I think this flow would be better
- HasSufficientBalance (calls balance)
- OnFetchWalletProperties (calls AC list)
- GetVerifiedAutoAmount (gets AC amount; return if not enough balance; calls recurring if enough balance)
- GetVerifiedRecurringAmount (gets recurring amount and return if sufficient balance)
With this approach we can exit sooner if we already know that AC is over the budget
this, _1, _2, total_reconcile_amount, callback)); | ||
} | ||
|
||
void BatContribution::OnFetchWalletProperties( |
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 one should be named more HasSufficientBalance
specific as we will probably had more FetchWalletProperties
calls. Maybe something like OnSufficientBalanceWallet
?
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.
Done.
} | ||
|
||
// static | ||
double BatContribution::GetAmountFromVerifiedRecurring( |
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.
Move it before OnFetchWalletProperties
. This is how it's defined in .h
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.
Done.
6fb59c5
to
6977a45
Compare
Modified flow to exit if AC balance does not meet contribution requirements |
double total_reconcile_amount, | ||
bool is_ac_list_empty, | ||
ledger::HasSufficientBalanceToReconcileCallback callback) { | ||
if (publisher_list.empty() && is_ac_list_empty) { |
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.
is_ac_list_empty
is still needed? We now exit in AC if over, so if publisher_list
is empty we know that we have enough funds
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.
Removed.
2c2fe8a
to
0a0573c
Compare
4dff4fa
to
7daedeb
Compare
Fixes brave/brave-browser#3707
Fixes brave/brave-browser#4104
Fixes brave/brave-browser#4090
brave-ui PR: brave/brave-ui#471
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests && npm run test-security
) onnpm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
-- --rewards=reconcile-interval=20
(or some other value less than 4320 [3 days])Repeat the steps above with a different combination of verified and unverified sites and make sure notification does not show if the balance would cover the verified sites contribution.
Repeat the steps above using also a combination of verified and unverified recurring donations.
Verify that 'Insufficient Funds notifications are not shown if the combined reconcile amount of all verified publishers is under the wallet balance. Likewise make sure the notification is shown if the wallet balance is insufficient.
Reviewer Checklist: