Purchase Confirmations not working correctly when set to USD #4057

Closed
opened 2020-04-24 08:42:16 +02:00 by jeffslofish · 5 comments
jeffslofish commented 2020-04-24 08:42:16 +02:00 (Migrated from github.com)

Bug
There are two related scenarios:

  1. If the setting "Only confirm purchases over a certain price" is chosen and currency is set to USD, the app treats the value entered as LBC, not USD.

  2. If the setting "Always confirm before purchasing content" is chosen and previously the currency for "Only confirm purchases over a certain price" was set to USD, a javascript error occurs.

To Reproduce
Steps to reproduce the behavior:
Scenario 1:

  1. Go to settings
  2. Click on the "Only confirm purchases over a certain price" radio button under "Purchase Confirmations"
  3. Set a price of 0.5 and change the currency to USD
  4. Try to buy something that costs 1 LBC
  5. A confirmation dialog will appear

Scenario 2:

  1. Go to setting
  2. Click on the "Only confirm purchases over a certain price" radio button under "Purchase Confirmations"
  3. Change the currency to USD
  4. Click on "Always confirm before purchasing content" radio button under "Purchase Confirmations"
  5. Try to buy something
  6. The player will get stuck on "Loading" and in the developer console, the following error is displayed: "Uncaught TypeError: Cannot read property 'getExchangeRates' of undefined"

Expected behavior
Scenario 1:

  • Instead of a confirmation dialog appearing, the content should start playing immediately

Scenario 2:

  • Instead of the playing getting stuck on "Loading", the content should play immediately and there should be no developer console error

Screenshots
If applicable, add screenshots to help explain your problem.

System Configuration

App | 0.45.0
Daemon (lbrynet) | 0.70.0
Platform | Mac OS 19.4.0
Installation ID | 6FW8Z6nraRjKxu7DxhayqYgMtHgovjAAKswHTSfhQYarw42MM289CWoAUzfc1CLkRi

Additional context
The problem is in the code at https://github.com/lbryio/lbry-desktop/blob/master/ui/redux/actions/content.js#L201-L208

I believe line 201 should be && instead of ||.
Also, in line 205, "Lbryapi.getExchangeRates()" is not defined. It appears to have been removed from lbry-redux in this commit: 71dda665759ead555fef0bccef3a0ae653cb4509

<!-- Thanks for reporting an issue to LBRY and helping us improve! To make it possible for us to help you, please fill out below information carefully. Before reporting any issues, please make sure that you're using the latest version. - App releases: https://github.com/lbryio/lbry-desktop/releases - Standalone daemon: https://github.com/lbryio/lbry/releases We are also available on live chat at https://chat.lbry.com --> **Bug** There are two related scenarios: 1. If the setting "Only confirm purchases over a certain price" is chosen and currency is set to USD, the app treats the value entered as LBC, not USD. 2. If the setting "Always confirm before purchasing content" is chosen and previously the currency for "Only confirm purchases over a certain price" was set to USD, a javascript error occurs. **To Reproduce** Steps to reproduce the behavior: Scenario 1: 1. Go to settings 2. Click on the "Only confirm purchases over a certain price" radio button under "Purchase Confirmations" 3. Set a price of 0.5 and change the currency to USD 4. Try to buy something that costs 1 LBC 5. A confirmation dialog will appear Scenario 2: 1. Go to setting 2. Click on the "Only confirm purchases over a certain price" radio button under "Purchase Confirmations" 3. Change the currency to USD 4. Click on "Always confirm before purchasing content" radio button under "Purchase Confirmations" 5. Try to buy something 6. The player will get stuck on "Loading" and in the developer console, the following error is displayed: "Uncaught TypeError: Cannot read property 'getExchangeRates' of undefined" **Expected behavior** Scenario 1: - Instead of a confirmation dialog appearing, the content should start playing immediately Scenario 2: - Instead of the playing getting stuck on "Loading", the content should play immediately and there should be no developer console error **Screenshots** If applicable, add screenshots to help explain your problem. **System Configuration** <!-- For the app, this info is in the About section at the bottom of the Help page. You can include a screenshot instead of typing it out --> <!-- For the daemon, run: curl 'http://localhost:5279' --data '{"method":"version"}' and include the full output --> App | 0.45.0 Daemon (lbrynet) | 0.70.0 Platform | Mac OS 19.4.0 Installation ID | 6FW8Z6nraRjKxu7DxhayqYgMtHgovjAAKswHTSfhQYarw42MM289CWoAUzfc1CLkRi **Additional context** The problem is in the code at https://github.com/lbryio/lbry-desktop/blob/master/ui/redux/actions/content.js#L201-L208 I believe line 201 should be && instead of ||. Also, in line 205, "Lbryapi.getExchangeRates()" is not defined. It appears to have been removed from lbry-redux in this commit: 71dda665759ead555fef0bccef3a0ae653cb4509
jeffslofish commented 2020-04-24 08:46:08 +02:00 (Migrated from github.com)

I cannot complete the requested additions to #4051 until this issue is addressed.

I cannot complete the requested additions to #4051 until this issue is addressed.
neb-b commented 2020-04-24 20:04:14 +02:00 (Migrated from github.com)

Good find @jeffslofish

I think your suggested fix looks like it would fix this issue. Can you make that change?

Good find @jeffslofish I think your suggested fix looks like it would fix this issue. Can you make that change?
jeffslofish commented 2020-04-24 20:52:31 +02:00 (Migrated from github.com)

I can change line 201 (|| to &&), but that only solves half the problem. The other problem is line 205, where Lbryapi.getExchangeRates() is undefined. I am not clear how to get the exchange rate functionality working.

I can change line 201 (|| to &&), but that only solves half the problem. The other problem is line 205, where Lbryapi.getExchangeRates() is undefined. I am not clear how to get the exchange rate functionality working.
neb-b commented 2020-04-24 21:01:13 +02:00 (Migrated from github.com)

Ah I missed that comment. Sorry about that. Let me check and see what's going on with that.

Ah I missed that comment. Sorry about that. Let me check and see what's going on with that.
neb-b commented 2020-04-24 21:13:49 +02:00 (Migrated from github.com)

@jeffslofish I just pushed up this commit dcb79685bc

It should work now. Looks like that has been broken for a while. Thanks for finding/reporting it!

@jeffslofish I just pushed up this commit https://github.com/lbryio/lbry-desktop/commit/dcb79685bc25cf3bc77d434255063fc4933cdf44 It should work now. Looks like that has been broken for a while. Thanks for finding/reporting it!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-desktop#4057
No description provided.