send flow fixes

This commit is contained in:
Gabriel Bazán 2016-12-02 10:09:24 -03:00
parent e44a305269
commit ff4b93acbe
5 changed files with 43 additions and 24 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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 = {};

View File

@ -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',

View File

@ -42,14 +42,25 @@
<div class="title">
<span translate>Amount</span>
<span ng-show="isGiftCard">(Purchase Amount is limited to USD 500 per day)</span>
<div ng-show="isGlidera" class="limits">
<span>Daily buy limit</span>:
{{limits.dailyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}})
<br>
<span>Monthly buy limit</span>:
{{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}})
<div ng-show="isGlidera">
<div class="limits" ng-show="limits && glideraBuy">
<span>Daily buy limit</span>:
{{limits.dailyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}})
<br>
<span>Monthly buy limit</span>:
{{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}})
</div>
<div class="limits" ng-show="limits && glideraSell">
<span>Daily sell limit</span>:
{{limits.dailySell|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailySellRemaining|currency:'':2}} {{limits.currency}})
<br>
<span>Monthly sell limit</span>:
{{limits.monthlySell|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlySellRemaining|currency:'':2}} {{limits.currency}})
</div>
</div>
</div>
</div>