remove fetch pay pro logic from send confirm screen
This commit is contained in:
parent
73c3f1853d
commit
2a7ed47548
4 changed files with 75 additions and 79 deletions
|
|
@ -19,13 +19,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
});
|
});
|
||||||
|
|
||||||
var initConfirm = function() {
|
var initConfirm = function() {
|
||||||
if ($scope.paypro) {
|
// if ($scope.paypro) {
|
||||||
return setFromPayPro($scope.paypro, function(err) {
|
// return setFromPayPro($scope.paypro, function(err) {
|
||||||
if (err && !isChromeApp) {
|
// if (err && !isChromeApp) {
|
||||||
popupService.showAlert(gettext('Could not fetch payment'));
|
// popupService.showAlert(gettext('Could not fetch payment'));
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
// TODO (URL , etc)
|
// TODO (URL , etc)
|
||||||
if (!$scope.toAddress || !$scope.toAmount) {
|
if (!$scope.toAddress || !$scope.toAmount) {
|
||||||
$log.error('Bad params at amount')
|
$log.error('Bad params at amount')
|
||||||
|
|
@ -143,58 +143,58 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
return amountStr.split(' ')[1];
|
return amountStr.split(' ')[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
var setFromPayPro = function(uri, cb) {
|
// var setFromPayPro = function(uri, cb) {
|
||||||
if (!cb) cb = function() {};
|
// if (!cb) cb = function() {};
|
||||||
|
//
|
||||||
var wallet = profileService.getWallets({
|
// var wallet = profileService.getWallets({
|
||||||
onlyComplete: true
|
// onlyComplete: true
|
||||||
})[0];
|
// })[0];
|
||||||
|
//
|
||||||
if (!wallet) return cb();
|
// if (!wallet) return cb();
|
||||||
|
//
|
||||||
if (isChromeApp) {
|
// if (isChromeApp) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
|
// popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
|
||||||
return cb(true);
|
// return cb(true);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$log.debug('Fetch PayPro Request...', uri);
|
// $log.debug('Fetch PayPro Request...', uri);
|
||||||
|
//
|
||||||
ongoingProcess.set('fetchingPayPro', true);
|
// ongoingProcess.set('fetchingPayPro', true);
|
||||||
//debugger;
|
// //debugger;
|
||||||
var uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM';
|
// var uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM';
|
||||||
uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU';
|
// uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU';
|
||||||
wallet.fetchPayPro({
|
// wallet.fetchPayPro({
|
||||||
payProUrl: uri,
|
// payProUrl: uri,
|
||||||
}, function(err, paypro) {
|
// }, function(err, paypro) {
|
||||||
console.log('paypro', paypro);
|
// console.log('paypro', paypro);
|
||||||
ongoingProcess.set('fetchingPayPro', false);
|
// ongoingProcess.set('fetchingPayPro', false);
|
||||||
|
//
|
||||||
if (err) {
|
// if (err) {
|
||||||
$log.warn('Could not fetch payment request:', err);
|
// $log.warn('Could not fetch payment request:', err);
|
||||||
var msg = err.toString();
|
// var msg = err.toString();
|
||||||
if (msg.match('HTTP')) {
|
// if (msg.match('HTTP')) {
|
||||||
msg = gettextCatalog.getString('Could not fetch payment information');
|
// msg = gettextCatalog.getString('Could not fetch payment information');
|
||||||
}
|
// }
|
||||||
popupService.showAlert(msg);
|
// popupService.showAlert(msg);
|
||||||
return cb(true);
|
// return cb(true);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!paypro.verified) {
|
// if (!paypro.verified) {
|
||||||
$log.warn('Failed to verify payment protocol signatures');
|
// $log.warn('Failed to verify payment protocol signatures');
|
||||||
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
|
// popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
|
||||||
return cb(true);
|
// return cb(true);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$scope.toAmount = paypro.amount;
|
// $scope.toAmount = paypro.amount;
|
||||||
$scope.toAddress = paypro.toAddress;
|
// $scope.toAddress = paypro.toAddress;
|
||||||
$scope.description = paypro.memo;
|
// $scope.description = paypro.memo;
|
||||||
$scope.paypro = null;
|
// $scope.paypro = null;
|
||||||
|
//
|
||||||
$scope._paypro = paypro;
|
// $scope._paypro = paypro;
|
||||||
|
//
|
||||||
return initConfirm();
|
// return initConfirm();
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
function setWallet(wallet, delayed) {
|
function setWallet(wallet, delayed) {
|
||||||
var stop;
|
var stop;
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
|
||||||
|
|
||||||
$scope.canGoBack = function(){
|
$scope.canGoBack = function(){
|
||||||
return $state.params.passthroughMode;
|
return $state.params.passthroughMode;
|
||||||
}
|
};
|
||||||
function goBack(){
|
function goBack(){
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
disableAnimate: true
|
disableAnimate: true
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
||||||
newUri.replace('://', ':');
|
newUri.replace('://', ':');
|
||||||
|
|
||||||
return newUri;
|
return newUri;
|
||||||
};
|
}
|
||||||
|
|
||||||
// data extensions for Payment Protocol with non-backwards-compatible request
|
// data extensions for Payment Protocol with non-backwards-compatible request
|
||||||
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
|
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
|
||||||
|
|
@ -65,7 +65,6 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
||||||
|
|
||||||
// Plain URL
|
// Plain URL
|
||||||
} else if (/^https?:\/\//.test(data)) {
|
} else if (/^https?:\/\//.test(data)) {
|
||||||
console.log('in here brah');
|
|
||||||
|
|
||||||
getPayProDetails(data, function(err, details) {
|
getPayProDetails(data, function(err, details) {
|
||||||
if(err) {
|
if(err) {
|
||||||
|
|
@ -75,9 +74,13 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
||||||
}
|
}
|
||||||
console.log('paypro details', details);
|
console.log('paypro details', details);
|
||||||
$state.go('tabs.send');
|
$state.go('tabs.send');
|
||||||
$timeout(function() {
|
var stateParams = {
|
||||||
$state.transitionTo('tabs.send.confirm', {paypro: data});
|
toAmount: details.amount,
|
||||||
}, 100);
|
toAddress: details.toAddress,
|
||||||
|
description: details.memo,
|
||||||
|
paypro: details
|
||||||
|
};
|
||||||
|
$state.transitionTo('tabs.send.confirm', stateParams);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
// Plain Address
|
// Plain Address
|
||||||
|
|
@ -137,16 +140,17 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
||||||
|
|
||||||
$log.debug('Fetch PayPro Request...', uri);
|
$log.debug('Fetch PayPro Request...', uri);
|
||||||
|
|
||||||
|
console.log('show fetchingPayPro loader');
|
||||||
ongoingProcess.set('fetchingPayPro', true);
|
ongoingProcess.set('fetchingPayPro', true);
|
||||||
//debugger;
|
//debugger;
|
||||||
// uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM';
|
// uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM';
|
||||||
// uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU';
|
//uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU';
|
||||||
wallet.fetchPayPro({
|
wallet.fetchPayPro({
|
||||||
payProUrl: uri,
|
payProUrl: uri,
|
||||||
}, function(err, paypro) {
|
}, function(err, paypro) {
|
||||||
console.log('paypro', paypro);
|
console.log('paypro', paypro);
|
||||||
ongoingProcess.set('fetchingPayPro', false);
|
|
||||||
|
|
||||||
|
ongoingProcess.set('fetchingPayPro', false);
|
||||||
if (err) {
|
if (err) {
|
||||||
// $log.warn('Could not fetch payment request:', err);
|
// $log.warn('Could not fetch payment request:', err);
|
||||||
// var msg = err.toString();
|
// var msg = err.toString();
|
||||||
|
|
@ -162,18 +166,10 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
||||||
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
|
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
|
||||||
return cb(true);
|
return cb(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $scope.toAmount = paypro.amount;
|
|
||||||
// $scope.toAddress = paypro.toAddress;
|
|
||||||
// $scope.description = paypro.memo;
|
|
||||||
// $scope.paypro = null;
|
|
||||||
//
|
|
||||||
// $scope._paypro = paypro;
|
|
||||||
|
|
||||||
//return initConfirm();
|
|
||||||
cb(null, paypro);
|
cb(null, paypro);
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ angular.module('copayApp.services').service('scannerService', function($log, $ti
|
||||||
initializeCompleted = false;
|
initializeCompleted = false;
|
||||||
QRScanner.destroy();
|
QRScanner.destroy();
|
||||||
initialize(callback);
|
initialize(callback);
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle the device light (if available).
|
* Toggle the device light (if available).
|
||||||
|
|
@ -244,7 +244,7 @@ angular.module('copayApp.services').service('scannerService', function($log, $ti
|
||||||
var nextCamera = backCamera? 1 : 0;
|
var nextCamera = backCamera? 1 : 0;
|
||||||
function cameraToString(index){
|
function cameraToString(index){
|
||||||
return index === 1? 'front' : 'back'; // front = 1, back = 0
|
return index === 1? 'front' : 'back'; // front = 1, back = 0
|
||||||
};
|
}
|
||||||
$log.debug('Toggling to the ' + cameraToString(nextCamera) + ' camera...');
|
$log.debug('Toggling to the ' + cameraToString(nextCamera) + ' camera...');
|
||||||
QRScanner.useCamera(nextCamera, function(err, status){
|
QRScanner.useCamera(nextCamera, function(err, status){
|
||||||
if(err){
|
if(err){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue