-
Notifications
You must be signed in to change notification settings - Fork 974
WIP - Add Payment History dialog to Payments Tab (#2994) #3391
Conversation
- We now store the last BTC price with the ledgerInfo object in `ledger.js`, which becomes the `ledgerData` object in UI - Why? The BTC price was being computed in a couple of places from the current account balance (balance $ / balance USD). Recomputation from derived quantities can lead to error, this is simpler.
- Displays a table of user payment history (Each row represents a batched payout to multiple publishers sometimes called a `reconciliation` or `transaction` elsewhere) - 3 columns are shown for each payment: `Date`, `Total Amount`, & `Receipt Link` - Data comes from `transactions` array in `ledgerData` obj in UI (same as `ledgerInfo` in `browser-laptop/app/ledger.js`) - Next payment date in footer comes from `ledgerData.reconcileStamp` Loose ends / unfinished items: - `Receipt Link` is a dummy filename for now: PDF receipts are NOT impl yet - `Total Amount` USD value fluctuates because the stored value is in BTC and current exchange rate is used. This will be fixed in followup commit - The "Show Payment History" button is in an awkward spot impls issue #2994
- restyle "View Payment History" button per updated spec Simple orange text in Account Balance box #2994 (comment)
if ((body.rates) && (body.rates[currency])) info.btc = (amount / body.rates[currency]).toFixed(8) | ||
if ((body.rates) && (body.rates[currency])) { | ||
info.btcPrice = body.rates[currency] | ||
info.btc = (amount / body.rates[currency]).toFixed(8) |
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.
need @mrose17 to review this part
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 guess this is obsolete now.
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.
agreed. no longer needed.
Thanks for the code review @diracdeltas! I'll get those points addressed this afternoon. |
@willy-b what's your thinking in terms of a timeframe? |
@mrose17, I will finish addressing the points @diracdeltas raised in her review by Then I aim to post a proposal/breakdown for the Receipt PDF based on @bradleyrichter's gorgeous new Receipt PDF mockups (reference: #2994 (comment)) by For one I am going to suggest we omit absolute time figures for pages and only include contributions actually sent. This is the data available in the We might want to do simple CSV receipts in this PR and implement @bradleyrichter's really nice mockups in a separate PR depending on schedule. |
agree, and i think simple CSV receipts are fine for now |
@@ -695,6 +695,7 @@ var ledgerInfo = { | |||
|
|||
// the desired contribution (the btc value approximates the amount/currency designation) | |||
btc: undefined, | |||
btcPrice: undefined, |
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.
} | ||
|
||
get satoshis () { | ||
return this.transaction.get('satoshis') |
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.
@mrose17 is this correct, or should it be this.transaction.get('contribution').get('satoshis')
now?
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.
Sorry @diracdeltas, hold on just a minute, I haven't pushed the merge of @mrose17's update which includes this.
When you see the merge commit with latest master then you can come in full guns blazing :-).
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.
@diracdeltas, while @mrose17 updated the docs/state.md
in 5040058 , he didn't update app/ledger.js
to whitelist the contribution
field to be picked from ledger-client
transaction result. Thus after #3397 the contribution
field still wasn't making it to UI.
I am updating the comments and code in ledger.js
right now. Let me know if this is available in a different commit I can cherry-pick, because enabling transactions[n].contribution
probably shouldn't be part of this PR.
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.
will defer to @mrose17 on that
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.
oops! i'll fix it in master momentarily... sorry!
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.
use this.transaction.get('contribution').get('satoshis')
Update: I merged latest master to get @mrose17's updates in ledger-client v0.8.46 brought in by #3397, specifically the awesome new |
@willy-b - sorry about that. do me a favor and to your
and change |
@mrose17 no worries at all, thanks for the help. It just appears to be logging the same line
|
- text should not wrap/overflow when window is narrow #3391 (comment) - "View Payment History" should be left-aligned now, since #3396
} | ||
|
||
get numericDateStr () { | ||
var date = new Date(this.timestamp) |
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.
why not just return date.toLocaleDateString()
here?
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.
So I did do that for the displayed date: 48b0171#diff-e3eeb751016b2ce9f8278efce585a461R1258
This is for a filename, so toLocaleDateString
is a little awkward with the slashes and lack of zero-padding. But sure, I can use toLocaleDateString
and then replace the '/' with '-'s and let the lack of zero-padding be.
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.
gotcha, i missed the fact that this is for a filename. sorry
@willy-b Heads up for you. We are discussing a change that would swap the percent column for dollars (or local currency) per site. We should have this ironed out soon. |
Thanks for heads up @bradleyrichter! My semi-blocker right now is that the |
} | ||
|
||
get satoshis () { | ||
return this.transaction.get('contribution').get('satoshis') |
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.
contribution
and other child properties may not necessarily exist, so this would throw cannot read property 'get' of undefined
errors. please use this.transaction.getIn(['contribution', ...])
.
@willy-b does the semi-blocker relating to the disappearance of Thanks for the work; please run |
Fixes for some items from @diracdeltas code review (thanks!) - use .getIn instead of .get for nested props https://github.com/brave/browser-laptop/pull/3391/files/1eded36027dbe9bf21d1fdfeb8fdcec8a3ff9a61#r76501448 - use template strings https://github.com/brave/browser-laptop/pull/3391/files/1eded36027dbe9bf21d1fdfeb8fdcec8a3ff9a61#r76501619 - return null, not undefined in React render calls https://github.com/brave/browser-laptop/pull/3391/files/1eded36027dbe9bf21d1fdfeb8fdcec8a3ff9a61#r76501793 - check that typeof is Number before using toFixed https://github.com/brave/browser-laptop/pull/3391/files/1eded36027dbe9bf21d1fdfeb8fdcec8a3ff9a61#r76502209
Thanks for all the testing and code reviewing @diracdeltas. Yes, the |
@willy-b False alarm on the change to currency. We are staying with percentages for now. |
- fix overflow in Payment History table https://github.com/brave/browser-laptop/pull/3391/files/1eded36027dbe9bf21d1fdfeb8fdcec8a3ff9a61#r76502448 - fix awkward alignment of `Account Balance`, `Monthly Budget` columns, and `View Payment History` button in Payments Tab https://github.com/brave/browser-laptop/pull/3391/files/bd84215c68d40093da63ed071347fb60617bb5f2#r76502032 - change "Add Funds" button text to "Add Funds..." and decrease font size https://github.com/brave/browser-laptop/pull/3391/files/bd84215c68d40093da63ed071347fb60617bb5f2#r76502449 - restore Buy With Coinbase modal broken by my ModalOverlay changes https://github.com/brave/browser-laptop/pull/3391/files/1eded36027dbe9bf21d1fdfeb8fdcec8a3ff9a61#r76502568
Is this ready to merge? I won't include it in beta5 yet because I'm not sure. |
Hey! If we are OK with doing the 'Receipt Link' in a separate PR then I
|
@willy-b agree; that sounds like a good plan. you can just hide the receipt link column for now. |
Sorry for the delay, coming right up! On Fri, Aug 26, 2016 at 11:41 PM, yan zhu (@bcrypt) <
|
The 'Receipt Link' has been disabled and this has been rebased down to two commits ready for review in PR #3473. Thanks again @diracdeltas and @mrose17 for the code reviews / testing, and for helping me come up to speed on your project as I worked on this :-). |
This pull request adds a Payment History dialog to the Payments Tab.
It is a work in progress: The
Receipt Link
column links do not work yet (working on generating the receipt PDFs now). But the rest of the content in the Payment History dialog should be correct.Detailed discussions and @bradleyrichter's original mockup can be found in issue #2994 (see mockup at #2994 (comment)).