From 728595f422c8ccde6f1bf2c1572aaf90e7651215 Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Tue, 13 Sep 2016 14:01:14 -0400 Subject: [PATCH 1/4] fix(Buy): skip confirm screen and go directly to kyc if needed --- app/partials/buy-modal.jade | 9 ++++++++- assets/js/controllers/buy.controller.js | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/partials/buy-modal.jade b/app/partials/buy-modal.jade index 95b817d4fc..614c4a9479 100644 --- a/app/partials/buy-modal.jade +++ b/app/partials/buy-modal.jade @@ -74,7 +74,7 @@ data-style="expand-left" ui-ladda="status.waiting" ng-disabled="isDisabled() || onStep('email')" - ng-hide="afterStep('select-payment-method') || onStep('accept-terms')") + ng-hide="afterStep('email')") button.button-primary( ladda-translate="CONTINUE" ng-click="signup()" @@ -82,6 +82,13 @@ ui-ladda="status.waiting" ng-disabled="isDisabled()" ng-show="onStep('accept-terms')") + button.button-primary( + ladda-translate="CONTINUE" + ng-click="confirmOrKYC()" + data-style="expand-left" + ui-ladda="status.waiting" + ng-disabled="isDisabled()" + ng-show="onStep('select-payment-method')") button.button-primary( ladda-translate="CONFIRM" ng-click="buy()" diff --git a/assets/js/controllers/buy.controller.js b/assets/js/controllers/buy.controller.js index a133d15a8b..5fa5a39f7d 100644 --- a/assets/js/controllers/buy.controller.js +++ b/assets/js/controllers/buy.controller.js @@ -227,6 +227,10 @@ function BuyCtrl ($scope, $filter, $q, MyWallet, Wallet, MyWalletHelpers, Alerts } }; + $scope.confirmOrKYC = () => { + $scope.needsKyc() ? $scope.buy() : $scope.goTo('summary'); + }; + $scope.changeEmail = (email, successCallback, errorCallback) => { $scope.rejectedEmail = void 0; Alerts.clear($scope.alerts); From 6520c1435b91601b22221510a04747d52b8aadac Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Tue, 13 Sep 2016 14:09:05 -0400 Subject: [PATCH 2/4] fix(Buy): do not show btc amount during kyc flow --- app/partials/buy-modal.jade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/partials/buy-modal.jade b/app/partials/buy-modal.jade index 614c4a9479..a36ba96339 100644 --- a/app/partials/buy-modal.jade +++ b/app/partials/buy-modal.jade @@ -10,9 +10,9 @@ tooltip-append-to-body="true" tooltip-placement="right" tooltip-enable="!hideQuote()") - span.type-h5.em-400(ng-show="transaction.btc !== 0 && !trade") {{ transaction.btc }} - span.type-h5.em-400(ng-show="trade" ng-class="{italic: expiredQuote && !trade.outAmount, 'tilda-before': expiredQuote && !trade.outAmount}") {{ expiredQuote && !trade.outAmount ? btcExpected / 100000000 : (trade.outAmount || trade.outAmountExpected) / 100000000 }} BTC - quote-countdown(quote="quote" trade-created-at="trade.createdAt" expired-quote="expiredQuote" ng-class="{'fade': hideQuote() }") + span.type-h5.em-400(ng-hide="!transaction.btc || trade || needsKyc()") {{ isKYC}} {{ transaction.btc }} + span.type-h5.em-400(ng-show="trade && !isKYC && !needsKyc()" ng-class="{italic: expiredQuote && !trade.outAmount, 'tilda-before': expiredQuote && !trade.outAmount}") {{ expiredQuote && !trade.outAmount ? btcExpected / 100000000 : (trade.outAmount || trade.outAmountExpected) / 100000000 }} BTC + quote-countdown(ng-hide="isKYC" quote="quote" trade-created-at="trade.createdAt" expired-quote="expiredQuote" ng-class="{'fade': hideQuote() }") p.security-red.pointer(ng-show="buySellDebug && quote.id") i.ti-search.mrm.right-align(ng-click="quote.expire()") QA: Now buy-steps(transaction="transaction" From abcfe521ffc0b510c71c7aaf6d17952f9ab3219b Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Tue, 13 Sep 2016 16:43:16 -0400 Subject: [PATCH 3/4] fix(Buy): skip confirm screen if valid bank transfer or kyc --- app/partials/buy-modal.jade | 2 +- assets/js/controllers/buy.controller.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/partials/buy-modal.jade b/app/partials/buy-modal.jade index a36ba96339..414381ef16 100644 --- a/app/partials/buy-modal.jade +++ b/app/partials/buy-modal.jade @@ -84,7 +84,7 @@ ng-show="onStep('accept-terms')") button.button-primary( ladda-translate="CONTINUE" - ng-click="confirmOrKYC()" + ng-click="confirmOrContinue()" data-style="expand-left" ui-ladda="status.waiting" ng-disabled="isDisabled()" diff --git a/assets/js/controllers/buy.controller.js b/assets/js/controllers/buy.controller.js index 5fa5a39f7d..158f3f8e14 100644 --- a/assets/js/controllers/buy.controller.js +++ b/assets/js/controllers/buy.controller.js @@ -20,12 +20,13 @@ function BuyCtrl ($scope, $filter, $q, MyWallet, Wallet, MyWalletHelpers, Alerts $scope.method = $scope.trade ? $scope.trade.medium : 'card'; $scope.methods = {}; $scope.getMethod = () => $scope.methods[$scope.method] || {}; + $scope.isMedium = (medium) => $scope.getMethod().inMedium === medium; let exchange = buySell.getExchange(); $scope.exchange = exchange && exchange.profile ? exchange : {profile: {}}; $scope.isKYC = $scope.trade && $scope.trade.constructor.name === 'CoinifyKYC'; - $scope.needsKyc = () => $scope.getMethod().inMedium === 'bank' && +$scope.exchange.profile.level.name < 2; + $scope.needsKyc = () => $scope.isMedium('bank') && +$scope.exchange.profile.level.name < 2; $scope.needsIST = () => buySell.resolveState($scope.trade.state) === 'pending' || $scope.isKYC; let fifteenMinutesAgo = new Date(new Date().getTime() - 15 * 60 * 1000); @@ -68,7 +69,7 @@ function BuyCtrl ($scope, $filter, $q, MyWallet, Wallet, MyWalletHelpers, Alerts $scope.hideQuote = () => ( $scope.afterStep('trade-complete') || - $scope.getMethod().inMedium === 'bank' || + $scope.isMedium('bank') || $scope.expiredQuote || ($scope.quote && !$scope.quote.id && !$scope.trade) ); @@ -227,8 +228,11 @@ function BuyCtrl ($scope, $filter, $q, MyWallet, Wallet, MyWalletHelpers, Alerts } }; - $scope.confirmOrKYC = () => { - $scope.needsKyc() ? $scope.buy() : $scope.goTo('summary'); + $scope.confirmOrContinue = () => { + let bankBuyMax = $scope.exchange.profile.currentLimits.bank.inRemaining; + let belowBuyLimit = transaction.fiat <= bankBuyMax; + let skipConfirm = $scope.needsKyc() || (belowBuyLimit && $scope.isMedium('bank')); + skipConfirm ? $scope.buy() : $scope.goTo('summary'); }; $scope.changeEmail = (email, successCallback, errorCallback) => { From f9b74eb387f66af5c2f98a8e5aa9d31b0130b87c Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Tue, 13 Sep 2016 17:01:15 -0400 Subject: [PATCH 4/4] feat(Buy Summary): custom error page for bank transfers that exceed daily amount --- app/partials/buy-summary.jade | 16 +++++++++++----- assets/js/controllers/buySummary.controller.js | 1 + locales/en-human.json | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/partials/buy-summary.jade b/app/partials/buy-summary.jade index e46f4c5693..b379d0119b 100644 --- a/app/partials/buy-summary.jade +++ b/app/partials/buy-summary.jade @@ -1,12 +1,18 @@ .flex-column.mbvl - span.type-h5.em-500.flex-start.pts(translate="CONFIRM_YOUR_ORDER") + span.type-h5.em-500.flex-start.pts( + ng-hide="isBankTransfer()" + translate="CONFIRM_YOUR_ORDER") + span.type-h5.em-500.flex-start.pts.state-danger-text( + ng-show="isBankTransfer()" + translate="ERROR_DAILY_LIMIT") p.mvm - span(translate="ORDER_CONFIRMATION_COPY") + span(translate="ORDER_CONFIRMATION_COPY" ng-hide="isBankTransfer()") + span(translate="ERROR_DAILY_LIMIT_COPY" ng-show="isBankTransfer()" translate-values="{symbol: currencySymbol.symbol, max: limits.available}") .flex-center.flex-between.flex-row-reverse.mtm .mam span.type-sm.blue.underline.pointer(ng-click="toggleEditAmount()" ng-hide="editAmount") Edit Order span.type-sm.blue.underline.pointer(ng-click="cancel()" ng-show="editAmount") Cancel - .flex-center(ng-show="(tempFiatForm.fiat.$error.max || tempFiatForm.fiat.$error.min) && !needsKyc()") + .flex-center(ng-show="(tempFiatForm.fiat.$error.max || tempFiatForm.fiat.$error.min) && !isBankTransfer()") i.ti-alert.state-danger-text.mrs.type-h4 span.state-danger-text.mrs(ng-show="tempFiatForm.fiat.$error.max" translate="MAX_LIMIT_EXCEEDED" translate-values="{code: tempCurrency.code, max: limits.available}") span.state-danger-text.mrs(ng-show="tempFiatForm.fiat.$error.min && !tempFiatForm.fiat.$error.max" translate="BELOW_MIN_LIMIT" translate-values="{code: tempCurrency.code, min: limits.min}") @@ -50,9 +56,9 @@ ng-click="changeTempCurrency(currency);" ng-class="{active: isCurrencySelected(currency)}") a(ng-click="$event.preventDefault()") {{ currency.code }} - .flex-row.flex-between.pam.border-bottom-light + .flex-row.flex-between.pam.border-bottom-light(ng-hide="isBankTransfer()") span(translate="PAYMENT_FEE") span {{ transaction.methodFee | format }} {{ transaction.currency.code }} - .flex-row.flex-between.pam + .flex-row.flex-between.pam(ng-hide="isBankTransfer()") span.em-500 Total Cost: span {{ currencySymbol.symbol }}{{ transaction.total }} {{ transaction.currency.code }} diff --git a/assets/js/controllers/buySummary.controller.js b/assets/js/controllers/buySummary.controller.js index 4f35dfe370..82b63dddfb 100644 --- a/assets/js/controllers/buySummary.controller.js +++ b/assets/js/controllers/buySummary.controller.js @@ -6,6 +6,7 @@ function BuySummaryCtrl ($scope, $q, $timeout, Wallet, buySell, currency) { $scope.limits = {}; $scope.exchange = buySell.getExchange(); $scope.toggleEditAmount = () => $scope.$parent.editAmount = !$scope.$parent.editAmount; + $scope.isBankTransfer = () => $scope.isMedium('bank'); $scope.getMaxMin = (curr) => { const calculateMin = (rate) => { diff --git a/locales/en-human.json b/locales/en-human.json index 53b8094ac7..4462bb6ba5 100644 --- a/locales/en-human.json +++ b/locales/en-human.json @@ -979,6 +979,8 @@ "BLACKLISTED_COUNTRY": "Buying bitcoin is not available in your country yet.
We'll be rolling out more countries soon.", "CONFIRM_YOUR_ORDER": "Confirm your order:", "ORDER_CONFIRMATION_COPY": "Please confirm your order details before we direct you to our secure payment provider.", + "ERROR_DAILY_LIMIT": "Error: Exceeds Daily Limit", + "ERROR_DAILY_LIMIT_COPY": "The amount selected exceeds your daily buy limit. For bank transfers, you can exchange up to {{symbol}}{{max}} per day. Please update your order to proceed.", "ORDER_DETAILS": "Order details:", "ACTION_REQUIRED": "Action Required", "MAX_LIMIT_EXCEEDED": "Exceeds your daily buy amount of {{::max}} {{::code}}.",