paypro: more notifications. comments. misc.

This commit is contained in:
Christopher Jeffrey 2014-08-07 11:38:26 -07:00 committed by Manuel Araoz
parent 92c0b69d35
commit 6438de6bd2
2 changed files with 11 additions and 11 deletions

View File

@ -80,11 +80,11 @@ angular.module('copayApp.controllers').controller('SendController',
var message = 'The transaction proposal has been created'; var message = 'The transaction proposal has been created';
if (merchantData) { if (merchantData) {
if (merchantData.pr.ca) { if (merchantData.pr.ca) {
message += '\nThis payment protocol transaction' message += ' This payment protocol transaction'
+ ' has been verified through ' + merchantData.pr.ca + '.'; + ' has been verified through ' + merchantData.pr.ca + '.';
} }
message += '\nMessage from server: ' + merchantData.ack.memo; message += ' Message from server: ' + merchantData.ack.memo;
message += '\nFor merchant: ' + merchantData.pr.pd.payment_url; message += ' For merchant: ' + merchantData.pr.pd.payment_url;
} }
notification.success('Success!', message); notification.success('Success!', message);
$scope.loadTxs(); $scope.loadTxs();
@ -94,11 +94,11 @@ angular.module('copayApp.controllers').controller('SendController',
var message = 'Transaction id: ' + txid; var message = 'Transaction id: ' + txid;
if (merchantData) { if (merchantData) {
if (merchantData.pr.ca) { if (merchantData.pr.ca) {
message += '\nThis payment protocol transaction' message += ' This payment protocol transaction'
+ ' has been verified through ' + merchantData.pr.ca + '.'; + ' has been verified through ' + merchantData.pr.ca + '.';
} }
message += '\nMessage from server: ' + merchantData.ack.memo; message += ' Message from server: ' + merchantData.ack.memo;
message += '\nFor merchant: ' + merchantData.pr.pd.payment_url; message += ' For merchant: ' + merchantData.pr.pd.payment_url;
} }
notification.success('Transaction broadcast', message); notification.success('Transaction broadcast', message);
} else { } else {
@ -116,6 +116,8 @@ angular.module('copayApp.controllers').controller('SendController',
uri = copay.HDPath.parseBitcoinURI(address); uri = copay.HDPath.parseBitcoinURI(address);
} else if (address.indexOf('Merchant: ') === 0) { } else if (address.indexOf('Merchant: ') === 0) {
uri = { merchant: address.split(/\s+/)[1] }; uri = { merchant: address.split(/\s+/)[1] };
} else if (/^https?:\/\//.test(address)) {
uri = { merchant: address };
} }
if (uri && uri.merchant) { if (uri && uri.merchant) {

View File

@ -55,8 +55,8 @@ angular.module('copayApp.directives')
total = +total / config.unitToSatoshi; total = +total / config.unitToSatoshi;
notification.info('Payment Request', notification.info('Payment Request',
'Server is requesting ' + total + ' ' + config.unitName + '.\n' 'Server is requesting ' + total + ' ' + config.unitName + '.'
+ 'Message: ' + memo); + ' Message: ' + memo);
// XXX Pretty much all of this code accesses the raw DOM. It's // 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 // very bad, there's probably a better, more angular-y way to
@ -122,8 +122,6 @@ angular.module('copayApp.directives')
sendall.attr('class').replace(' hidden', '')); sendall.attr('class').replace(' hidden', ''));
} }
} }
// TODO: Check paymentRequest expiration,
// delete if beyond expiration date.
}; };
scope.$watch('address',scope._resetPayPro); scope.$watch('address',scope._resetPayPro);
} }
@ -148,7 +146,7 @@ angular.module('copayApp.directives')
ctrl.$setValidity('validAddress', true); ctrl.$setValidity('validAddress', true);
return 'Merchant: '+ uri.merchant; return 'Merchant: ' + uri.merchant;
}; };
ctrl.$parsers.unshift(validator); ctrl.$parsers.unshift(validator);