mirror of https://github.com/BTCPrivate/copay.git
Bitpay card config external json
This commit is contained in:
parent
63916402a3
commit
222fbe57ff
|
@ -24,6 +24,7 @@
|
|||
"angular-mocks": "1.4.10",
|
||||
"bezier-easing": "^2.0.3",
|
||||
"bhttp": "^1.2.1",
|
||||
"bitauth": "^0.3.2",
|
||||
"bitcore-wallet-client": "4.3.1",
|
||||
"bower": "^1.7.9",
|
||||
"chai": "^3.5.0",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('bitpayCardIntroController', function($scope, $state, $timeout, $ionicHistory, storageService, externalLinkService, bitpayCardService, gettextCatalog, popupService) {
|
||||
angular.module('copayApp.controllers').controller('bitpayCardIntroController', function($scope, $log, $state, $timeout, $ionicHistory, storageService, externalLinkService, bitpayCardService, gettextCatalog, popupService) {
|
||||
|
||||
var checkOtp = function(obj, cb) {
|
||||
if (obj.otp) {
|
||||
|
@ -48,7 +48,10 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
|
|||
});
|
||||
});
|
||||
} else {
|
||||
// TODO
|
||||
// TEST TODO
|
||||
bitpayCardService.testSession(function(err, session) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,24 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('bitpayCardService', function($http, $log, lodash, storageService, bitauthService, platformInfo) {
|
||||
angular.module('copayApp.services').factory('bitpayCardService', function($http, $log, $window, lodash, storageService, bitauthService, platformInfo) {
|
||||
var root = {};
|
||||
var credentials = {};
|
||||
var bpSession = {};
|
||||
var pubkey, sin;
|
||||
|
||||
var _setCredentials = function() {
|
||||
if (!$window.externalServices || !$window.externalServices.bitpayCard) {
|
||||
return;
|
||||
}
|
||||
|
||||
var bitpayCard = $window.externalServices.bitpayCard;
|
||||
/*
|
||||
* Development: 'testnet'
|
||||
* Production: 'livenet'
|
||||
*/
|
||||
credentials.NETWORK = 'livenet';
|
||||
if (credentials.NETWORK == 'testnet') {
|
||||
credentials.BITPAY_PRIV_KEY = '';
|
||||
credentials.BITPAY_API_URL = 'https://test.bitpay.com';
|
||||
credentials.BITPAY_PRIV_KEY = bitpayCard.sandbox.secret;
|
||||
credentials.BITPAY_API_URL = bitpayCard.sandbox.host;
|
||||
}
|
||||
else {
|
||||
credentials.BITPAY_PRIV_KEY = '';
|
||||
credentials.BITPAY_API_URL = 'https://bitpay.com';
|
||||
credentials.BITPAY_PRIV_KEY = bitpayCard.production.secret;
|
||||
credentials.BITPAY_API_URL = bitpayCard.production.host;
|
||||
}
|
||||
try {
|
||||
pubkey = bitauthService.getPublicKeyFromPrivateKey(credentials.BITPAY_PRIV_KEY);
|
||||
|
@ -87,6 +92,12 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
|
|||
return credentials.BITPAY_API_URL;
|
||||
};
|
||||
|
||||
root.testSession = function(cb) {
|
||||
_getSession(function(err, session) {
|
||||
return cb(err, session);
|
||||
});
|
||||
};
|
||||
|
||||
var _postBitAuth = function(endpoint, data) {
|
||||
var dataToSign = credentials.BITPAY_API_URL + endpoint + JSON.stringify(data);
|
||||
var signedData = bitauthService.sign(dataToSign, credentials.BITPAY_PRIV_KEY);
|
||||
|
|
|
@ -70,6 +70,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
|
||||
// Plain URL
|
||||
} else if (/^https?:\/\//.test(data)) {
|
||||
if ($state.current.name == 'tabs.bitpayCardIntro' || $state.current.name == 'tabs.buyandsell.glidera') return false;
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.confirm', {paypro: data});
|
||||
|
|
|
@ -24,6 +24,10 @@ if (externalServices.glidera &&
|
|||
if (externalServices.glidera &&
|
||||
(externalServices.glidera.sandbox.mobile.client_id || externalServices.glidera.sandbox.desktop.client_id))
|
||||
console.log('Glidera Sandbox Enabled');
|
||||
if (externalServices.bitpayCard && externalServices.bitpayCard.production.secret)
|
||||
console.log('BitPay Card Production Enabled');
|
||||
if (externalServices.bitpayCard && externalServices.bitpayCard.sandbox.secret)
|
||||
console.log('BitPay Card Sandbox Enabled');
|
||||
|
||||
var content = 'window.externalServices=' + JSON.stringify(externalServices) + ';';
|
||||
fs.writeFileSync("./src/js/externalServices.js", content);
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<ion-view id="bitpayCard-intro">
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-back-button>
|
||||
</ion-nav-back-button>
|
||||
<ion-nav-title></ion-nav-title>
|
||||
<ion-nav-buttons side="secondary">
|
||||
<button class="button back-button button-clear" ng-click="orderBitPayCard()">
|
||||
<i class="icon ion-ios-information-outline"></i>
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
<ion-content scroll="false">
|
||||
<div class="text-center padding">
|
||||
<img src="img/bitpay-card-visa.svg" width="100%">
|
||||
</div>
|
||||
<ion-slide-box>
|
||||
<ion-slide>
|
||||
<p translate>
|
||||
Turn bitcoin into dollars, swipe anywhere Visa® is accepted.
|
||||
</p>
|
||||
</ion-slide>
|
||||
<ion-slide>
|
||||
<p translate>
|
||||
<span translate>Get local cash anywhere you go, from any Visa®-compatible ATM.</span>
|
||||
<div translate class="size-10 m20t text-center">
|
||||
*ATM bank fees may apply
|
||||
</div>
|
||||
</p>
|
||||
</ion-slide>
|
||||
<ion-slide>
|
||||
<p translate>
|
||||
Pay 0% fees to turn bitcoin into dollars.
|
||||
</p>
|
||||
</ion-slide>
|
||||
</ion-slide-box>
|
||||
<div class="cta-button">
|
||||
<button class="button button-block button-primary" ng-click="orderBitPayCard()" translate>
|
||||
Order the BitPay Card
|
||||
</button>
|
||||
<button class="button button-block button-transparent text-white m10t" ng-click="connectBitPayCard()" translate>
|
||||
Connect my BitPay Card
|
||||
</button>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-view>
|
|
@ -104,7 +104,7 @@
|
|||
<i class="icon bp-arrow-right"></i>
|
||||
</a>
|
||||
<a ui-sref="tabs.bitpayCardIntro"
|
||||
ng-if="bitpayCardEnabled && !bitpayCards[0]"
|
||||
ng-if="bitpayCardEnabled && !bitpayCards[0] && externalServices.BitpayCard"
|
||||
class="item item-icon-left item-big-icon-left item-icon-right">
|
||||
<i class="icon big-icon-svg">
|
||||
<div class="bg icon-bitpay-card"></div>
|
||||
|
|
Loading…
Reference in New Issue