Fix bitpayCard and buyAmazon

This commit is contained in:
Gustavo Maximiliano Cortez 2016-08-29 18:54:14 -03:00
commit 0ad20fcc77
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 8 additions and 57 deletions

View file

@ -13,7 +13,7 @@
</div>
<div ng-if="type == 'created'" class="popup-txsigned m30tp">
<div ng-if="type == 'created'" class="popup-txsigned text-center m30tp">
<i class="icon ion-checkmark-round"></i>
<div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Proposal Created</span>
@ -25,7 +25,7 @@
<div ng-if="type == 'accepted'" class="popup-txsigned m30tp">
<div ng-if="type == 'accepted'" class="popup-txsigned text-center m30tp">
<i class="icon ion-checkmark-round"></i>
<div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Accepted</span>
@ -35,7 +35,7 @@
</div>
</div>
<div ng-if="type=='rejected'" class="popup-txrejected m30tp">
<div ng-if="type=='rejected'" class="popup-txrejected text-center m30tp">
<i class="icon ion-close-round"></i>
<div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Rejected</span>

View file

@ -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() {

View file

@ -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);
}
});
});
});
});
};
});