Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var fs = require('fs');
var HOME = process.env['HOME'];
var bitauth = require('bitauth');
var bitpay = require('../index');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var privkey = bitauth.decrypt('', encPrivkey); // decrypt with your key pass
var client = bitpay.createClient(privkey);
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
var payload = {
items: [
{ price: 10, quantity: 1, description: 'thing' }
],
name: 'Bill Merchant',
address1: '1234 Fake St',
city: 'Atlanta',
state: 'GA',
var fs = require('fs');
var HOME = process.env['HOME'];
var bitauth = require('bitauth');
var bitpay = require('../index');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var privkey = bitauth.decrypt('', encPrivkey); // decrypt with your key pass
var client = bitpay.createClient(privkey);
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
var today = new Date().getTime();
var oneWeekAgo = new Date(today - 1000 * 60 * 60 * 24 * 7).getTime();
client.get('invoices', {
dateStart: oneWeekAgo,
dateEnd: today
}).pipe(process.stdout);
var fs = require('fs');
var HOME = process.env['HOME'];
var bitauth = require('bitauth');
var bitpay = require('../index');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var privkey = bitauth.decrypt('', encPrivkey); // decrypt with your key pass
var client = bitpay.createClient(privkey);
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
client.as('payroll').get('payouts', { status: 'new' }, function(err, request) {
console.log(err || request);
});
});
var fs = require('fs');
var HOME = process.env['HOME'];
var bitauth = require('bitauth');
var bitpay = require('../index');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var privkey = bitauth.decrypt('', encPrivkey); // decrypt with your key pass
var client = bitpay.createClient(privkey);
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
var today = new Date().getTime();
var oneWeekAgo = new Date(today - 1000 * 60 * 60 * 24 * 7).getTime();
client.get('ledgers', function(err, data) {
console.log(err || data);
});
});
var fs = require('fs');
var HOME = process.env['HOME'];
var bitauth = require('bitauth');
var bitpay = require('../index');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var privkey = bitauth.decrypt('', encPrivkey); // decrypt with your key pass
var client = bitpay.createClient(privkey);
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
var today = new Date().getTime();
var oneWeekAgo = new Date(today - 1000 * 60 * 60 * 24 * 7).getTime();
client.get('invoices', {
dateStart: oneWeekAgo,
dateEnd: today
}, function(err, data) {
console.log(err || data)
var assert = require('assert');
var fs = require('fs');
var BitPay = require('../lib/rest-client');
var HOME = process.env['HOME'];
var config = require('../config');
var bitauth = require('bitauth');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var privkey = bitauth.decrypt(config.keyPassword, encPrivkey);
var client = new BitPay( privkey , {
sticky: true
});
describe('Currency API', function() {
var bitpay = client.as('public');
describe('get currencies', function() {
it('should provide a list of currencies', function(done) {
client.get('currencies', done );
});
});
});
var assert = require('assert');
var fs = require('fs');
var BitPay = require('../lib/rest-client');
var HOME = process.env['HOME'];
var config = require('../config');
var bitauth = require('bitauth');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var privkey = bitauth.decrypt(config.keyPassword, encPrivkey);
var client = new BitPay( privkey , {
sticky: true
});
describe('Invoice API', function() {
var bitpay = client.as('merchant');
describe('get invoices', function() {
it('should provide a list of invoices', function(done) {
client.get('invoices', done );
});
});
describe('create invoice', function() {
var fs = require('fs');
var async = require('async');
var bitauth = require('bitauth');
var HOME = process.env['HOME'];
var BitPay = require('../lib/rest-client');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var config = require('../config');
var privkey = bitauth.decrypt(config.keyPassword, encPrivkey);
var client = new BitPay(privkey);
if (process.argv.length < 3) {
console.log('usage: get-payout-request.js [payoutId]');
return;
}
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
client.as('payroll').get('payouts/' + process.argv[2], { status: 'new' }, function(err, requests) {
console.log(err || requests);
});
var fs = require('fs');
var bitauth = require('bitauth');
var HOME = process.env['HOME'];
var BitPay = require('../lib/rest-client');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var config = require('../config');
var privkey = bitauth.decrypt(config.keyPassword, encPrivkey);
var client = new BitPay(privkey);
if (process.argv.length < 3) {
console.log("Usage: get-invoice-by-id.js [invoiceID]");
return;
}
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
client.get('invoices/' + process.argv[2], function(err, invoice) {
invoice.post('notifications', function(err, msg) {
console.log(err || msg);
var fs = require('fs');
var bitauth = require('bitauth');
var HOME = process.env['HOME'];
var BitPay = require('../lib/rest-client');
var encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString();
var config = require('../config');
var privkey = bitauth.decrypt(config.keyPassword, encPrivkey);
var client = new BitPay(privkey);
if (process.argv.length < 3) {
console.log("Usage: get-payout-request.js [invoiceID]");
return;
}
client.on('error', function(err) {
console.log(err);
});
client.on('ready', function() {
client.get('invoices/' + process.argv[2], function(err, invoice) {
if(err) console.log(err);
invoice.get('orphans', function(err, txs) {
console.log(err || txs)