From ff4b93acbe83e471d4d1f322e199e07b30b7237f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 2 Dec 2016 10:09:24 -0300 Subject: [PATCH] send flow fixes --- src/js/controllers/amount.js | 8 +++++++- src/js/controllers/buyGlidera.js | 28 ++++++++++++++-------------- src/js/controllers/confirm.js | 2 ++ src/js/routes.js | 2 +- www/views/amount.html | 27 +++++++++++++++++++-------- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 3f9cbc6c2..74f9d7c88 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -15,8 +15,13 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.isGiftCard = data.stateParams.isGiftCard; + + // Glidera parameters $scope.isGlidera = data.stateParams.isGlidera; $scope.glideraAccessToken = data.stateParams.glideraAccessToken; + $scope.glideraBuy = data.stateParams.glideraBuy; + $scope.glideraSell = data.stateParams.glideraSell; + $scope.cardId = data.stateParams.cardId; $scope.showMenu = $ionicHistory.backView().stateName == 'tabs.send'; $scope.isWallet = data.stateParams.isWallet; @@ -337,7 +342,8 @@ angular.module('copayApp.controllers').controller('amountController', function($ } else if ($scope.isGlidera) { $state.transitionTo('tabs.buyandsell.glidera.confirm', { toAmount: (amount * unitToSatoshi).toFixed(0), - glideraBuy: true, + glideraBuy: $scope.glideraBuy, + glideraSell: $scope.glideraSell, glideraAccessToken: $scope.glideraAccessToken }); } else { diff --git a/src/js/controllers/buyGlidera.js b/src/js/controllers/buyGlidera.js index 0212622a4..2bdcd049d 100644 --- a/src/js/controllers/buyGlidera.js +++ b/src/js/controllers/buyGlidera.js @@ -69,20 +69,20 @@ angular.module('copayApp.controllers').controller('buyGlideraController', // }); // }; - this.get2faCode = function(token) { - var self = this; - ongoingProcess.set('Sending 2FA code...', true); - $timeout(function() { - glideraService.get2faCode(token, function(err, sent) { - ongoingProcess.set('Sending 2FA code...', false); - if (err) { - popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send confirmation code to your phone')); - return; - } - self.show2faCodeInput = sent; - }); - }, 100); - }; + // this.get2faCode = function(token) { + // var self = this; + // ongoingProcess.set('Sending 2FA code...', true); + // $timeout(function() { + // glideraService.get2faCode(token, function(err, sent) { + // ongoingProcess.set('Sending 2FA code...', false); + // if (err) { + // popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send confirmation code to your phone')); + // return; + // } + // self.show2faCodeInput = sent; + // }); + // }, 100); + // }; this.sendRequest = function(token, permissions, twoFaCode) { var self = this; diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 541bea870..3e762942d 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -22,6 +22,8 @@ angular.module('copayApp.controllers').controller('confirmController', function( giftCardUUID = data.stateParams.giftCardUUID; // Glidera parameters + $scope.isGlidera = data.stateParams.isGlidera; + $scope.glideraAccessToken = data.stateParams.glideraAccessToken; toAmount = data.stateParams.toAmount; cachedSendMax = {}; diff --git a/src/js/routes.js b/src/js/routes.js index eb40cdec9..4e49e6fa8 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -912,7 +912,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) .state('tabs.buyandsell.glidera.amount', { - url: '/amount/:glideraBuy/:glideraAccessToken', + url: '/amount/:glideraBuy/:glideraSell/:glideraAccessToken', views: { 'tab-home@tabs': { controller: 'amountController', diff --git a/www/views/amount.html b/www/views/amount.html index ef560983a..aab0fb4f8 100644 --- a/www/views/amount.html +++ b/www/views/amount.html @@ -42,14 +42,25 @@
Amount (Purchase Amount is limited to USD 500 per day) -
- Daily buy limit: - {{limits.dailyBuy|currency:'':2}} {{limits.currency}} - (remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}}) -
- Monthly buy limit: - {{limits.monthlyBuy|currency:'':2}} {{limits.currency}} - (remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}}) +
+
+ Daily buy limit: + {{limits.dailyBuy|currency:'':2}} {{limits.currency}} + (remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}}) +
+ Monthly buy limit: + {{limits.monthlyBuy|currency:'':2}} {{limits.currency}} + (remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}}) +
+
+ Daily sell limit: + {{limits.dailySell|currency:'':2}} {{limits.currency}} + (remaining {{limits.dailySellRemaining|currency:'':2}} {{limits.currency}}) +
+ Monthly sell limit: + {{limits.monthlySell|currency:'':2}} {{limits.currency}} + (remaining {{limits.monthlySellRemaining|currency:'':2}} {{limits.currency}}) +