Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

daplie-tools

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

daplie-tools - npm Package Compare versions

Comparing version 1.0.0-alpha.7 to 1.0.0-alpha.8

154

bin/daplie.js

@@ -95,2 +95,36 @@ #!/usr/bin/env node

function listCards(opts, card1) {
return oauth3.Cards.list(opts).then(function (results) {
var cards = results.results || results;
console.log('');
console.log('PRIORITY\tBRAND\tLAST 4\tEXPIRES\tDEFAULT\tNICK\t\tCOMMENT');
console.log('');
cards.forEach(function (card) {
var brand = card.brand
.replace(/American Express/i, 'AMEX')
.replace(/MasterCard/i, 'MC')
.replace(/Discover/i, 'Disc')
;
var isDefault = ' ';
if (card1 && card1.brand === card.brand && card1.exp === card.exp) {
brand = '^' + brand;
}
if (card.default) {
//brand += '*';
isDefault = ' YES ';
}
console.log(
(card.priority || 'ERR')
+ '\t\t' + brand
+ '\t' + card.last4 // TODO xxxx-xxxx-xxxx-abcd
+ '\t' + pad(card.exp_month) + '/' + String(card.exp_year).slice(2)
+ '\t' + isDefault
+ '\t' + (card.nick || '')
+ '\t' + (card.comment || '')
);
});
console.log('');
});
}
if ('auth' === cmd) {

@@ -580,2 +614,4 @@ console.log("");

console.log(" wallet:sources:remove # remove a credit card");
console.log(" wallet:sources:update # set the default (or the priority)");
//console.log(" wallet:sources:default # alias of wallet:sources:update --default");
console.log("");

@@ -587,20 +623,5 @@ return;

program.provider = cliOptions.provider;
oauth3.Cards.list(program.opts()).then(function (results) {
var cards = results.results || results;
var opts = program.opts();
console.log('');
console.log('BRAND\tLAST 4\tEXPIRES AT');
console.log('');
cards.forEach(function (card) {
console.log(
(card.brand||'')
.replace(/American Express/i, 'AMEX')
.replace(/MasterCard/i, 'MC')
.replace(/Discover/i, 'Disc')
+ '\t' + card.last4 // TODO xxxx-xxxx-xxxx-abcd
+ '\t' + pad(card.exp_month) + '/' + String(card.exp_year).slice(2)
);
});
console.log('');
});
listCards(opts, null);
}

@@ -616,2 +637,6 @@

.option('--cc-nick <value>', 'Credit Card nickname (defaults to email)')
.option('--priority <n>', 'Manually set the priority (where 100 is high, 1000 is low)')
.option('--nick <value>', 'Choose a new nickname for this card')
.option('--comment <value>', 'Set an arbirtrary comment for this card')
//.option('--cc- <value>', '')

@@ -629,27 +654,64 @@ .parse(process.argv)

var opts = program.opts();
opts.ccPriority = opts.priority;
opts.ccNick = opts.nick;
opts.ccComment = opts.comment;
program.provider = cliOptions.provider;
oauth3.Cards.add(program.opts()).then(function (card1) {
return oauth3.Cards.list(program.opts()).then(function (results) {
var cards = results.results || results;
console.log('');
console.log('BRAND\tLAST 4\tEXPIRES AT');
console.log('');
cards.forEach(function (card) {
if (card1.brand === card.brand && card1.exp === card.exp) {
card.brand += '*';
}
console.log(
card.brand
.replace(/American Express/i, 'AMEX')
.replace(/MasterCard/i, 'MC')
.replace(/Discover/i, 'Disc')
+ '\t' + card.last4 // TODO xxxx-xxxx-xxxx-abcd
+ '\t' + pad(card.exp_month) + '/' + String(card.exp_year).slice(2)
);
});
console.log('');
});
return listCards(opts, card1);
});
}
else if ('wallet:sources:update' === cmd) {
program
.usage('wallet:sources:update --last4 <xxxx>')
.option('--last4 <value>', 'Last 4 of credit card (xxxx-xxxx-xxxx-XXXXX)')
.option('--comment <value>', 'Set an arbirtrary comment for this card')
.option('--default', 'Set this card as default (sets priority to highest)')
//.option('--exp <value>', 'Update the expiration date (and re-test card authorization)')
//.option('--new-nick <value>', 'Choose a new nickname for this card')
//.option('--email <value>', 'Choose a new receipt email for this card')
.option('--nick <value>', 'Choose a new nickname for this card')
.option('--priority <n>', 'Manually set the priority (where 100 is high, 1000 is low)')
.parse(process.argv)
;
var opts = program.opts();
if (helpme
|| !(opts.last4)
|| !(opts.default || opts.priority || opts.nick || opts.comment || opts.exp)
) {
program.help();
console.log('');
console.log("Example: daplie wallet:sources:update --last4 4321");
console.log('');
return;
}
var opts = program.opts();
opts.ccPriority = opts.priority;
opts.ccNick = opts.nick;
opts.ccComment = opts.comment;
if (opts.brand) {
if ('amex' === opts.brand.toLowerCase()) {
program.brand = 'American Express';
}
else if ('mc' === opts.brand.toLowerCase()) {
program.brand = 'MasterCard';
}
else if ('disc' === opts.brand.toLowerCase()) {
program.brand = 'Discover';
}
else if (/^(dci|diner)/i.test(opts.brand)) {
program.brand = 'Diners Club';
}
}
opts.provider = cliOptions.provider;
oauth3.Cards.update(opts).then(function (updatedCard) {
return listCards(opts, null);
});
}
else if ('wallet:sources:remove' === cmd) {

@@ -690,19 +752,3 @@ program

oauth3.Cards.remove(program.opts()).then(function (/*deletedCard*/) {
return oauth3.Cards.list(program.opts()).then(function (results) {
var cards = results.results || results;
console.log('');
console.log('BRAND\tLAST 4\tEXPIRES AT');
console.log('');
cards.forEach(function (card) {
console.log(
card.brand
.replace(/American Express/i, 'AMEX')
.replace(/MasterCard/i, 'MC')
.replace(/Discover/i, 'Disc')
+ '\t' + card.last4 // TODO xxxx-xxxx-xxxx-abcd
+ '\t' + pad(card.exp_month) + '/' + String(card.exp_year).slice(2)
);
});
console.log('');
});
return listCards(opts, null);
});

@@ -709,0 +755,0 @@ }

{
"name": "daplie-tools",
"version": "1.0.0-alpha.7",
"version": "1.0.0-alpha.8",
"description": "Taking back the Internet",

@@ -35,5 +35,5 @@ "main": "index.js",

"commander": "^2.9.0",
"oauth3-cli": "git+https://github.com/OAuth3/oauth3-cli.git#v1.0.0-alpha.7",
"oauth3-cli": "git+https://github.com/OAuth3/oauth3-cli.git#v1.0.0-alpha.8",
"request": "^2.69.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc