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

Commit

Permalink
Merge branch 'v1.32-release' into sfox-bug-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon authored Feb 10, 2018
2 parents e63f791 + 9f69bee commit d4ac29c
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 12 deletions.
6 changes: 6 additions & 0 deletions app/partials/sfox/checkout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ bc-tabs(tab="tabs.selectedTab" tab-options="tabs.options" on-select="tabs.select
trade-account="checkout.state.account"
handle-quote="sellQuoteHandler(amount, baseCurr, quoteCurr)"
on-success="selling().verificationRequired ? checkout.openSfoxSignup() : buildPayment(quote)")
.flex-column.width-50.pl-30.prn.pv-10-mobile.no-margin-mobile.hidden-xs(ng-if="checkout.onStep('create') && !checkout.hasDismissedSellIntro()")
.flex-between
span.f-24.blue.f-14-mobile(translate="SFOX.sell.INTRODUCING_HEADER")
.flex-center.pl-10
i.pointer.ti-close.f-12.mid-grey(ng-click="dismissSellIntro()")
p.f-12.mt-10(translate="SFOX.sell.INTRODUCING_BODY")
.flex-row.pbvl(ng-if="checkout.onStep('confirm')")
exchange-confirm.width-50.border-desktop(
type="checkout.type"
Expand Down
4 changes: 2 additions & 2 deletions assets/js/constants/whats-new.constant.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
angular.module('walletApp')
.constant('whatsNew', [
{ title: 'BUY_BITCOIN', desc: 'BUY_BITCOIN_EXPLAIN', date: new Date('Jan 08 2018'), ref: 'wallet.common.buy-sell' },
{ title: 'SFOX.BUY_BITCOIN', desc: 'SFOX.BUY_BITCOIN_EXPLAIN', date: new Date('Feb 08 2018'), ref: 'wallet.common.buy-sell' },
{ title: 'BITCOIN_CASH.ADDRESSES', desc: 'BITCOIN_CASH.ADDR_FORMAT', date: new Date('Jan 18 2018'), ref: 'wallet.common.faq' },
{ title: 'SELL_BITCOIN', desc: 'SELL_BITCOIN_EXPLAIN', date: new Date('Dec 15 2017'), ref: 'wallet.common.buy-sell' },
{ title: 'SFOX.SELL_BITCOIN', desc: 'SELL_BITCOIN_EXPLAIN', date: new Date('Dec 15 2017'), ref: 'wallet.common.buy-sell' },
{ title: 'BITCOIN_CASH.TITLE', 'desc': 'BITCOIN_CASH.WHATS_NEW', date: new Date('December 12 2017'), ref: 'wallet.common.bch.transactions' },
// { title: 'RECURRING_BUY', 'desc': 'RECURRING_BUY_WHATS_NEW', date: new Date('November 16 2017'), ref: 'wallet.common.buy-sell' },
{ title: 'BTC_ETH_EXCHANGE', desc: 'BTC_ETH_EXCHANGE_WHATS_NEW', date: new Date('August 11 2017'), ref: 'wallet.common.shift' },
Expand Down
2 changes: 1 addition & 1 deletion assets/js/controllers/accountForm.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function AccountFormCtrl (AngularHelper, $scope, $q, $uibModalInstance, $timeout
}

let done = () => {
BitcoinCash.bch.fetch && BitcoinCash.bch.fetch();
BitcoinCash.bch.sync && BitcoinCash.bch.sync().then(() => BitcoinCash.bch.fetch());
$scope.status.busy = false;
$scope.$root.scheduleRefresh();
AngularHelper.$safeApply();
Expand Down
9 changes: 6 additions & 3 deletions assets/js/controllers/navigation.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ angular
.module('walletApp')
.controller('NavigationCtrl', NavigationCtrl);

function NavigationCtrl ($scope, $window, $rootScope, BrowserHelper, $state, $interval, $timeout, localStorageService, $q, $uibModal, Wallet, Alerts, currency, whatsNew, MyWallet, tradeStatus, Env, Ethereum, ShapeShift) {
function NavigationCtrl ($scope, $window, $rootScope, BrowserHelper, $state, $interval, $timeout, MyWalletHelpers, localStorageService, $q, $uibModal, Wallet, Alerts, currency, whatsNew, MyWallet, tradeStatus, Env, Ethereum, ShapeShift) {
$scope.status = Wallet.status;
$scope.settings = Wallet.settings;
$scope.popover = { isOpen: false };
Expand Down Expand Up @@ -95,10 +95,13 @@ function NavigationCtrl ($scope, $window, $rootScope, BrowserHelper, $state, $in

$q.all([Env, tradeStatus.canTrade()]).then(([env, canTrade]) => {
let now = Date.now();
let email = MyWallet.wallet.accountInfo.email;
let internalEmail = email.indexOf('@blockchain.com') > -1 || email.indexOf('@sfox.com') > -1;
let invitedEmail = MyWalletHelpers.isStringHashInFraction(email, env.partners.sfox.showBuyFraction);

$scope.filterFeatures = (feat) => (
(feat.title !== 'BUY_BITCOIN' || canTrade && MyWallet.wallet.accountInfo.countryCodeGuess === 'US') &&
(feat.title !== 'SELL_BITCOIN' || canTrade && MyWallet.wallet.accountInfo.countryCodeGuess === 'US') &&
(feat.title !== 'SFOX.BUY_BITCOIN' || canTrade && MyWallet.wallet.accountInfo.countryCodeGuess === 'US' && (internalEmail || invitedEmail)) &&
(feat.title !== 'SFOX.SELL_BITCOIN' || canTrade && MyWallet.wallet.accountInfo.countryCodeGuess === 'US') &&
(feat.title !== 'RECURRING_BUY' || canTrade) &&
(feat.title !== 'BUY_BITCOIN' || canTrade) &&
(feat.title !== 'SELL_BITCOIN' || (canTrade && MyWallet.wallet.external.shouldDisplaySellTab(Wallet.user.email, env, 'coinify'))) &&
Expand Down
4 changes: 3 additions & 1 deletion assets/js/controllers/sfox/sfoxCheckout.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function SfoxCheckoutController ($scope, $timeout, $stateParams, $q, Wallet, MyW
$scope.inspectTrade = (quote, trade) => modals.openTradeDetails(trade);
$scope.onClose = () => {
const seenBuySurvey = localStorageService.get('sfox-buy-survey');
if (seenBuySurvey.index < 1 && this.type === 'buy') this.handleCancel(null, 'buy', 1);
if (seenBuySurvey && seenBuySurvey.index < 1 && this.type === 'buy') this.handleCancel(null, 'buy', 1);
else $scope.checkout.goTo('create'); $scope.tabs.select('ORDER_HISTORY');
};

Expand All @@ -83,6 +83,8 @@ function SfoxCheckoutController ($scope, $timeout, $stateParams, $q, Wallet, MyW
localStorageService.set('hasSignedUpForSfoxBuyAccess', true);
};
$scope.hasSignedUpForSfoxBuyAccess = () => localStorageService.get('hasSignedUpForSfoxBuyAccess');
this.dismissSellIntro = sfox.dismissSellIntro;
this.hasDismissedSellIntro = sfox.hasDismissedSellIntro;
this.dismissBuyIntro = sfox.dismissBuyIntro;
this.hasDismissedBuyIntro = sfox.hasDismissedBuyIntro;

Expand Down
1 change: 1 addition & 0 deletions assets/js/controllers/sfox/sfoxSellCheckout.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function SfoxSellCheckoutController ($scope, $timeout, $stateParams, $q, Wallet,
.then(recordNote)
.then($scope.checkout.fetchTransactions)
.then(enableSiftScience)
.then(() => exchange.fetchProfile())
.catch((e) => Alerts.displayError(e));

const setRate = (res) => { $scope.rate = Math.abs(res.quoteAmount); };
Expand Down
1 change: 0 additions & 1 deletion assets/js/controllers/wallet.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ function WalletCtrl ($scope, $rootScope, Wallet, $uibModal, $timeout, Alerts, $i
BitcoinCash.setHasSeen();
} else {
tradeStatus.canTrade().then((canTrade) => {
modals.openAnnouncement('SFOX.buy', 'wallet.common.buy-sell');
Env.then((env) => {
if (canTrade) {
if (!sfox.hasSeenBuy && sfox.showBuyAnnouncement(canTrade, tradeStatus.isSFOXCountryState, env.partners.sfox.showBuyFraction) && !$rootScope.inMobileBuy) {
Expand Down
10 changes: 10 additions & 0 deletions assets/js/services/sfox.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ function sfox ($q, MyWallet, MyWalletHelpers, Alerts, modals, Env, Exchange, cur
setSellMin,
showAnnouncement,
showBuyAnnouncement,
dismissSellIntro,
hasDismissedSellIntro,
dismissBuyIntro,
hasDismissedBuyIntro,
signupForBuyAccess,
Expand Down Expand Up @@ -177,6 +179,14 @@ function sfox ($q, MyWallet, MyWalletHelpers, Alerts, modals, Env, Exchange, cur
.then(mediums => mediums.ach.sell(account));
}

function dismissSellIntro () {
localStorageService.set('hasSeenSfoxSellIntro', true);
}

function hasDismissedSellIntro () {
return localStorageService.get('hasSeenSfoxSellIntro');
}

function dismissBuyIntro () {
localStorageService.set('hasSeenSfoxBuyIntro', true);
}
Expand Down
5 changes: 4 additions & 1 deletion locales/en-human.json
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@
"error listing accounts: unauthorized product": "Sorry, there was an error validating your information with our partner. If this issue persists please try contacting support.",
"PURCHASE_PENDING": "your pending purchase for",
"PURCHASE_PENDING_CANT_CANCEL": "Please wait for your pending trade to complete.",
"BUY_BITCOIN_EXPLAIN": "You can now buy bitcoin with your Blockchain wallet!",
"BUY_BITCOIN_EXPLAIN": "You can now buy bitcoin with your Blockchain wallet! 💸💸💸",
"SELL_BITCOIN_EXPLAIN": "You can now sell bitcoin directly from your Blockchain wallet!",
"BUY_BTC_UNAVAIL_COUNTRY": "Buying bitcoin is not yet available in your country. We'll be rolling out more countries soon.",
"SELL_BTC_UNAVAIL_STATE": "Unfortunately trading bitcoin is not available in your state at this time. To be notified when we expand to your area, sign up below.",
Expand Down Expand Up @@ -1794,6 +1794,9 @@
"NOW_SUPPORTING": "The Wait is Over!",
"ANNOUNCEMENT": "We’re excited to announce that you can now trade bitcoin directly from your Blockchain wallet! You can get started by creating an account in your 'Buy & Sell Bitcoin' tab.",
"GET_STARTED": "Start Trading",
"BUY_BITCOIN": "Buy Bitcoin!",
"SELL_BITCOIN": "Sell Bitcoin",
"BUY_BITCOIN_EXPLAIN": "You can now buy bitcoin with your Blockchain wallet! 💸💸💸",
"VERIFY": {
"PO_WARNING": "⛔️ P.O. boxes are not sufficient for verifying your address information."
},
Expand Down
4 changes: 2 additions & 2 deletions rootApp/Resources/wallet-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"buyTransactionFeeInSatoshi": false,
"apiKey": "6fbfb80536564af8bbedb7e3be4ec439",
"plaid": "0b041cd9e9fbf1e7d93a0d5a39f5b9",
"plaidEnv": "production",
"siftScience": "a19cc360a1",
"plaidEnv": "tartan",
"siftScience": "3884e5fae5",
"surveyLinks": ["https://blockchain.co1.qualtrics.com/jfe/form/SV_9BuZyJxdOT0Psb3",
"https://blockchain.co1.qualtrics.com/jfe/form/SV_8cE4saqzhlLXngN",
"https://blockchain.co1.qualtrics.com/jfe/form/SV_50v2ta2RiXMGx7v",
Expand Down
8 changes: 7 additions & 1 deletion tests/controllers/navigation_ctrl_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ describe('NavigationCtrl', () => {
let MyWallet = $injector.get('MyWallet');
let Alerts = $injector.get('Alerts');
let tradeStatus = $injector.get('tradeStatus');
let MyWalletHelpers = $injector.get('MyWalletHelpers');
mockFailure = false;

tradeStatus.canTrade = () => $q.resolve(true);

Alerts.confirm = msg => $q.resolve();

MyWalletHelpers.isStringHashInFraction = (str) => true

Wallet.status = {
isLoggedIn: true,
Expand All @@ -45,6 +48,9 @@ describe('NavigationCtrl', () => {
};

MyWallet.wallet = {
accountInfo: {
email: '[email protected]'
},
metadata (n) {
return {
fetch () { return mocked({lastViewed: 3}); },
Expand Down Expand Up @@ -72,7 +78,7 @@ describe('NavigationCtrl', () => {
$controller('NavigationCtrl', {
$scope: scope,
whatsNew,
Env: $q.resolve({})
Env: $q.resolve({partners: {sfox: {}}})
});
});
});
Expand Down

0 comments on commit d4ac29c

Please sign in to comment.