mirror of https://github.com/BTCPrivate/copay.git
commit
279b1c274f
|
@ -42,7 +42,7 @@
|
||||||
ng-attr-placeholder="{{'Amount in USD'}}"
|
ng-attr-placeholder="{{'Amount in USD'}}"
|
||||||
min="0.01"
|
min="0.01"
|
||||||
max="500"
|
max="500"
|
||||||
ng-model="fiat"
|
ng-model="formData.fiat"
|
||||||
ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/"
|
ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/"
|
||||||
step="0.01"
|
step="0.01"
|
||||||
autocomplete="off" ignore-mouse-wheel required>
|
autocomplete="off" ignore-mouse-wheel required>
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<wallets ng-if="wallets[0]" wallets="wallets"></wallets>
|
<wallets ng-if="wallets[0]" wallets="wallets"></wallets>
|
||||||
|
|
||||||
<button class="button button-block button-positive"
|
<button class="button button-block button-positive"
|
||||||
ng-disabled="!fiat"
|
ng-disabled="!formData.fiat"
|
||||||
type="submit">
|
type="submit">
|
||||||
Buy now
|
Buy now
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
angular.module('copayApp.controllers').controller('amazonController',
|
angular.module('copayApp.controllers').controller('amazonController',
|
||||||
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, externalLinkService, popupService) {
|
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, externalLinkService, popupService) {
|
||||||
|
|
||||||
|
$scope.network = amazonService.getEnvironment();
|
||||||
|
|
||||||
$scope.openExternalLink = function(url, target) {
|
$scope.openExternalLink = function(url, target) {
|
||||||
externalLinkService.open(url, target);
|
externalLinkService.open(url, target);
|
||||||
};
|
};
|
||||||
|
|
||||||
var initAmazon = function() {
|
var initAmazon = function() {
|
||||||
$scope.network = amazonService.getEnvironment();
|
|
||||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(err);
|
popupService.showAlert(err);
|
||||||
|
@ -82,7 +83,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.enter", function(event, data){
|
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||||
initAmazon();
|
initAmazon();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, externalLinkService, popupService) {
|
function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, externalLinkService, popupService) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var network = amazonService.getEnvironment();
|
||||||
var wallet;
|
var wallet;
|
||||||
|
|
||||||
$scope.$on('Wallet/Changed', function(event, w) {
|
$scope.$on('Wallet/Changed', function(event, w) {
|
||||||
|
@ -20,7 +21,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
};
|
};
|
||||||
|
|
||||||
this.confirm = function() {
|
this.confirm = function() {
|
||||||
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {amount: $scope.fiat});
|
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {amount: $scope.formData.fiat});
|
||||||
var ok = gettextCatalog.getString('Buy');
|
var ok = gettextCatalog.getString('Buy');
|
||||||
popupService.showConfirm(null, message, ok, null, function(res) {
|
popupService.showConfirm(null, message, ok, null, function(res) {
|
||||||
if (res) self.createTx();
|
if (res) self.createTx();
|
||||||
|
@ -40,7 +41,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
|
|
||||||
var dataSrc = {
|
var dataSrc = {
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
amount: $scope.fiat,
|
amount: $scope.formData.fiat,
|
||||||
uuid: wallet.id
|
uuid: wallet.id
|
||||||
};
|
};
|
||||||
var outputs = [];
|
var outputs = [];
|
||||||
|
@ -209,7 +210,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.enter", function(event, data){
|
$scope.$on("$ionicView.enter", function(event, data){
|
||||||
var network = amazonService.getEnvironment();
|
$scope.formData = { fiat: null };
|
||||||
$scope.wallets = profileService.getWallets({
|
$scope.wallets = profileService.getWallets({
|
||||||
network: network,
|
network: network,
|
||||||
onlyComplete: true
|
onlyComplete: true
|
||||||
|
|
|
@ -3,11 +3,14 @@
|
||||||
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout, $state, $ionicHistory, $log, addressbookService) {
|
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout, $state, $ionicHistory, $log, addressbookService) {
|
||||||
|
|
||||||
if ($scope.cb) $timeout($scope.cb, 100);
|
if ($scope.cb) $timeout($scope.cb, 100);
|
||||||
|
$scope.fromSendTab = $ionicHistory.viewHistory().backView.stateName === "tabs.send.amount";
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$ionicHistory.removeBackView();
|
|
||||||
$state.go('tabs.home');
|
|
||||||
$scope.txStatusModal.hide();
|
$scope.txStatusModal.hide();
|
||||||
|
if ($scope.fromSendTab) {
|
||||||
|
$ionicHistory.removeBackView();
|
||||||
|
$state.go('tabs.home');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.save = function(addressbookEntry) {
|
$scope.save = function(addressbookEntry) {
|
||||||
|
@ -23,7 +26,6 @@ angular.module('copayApp.controllers').controller('txStatusController', function
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.fromSendTab = $ionicHistory.viewHistory().backView.stateName === "tabs.send.amount";
|
|
||||||
addressbookService.list(function(err, ab) {
|
addressbookService.list(function(err, ab) {
|
||||||
if (err) $log.error(err);
|
if (err) $log.error(err);
|
||||||
if (ab[$scope.tx.toAddress]) {
|
if (ab[$scope.tx.toAddress]) {
|
||||||
|
|
Loading…
Reference in New Issue