Buy gift card. Limits
This commit is contained in:
parent
ef650aff86
commit
3e78971446
7 changed files with 221 additions and 193 deletions
|
|
@ -19,7 +19,7 @@ angular.module('copayApp.services').factory('mercadoLibreService', function($htt
|
|||
credentials.NETWORK = 'testnet';
|
||||
|
||||
if (credentials.NETWORK == 'testnet') {
|
||||
credentials.BITPAY_API_URL = "https://test.bitpay.com";
|
||||
credentials.BITPAY_API_URL = "https://gustavo.bp:8088";
|
||||
} else {
|
||||
credentials.BITPAY_API_URL = "https://bitpay.com";
|
||||
};
|
||||
|
|
@ -102,16 +102,13 @@ angular.module('copayApp.services').factory('mercadoLibreService', function($htt
|
|||
};
|
||||
|
||||
root.createBitPayInvoice = function(data, cb) {
|
||||
|
||||
// TODO
|
||||
var dataSrc = {
|
||||
currency: 'USD' || data.currency,
|
||||
currency: data.currency,
|
||||
amount: data.amount,
|
||||
clientId: data.uuid
|
||||
};
|
||||
console.log('[mercadoLibreService.js:106]',dataSrc); //TODO
|
||||
|
||||
$http(_postBitPay('/amazon-gift/pay', dataSrc)).then(function(data) {
|
||||
$http(_postBitPay('/mercado-libre-gift/pay', dataSrc)).then(function(data) {
|
||||
$log.info('BitPay Create Invoice: SUCCESS');
|
||||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
|
|
@ -131,22 +128,6 @@ console.log('[mercadoLibreService.js:106]',dataSrc); //TODO
|
|||
};
|
||||
|
||||
root.createGiftCard = function(data, cb) {
|
||||
console.log('[mercadoLibreService.js:132]',data); //TODO
|
||||
|
||||
return cb(null, {
|
||||
"id": "f2bd6204fc49661a56057d33e37e32f2518ae92eea2f5457c379434712e35537",
|
||||
"currency_id": data.currency,
|
||||
"external_reference": "external_id_123456",
|
||||
"initial_amount": data.amount,
|
||||
"balance": 59.99,
|
||||
"status": "active",
|
||||
"date_creation": "20170314T10:39:14.82603:00",
|
||||
"date_activation": "20170314T10:39:15.31603:00",
|
||||
"date_expiration": "20180914T10:39:15.31603:00",
|
||||
"date_last_updated": "20170314T10:39:15.32103:00",
|
||||
"pin": "UYNHSIONUY"
|
||||
});
|
||||
|
||||
var dataSrc = {
|
||||
"clientId": data.uuid,
|
||||
"invoiceId": data.invoiceId,
|
||||
|
|
@ -164,6 +145,10 @@ console.log('[mercadoLibreService.js:132]',data); //TODO
|
|||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Disabled for now *
|
||||
*/
|
||||
/*
|
||||
root.cancelGiftCard = function(data, cb) {
|
||||
|
||||
var dataSrc = {
|
||||
|
|
@ -180,6 +165,7 @@ console.log('[mercadoLibreService.js:132]',data); //TODO
|
|||
return cb(data.data);
|
||||
});
|
||||
};
|
||||
*/
|
||||
|
||||
var register = function() {
|
||||
storageService.getMercadoLibreGiftCards(root.getNetwork(), function(err, giftCards) {
|
||||
|
|
|
|||
|
|
@ -767,12 +767,14 @@ angular.module('copayApp.services')
|
|||
|
||||
if (opts.hasFunds) {
|
||||
ret = lodash.filter(ret, function(w) {
|
||||
if (!w.status) return;
|
||||
return (w.status.availableBalanceSat > 0);
|
||||
});
|
||||
}
|
||||
|
||||
if (opts.minAmount) {
|
||||
ret = lodash.filter(ret, function(w) {
|
||||
if (!w.status) return;
|
||||
return (w.status.availableBalanceSat > opts.minAmount);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue