mirror of https://github.com/BTCPrivate/copay.git
paypro: fixes. clean up form reset from paypro. etc.
This commit is contained in:
parent
4dd725aa48
commit
64b38802bf
|
@ -64,13 +64,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
function done(ntxid, ca) {
|
||||
var txp = w.txProposals.txps[ntxid];
|
||||
var merchantData = txp.merchant;
|
||||
var amt = angular.element(document.querySelector('input#amount'));
|
||||
var sendto = angular.element(document
|
||||
.querySelector('div.send-note > p[ng-class]:first-of-type'));
|
||||
var tamount = angular.element(document
|
||||
.querySelector('div.send-note > p[ng-class]:nth-of-type(2)'));
|
||||
var submit = angular.element(document.querySelector('button[type=submit]'));
|
||||
var sendall = angular.element(document.querySelector('[title="Send all funds"]'));
|
||||
if (w.isShared()) {
|
||||
$scope.loading = false;
|
||||
var message = 'The transaction proposal has been created';
|
||||
|
@ -83,13 +76,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
}
|
||||
notification.success('Success!', message);
|
||||
$scope.loadTxs();
|
||||
if (merchantData) {
|
||||
amt.attr('disabled', false);
|
||||
sendto.html(sendto.html().replace(/<br><b>Server:.*$/, ''));
|
||||
tamount.html('');
|
||||
submit.attr('disabled', true);
|
||||
sendall.attr('class', sendall.attr('class').replace(' hidden', ''));
|
||||
}
|
||||
} else {
|
||||
w.sendTx(ntxid, function(txid, ca) {
|
||||
if (txid) {
|
||||
|
@ -107,13 +93,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
}
|
||||
$scope.loading = false;
|
||||
$scope.loadTxs();
|
||||
if (merchantData) {
|
||||
amt.attr('disabled', false);
|
||||
sendto.html(sendto.html().replace(/<br><b>Server:.*$/, ''));
|
||||
tamount.html('');
|
||||
submit.attr('disabled', true);
|
||||
sendall.attr('class', sendall.attr('class').replace(' hidden', ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
$rootScope.pendingPayment = null;
|
||||
|
|
|
@ -44,11 +44,14 @@ angular.module('copayApp.directives')
|
|||
// XXX There needs to be a better way to do this:
|
||||
total = +total / config.unitToSatoshi;
|
||||
|
||||
// XXX Pretty much all of this code accesses the raw DOM. It's
|
||||
// very bad, there's probably a better, more angular-y way to
|
||||
// do things here.
|
||||
|
||||
var address = angular.element(
|
||||
document.querySelector('input#address'));
|
||||
|
||||
var amount = angular.element(
|
||||
document.querySelector('input#amount'));
|
||||
var amount = angular.element( document.querySelector('input#amount'));
|
||||
amount.val(total);
|
||||
amount.attr('disabled', true);
|
||||
|
||||
|
@ -67,8 +70,7 @@ angular.module('copayApp.directives')
|
|||
+ expires.toISOString()
|
||||
+ ')');
|
||||
|
||||
var submit = angular.element(
|
||||
document.querySelector('button[type=submit]'));
|
||||
var submit = angular.element( document.querySelector('button[type=submit]'));
|
||||
submit.attr('disabled', false);
|
||||
|
||||
var sendall = angular.element(
|
||||
|
@ -76,39 +78,36 @@ angular.module('copayApp.directives')
|
|||
sendall.attr('class', sendall.attr('class') + ' hidden');
|
||||
|
||||
// Reset all the changes from the payment protocol weirdness.
|
||||
//address.attr('ng-change', 'ppChange()');
|
||||
//scope.ppChange = scope.ppChange || function() {
|
||||
//address.on('change', function(ev) {
|
||||
scope.$watch('address', function(newValue, oldValue) {
|
||||
var val = address.val();
|
||||
var uri = copay.HDPath.parseBitcoinURI(val || '');
|
||||
if (!uri || !uri.merchant) {
|
||||
if (amount.attr('disabled') === true) {
|
||||
amount.attr('disabled', false);
|
||||
// XXX Bad hook.
|
||||
if (!scope.__watchingAddress) {
|
||||
scope.__watchingAddress = true;
|
||||
scope.$watch('address', function(newValue, oldValue) {
|
||||
var val = address.val();
|
||||
var uri = copay.HDPath.parseBitcoinURI(val || '');
|
||||
if (!uri || !uri.merchant) {
|
||||
if (amount.attr('disabled')) {
|
||||
amount.val('');
|
||||
amount.attr('disabled', false);
|
||||
}
|
||||
sendto.html(sendto.html().replace(/<br><b>Server:.*$/, ''));
|
||||
if (!/hidden/.test(tamount.attr('class'))) {
|
||||
tamount.attr(tamount.attr('class') + ' hidden');
|
||||
}
|
||||
if (~tamount.html().indexOf('(CA: ')) {
|
||||
tamount.html('');
|
||||
}
|
||||
if (!submit.attr('disabled')) {
|
||||
submit.attr('disabled', true);
|
||||
}
|
||||
if (/ hidden$/.test(sendall.attr('class'))) {
|
||||
sendall.attr('class',
|
||||
sendall.attr('class').replace(' hidden', ''));
|
||||
}
|
||||
}
|
||||
if (submit.attr('disabled') === false) {
|
||||
submit.attr('disabled', true);
|
||||
}
|
||||
sendto.html(sendto.html().replace(/<br><b>Server:.*$/, ''));
|
||||
if (!/hidden/.test(tamount.attr('class'))) {
|
||||
tamount.attr(tamount.attr('class') + ' hidden');
|
||||
}
|
||||
if (~tamount.html().indexOf('(CA: ')) {
|
||||
tamount.html('');
|
||||
}
|
||||
if (submit.attr('disabled') === false) {
|
||||
submit.attr('disabled', true);
|
||||
}
|
||||
if (/ hidden$/.test(sendall.attr('class'))) {
|
||||
sendall.attr('class',
|
||||
sendall.attr('class').replace(' hidden', ''));
|
||||
}
|
||||
}
|
||||
// TODO: Check paymentRequest expiration,
|
||||
// delete if beyond expiration date.
|
||||
//};
|
||||
});
|
||||
//scope.$apply(); // scope.$digest();
|
||||
// TODO: Check paymentRequest expiration,
|
||||
// delete if beyond expiration date.
|
||||
});
|
||||
}
|
||||
|
||||
ctrl.$setValidity('validAddress', true);
|
||||
|
||||
|
|
|
@ -1035,7 +1035,9 @@ Wallet.prototype.sendPaymentTx = function(ntxid, options, cb) {
|
|||
// 'Content-Length': (pay.byteLength || pay.length) + '',
|
||||
// 'Content-Transfer-Encoding': 'binary'
|
||||
},
|
||||
data: buf, // Technically how this should be done via XHR.
|
||||
// Technically how this should be done via XHR (used to
|
||||
// be the ArrayBuffer, now you send the View instead).
|
||||
data: view,
|
||||
responseType: 'arraybuffer'
|
||||
})
|
||||
.success(function(data, status, headers, config) {
|
||||
|
|
Loading…
Reference in New Issue