Merge pull request #7 from cmgustavo/ref/design-05
Fix bitpayCard and buyAmazon
This commit is contained in:
commit
2110b150df
3 changed files with 8 additions and 57 deletions
|
|
@ -184,7 +184,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
});
|
||||
return;
|
||||
}
|
||||
walletService.publishAndSign(createdTxp, function(err, tx) {
|
||||
walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
|
|
|
|||
|
|
@ -139,10 +139,13 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
});
|
||||
return;
|
||||
}
|
||||
self.confirmTx(createdTxp, function(err, tx) {
|
||||
walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
|
||||
if (err) {
|
||||
ongoingProcess.set('Processing Transaction...', false);
|
||||
self.error = bwcError.msg(err);
|
||||
walletService.removeTx(wallet, tx, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
});
|
||||
|
|
@ -223,56 +226,4 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
});
|
||||
};
|
||||
|
||||
this.confirmTx = function(txp, cb) {
|
||||
fingerprintService.check(wallet, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
walletService.handleEncryptedWallet(wallet, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
|
||||
ongoingProcess.set('Processing Transaction...', true);
|
||||
walletService.publishTx(wallet, txp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
|
||||
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
walletService.removeTx(wallet, signedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
if (signedTxp.status == 'accepted') {
|
||||
walletService.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
walletService.removeTx(wallet, broadcastedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
$timeout(function() {
|
||||
return cb(null, broadcastedTxp);
|
||||
}, 5000);
|
||||
});
|
||||
} else {
|
||||
$timeout(function() {
|
||||
return cb(null, signedTxp);
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue