prelim incoming data menu component
This commit is contained in:
parent
c2641a1102
commit
cc7311d169
9 changed files with 104 additions and 10 deletions
|
|
@ -160,10 +160,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$log.debug('Fetch PayPro Request...', uri);
|
||||
|
||||
ongoingProcess.set('fetchingPayPro', true);
|
||||
//debugger;
|
||||
var uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM';
|
||||
uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU';
|
||||
wallet.fetchPayPro({
|
||||
payProUrl: uri,
|
||||
}, function(err, paypro) {
|
||||
|
||||
console.log('paypro', paypro);
|
||||
ongoingProcess.set('fetchingPayPro', false);
|
||||
|
||||
if (err) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
|
|||
};
|
||||
$scope.scannerStates = scannerStates;
|
||||
|
||||
$timeout(function() {
|
||||
$scope.showActionSheet = true;
|
||||
}, 2000);
|
||||
|
||||
function _updateCapabilities(){
|
||||
var capabilities = scannerService.getCapabilities();
|
||||
$scope.scannerIsAvailable = capabilities.isAvailable;
|
||||
|
|
|
|||
16
src/js/directives/incomingDataMenu.js
Normal file
16
src/js/directives/incomingDataMenu.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('incomingDataMenu', function($timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'views/includes/incomingDataMenu.html',
|
||||
link: function(scope, element, attrs) {
|
||||
console.log('incomingDataMenu constructed');
|
||||
$timeout(function() {
|
||||
scope.showMenu = true;
|
||||
}, 5000);
|
||||
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, $timeout, bitcore) {
|
||||
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, $timeout, bitcore, profileService, popupService, ongoingProcess, platformInfo, gettextCatalog) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -61,12 +61,20 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
|
||||
// Plain URL
|
||||
} else if (/^https?:\/\//.test(data)) {
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.confirm', {paypro: data});
|
||||
}, 100);
|
||||
return true;
|
||||
console.log('in here brah');
|
||||
|
||||
getPayProDetails(data, function(err, details) {
|
||||
if(err) {
|
||||
console.log('getPayProDetails err', err);
|
||||
return;
|
||||
}
|
||||
console.log('paypro details', details);
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.confirm', {paypro: data});
|
||||
}, 100);
|
||||
return true;
|
||||
});
|
||||
// Plain Address
|
||||
} else if (bitcore.Address.isValid(data, 'livenet')) {
|
||||
$state.go('tabs.send');
|
||||
|
|
@ -108,5 +116,59 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
|
||||
};
|
||||
|
||||
function getPayProDetails(uri, cb) {
|
||||
if (!cb) cb = function() {};
|
||||
|
||||
var wallet = profileService.getWallets({
|
||||
onlyComplete: true
|
||||
})[0];
|
||||
|
||||
if (!wallet) return cb();
|
||||
|
||||
if (platformInfo.isChromeApp) {
|
||||
popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
|
||||
return cb(true);
|
||||
}
|
||||
|
||||
$log.debug('Fetch PayPro Request...', uri);
|
||||
|
||||
ongoingProcess.set('fetchingPayPro', true);
|
||||
//debugger;
|
||||
// uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM';
|
||||
// uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU';
|
||||
wallet.fetchPayPro({
|
||||
payProUrl: uri,
|
||||
}, function(err, paypro) {
|
||||
console.log('paypro', paypro);
|
||||
ongoingProcess.set('fetchingPayPro', false);
|
||||
|
||||
if (err) {
|
||||
$log.warn('Could not fetch payment request:', err);
|
||||
var msg = err.toString();
|
||||
if (msg.match('HTTP')) {
|
||||
msg = gettextCatalog.getString('Could not fetch payment information');
|
||||
}
|
||||
popupService.showAlert(msg);
|
||||
return cb(true);
|
||||
}
|
||||
|
||||
if (!paypro.verified) {
|
||||
$log.warn('Failed to verify payment protocol signatures');
|
||||
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
|
||||
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);
|
||||
});
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue