mirror of https://github.com/BTCPrivate/copay.git
send working. Refactor paypro and payment intents
This commit is contained in:
parent
7f42d60d5d
commit
2fe6ec4c6a
12
TODO
12
TODO
|
@ -1,12 +1,2 @@
|
||||||
|
- join. on walletComplete!
|
||||||
|
|
||||||
- homeWallet address...e sta ok?
|
|
||||||
- receive controller .. owned
|
|
||||||
--
|
|
||||||
// pkr.cache = opts.cache;
|
|
||||||
|
|
||||||
(en send.js)
|
|
||||||
// $rootScope.pendingTxCount = res.pendingForUs;
|
|
||||||
|
|
||||||
-- probar payment intent
|
|
||||||
|
|
||||||
// TODO refrescar en 'add'
|
|
||||||
|
|
|
@ -99,8 +99,17 @@ header .alt-currency {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
color: #1abc9c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
color: #A02F23;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.alt-currency.green {
|
.alt-currency.green {
|
||||||
background: #1ABC9C;
|
background: #1abc9c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.alt-currency.red {
|
.alt-currency.red {
|
||||||
|
|
|
@ -3,14 +3,10 @@
|
||||||
angular.module('copayApp.controllers').controller('CopayersController',
|
angular.module('copayApp.controllers').controller('CopayersController',
|
||||||
function($scope, $rootScope, $location) {
|
function($scope, $rootScope, $location) {
|
||||||
|
|
||||||
if (!$rootScope.wallet.isComplete()) {
|
$scope.init = function() {
|
||||||
$rootScope.title = 'Waiting copayers for ' + $rootScope.wallet.getName();
|
$rootScope.title = 'Waiting copayers for ' + $rootScope.wallet.getName();
|
||||||
}
|
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.secret = $rootScope.wallet.getSecret();
|
$scope.secret = $rootScope.wallet.getSecret();
|
||||||
|
|
||||||
$scope.goToWallet = function() {
|
|
||||||
$location.path('/homeWallet');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.copayersList = function() {
|
$scope.copayersList = function() {
|
||||||
|
|
|
@ -5,7 +5,10 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
||||||
var _credentials, _firstpin;
|
var _credentials, _firstpin;
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
identityService.goWalletHome();
|
|
||||||
|
if ($rootScope.wallet)
|
||||||
|
go.walletHome();
|
||||||
|
|
||||||
$scope.isMobile = isMobile.any();
|
$scope.isMobile = isMobile.any();
|
||||||
|
|
||||||
$scope.createStep = 'storage';
|
$scope.createStep = 'storage';
|
||||||
|
|
|
@ -25,8 +25,8 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
$rootScope.fromEmailConfirmation = false;
|
$rootScope.fromEmailConfirmation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rootScope.iden) {
|
if ($rootScope.wallet) {
|
||||||
identityService.goWalletHome();
|
go.walletHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
Compatibility.check($scope);
|
Compatibility.check($scope);
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $modal, $location, $timeout, balanceService) {
|
|
||||||
|
|
||||||
$rootScope.title = 'Payment intent';
|
|
||||||
|
|
||||||
$scope.open = function() {
|
|
||||||
var modalInstance = $modal.open({
|
|
||||||
templateUrl: 'myModalContent.html',
|
|
||||||
controller: ModalInstanceCtrl
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Please note that $modalInstance represents a modal window (instance) dependency.
|
|
||||||
// It is not the same as the $modal service used above.
|
|
||||||
|
|
||||||
var ModalInstanceCtrl = function($scope, $modalInstance, identityService) {
|
|
||||||
$scope.loading = true;
|
|
||||||
$scope.setWallets = function() {
|
|
||||||
if (!$rootScope.iden) return;
|
|
||||||
var ret = _.filter($rootScope.iden.listWallets(), function(w) {
|
|
||||||
return w.balanceInfo && w.balanceInfo.totalBalanceBTC;
|
|
||||||
});
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.wallets = ret;
|
|
||||||
$scope.loading = false;
|
|
||||||
$scope.$digest();
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
if ($rootScope.iden) {
|
|
||||||
var iden = $rootScope.iden;
|
|
||||||
iden.on('newWallet', function() {
|
|
||||||
$scope.setWallets();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$scope.ok = function(selectedItem) {
|
|
||||||
identityService.setPaymentWallet(selectedItem);
|
|
||||||
$modalInstance.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$rootScope.pendingPayment = null;
|
|
||||||
$modalInstance.close();
|
|
||||||
$location.path('/homeWallet');
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
var bitcore = require('bitcore');
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('paymentUriController', function($rootScope, $scope, $routeParams, $location, go) {
|
||||||
|
|
||||||
|
// Build bitcoinURI with querystring
|
||||||
|
var query = [];
|
||||||
|
angular.forEach($location.search(), function(value, key) {
|
||||||
|
query.push(key + "=" + value);
|
||||||
|
});
|
||||||
|
var queryString = query ? "?" + query.join("&") : "";
|
||||||
|
var bitcoinURI = $routeParams.data + queryString;
|
||||||
|
var uri = new bitcore.BIP21(bitcoinURI);
|
||||||
|
|
||||||
|
if (uri.isValid()) {
|
||||||
|
$rootScope.pendingPayment = bitcoinURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
go.home();
|
||||||
|
});
|
|
@ -4,43 +4,50 @@ var preconditions = require('preconditions').singleton();
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('SendController',
|
angular.module('copayApp.controllers').controller('SendController',
|
||||||
function($scope, $rootScope, $window, $timeout, $modal, $filter, $location, isMobile, notification, rateService) {
|
function($scope, $rootScope, $window, $timeout, $modal, $filter, $location, isMobile, notification, rateService) {
|
||||||
var w = $rootScope.wallet;
|
|
||||||
|
var satToUnit, unitToSat, w;
|
||||||
|
|
||||||
|
$scope.init = function() {
|
||||||
|
w = $rootScope.wallet;
|
||||||
preconditions.checkState(w);
|
preconditions.checkState(w);
|
||||||
preconditions.checkState(w.settings.unitToSatoshi);
|
preconditions.checkState(w.settings.unitToSatoshi);
|
||||||
|
|
||||||
$rootScope.title = w.isShared() ? 'Create Transaction Proposal' : 'Send';
|
$rootScope.title = w.isShared() ? 'Create Transaction Proposal' : 'Send';
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.error = $scope.success = null;
|
$scope.error = $scope.success = null;
|
||||||
var satToUnit = 1 / w.settings.unitToSatoshi;
|
|
||||||
$scope.defaultFee = bitcore.TransactionBuilder.FEE_PER_1000B_SAT * satToUnit;
|
unitToSat = w.settings.unitToSatoshi;
|
||||||
$scope.unitToBtc = w.settings.unitToSatoshi / bitcore.util.COIN;
|
satToUnit = 1 / w.settings.unitToSatoshi;
|
||||||
$scope.unitToSatoshi = w.settings.unitToSatoshi;
|
|
||||||
|
|
||||||
$scope.alternativeName = w.settings.alternativeName;
|
$scope.alternativeName = w.settings.alternativeName;
|
||||||
$scope.alternativeIsoCode = w.settings.alternativeIsoCode;
|
$scope.alternativeIsoCode = w.settings.alternativeIsoCode;
|
||||||
|
|
||||||
|
$scope.isPayUri = false;
|
||||||
$scope.isRateAvailable = false;
|
$scope.isRateAvailable = false;
|
||||||
$scope.rateService = rateService;
|
$scope.rateService = rateService;
|
||||||
$scope.showScanner = false;
|
$scope.showScanner = false;
|
||||||
$scope.myId = w.getMyCopayerId();
|
$scope.myId = w.getMyCopayerId();
|
||||||
$scope.isMobile = isMobile.any();
|
$scope.isMobile = isMobile.any();
|
||||||
|
|
||||||
|
if ($rootScope.pendingPayment) {
|
||||||
|
var value;
|
||||||
|
var pp = $rootScope.pendingPayment;
|
||||||
|
var amount = (pp.data && pp.data.amount) ?
|
||||||
|
pp.data.amount * 100000000 * satToUnit : 0;
|
||||||
|
$scope.setForm(pp.address, amount, pp.data.message)
|
||||||
|
_onAddressChange(pp);
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.setInputs();
|
||||||
|
$scope.setScanner();
|
||||||
|
|
||||||
rateService.whenAvailable(function() {
|
rateService.whenAvailable(function() {
|
||||||
$scope.isRateAvailable = true;
|
$scope.isRateAvailable = true;
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$scope.setAlternativeAmount = function(w, tx, cb) {
|
$scope.setInputs = function() {
|
||||||
rateService.whenAvailable(function() {
|
|
||||||
_.each(tx.outs, function(out) {
|
|
||||||
var valueSat = out.valueSat * w.settings.unitToSatoshi;
|
|
||||||
out.alternativeAmount = $filter('noFractionNumber')(rateService.toFiat(valueSat, $scope.alternativeIsoCode), 2);
|
|
||||||
out.alternativeIsoCode = $scope.alternativeIsoCode;
|
|
||||||
});
|
|
||||||
if (cb) return cb(tx);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting the two related amounts as properties prevents an infinite
|
* Setting the two related amounts as properties prevents an infinite
|
||||||
* recursion for watches while preserving the original angular updates
|
* recursion for watches while preserving the original angular updates
|
||||||
|
@ -73,7 +80,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
if (typeof(newValue) === 'number' && $scope.isRateAvailable) {
|
if (typeof(newValue) === 'number' && $scope.isRateAvailable) {
|
||||||
|
|
||||||
this._alternative = parseFloat(
|
this._alternative = parseFloat(
|
||||||
(rateService.toFiat(newValue * w.settings.unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2), 10);
|
(rateService.toFiat(newValue * unitToSat, $scope.alternativeIsoCode)).toFixed(2), 10);
|
||||||
} else {
|
} else {
|
||||||
this._alternative = 0;
|
this._alternative = 0;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +88,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.defineProperty($scope,
|
Object.defineProperty($scope,
|
||||||
"address", {
|
"address", {
|
||||||
get: function() {
|
get: function() {
|
||||||
|
@ -88,22 +96,24 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
},
|
},
|
||||||
set: function(newValue) {
|
set: function(newValue) {
|
||||||
this._address = newValue;
|
this._address = newValue;
|
||||||
_onChanged();
|
_onAddressChange();
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$scope.init = function() {
|
|
||||||
// Empty
|
|
||||||
};
|
};
|
||||||
|
|
||||||
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
|
$scope.setScanner = function() {
|
||||||
window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
|
navigator.getUserMedia = navigator.getUserMedia ||
|
||||||
|
navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||
|
||||||
|
navigator.msGetUserMedia;
|
||||||
|
window.URL = window.URL || window.webkitURL ||
|
||||||
|
window.mozURL || window.msURL;
|
||||||
|
|
||||||
if (!window.cordova && !navigator.getUserMedia)
|
if (!window.cordova && !navigator.getUserMedia)
|
||||||
$scope.disableScanner = 1;
|
$scope.disableScanner = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope._showError = function(err) {
|
$scope._showError = function(err) {
|
||||||
copay.logger.error(err);
|
copay.logger.error(err);
|
||||||
|
@ -112,12 +122,8 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
if (msg.match('BIG'))
|
if (msg.match('BIG'))
|
||||||
msg = 'The transaction have too many inputs. Try creating many transactions for smaller amounts'
|
msg = 'The transaction have too many inputs. Try creating many transactions for smaller amounts'
|
||||||
|
|
||||||
if (msg.match('totalNeededAmount'))
|
if (msg.match('totalNeededAmount') || msg.match('unspent not set'))
|
||||||
msg = 'Not enough funds'
|
msg = 'Insufficient funds'
|
||||||
|
|
||||||
|
|
||||||
if (msg.match('unspent not set'))
|
|
||||||
msg = 'Not enough funds'
|
|
||||||
|
|
||||||
var message = 'The transaction' + (w.isShared() ? ' proposal' : '') +
|
var message = 'The transaction' + (w.isShared() ? ' proposal' : '') +
|
||||||
' could not be created: ' + msg;
|
' could not be created: ' + msg;
|
||||||
|
@ -135,7 +141,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
|
||||||
var address = form.address.$modelValue;
|
var address = form.address.$modelValue;
|
||||||
var amount = parseInt((form.amount.$modelValue * w.settings.unitToSatoshi).toFixed(0));
|
var amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
|
||||||
var commentText = form.comment.$modelValue;
|
var commentText = form.comment.$modelValue;
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,12 +154,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're setting the domain, ignore the change.
|
|
||||||
if ($rootScope.merchant && $rootScope.merchant.domain && address === $rootScope.merchant.domain) {
|
|
||||||
payInfo = {
|
|
||||||
merchant: $rootScope.merchant.request_url
|
|
||||||
};
|
|
||||||
}
|
|
||||||
w.spend({
|
w.spend({
|
||||||
toAddress: address,
|
toAddress: address,
|
||||||
amountSat: amount,
|
amountSat: amount,
|
||||||
|
@ -341,46 +341,28 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.clearMerchant = function(callback) {
|
$scope.setForm = function(to, amount, comment) {
|
||||||
// TODO: Find a better way of detecting
|
var form = $scope.sendForm;
|
||||||
// whether we're in the Send scope or not.
|
form.address.$setViewValue(merchantData.domain);
|
||||||
if (!$scope.sendForm || !$scope.sendForm.address) {
|
form.address.$render();
|
||||||
delete $rootScope.merchant;
|
form.address.$isValid = true;
|
||||||
$rootScope.merchantError = false;
|
|
||||||
$scope.isPayUri = false;
|
form.amount.$setViewValue(merchantData.unitTotal);
|
||||||
if (callback) callback();
|
form.amount.$render();
|
||||||
return;
|
form.amount.$isValid = true;
|
||||||
}
|
|
||||||
var val = $scope.sendForm.address.$viewValue || '';
|
if (comment)
|
||||||
var uri;
|
$scope.commentText = comment;
|
||||||
// If we're setting the domain, ignore the change.
|
|
||||||
if ($rootScope.merchant && $rootScope.merchant.domain && val === $rootScope.merchant.domain) {
|
|
||||||
uri = {
|
|
||||||
merchant: $rootScope.merchant.request_url
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (val.indexOf('bitcoin:') === 0) {
|
|
||||||
uri = new bitcore.BIP21(val).data;
|
|
||||||
} else if (/^https?:\/\//.test(val)) {
|
|
||||||
uri = {
|
|
||||||
merchant: val
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (!uri || !uri.merchant) {
|
|
||||||
delete $rootScope.merchant;
|
|
||||||
$scope.sendForm.amount.$setViewValue('');
|
|
||||||
$scope.sendForm.amount.$render();
|
|
||||||
if (callback) callback();
|
|
||||||
if ($rootScope.$$phase !== '$apply' && $rootScope.$$phase !== '$digest') {
|
|
||||||
$rootScope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.cancelSend = function(form) {
|
$scope.cancelSend = function(error) {
|
||||||
delete $rootScope.merchant;
|
var form = $scope.sendForm;
|
||||||
$rootScope.merchantError = false;
|
|
||||||
$scope.isPayUri = false;
|
if (error)
|
||||||
|
$scope.error = error;
|
||||||
|
|
||||||
|
$scope.fetchingURL = null;
|
||||||
|
$scope.isPayUri = null;
|
||||||
form.address.$setViewValue('');
|
form.address.$setViewValue('');
|
||||||
form.address.$render();
|
form.address.$render();
|
||||||
form.amount.$setViewValue('');
|
form.amount.$setViewValue('');
|
||||||
|
@ -390,39 +372,35 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
form.$setPristine();
|
form.$setPristine();
|
||||||
};
|
};
|
||||||
|
|
||||||
var _onChanged = function(pp) {
|
|
||||||
|
$scope.openPPModal = function(pp) {
|
||||||
|
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||||
|
$scope.pp = pp;
|
||||||
|
$scope.cancel = function() {
|
||||||
|
$modalInstance.dismiss('cancel');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
$modal.open({
|
||||||
|
templateUrl: 'views/modals/paypro.html',
|
||||||
|
windowClass: 'tiny',
|
||||||
|
controller: ModalInstanceCtrl,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var _onAddressChange = function(pp) {
|
||||||
var value;
|
var value;
|
||||||
|
|
||||||
if (pp) {
|
|
||||||
$scope.isPayUri = true;
|
|
||||||
var amount = (pp.data && pp.data.amount) ? pp.data.amount * 100000000 * satToUnit : 0;
|
|
||||||
$scope.commentText = pp.data.message;
|
|
||||||
if (pp.data.merchant) {
|
|
||||||
value = 'bitcoin:' + pp.address.data + '?amount=' + amount + '&r=' + pp.data.r;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = pp.address + '';
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.amount = amount;
|
|
||||||
}, 1000);
|
|
||||||
$scope.address = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
value = value || $scope.address || '';
|
value = value || $scope.address || '';
|
||||||
var uri;
|
var uri;
|
||||||
|
|
||||||
$scope.error = $scope.success = null;
|
$scope.error = $scope.success = null;
|
||||||
// If we're setting the domain, ignore the change.
|
|
||||||
if ($rootScope.merchant && $rootScope.merchant.domain && value === $rootScope.merchant.domain) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value.indexOf('bitcoin:') === 0) {
|
if (value.indexOf('bitcoin:') === 0) {
|
||||||
uri = new bitcore.BIP21(value);
|
uri = new bitcore.BIP21(value);
|
||||||
} else if (/^https?:\/\//.test(value)) {
|
} else if (/^https?:\/\//.test(value)) {
|
||||||
uri = {
|
uri = {
|
||||||
data : {
|
data: {
|
||||||
merchant: value
|
merchant: value
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -433,7 +411,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
var amount = (uri.data && uri.data.amount) ? uri.data.amount * 100000000 * satToUnit : 0;
|
var amount = (uri.data && uri.data.amount) ? uri.data.amount * 100000000 * satToUnit : 0;
|
||||||
var address = uri.address.data;
|
var address = uri.address.data;
|
||||||
if (amount && address) {
|
if (amount && address) {
|
||||||
$scope.isPayUri = true;
|
$scope.isPayUri = {fixedAmount: true} ;
|
||||||
}
|
}
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.amount = amount;
|
$scope.amount = amount;
|
||||||
|
@ -444,110 +422,38 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var apply = function() {
|
|
||||||
if ($rootScope.$$phase !== '$apply' && $rootScope.$$phase !== '$digest') {
|
|
||||||
$rootScope.$apply();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.fetchingURL = uri.data.merchant;
|
$scope.fetchingURL = uri.data.merchant;
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
apply();
|
|
||||||
|
|
||||||
var timeout = setTimeout(function() {
|
|
||||||
timeout = null;
|
var balance = w.balanceInfo.availableBalance;
|
||||||
$scope.fetchingURL = null;
|
var available = +(balance * unitToSat).toFixed(0);
|
||||||
$scope.loading = false;
|
|
||||||
$scope.sendForm.address.$setViewValue('');
|
|
||||||
$scope.sendForm.address.$render();
|
|
||||||
$scope.sendForm.address.$isValid = false;
|
|
||||||
$scope.error = 'Payment server timed out';
|
|
||||||
apply();
|
|
||||||
}, 10 * 1000);
|
|
||||||
|
|
||||||
// Payment Protocol URI (BIP-72)
|
// Payment Protocol URI (BIP-72)
|
||||||
$scope.wallet.fetchPaymentRequest({
|
$scope.wallet.fetchPaymentRequest({
|
||||||
url: uri.data.merchant
|
url: uri.data.merchant
|
||||||
}, function(err, merchantData) {
|
}, function(err, merchantData) {
|
||||||
if (!timeout) return;
|
|
||||||
clearTimeout(timeout);
|
|
||||||
|
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.fetchingURL = null;
|
$scope.fetchingURL = null;
|
||||||
apply();
|
|
||||||
|
|
||||||
var balance = $rootScope.availableBalance;
|
|
||||||
var available = +(balance * w.settings.unitToSatoshi).toFixed(0);
|
|
||||||
if (merchantData && available < +merchantData.total) {
|
|
||||||
err = new Error('Insufficient funds.');
|
|
||||||
err.amount = merchantData.total;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.amount) {
|
if (err.match('TIMEOUT')) {
|
||||||
$scope.sendForm.amount.$setViewValue(+err.amount / w.settings.unitToSatoshi);
|
$scope.cancelSend('Payment server timed out');
|
||||||
$scope.sendForm.amount.$render();
|
|
||||||
$scope.sendForm.amount.$isValid = false;
|
|
||||||
$scope.notEnoughAmount = true;
|
|
||||||
$rootScope.merchantError = true;
|
|
||||||
var lastAddr = $scope.sendForm.address.$viewValue;
|
|
||||||
var unregister = $scope.$watch('address', function() {
|
|
||||||
if ($scope.sendForm.address.$viewValue !== lastAddr) {
|
|
||||||
delete $rootScope.merchantError;
|
|
||||||
$scope.isPayUri = false;
|
|
||||||
$scope.sendForm.amount.$setViewValue('');
|
|
||||||
$scope.sendForm.amount.$render();
|
|
||||||
unregister();
|
|
||||||
apply();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$scope.sendForm.address.$setViewValue('');
|
$scope.cancelSend(err.toString());
|
||||||
$scope.sendForm.address.$render();
|
|
||||||
}
|
|
||||||
$scope.sendForm.address.$isValid = false;
|
|
||||||
copay.logger.error(err);
|
|
||||||
|
|
||||||
$scope.error = 'Could not fetch payment request';
|
|
||||||
|
|
||||||
apply();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = merchantData.request_url;
|
} else if (merchantData && available < +merchantData.total) {
|
||||||
var domain = /^(?:https?)?:\/\/([^\/:]+).*$/.exec(url)[1];
|
$scope.cancelSend(err.toString('Insufficient funds'));
|
||||||
|
} else {
|
||||||
merchantData.unitTotal = (+merchantData.total / w.settings.unitToSatoshi) + '';
|
$scope.setForm(merchantData.domain, merchantData.unitTotal)
|
||||||
merchantData.expiration = new Date(
|
}
|
||||||
merchantData.pr.pd.expires * 1000);
|
$timeout(function() {
|
||||||
merchantData.domain = domain;
|
$scope.$digest();
|
||||||
|
}, 1);
|
||||||
$rootScope.merchant = merchantData;
|
|
||||||
|
|
||||||
$scope.sendForm.address.$setViewValue(domain);
|
|
||||||
$scope.sendForm.address.$render();
|
|
||||||
$scope.sendForm.address.$isValid = true;
|
|
||||||
|
|
||||||
$scope.sendForm.amount.$setViewValue(merchantData.unitTotal);
|
|
||||||
$scope.sendForm.amount.$render();
|
|
||||||
$scope.sendForm.amount.$isValid = true;
|
|
||||||
|
|
||||||
// If the address changes to a non-payment-protocol one,
|
|
||||||
// delete the `merchant` property from the scope.
|
|
||||||
var unregister = $rootScope.$watch(function() {
|
|
||||||
$scope.clearMerchant(unregister);
|
|
||||||
});
|
|
||||||
|
|
||||||
apply();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($rootScope.pendingPayment) {
|
|
||||||
var value;
|
|
||||||
var pp = $rootScope.pendingPayment;
|
|
||||||
_onChanged(pp);
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.openAddressBook = function() {
|
$scope.openAddressBook = function() {
|
||||||
var modalInstance = $modal.open({
|
var modalInstance = $modal.open({
|
||||||
templateUrl: 'views/modals/address-book.html',
|
templateUrl: 'views/modals/address-book.html',
|
||||||
|
@ -591,7 +497,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
try {
|
try {
|
||||||
w.setAddressBook(entry.address, entry.label);
|
w.setAddressBook(entry.address, entry.label);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('[send.js:583]',e); //TODO
|
console.log('[send.js:583]', e); //TODO
|
||||||
errorMsg = e.message;
|
errorMsg = e.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, $timeout, identityService, isMobile) {
|
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, $timeout, identityService, isMobile, go) {
|
||||||
|
|
||||||
$scope.isMobile = isMobile.any()
|
$scope.isMobile = isMobile.any()
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
|
||||||
$scope.switchWallet = function(wid) {
|
$scope.switchWallet = function(wid) {
|
||||||
$scope.walletSelection = false;
|
$scope.walletSelection = false;
|
||||||
identityService.setFocusedWallet(wid);
|
identityService.setFocusedWallet(wid);
|
||||||
identityService.goWalletHome();
|
go.walletHome();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggleWalletSelection = function() {
|
$scope.toggleWalletSelection = function() {
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var bitcore = require('bitcore');
|
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('UriPaymentController', function($rootScope, $scope, $routeParams, $timeout, $location) {
|
|
||||||
// Build bitcoinURI with querystring
|
|
||||||
var query = [];
|
|
||||||
angular.forEach($location.search(), function(value, key) {
|
|
||||||
query.push(key + "=" + value);
|
|
||||||
});
|
|
||||||
var queryString = query ? "?" + query.join("&") : "";
|
|
||||||
var bitcoinURI = $routeParams.data + queryString;
|
|
||||||
|
|
||||||
$rootScope.pendingPayment = new bitcore.BIP21(bitcoinURI);
|
|
||||||
|
|
||||||
$timeout(function() {
|
|
||||||
console.log('Redirecting to /paymentIntent');
|
|
||||||
$location.path('/paymentIntent');
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
var bitcore = require('bitcore');
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('walletForPaymentController', function($rootScope, $scope, $modal, go) {
|
||||||
|
|
||||||
|
console.log('[walletForPayment.js.4]'); //TODO
|
||||||
|
if (!$rootScope.pendingPayment) {
|
||||||
|
go.walletHome();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
console.log('[walletForPayment.js.9]'); //TODO
|
||||||
|
$scope.selectWallet(function(w) {
|
||||||
|
if (w) {
|
||||||
|
identityService.setFocusedWallet(w);
|
||||||
|
go.send();
|
||||||
|
} else {
|
||||||
|
go.walletHome();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.selectWallet = function(cb) {
|
||||||
|
|
||||||
|
console.log('[walletForPayment.js.22]'); //TODO
|
||||||
|
var ModalInstanceCtrl = function($scope, $modalInstance, $identityService) {
|
||||||
|
$scope.loading = true;
|
||||||
|
preconditions.checkState($rootScope.iden);
|
||||||
|
|
||||||
|
var iden = $rootScope.iden;
|
||||||
|
iden.on('newWallet', function() {
|
||||||
|
$scope.setWallets();
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.setWallets = function() {
|
||||||
|
$scope.wallets = _.filter($rootScope.iden.listWallets(), function(w) {
|
||||||
|
return w.balanceInfo && w.balanceInfo.totalBalanceBTC;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.ok = function(w) {
|
||||||
|
$modalInstance.close();
|
||||||
|
return cb(w);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.cancel = function() {
|
||||||
|
$modalInstance.close();
|
||||||
|
return cb();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('[walletForPayment.js.49]'); //TODO
|
||||||
|
$modal.open({
|
||||||
|
templateUrl: 'views/modals/walletSelect.html',
|
||||||
|
windowClass: 'tiny',
|
||||||
|
controller: ModalInstanceCtrl,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
|
@ -1793,6 +1793,7 @@ Wallet.prototype.parsePaymentRequest = function(options, rawData) {
|
||||||
var payment_url = pd.get('payment_url');
|
var payment_url = pd.get('payment_url');
|
||||||
var merchant_data = pd.get('merchant_data');
|
var merchant_data = pd.get('merchant_data');
|
||||||
|
|
||||||
|
var total = bignum('0', 10).toString(10);
|
||||||
var merchantData = {
|
var merchantData = {
|
||||||
pr: {
|
pr: {
|
||||||
payment_details_version: ver,
|
payment_details_version: ver,
|
||||||
|
@ -1826,8 +1827,12 @@ Wallet.prototype.parsePaymentRequest = function(options, rawData) {
|
||||||
},
|
},
|
||||||
expires: expires,
|
expires: expires,
|
||||||
request_url: options.url,
|
request_url: options.url,
|
||||||
total: bignum('0', 10).toString(10),
|
domain: /^(?:https?)?:\/\/([^\/:]+).*$/.exec(options.url)[1],
|
||||||
|
total: total,
|
||||||
|
unitTotal: total ? (+total / w.settings.unitToSatoshi) + '' : null,
|
||||||
|
expirationDate: expires ? new Date(expires * 1000) : null,
|
||||||
};
|
};
|
||||||
|
|
||||||
this._addOutputsToMerchantData(merchantData, options.amount);
|
this._addOutputsToMerchantData(merchantData, options.amount);
|
||||||
return merchantData;
|
return merchantData;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,11 +22,14 @@ angular
|
||||||
template: " ", // just fire controller
|
template: " ", // just fire controller
|
||||||
controller: 'EmailConfirmationController',
|
controller: 'EmailConfirmationController',
|
||||||
})
|
})
|
||||||
|
// Payment intents come here.
|
||||||
.when('/uri-payment/:data', {
|
.when('/uri-payment/:data', {
|
||||||
templateUrl: 'views/uri-payment.html'
|
template: " ", // just fire controller
|
||||||
|
controller: 'paymentUriController',
|
||||||
})
|
})
|
||||||
.when('/paymentIntent', {
|
.when('/selectWalletForPayment', {
|
||||||
templateUrl: 'views/paymentIntent.html',
|
template: " ", // just fire controller
|
||||||
|
controller: 'walletForPaymentController',
|
||||||
logged: true
|
logged: true
|
||||||
})
|
})
|
||||||
.when('/join', {
|
.when('/join', {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('go', function($window, $location) {
|
angular.module('copayApp.services').factory('go', function($window, $rootScope, $location) {
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
var hideSidebars = function() {
|
var hideSidebars = function() {
|
||||||
|
@ -44,7 +44,7 @@ angular.module('copayApp.services').factory('go', function($window, $location) {
|
||||||
var ref = window.open(url, '_blank', 'location=no');
|
var ref = window.open(url, '_blank', 'location=no');
|
||||||
};
|
};
|
||||||
|
|
||||||
root.go = function(path) {
|
root.path = function(path) {
|
||||||
var parts = path.split('#');
|
var parts = path.split('#');
|
||||||
$location.path(parts[0]);
|
$location.path(parts[0]);
|
||||||
if (parts[1])
|
if (parts[1])
|
||||||
|
@ -56,5 +56,35 @@ angular.module('copayApp.services').factory('go', function($window, $location) {
|
||||||
toggleSidebar(invert);
|
toggleSidebar(invert);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.walletHome = function() {
|
||||||
|
console.log('[go.js.25:walletHome:]'); //TODO
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
preconditions.checkState(w);
|
||||||
|
$rootScope.starting = false;
|
||||||
|
if (!w.isComplete()) {
|
||||||
|
root.path('copayers');
|
||||||
|
} else {
|
||||||
|
if ($rootScope.pendingPayment) {
|
||||||
|
root.path('selectWalletForPayment');
|
||||||
|
} else {
|
||||||
|
|
||||||
|
console.log('[go.js.36]'); //TODO
|
||||||
|
root.path('homeWallet');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
root.home = function() {
|
||||||
|
if ($rootScope.iden)
|
||||||
|
root.walletHome();
|
||||||
|
else
|
||||||
|
root.path('/');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
root.send = function() {
|
||||||
|
$location.path('send');
|
||||||
|
};
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,23 +27,6 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO should be on 'walletService' or 'go'
|
|
||||||
root.goWalletHome = function() {
|
|
||||||
var w = $rootScope.wallet;
|
|
||||||
if (w) {
|
|
||||||
$rootScope.starting = false;
|
|
||||||
if (!w.isComplete()) {
|
|
||||||
go.go('copayers');
|
|
||||||
} else {
|
|
||||||
if ($rootScope.pendingPayment) {
|
|
||||||
go.go('paymentIntent');
|
|
||||||
} else {
|
|
||||||
go.go('homeWallet');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
root.create = function(email, password, cb) {
|
root.create = function(email, password, cb) {
|
||||||
copay.Identity.create({
|
copay.Identity.create({
|
||||||
email: email,
|
email: email,
|
||||||
|
@ -133,10 +116,6 @@ angular.module('copayApp.services')
|
||||||
$rootScope.iden = iden;
|
$rootScope.iden = iden;
|
||||||
};
|
};
|
||||||
|
|
||||||
root.setPaymentWallet = function(w) {
|
|
||||||
root.setFocusedWallet(w);
|
|
||||||
$location.path('/send');
|
|
||||||
};
|
|
||||||
|
|
||||||
root.noFocusedWallet = function() {
|
root.noFocusedWallet = function() {
|
||||||
$rootScope.wallet = null;
|
$rootScope.wallet = null;
|
||||||
|
@ -296,7 +275,7 @@ angular.module('copayApp.services')
|
||||||
if (wid == iden.getLastFocusedWalletId()) {
|
if (wid == iden.getLastFocusedWalletId()) {
|
||||||
copay.logger.debug('GOT Focused wallet:', w.getName());
|
copay.logger.debug('GOT Focused wallet:', w.getName());
|
||||||
root.setFocusedWallet(w, true);
|
root.setFocusedWallet(w, true);
|
||||||
root.goWalletHome();
|
go.walletHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
// At the end (after all handlers are in place)...start the wallet.
|
// At the end (after all handlers are in place)...start the wallet.
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<div ng-controller="CopayersController">
|
<div ng-controller="CopayersController">
|
||||||
<div ng-if='$root.wallet && $root.wallet.isComplete()' ng-init="goToWallet()"></div>
|
|
||||||
|
|
||||||
<div class="row hide-for-large-up">
|
<div class="row hide-for-large-up">
|
||||||
<div class="medium-12 small-12 columns">
|
<div class="medium-12 small-12 columns">
|
||||||
<h1 translate>
|
<h1 translate>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<a class="close-reveal-modal" ng-click="cancel()">×</a>
|
||||||
|
|
||||||
|
<div class="size-14">
|
||||||
|
<h1 class="m30v">Payment Protocol Request</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b translate>Signature:</b>
|
||||||
|
<span ng-show="!!$root.merchant.pr.ca"><i class="fi-lock green"></i> {{$root.merchant.pr.ca}}</span>
|
||||||
|
<span ng-show="!$root.merchant.pr.ca"><i class="fi-unlock red"></i> Untrusted</span>
|
||||||
|
<p>
|
||||||
|
<b translate>Merchant Message:</b>
|
||||||
|
{{$root.merchant.pr.pd.memo || address}}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b translate>Merchant Message:</b>
|
||||||
|
<i>{{amount}} {{$root.wallet.settings.unitName}}</i>
|
||||||
|
<span class="text-gray" ng-if="isRateAvailable">
|
||||||
|
{{ alternative }} {{ alternativeIsoCode }}
|
||||||
|
</span>
|
||||||
|
<p ng-show="!!$root.merchant">
|
||||||
|
Expires {{$root.merchant.expiration | amTimeAgo }} [{{$root.merchant.domain}}]
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<a class="close-reveal-modal" ng-click="cancel()">×</a>
|
||||||
|
|
||||||
|
<h3>Select a wallet to make the payment</h3>
|
||||||
|
<span ng-show="!wallets[0]">Loading...</span>
|
||||||
|
<ul class="w-popup-menu" ng-show="wallets[0]" ng-class="{'large':wallets.length > 4, 'medium':wallets.length > 2 && wallets.length < 5}">
|
||||||
|
<li data-ng-repeat="item in wallets track by $index" class="nav-item" ng-click="ok(item)">
|
||||||
|
<div class="w-popup-icon">
|
||||||
|
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="w-popup-content">
|
||||||
|
<div class="">
|
||||||
|
<a class="size-12 wallet-item">
|
||||||
|
<div class="">
|
||||||
|
<div class="w-popup-main">[ {{item.requiredCopayers}} of {{item.totalCopayers}} ]</div>
|
||||||
|
<div class="w-popup-sub size-18">{{item.name || item.id}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="w-popup-sub">
|
||||||
|
<span ng-if="item.balanceInfo.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||||
|
<div ng-if="!item.balanceInfo.updatingBalance" data-options="disable_for_touch:true">
|
||||||
|
<b class="m5r size-12">{{item.balanceInfo.totalBalance || 0}} {{item.settings.unitName}}</b>
|
||||||
|
<span class="alt-currency size-10">{{item.balanceInfo.totalBalanceAlternative}} {{item.balanceInfo.alternativeIsoCode}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
<div ng-controller="PaymentIntentController" ng-init="open()">
|
|
||||||
<script type="text/ng-template" id="myModalContent.html">
|
|
||||||
<h3>Select a wallet to make the payment</h3>
|
|
||||||
<span ng-show="loading">Loading...</span>
|
|
||||||
<ul class="w-popup-menu" ng-show="wallets[0]"
|
|
||||||
ng-class="{'large':wallets.length > 4, 'medium':wallets.length > 2 && wallets.length < 5}">
|
|
||||||
<li data-ng-repeat="item in wallets track by $index" class="nav-item" ng-click="ok(item)">
|
|
||||||
<div class="w-popup-icon">
|
|
||||||
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
|
|
||||||
</div>
|
|
||||||
<div class="w-popup-content">
|
|
||||||
<div class="">
|
|
||||||
<a class="size-12 wallet-item">
|
|
||||||
<div class="">
|
|
||||||
<div class="w-popup-main">[ {{item.requiredCopayers}} of {{item.totalCopayers}} ]</div>
|
|
||||||
<div class="w-popup-sub size-18">{{item.name || item.id}}</div>
|
|
||||||
</div>
|
|
||||||
<div class="w-popup-sub">
|
|
||||||
<span ng-if="item.balanceInfo.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
|
||||||
<div ng-if="!item.balanceInfo.updatingBalance" data-options="disable_for_touch:true">
|
|
||||||
<b class="m5r size-12">{{item.balanceInfo.totalBalance || 0}} {{item.settings.unitName}}</b>
|
|
||||||
<span class="alt-currency size-10">{{item.balanceInfo.totalBalanceAlternative}} {{item.balanceInfo.alternativeIsoCode}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<a class="close-reveal-modal" ng-click="cancel()">×</a>
|
|
||||||
</script>
|
|
||||||
</div>
|
|
|
@ -48,7 +48,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" id="address" name="address" ng-disabled="loading || !!$root.merchant || isPayUri"
|
<input type="text" id="address" name="address" ng-disabled="loading || isPayUri"
|
||||||
placeholder="{{'Bitcoin address'|translate}}" ng-model="address" valid-address required>
|
placeholder="{{'Bitcoin address'|translate}}" ng-model="address" valid-address required>
|
||||||
<i class="fi-address-book"></i>
|
<i class="fi-address-book"></i>
|
||||||
<div ng-hide="showScanner || disableScanner">
|
<div ng-hide="showScanner || disableScanner">
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
<div class="small-9 columns">
|
<div class="small-9 columns">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="number" id="amount"
|
<input type="number" id="amount"
|
||||||
ng-disabled="loading || ($root.merchant && +$root.merchant.total > 0) || isPayUri"
|
ng-disabled="loading || isPayUri.fixedAmount"
|
||||||
name="amount" placeholder="{{'Amount'|translate}}" ng-model="amount"
|
name="amount" placeholder="{{'Amount'|translate}}" ng-model="amount"
|
||||||
ng-minlength="0.00000001" ng-maxlength="10000000000" valid-amount required
|
ng-minlength="0.00000001" ng-maxlength="10000000000" valid-amount required
|
||||||
autocomplete="off">
|
autocomplete="off">
|
||||||
|
@ -112,8 +112,7 @@
|
||||||
<div class="small-9 columns">
|
<div class="small-9 columns">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="number" id="alternative"
|
<input type="number" id="alternative"
|
||||||
ng-disabled="loading || !isRateAvailable || ($root.merchant && +$root.merchant.total > 0) ||
|
ng-disabled="loading || !isRateAvailable ||isPayUri"
|
||||||
isPayUri"
|
|
||||||
name="alternative" placeholder="{{'Amount'|translate}}" ng-model="alternative" requiredautocomplete="off">
|
name="alternative" placeholder="{{'Amount'|translate}}" ng-model="alternative" requiredautocomplete="off">
|
||||||
<i class="icon-usd"></i>
|
<i class="icon-usd"></i>
|
||||||
</div>
|
</div>
|
||||||
|
@ -136,10 +135,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="large-12 columns" ng-show="!!$root.merchant">
|
<div class="large-12 columns" ng-show="!!$root.merchant">
|
||||||
<h3 >This is a payment protocol transaction</h3>
|
<h3 >Payment Protocol Request</h3>
|
||||||
<div class="send-note">
|
<div class="send-note" ng-click="openPPModal(btx)">
|
||||||
<p>
|
<p>
|
||||||
<b>{{$root.merchant.pr.pd.memo || address}}</b>
|
<span ng-show="!!$root.merchant.pr.ca"><i class="fi-lock green"></i> {{$root.merchant.pr.ca}}</span>
|
||||||
|
<span ng-show="!$root.merchant.pr.ca"><i class="fi-unlock red"></i> Untrusted</span>
|
||||||
|
|
||||||
|
{{$root.merchant.pr.pd.memo || address}}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -150,8 +152,6 @@
|
||||||
<p ng-show="!!$root.merchant">
|
<p ng-show="!!$root.merchant">
|
||||||
Expires {{$root.merchant.expiration | amTimeAgo }}
|
Expires {{$root.merchant.expiration | amTimeAgo }}
|
||||||
[{{$root.merchant.domain}}]
|
[{{$root.merchant.domain}}]
|
||||||
<span ng-show="!!$root.merchant.pr.ca"><i class="fi-lock"></i> {{$root.merchant.pr.ca}}</span>
|
|
||||||
<span ng-show="!$root.merchant.pr.ca" style="color:red;weight:bold;"><i class="fi-unlock"></i> Untrusted</span>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
<div data-ng-init="" data-ng-controller="UriPaymentController">
|
|
||||||
|
|
||||||
<div class="loading-screen" data-alert>
|
|
||||||
<div class="spinner">
|
|
||||||
<div class="contener_general">
|
|
||||||
<div class="contener_mixte"><div class="ballcolor ball_1"> </div></div>
|
|
||||||
<div class="contener_mixte"><div class="ballcolor ball_2"> </div></div>
|
|
||||||
<div class="contener_mixte"><div class="ballcolor ball_3"> </div></div>
|
|
||||||
<div class="contener_mixte"><div class="ballcolor ball_4"> </div></div>
|
|
||||||
</div>
|
|
||||||
<span class="text-gray size-12" translate>Preparing payment...</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
Loading…
Reference in New Issue