New flow to link the bitpay card
This commit is contained in:
parent
4f5c814c50
commit
35cd6ce4cc
19 changed files with 385 additions and 384 deletions
|
|
@ -1,5 +1,5 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('bitpayCardIntroController', function($scope, $state, $timeout, $ionicHistory, storageService, externalLinkService, bitpayCardService) {
|
||||
angular.module('copayApp.controllers').controller('bitpayCardIntroController', function($scope, $state, $timeout, $ionicHistory, storageService, externalLinkService, bitpayCardService, gettextCatalog, popupService) {
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.data = {
|
||||
|
|
@ -13,6 +13,39 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
|
|||
spaceBetween: 100
|
||||
};
|
||||
|
||||
if (data.stateParams && data.stateParams.secret) {
|
||||
var obj = {
|
||||
secret: data.stateParams.secret,
|
||||
email: data.stateParams.email,
|
||||
otp: data.stateParams.otp
|
||||
};
|
||||
bitpayCardService.bitAuthPair(obj, function(err, data) {
|
||||
if (err) {
|
||||
popupService.showAlert(null, err);
|
||||
return;
|
||||
}
|
||||
var title = gettextCatalog.getString('Add BitPay Cards?');
|
||||
var msg = gettextCatalog.getString('Would you like to add this account to your wallet?');
|
||||
var ok = gettextCatalog.getString('Add cards');
|
||||
var cancel = gettextCatalog.getString('Go back');
|
||||
popupService.showConfirm(title, msg, ok, cancel, function(res) {
|
||||
if (res) {
|
||||
// Save data
|
||||
bitpayCardService.setBitpayDebitCards(data, function(err) {
|
||||
if (err) return;
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/*
|
||||
storageService.getNextStep('BitpayCard', function(err, value) {
|
||||
if (value) {
|
||||
$ionicHistory.nextViewOptions({
|
||||
|
|
@ -24,6 +57,7 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
|
|||
}, 100);
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
$scope.orderBitPayCard = function() {
|
||||
|
|
@ -32,7 +66,11 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
|
|||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.connectBitPayCard = function() {};
|
||||
$scope.connectBitPayCard = function() {
|
||||
var url = 'https://bitpay.com/visa/login';
|
||||
var target = '_system';
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.goBack = function() {
|
||||
if ($scope.data.index != 0) $scope.slider.slidePrev();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue