Fix main view of the bitpay card
This commit is contained in:
parent
1ac78c21a5
commit
da931600e2
3 changed files with 30 additions and 149 deletions
|
|
@ -98,81 +98,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
});
|
||||
};
|
||||
|
||||
this.sendFunds = function() {
|
||||
if (lodash.isEmpty(wallet)) return;
|
||||
|
||||
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
|
||||
$log.info('No signing proposal: No private key');
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg('MISSING_PRIVATE_KEY'));
|
||||
return;
|
||||
}
|
||||
|
||||
var dataSrc = {
|
||||
amount: $scope.fiat,
|
||||
currency: 'USD'
|
||||
};
|
||||
var outputs = [];
|
||||
var config = configService.getSync();
|
||||
var configWallet = config.wallet;
|
||||
var walletSettings = configWallet.settings;
|
||||
|
||||
|
||||
ongoingProcess.set('Processing Transaction...', true);
|
||||
$timeout(function() {
|
||||
|
||||
bitpayCardService.topUp(dataSrc, function(err, invoiceId) {
|
||||
if (err) {
|
||||
ongoingProcess.set('Processing Transaction...', false);
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
|
||||
return;
|
||||
}
|
||||
|
||||
bitpayCardService.getInvoice(invoiceId, function(err, data) {
|
||||
var address, comment, amount;
|
||||
|
||||
address = data.bitcoinAddress;
|
||||
amount = parseInt((data.btcPrice * 100000000).toFixed(0));
|
||||
comment = data.itemDesc;
|
||||
|
||||
outputs.push({
|
||||
'toAddress': address,
|
||||
'amount': amount,
|
||||
'message': comment
|
||||
});
|
||||
|
||||
var txp = {
|
||||
toAddress: address,
|
||||
amount: amount,
|
||||
outputs: outputs,
|
||||
message: comment,
|
||||
payProUrl: null,
|
||||
excludeUnconfirmedUtxos: configWallet.spendUnconfirmed ? false : true,
|
||||
feeLevel: walletSettings.feeLevel || 'normal'
|
||||
};
|
||||
|
||||
walletService.createTx(wallet, txp, function(err, createdTxp) {
|
||||
ongoingProcess.set('Processing Transaction...', false);
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
|
||||
return;
|
||||
}
|
||||
walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
|
||||
return;
|
||||
}
|
||||
self.update();
|
||||
$scope.addFunds = false;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
this.authenticate = function() {
|
||||
|
||||
var data = {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 2rem 1rem 1.5rem 1rem;
|
||||
min-height: 115px;
|
||||
margin-bottom: 25px;
|
||||
min-height: 140px;
|
||||
border-color: #172565;
|
||||
background-color: #1e3186;
|
||||
background-image: linear-gradient(0deg, #172565, #172565 0%, transparent 0%);
|
||||
|
|
@ -13,4 +12,13 @@
|
|||
strong {
|
||||
line-height: 100%;
|
||||
}
|
||||
.select-style {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue