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

cheddargetter

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheddargetter - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/index.js~

59

lib/cheddargetter.js

@@ -5,3 +5,3 @@ var https = require("https");

var ceddargetter = module.exports = function (user, pass, productCode) {
var cheddargetter = module.exports = function (user, pass, productCode) {
this.auth = "Basic " + new Buffer(user + ":" + pass).toString("base64");

@@ -12,3 +12,3 @@ this.pass = pass;

ceddargetter.prototype.callAPI = function (data, path, callback) {
cheddargetter.prototype.callAPI = function (data, path, callback) {
if (typeof(path) == "function") {

@@ -60,11 +60,11 @@ callback = path;

ceddargetter.prototype.getAllPricingPlans = function (callback) {
cheddargetter.prototype.getAllPricingPlans = function (callback) {
this.callAPI("/plans/get/productCode/" + this.productCode, callback);
};
ceddargetter.prototype.getPricingPlan = function (code, callback) {
cheddargetter.prototype.getPricingPlan = function (code, callback) {
this.callAPI("/plans/get/productCode/" + this.productCode + "/code/" + code, callback);
};
ceddargetter.prototype.getAllCustomers = function (data, callback) {
cheddargetter.prototype.getAllCustomers = function (data, callback) {
if (!callback && typeof(data) == "function") {

@@ -77,20 +77,59 @@ callback = data;

ceddargetter.prototype.getCustomer = function (code, callback) {
cheddargetter.prototype.getCustomer = function (code, callback) {
this.callAPI("/customers/get/productCode/" + this.productCode + "/code/" + code, callback);
};
ceddargetter.prototype.createCustomer = function (data, callback) {
cheddargetter.prototype.createCustomer = function (data, callback) {
this.callAPI(data, "/customers/new/productCode/" + this.productCode, callback);
};
ceddargetter.prototype.editCustomer = function (code, data, callback) {
cheddargetter.prototype.editCustomerAndSubscription = function (code, data, callback) {
this.callAPI(data, "/customers/edit/productCode/" + this.productCode + "/code/" + code, callback);
};
cheddargetter.prototype.editCustomer = function (code, data, callback) {
this.callAPI(data, "/customers/edit-customer/productCode/" + this.productCode + "/code/" + code, callback);
};
ceddargetter.prototype.editSubscription = function (code, data, callback) {
cheddargetter.prototype.editSubscription = function (code, data, callback) {
this.callAPI(data, "/customers/edit-subscription/productCode" + this.productCode + "/code/" + code, callback);
};
ceddargetter.prototype.deleteCustomer = function (customerCode, callback) {
cheddargetter.prototype.deleteCustomer = function (customerCode, callback) {
this.callAPI("/customers/delete/productCode/" + this.productCode + "/code/" + customerCode, callback);
};
cheddargetter.prototype.cancelSubscription = function (customerCode, callback) {
this.callAPI("/customers/cancel/productCode/" + this.productCode + "/code/" + customerCode, callback);
};
cheddargetter.prototype.addItem = function (customerCode, itemCode, amount, callback) {
if (!callback && typeof(amount) == "function") {
callback = amount;
amount = null;
}
if (amount) {
amount = {quantity: amount.toString()};
}
this.callAPI(amount, "/customers/add-item-quantity/productCode/" + this.productCode + "/code/" + customerCode + "/itemCode/" + itemCode, callback);
};
cheddargetter.prototype.removeItem = function (customerCode, itemCode, amount, callback) {
if (!callback && typeof(amount) == "function") {
callback = amount;
amount = null;
}
if (amount) {
amount = {quantity: amount.toString()};
}
this.callAPI(amount, "/customers/remove-item-quantity/productCode/" + this.productCode + "/code/" + customerCode + "/itemCode/" + itemCode, callback);
};
cheddargetter.prototype.setItemQuantity = function (customerCode, itemCode, amount, callback) {
amount = {quantity: amount.toString()};
this.callAPI(amount, "/customers/set-item-quantity/productCode/" + this.productCode + "/code/" + customerCode + "/itemCode/" + itemCode, callback);
};

13

package.json
{
"name": "cheddargetter",
"version": "0.0.1",
"version": "0.0.2",
"author": "Kevin Smith",
"repository": {
"type": "git",
"url": "https://github.com/respectTheCode/node-cheddargetter"
},
"description": "Wrapper for the CheddarGetter recurring billing system APIs",
"homepage": "https://github.com/respectTheCode/node-cheddargetter",
"dependencies": {
"async": ">=0.1.x",
"async": "0.1.x",
"xml2js": "0.1.x",
"qs": "0.3.x",
"qs": "0.3.x"
},
"devDependencies": {
"nodeunit": "0.6.x"

@@ -11,0 +18,0 @@ },

@@ -0,1 +1,5 @@

# Install
npm install cheddargetter
# Usage

@@ -2,0 +6,0 @@

@@ -62,3 +62,2 @@ var fs = require("fs");

}, function (result, cb) {
console.log(result);
cg.getAllCustomers(cb);

@@ -71,2 +70,34 @@ }, function (result, cb) {

test.equal(typeof(result.customer), "object", "getCustomer should return a customer object");
//cg.deleteCustomer("test", cb);
cb();
}], function (err) {
test.ifError(err);
test.done();
});
};
module.exports.Items = function (test) {
var cg = new CheddarGetter(config.user, config.pass, config.productCode);
async.waterfall([function (cb) {
cg.setItemQuantity("test", config.itemCode, 5, cb);
}, function (result, cb) {
cg.addItem("test", config.itemCode, 2, cb);
}, function (result, cb) {
cg.addItem("test", config.itemCode, cb);
}, function (result, cb) {
cg.getCustomer("test", cb);
}, function (result, cb) {
test.equal(result.customer.subscriptions.subscription.items.item[0].quantity, "7");
cb(null, {});
}, function (result, cb) {
cg.removeItem("test", config.itemCode, 2, cb);
}, function (result, cb) {
cg.removeItem("test", config.itemCode, cb);
}, function (result, cb) {
cg.getCustomer("test", cb);
}, function (result, cb) {
test.equal(result.customer.subscriptions.subscription.items.item[0].quantity, "5");
cb(null, {});
}, function (result, cb) {
cg.deleteCustomer("test", cb);

@@ -73,0 +104,0 @@ }], function (err) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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