ensure rate limit errors are handled properly

This commit is contained in:
Marty Alcala 2016-10-26 15:02:14 -04:00
commit ffeb8ad612
5 changed files with 27 additions and 8 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('amountController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService) {
angular.module('copayApp.controllers').controller('amountController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError) {
var unitToSatoshi;
var satToUnit;
@ -203,6 +203,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
$timeout(function() {
bitpayCardService.topUp($scope.cardId, dataSrc, function(err, invoiceId) {
console.log('hereerere');
if (err) {
ongoingProcess.set('Preparing transaction...', false);
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
@ -220,7 +221,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
$state.transitionTo('tabs.bitpayCard.confirm', {
cardId: $scope.cardId,
toName: $scope.toName,
paypro: payProUrl
payProUrl: payProUrl
});
});
});

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, gettext, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig) {
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, gettext, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService) {
var cachedTxp = {};
var isChromeApp = platformInfo.isChromeApp;
var countDown = null;
@ -15,6 +15,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.toEmail = data.stateParams.toEmail;
$scope.description = data.stateParams.description;
$scope.paypro = data.stateParams.paypro;
$scope.payProUrl = data.stateParams.payProUrl;
$scope._paypro = $scope.paypro;
$scope.paymentExpired = {
value: false
@ -26,6 +27,19 @@ angular.module('copayApp.controllers').controller('confirmController', function(
});
var initConfirm = function() {
console.log('in init confirm');
console.log('$scope.paypro', $scope.paypro);
if($scope.payProUrl && !$scope.paypro) {
console.log('getting paypro details', $scope.payProUrl);
payproService.getPayProDetails($scope.payProUrl, function(err, details) {
console.log('paypro details', details);
$scope.toAmount = details.amount;
$scope.toAddress = details.toAddress;
$scope.description = details.memo;
$scope.paypro = details;
return initConfirm();
});
}
// TODO (URL , etc)
if (!$scope.toAddress || !$scope.toAmount) {
$log.error('Bad params at amount');