ensure rate limit errors are handled properly
This commit is contained in:
parent
08711f1f07
commit
ffeb8ad612
5 changed files with 27 additions and 8 deletions
|
|
@ -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
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -885,7 +885,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.bitpayCard.confirm', {
|
||||
url: '/confirm/:cardId/:toAddress/:toName/:toAmount/:toEmail/:description/:paypro',
|
||||
url: '/confirm/:cardId/:toAddress/:toName/:toAmount/:toEmail/:description/:payProUrl',
|
||||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'confirmController',
|
||||
|
|
|
|||
|
|
@ -215,7 +215,11 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
|
|||
if (!card) return cb(_setError('Not card found'));
|
||||
$http(_post('/api/v2/' + card.token, json, credentials)).then(function(data) {
|
||||
$log.info('BitPay TopUp: SUCCESS');
|
||||
return cb(data.data.error, data.data.data.invoice);
|
||||
if(data.data.error) {
|
||||
return cb(data.data.error);
|
||||
} else {
|
||||
return cb(null, data.data.data.invoice);
|
||||
}
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: TopUp', data));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
$rootScope.$broadcast('incomingDataMenu.showMenu', data);
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
root.redir();
|
||||
}, 2000);;
|
||||
// $timeout(function() {
|
||||
// root.redir();
|
||||
// }, 2000);
|
||||
|
||||
root.redir = function(data) {
|
||||
$log.debug('Processing incoming data: ' + data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue