fix paypro scan handling

This commit is contained in:
Marty Alcala 2016-10-21 11:10:01 -04:00
commit 360e1c8f87
3 changed files with 9 additions and 2 deletions

View file

@ -15,6 +15,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.toEmail = data.stateParams.toEmail; $scope.toEmail = data.stateParams.toEmail;
$scope.description = data.stateParams.description; $scope.description = data.stateParams.description;
$scope.paypro = data.stateParams.paypro; $scope.paypro = data.stateParams.paypro;
$scope._paypro = $scope.paypro;
$scope.paymentExpired = { $scope.paymentExpired = {
value: false value: false
}; };
@ -94,6 +95,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}); });
if($scope.paypro) { if($scope.paypro) {
console.log('$scope.paypro', $scope.paypro);
_paymentTimeControl($scope.paypro.expires); _paymentTimeControl($scope.paypro.expires);
} }
@ -199,6 +201,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
// }; // };
function _paymentTimeControl(expirationTime) { function _paymentTimeControl(expirationTime) {
console.log('expirationTime', expirationTime);
$scope.paymentExpired.value = false; $scope.paymentExpired.value = false;
setExpirationTime(); setExpirationTime();
@ -313,13 +316,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
txp.outputs = outputs; txp.outputs = outputs;
txp.message = description; txp.message = description;
txp.payProUrl = paypro; txp.payProUrl = paypro.url;
txp.excludeUnconfirmedUtxos = config.spendUnconfirmed ? false : true; txp.excludeUnconfirmedUtxos = config.spendUnconfirmed ? false : true;
txp.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal'; txp.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
txp.dryRun = dryRun; txp.dryRun = dryRun;
walletService.createTx(wallet, txp, function(err, ctxp) { walletService.createTx(wallet, txp, function(err, ctxp) {
if (err) { if (err) {
console.log('in createTx error', err);
setSendError(err); setSendError(err);
return cb(err); return cb(err);
} }
@ -337,6 +341,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}; };
$scope.approve = function(onSendStatusChange) { $scope.approve = function(onSendStatusChange) {
console.log('$scope._paypro', $scope._paypro);
console.log('$scope.paymentExpired', $scope.paymentExpired);
if ($scope._paypro && $scope.paymentExpired.value) { if ($scope._paypro && $scope.paymentExpired.value) {
popupService.showAlert(null, gettextCatalog.getString('The payment request has expired')); popupService.showAlert(null, gettextCatalog.getString('The payment request has expired'));
$scope.sendStatus = ''; $scope.sendStatus = '';

View file

@ -260,7 +260,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} }
}) })
.state('tabs.send.confirm', { .state('tabs.send.confirm', {
url: '/confirm/:isWallet/:toAddress/:toName/:toAmount/:toEmail/:description/:paypro', url: '/confirm/:isWallet/:toAddress/:toName/:toAmount/:toEmail/:description/{paypro:json}',
views: { views: {
'tab-send@tabs': { 'tab-send@tabs': {
controller: 'confirmController', controller: 'confirmController',

View file

@ -180,6 +180,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
} }
function handlePayPro(payProDetails){ function handlePayPro(payProDetails){
console.log('payProDetails', payProDetails);
var stateParams = { var stateParams = {
toAmount: payProDetails.amount, toAmount: payProDetails.amount,
toAddress: payProDetails.toAddress, toAddress: payProDetails.toAddress,