mirror of https://github.com/BTCPrivate/copay.git
paypro: cleanup a lot of old code and comments. minor fixes.
This commit is contained in:
parent
d9c72392bd
commit
3b550d853f
|
@ -75,7 +75,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
+ ' has been verified through ' + ca + '.';
|
||||
}
|
||||
if (merchantData) {
|
||||
message += '\nFor merchant: ' + merchantData.pr.payment_url;
|
||||
message += '\nFor merchant: ' + merchantData.pr.pd.payment_url;
|
||||
}
|
||||
notification.success('Success!', message);
|
||||
$scope.loadTxs();
|
||||
|
@ -93,7 +93,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
+ ' has been verified through ' + ca + '.';
|
||||
}
|
||||
if (merchantData) {
|
||||
message += '\nFor merchant: ' + merchantData.pr.payment_url;
|
||||
message += '\nFor merchant: ' + merchantData.pr.pd.payment_url;
|
||||
}
|
||||
notification.success('Transaction broadcast', message);
|
||||
} else {
|
||||
|
|
|
@ -14,8 +14,6 @@ angular.module('copayApp.directives')
|
|||
var validator = function(value) {
|
||||
var uri = copay.HDPath.parseBitcoinURI(value);
|
||||
|
||||
window._rootScope = scope;
|
||||
|
||||
// Is this a payment protocol URI (BIP-72)?
|
||||
if (uri && uri.merchant) {
|
||||
scope.wallet.fetchPaymentTx(uri.merchant, function(err, merchantData) {
|
||||
|
@ -46,9 +44,6 @@ angular.module('copayApp.directives')
|
|||
// XXX There needs to be a better way to do this:
|
||||
total = +total / config.unitToSatoshi;
|
||||
|
||||
var sendForm = angular.element(
|
||||
document.getElementsByName('sendForm')[0]);
|
||||
|
||||
var address = angular.element(
|
||||
document.querySelector('input#address'));
|
||||
|
||||
|
@ -81,12 +76,10 @@ angular.module('copayApp.directives')
|
|||
sendall.attr('class', sendall.attr('class') + ' hidden');
|
||||
|
||||
// Reset all the changes from the payment protocol weirdness.
|
||||
// XXX use ng-change attr instead
|
||||
//address.attr('ng-change', 'ppChange()');
|
||||
//scope.ppChange = scope.ppChange || function() {
|
||||
//address.on('change', function(ev) {
|
||||
scope.$on('change', function(ev) {
|
||||
//scope.$watch('address', function(newValue, oldValue) {
|
||||
scope.$watch('address', function(newValue, oldValue) {
|
||||
var val = address.val();
|
||||
var uri = copay.HDPath.parseBitcoinURI(val || '');
|
||||
if (!uri || !uri.merchant) {
|
||||
|
@ -111,7 +104,6 @@ angular.module('copayApp.directives')
|
|||
// TODO: Check paymentRequest expiration,
|
||||
// delete if beyond expiration date.
|
||||
//};
|
||||
//});
|
||||
});
|
||||
//scope.$apply(); // scope.$digest();
|
||||
|
||||
|
@ -120,9 +112,11 @@ angular.module('copayApp.directives')
|
|||
scope.sendForm.$valid = true;
|
||||
scope.sendForm.$invalid = false;
|
||||
scope.sendForm.$pristine = true;
|
||||
|
||||
scope.sendForm.address.$valid = true;
|
||||
scope.sendForm.address.$invalid = false;
|
||||
scope.sendForm.address.$pristine = true;
|
||||
|
||||
scope.sendForm.amount.$valid = true;
|
||||
scope.sendForm.amount.$invalid = false;
|
||||
scope.sendForm.amount.$pristine = true;
|
||||
|
|
|
@ -803,7 +803,7 @@ Wallet.prototype.createPaymentTx = function(options, cb) {
|
|||
'Accept': PayPro.PAYMENT_REQUEST_CONTENT_TYPE
|
||||
+ ', ' + PayPro.PAYMENT_ACK_CONTENT_TYPE,
|
||||
'Content-Type': 'application/octet-stream'
|
||||
// XHR does not allow these:
|
||||
// XHR does not allow this:
|
||||
// 'Content-Length': 0
|
||||
},
|
||||
responseType: 'arraybuffer'
|
||||
|
@ -856,7 +856,7 @@ Wallet.prototype.receivePaymentRequest = function(options, pr, cb) {
|
|||
var certs = PayPro.X509Certificates.decode(pki_data);
|
||||
certs = certs.certificate;
|
||||
|
||||
// XXX Temporary fix for tests
|
||||
// Fix for older versions of bitcore
|
||||
if (!PayPro.RootCerts) {
|
||||
PayPro.RootCerts = {
|
||||
getTrusted: function() {}
|
||||
|
@ -869,10 +869,6 @@ Wallet.prototype.receivePaymentRequest = function(options, pr, cb) {
|
|||
return PayPro.RootCerts.getTrusted(pem);
|
||||
}).filter(Boolean);
|
||||
|
||||
// if (!trusted.length) {
|
||||
// return cb(new Error('Not a trusted certificate.'));
|
||||
// }
|
||||
|
||||
// Verify Signature
|
||||
var verified = pr.verify();
|
||||
|
||||
|
@ -1018,21 +1014,9 @@ Wallet.prototype.sendPaymentTx = function(ntxid, options, cb) {
|
|||
|
||||
pay = pay.serialize();
|
||||
|
||||
this.log(pay);
|
||||
this.log('Sending Payment Message:');
|
||||
this.log(pay.toString('hex'));
|
||||
|
||||
// https://www.google.com/search?q=angular+%24http+ArrayBuffer+in+body
|
||||
// https://github.com/feross/buffer/blob/master/index.js
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
|
||||
|
||||
// var view = new Uint8Array(new ArrayBuffer(pay.length));
|
||||
// Buffer._augment(view);
|
||||
// pay = pay.copy(view);
|
||||
|
||||
// var view = new Uint8Array(new ArrayBuffer(pay.length));
|
||||
// view.set(Array.prototype.slice.call(pay), 0);
|
||||
// pay = view;
|
||||
|
||||
var buf = new ArrayBuffer(pay.length);
|
||||
var view = new Uint8Array(buf);
|
||||
for (var i = 0; i < pay.length; i++) {
|
||||
|
@ -1051,11 +1035,7 @@ Wallet.prototype.sendPaymentTx = function(ntxid, options, cb) {
|
|||
// 'Content-Length': (pay.byteLength || pay.length) + '',
|
||||
// 'Content-Transfer-Encoding': 'binary'
|
||||
},
|
||||
// data: pay,
|
||||
// data: pay,
|
||||
// data: view,
|
||||
data: buf, // Technically how this should be done.
|
||||
// requestType: 'arraybuffer',
|
||||
data: buf, // Technically how this should be done via XHR.
|
||||
responseType: 'arraybuffer'
|
||||
})
|
||||
.success(function(data, status, headers, config) {
|
||||
|
|
Loading…
Reference in New Issue