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
[billing] Cancel non-positive invoices on charge #491
Conversation
Codecov Report
@@ Coverage Diff @@
## master #491 +/- ##
==========================================
+ Coverage 92.7% 92.73% +0.02%
==========================================
Files 2344 2342 -2
Lines 75695 75621 -74
==========================================
- Hits 70173 70127 -46
+ Misses 5522 5494 -28
Continue to review full report at Codecov.
|
dd846d6
to
d208420
Compare
end | ||
nil | ||
reason = CONDITIONS_TO_CHARGE.find { |condition| !method("#{condition}?").call } | ||
I18n.t(reason, scope: %i[invoices reasons_cannot_charge]) if reason |
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.
What if not reason? Does it return null.. ?
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.
it does
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.
maybe it would be clearer with:
return unless (reason = CONDITIONS_TO_CHARGE.find { |condition| !method("#{condition}?").call })
I18n.t(reason, scope: %i[invoices reasons_cannot_charge])
But either way is fine 👍
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.
I didn't even have to touch this, TBH. Just did to make it shorter. It's Ruby language anyway.
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.
Makes sense to me but I don't know much about Billing so it would be good if @hallelujah can review it as well 😄
What this PR does / why we need it
What the title says, it ensures invoices with non-positive cost are cancelled when charged.
Which issue(s) this PR fixes
Closes THREESCALE-1420
Verification steps