fix coinbase payment protocol

This commit is contained in:
Gabriel Bazán 2017-02-22 12:20:55 -05:00
commit 54751bd755

View file

@ -46,6 +46,26 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
return true;
}
function setForm(addr, amount, message) {
$state.go('tabs.send', {}, {
'reload': true,
'notify': $state.current.name == 'tabs.send' ? false : true
});
// Timeout is required to enable the "Back" button
$timeout(function() {
if (amount) {
$state.transitionTo('tabs.send.confirm', {
toAmount: amount,
toAddress: addr,
description: message
});
} else {
$state.transitionTo('tabs.send.amount', {
toAddress: addr
});
}
}, 100);
}
// data extensions for Payment Protocol with non-backwards-compatible request
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
data = decodeURIComponent(data.replace('bitcoin:?r=', ''));
@ -73,27 +93,13 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
if (parsed.r) {
payproService.getPayProDetails(parsed.r, function(err, details) {
if (err && addr && amount) {
setForm(addr, amount, message);
}
handlePayPro(details);
});
} else {
$state.go('tabs.send', {}, {
'reload': true,
'notify': $state.current.name == 'tabs.send' ? false : true
});
// Timeout is required to enable the "Back" button
$timeout(function() {
if (amount) {
$state.transitionTo('tabs.send.confirm', {
toAmount: amount,
toAddress: addr,
description: message
});
} else {
$state.transitionTo('tabs.send.amount', {
toAddress: addr
});
}
}, 100);
setForm(addr, amount, message);
}
return true;
@ -170,7 +176,8 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
}).then(function() {
switch (reason) {
default:
case '0': /* For BitPay card binding */
case '0':
/* For BitPay card binding */
$state.transitionTo('tabs.bitpayCardIntro', {
secret: secret,
email: email,