fix coinbase payment protocol
This commit is contained in:
parent
bb744f1e05
commit
54751bd755
1 changed files with 28 additions and 21 deletions
|
|
@ -46,6 +46,26 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
return true;
|
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
|
// data extensions for Payment Protocol with non-backwards-compatible request
|
||||||
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
|
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
|
||||||
data = decodeURIComponent(data.replace('bitcoin:?r=', ''));
|
data = decodeURIComponent(data.replace('bitcoin:?r=', ''));
|
||||||
|
|
@ -73,27 +93,13 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
|
|
||||||
if (parsed.r) {
|
if (parsed.r) {
|
||||||
payproService.getPayProDetails(parsed.r, function(err, details) {
|
payproService.getPayProDetails(parsed.r, function(err, details) {
|
||||||
|
if (err && addr && amount) {
|
||||||
|
setForm(addr, amount, message);
|
||||||
|
}
|
||||||
handlePayPro(details);
|
handlePayPro(details);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$state.go('tabs.send', {}, {
|
setForm(addr, amount, message);
|
||||||
'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);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -170,13 +176,14 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
default:
|
default:
|
||||||
case '0': /* For BitPay card binding */
|
case '0':
|
||||||
|
/* For BitPay card binding */
|
||||||
$state.transitionTo('tabs.bitpayCardIntro', {
|
$state.transitionTo('tabs.bitpayCardIntro', {
|
||||||
secret: secret,
|
secret: secret,
|
||||||
email: email,
|
email: email,
|
||||||
otp: otp
|
otp: otp
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue