Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

display different payment options based on user location #3862

Merged
merged 1 commit into from
Sep 12, 2016

Conversation

jkup
Copy link
Contributor

@jkup jkup commented Sep 10, 2016

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Fix #3711

Test Plan:

I'm having a tough time testing this one. I don't see exchangeInfo.exchangeName or exchangeInfo.exchangeURL even when I VPN to another country. @mrose17 what triggers those to come down? How can I test getting them?

Based on that I might need to change the naming of some of my functions but this is the general idea.

@mrose17
Copy link
Member

mrose17 commented Sep 10, 2016

@jkup - sorry for the delay in replying, it's been a little busy this week.

first, make sure that you are seeing ledgerInfo.countryCode. it is the 3166-2 alpha code for the country that the browser is operating in. if it's not there, please let me know!

second, if the code is "US", there will not be any ledgerInfo.exchangInfo.* properties

third, if the code isn't "US", and there aren't any ledgerInfo.exchangInfo.* properties, please let me know what the country code is

thanks!

@bbondy
Copy link
Member

bbondy commented Sep 12, 2016

Is this needed for 0.12.1? This needs a rebase btw and can't be cleanly merged.

@mrose17
Copy link
Member

mrose17 commented Sep 12, 2016

i would prefer to see it in 0.12.1 ... however, it isn't essential.

@jkup - can you construct a clean branch from master and then generate a new PR?

thanks,

/mtr

@jkup
Copy link
Contributor Author

jkup commented Sep 12, 2016

@mrose17 I updated the PR so it doesn't have conflicts. I think there is a misunderstanding though in what state data I have access to. I don't see this.props.ledgerInfo only this.props.ledgerData and I don't see countrycode on that.

Do I have access to any of this info in preferences.js?

@mrose17
Copy link
Member

mrose17 commented Sep 12, 2016

@jkup - please check with @diracdeltas ... in ledger.js it is called ledgerInfo, perhaps it goes by a different name in the UI.

to verify what ledger.js is sending, run the browser like this:

    LEDGER_CLIENT_DEBUG=true npm start

and look for a series of lines that starts with

    updateLedgerInfo: ...

good luck!

@bbondy bbondy added this to the 0.12.1dev milestone Sep 12, 2016
@diracdeltas
Copy link
Member

@mrose17 i don't see exchangeInfo either when i run with LEDGER_CLIENT_DEBUG=true

updateLedgerInfo: {
  "creating": false,
  "created": true,
  "reconcileStamp": 1475887090152,
  "transactions": [],
  "address": "35x1xVzJgFNmyWoWZva1aaCvCgjnchfNvs",
  "balance": "0.0079",
  "unconfirmed": "0.0000",
  "satoshis": 791348,
  "btc": "0.01643142",
  "amount": 10,
  "currency": "USD",
  "paymentURL": "bitcoin:35x1xVzJgFNmyWoWZva1aaCvCgjnchfNvs?amount=0.01643142&label=Bra$e%20Software",
  "buyURL": "https://buy.coinbase.com?crypto_currency=BTC&code=729cbe57-599a-5a99-b131-$28d9da0987d&amount=10&address=35x1xVzJgFNmyWoWZva1aaCvCgjnchfNvs",
  "bravery": {
    "setting": "adFree",
    "fee": {
      "currency": "USD",
      "amount": 10
    }
  },
  "hasBitcoinHandler": false,
  "countryCode": "US",
  "error": null,
  "paymentIMG": ...

</div>
<div className='settingsPanelDivider'>
<a target='_blank' className='browserButton primaryButton' href={exchangeInfo.get('exchangeURL')}>
{exchangeInfo.get('exchangeURL')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be labeled exchangeInfo.get('exchangeName') if it's defined

get exchangePanel () {
const exchangeInfo = this.props.ledgerData.get('exchangeInfo')
const url = exchangeInfo.get('exchangeURL')
const name = exchangeInfo.get('exchangeName')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this causes the Add funds panel to throw an error and not appear at all if exchangeInfo is undefined. better to use this.props.ledgerData.getIn(['exchangeInfo', propertyname])

@jkup
Copy link
Contributor Author

jkup commented Sep 12, 2016

@diracdeltas TIL about .getIn 👍

</div>
<div className='settingsPanelDivider'>
<a target='_blank' className='browserButton primaryButton' href={url}>
{name}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github somehow lost my comment but i think this should say Go to ${name} instead of just the name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I totally forgot to add the word 'visit' before the button like @bradleyrichter has in his designs! Fixed.

@luixxiul
Copy link
Contributor

From Japan, visit Cubits 👍

@luixxiul
Copy link
Contributor

For QA: test needed by who lives in USA

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants