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

Commit

Permalink
Merge pull request #637 from blockchain/buy-confirm-kyc
Browse files Browse the repository at this point in the history
Buy confirm step updates and fixes
  • Loading branch information
plondon authored Sep 13, 2016
2 parents c81f574 + f9b74eb commit d05c1c7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
15 changes: 11 additions & 4 deletions app/partials/buy-modal.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -74,14 +74,21 @@
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()"
data-style="expand-left"
ui-ladda="status.waiting"
ng-disabled="isDisabled()"
ng-show="onStep('accept-terms')")
button.button-primary(
ladda-translate="CONTINUE"
ng-click="confirmOrContinue()"
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()"
Expand Down
16 changes: 11 additions & 5 deletions app/partials/buy-summary.jade
Original file line number Diff line number Diff line change
@@ -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}")
Expand Down Expand Up @@ -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 }}
12 changes: 10 additions & 2 deletions assets/js/controllers/buy.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
);

Expand Down Expand Up @@ -227,6 +228,13 @@ function BuyCtrl ($scope, $filter, $q, MyWallet, Wallet, MyWalletHelpers, Alerts
}
};

$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) => {
$scope.rejectedEmail = void 0;
Alerts.clear($scope.alerts);
Expand Down
1 change: 1 addition & 0 deletions assets/js/controllers/buySummary.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 2 additions & 0 deletions locales/en-human.json
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,8 @@
"BLACKLISTED_COUNTRY": "Buying bitcoin is not available in your country yet.<br>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}}.",
Expand Down

0 comments on commit d05c1c7

Please sign in to comment.