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

Commit

Permalink
display different payment options based on user location
Browse files Browse the repository at this point in the history
  • Loading branch information
jkup committed Sep 12, 2016
1 parent fa53c2e commit 5c7e49a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sync=Sync
privacy=Privacy
shields=Shields
security=Security
visit=visit
visits=Visits
publisher=Site
publishers=Publishers
Expand Down Expand Up @@ -63,6 +64,7 @@ on=on
notifications=notifications
moneyAdd=Use your debit/credit card
moneyAddSubTitle=No Bitcoin needed!
outsideUSAPayment=Need to buy Bitcoin outside of the USA?
coinbaseNotAvailable=Sorry! Adding funds with a credit/debit card is only available for contributions of $5/month at the moment.
add=Fund with debit/credit
transferTime=Transfer may take up to 40 minutes
Expand Down
30 changes: 29 additions & 1 deletion js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ class BitcoinDashboard extends ImmutableComponent {
get canUseCoinbase () {
return this.currency === 'USD' && this.amount < 6
}
get userInAmerica () {
const countryCode = this.props.ledgerData.get('countryCode')
return !(countryCode && countryCode !== 'US')
}
get coinbasePanel () {
if (this.canUseCoinbase) {
return <div className='panel'>
Expand All @@ -311,6 +315,27 @@ class BitcoinDashboard extends ImmutableComponent {
</div>
}
}
get exchangePanel () {
const exchangeInfo = this.props.ledgerData.get('exchangeInfo')
const url = exchangeInfo.get('exchangeURL')
const name = exchangeInfo.get('exchangeName')
// Call coinbasePanel if we don't have the URL or Name
if (!url || !name) {
return this.coinbasePanel
} else {
return <div className='panel'>
<div className='settingsPanelDivider'>
<span className='fa fa-credit-card' />
<div className='settingsListTitle' data-l10n-id='outsideUSAPayment' />
</div>
<div className='settingsPanelDivider'>
<a target='_blank' className='browserButton primaryButton' href={exchangeInfo.get('exchangeURL')}>
{exchangeInfo.get('exchangeName')}
</a>
</div>
</div>
}
}
get smartphonePanel () {
return <div className='panel'>
<div className='settingsPanelDivider'>
Expand Down Expand Up @@ -362,7 +387,10 @@ class BitcoinDashboard extends ImmutableComponent {
: null
}
<div className='board'>
{this.coinbasePanel}
{ (this.userInAmerica)
? this.coinbasePanel
: this.exchangePanel
}
<div className='panel'>
<div className='settingsPanelDivider'>
<span className='bitcoinIcon fa-stack fa-lg'>
Expand Down

0 comments on commit 5c7e49a

Please sign in to comment.