Socket
Socket
Sign inDemoInstall

dotdashpay

Package Overview
Dependencies
129
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.2 to 0.3.3

tests/simulator.test.js

280

examples/reference.example.js

@@ -0,1 +1,8 @@

/**
Autogenerated example for API request: PreAuthorize
**/
// @reference()
// @standalone(try_api_short)

@@ -10,3 +17,3 @@ var dotdashpay = require("dotdashpay");

.onSettled(function(response) {
console.log("sSettlement finished! Transaction id: " + response.settleId);
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);

@@ -16,19 +23,5 @@ })

console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
/**
Autogenerated example for API request: PreAuthorize
**/
// @reference()
// @reference-end()

@@ -89,2 +82,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -148,2 +158,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -194,2 +221,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -240,2 +284,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -273,2 +334,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -405,2 +483,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -472,2 +567,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -512,2 +624,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -544,2 +673,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -578,2 +724,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -611,2 +774,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -652,2 +832,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -689,2 +886,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -721,2 +935,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -754,2 +985,19 @@

// @reference()
// @standalone(try_api_short)
var dotdashpay = require("dotdashpay");
dotdashpay.setup({
simulate: true,
apiToken: "@api-token()"
});
dotdashpay.payment.receivePaymentDataThenSettle({ cents: 100 })
.onSettled(function(response) {
console.log("Settlement finished! Transaction id: " + response.settle_id);
process.exit(0);
})
.onError(function(errorData) {
console.error("Unexpected error while processing receivePaymentDataThenSettle: " + errorData);
process.exit(0);
});
// @standalone-end()
// @reference-end()

@@ -756,0 +1004,0 @@

@@ -80,2 +80,6 @@ /**

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'receivePaymentData' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -142,2 +146,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'getDatalinkStatus' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -193,2 +201,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'getInternetStatus' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -244,2 +256,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'configurePeripheral' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -295,2 +311,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'configureWifi' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -346,2 +366,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'configureEthernet' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -397,2 +421,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'getConnectedPeripherals' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -399,0 +427,0 @@ });

@@ -49,2 +49,6 @@ /**

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'getCustomerId' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -100,2 +104,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'receiveLogs' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -102,0 +110,0 @@ });

@@ -80,2 +80,6 @@ /**

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'preAuthorize' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -143,2 +147,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'settle' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -205,2 +213,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'voidPreAuthorize' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -256,2 +268,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'refund' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -307,2 +323,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'configureProcessor' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -361,2 +381,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'receivePaymentDataThenSettle' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -448,2 +472,6 @@ });

_.each(requestDataArgs, function(val, key) {
if (thisProtobuf[key] === undefined) {
throw new Error("Request 'receivePaymentDataThenPreAuthorize' does not accept an argument with name '" + key + "'");
}
thisProtobuf[key] = val;

@@ -450,0 +478,0 @@ });

@@ -47,3 +47,19 @@ /**

module.exports.setResponse = function setResponse(responseName, data, raiseError) {
// TODO(cjrd) validate the arguments
// Check the input arguments
var responseProto = null;
try {
responseProto = protoTools.getProtobuf(raiseError ? "ErrorResponse" : responseName);
} catch (err) {
throw new Error("Unable to set the simulator.setResponse for " +
responseName + ". Response with that name does not exist");
}
_.each(data, function(val, key) {
if (responseProto[key] === undefined) {
throw new Error("simulator.setResponse error: response with name " + responseName
+ " does not have a field with name " + key);
}
});
// Setup the simulator response
var useData = {};

@@ -54,3 +70,2 @@ var responseType = "partial";

var errResponse = protoTools.getProtobuf("ErrorResponse");
if (data.errorMessage !== undefined){

@@ -62,3 +77,2 @@ errResponse.errorMessage = data.errorMessage;

}
useData = errResponse.encode().toBase64();

@@ -72,3 +86,3 @@ } else {

// RADO: we just need to make sure we're encoding the simulator state in the way the simulator expects it
// set the simulator state
simulatorState[responseName] = {

@@ -75,0 +89,0 @@ type: responseType,

13

lib/util/protobuf-tools.js

@@ -39,4 +39,8 @@ /**

// TODO(cjrd) docs
module.exports.getProtobufConstructor = function getProtobufConstructor (msgName) {
/**
Returns the constructor for a protobuf message with the given input name
@param {String} msgName: the name of the protobuf message
**/
module.exports.getProtobufConstructor = function getProtobufConstructor(msgName) {
return requestProtobufs[msgName];

@@ -58,3 +62,6 @@ };

// TODO docs
/**
Return the input protobuf wrapped in a datalink protobuf message
*/
module.exports.wrapInDataLinkFrame = function wrapInDataLinkFrame(msgName, msgObj) {

@@ -61,0 +68,0 @@ var dataLinkFrame = module.exports.getProtobuf("DataLinkFrame");

{
"name": "dotdashpay",
"version": "0.3.2",
"version": "0.3.3",
"description": "DotDashPay Node API",

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

@@ -84,3 +84,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.hardware.configureEthernet({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'configureEthernet' called with non existant field");
});
});
});

@@ -80,3 +80,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.hardware.configurePeripheral({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'configurePeripheral' called with non existant field");
});
});
});

@@ -81,3 +81,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.payment.configureProcessor({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'configureProcessor' called with non existant field");
});
});
});

@@ -88,3 +88,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.hardware.configureWifi({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'configureWifi' called with non existant field");
});
});
});

@@ -81,3 +81,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.hardware.getConnectedPeripherals({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'getConnectedPeripherals' called with non existant field");
});
});
});

@@ -83,3 +83,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.information.getCustomerId({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'getCustomerId' called with non existant field");
});
});
});

@@ -83,3 +83,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.hardware.getDatalinkStatus({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'getDatalinkStatus' called with non existant field");
});
});
});

@@ -87,3 +87,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.hardware.getInternetStatus({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'getInternetStatus' called with non existant field");
});
});
});

@@ -136,3 +136,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.payment.preAuthorize({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'preAuthorize' called with non existant field");
});
});
});

@@ -85,3 +85,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.information.receiveLogs({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'receiveLogs' called with non existant field");
});
});
});

@@ -99,3 +99,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.hardware.receivePaymentData({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'receivePaymentData' called with non existant field");
});
});
});

@@ -159,3 +159,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.payment.receivePaymentDataThenPreAuthorize({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'receivePaymentDataThenPreAuthorize' called with non existant field");
});
});
});

@@ -164,3 +164,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.payment.receivePaymentDataThenSettle({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'receivePaymentDataThenSettle' called with non existant field");
});
});
});

@@ -116,3 +116,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.payment.refund({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'refund' called with non existant field");
});
});
});

@@ -142,3 +142,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.payment.settle({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'settle' called with non existant field");
});
});
});

@@ -116,3 +116,14 @@ /**

});
it("should throw an error when a field is input that does not exist", function() {
var errRegexp = new RegExp("does not accept an argument with name");
try {
dotdashpay.payment.voidPreAuthorize({ nonExistantFieldNameYEah: 5 })
} catch (err) {
assert.isTrue(errRegexp.test(String(err)));
return
}
throw new Error("Did not throw an error when rpc 'voidPreAuthorize' called with non existant field");
});
});
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc