Socket
Socket
Sign inDemoInstall

opennode

Package Overview
Dependencies
5
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.1

8

package.json

@@ -12,7 +12,7 @@ {

"name": "OpenNode Inc",
"email": "support@opennode.co",
"url": "https://opennode.co"
"email": "support@opennode.com",
"url": "https://opennode.com"
},
"contributors": [
"João Almeida <joao@opennode.co>"
"João Almeida <joao@opennode.com>"
],

@@ -30,3 +30,3 @@ "license": "MIT",

"main": "src/lib.js",
"version": "1.1.1",
"version": "1.2.1",
"dependencies": {

@@ -33,0 +33,0 @@ "axios": "^0.18.0"

@@ -75,3 +75,3 @@ # OpenNode Node.js Library

const charge = req.body;
const isValid = opennode.signatureIsValid(charge);
const isValid = await opennode.signatureIsValid(charge);

@@ -78,0 +78,0 @@ if (isValid){

const axios = require('axios');
const crypto = require('crypto');
const version = 'npm-opennode-v1.1.0';
const version = 'npm-opennode-v1.2.0';
var instance = undefined;

@@ -10,3 +10,3 @@ var api_key;

function setCredentials(key = '', environment = 'live') {
if (instance != undefined) return;
if (instance !== undefined) return;

@@ -16,3 +16,3 @@ api_key = key;

env = environment;
instance.defaults.baseURL = (environment === 'live') ? 'https://api.opennode.co/v1' : 'https://dev-api.opennode.co/v1';
instance.defaults.baseURL = (environment === 'live') ? 'https://api.opennode.com/v1' : 'https://dev-api.opennode.com/v1';
instance.defaults.timeout = 15000;

@@ -123,3 +123,3 @@ instance.defaults.headers = { 'Authorization' : api_key, 'user_agent' : version };

let new_instance = axios.create();
new_instance.defaults.baseURL = (env === 'live') ? 'https://api.opennode.co/v2' : 'https://dev-api.opennode.co/v2';
new_instance.defaults.baseURL = (env === 'live') ? 'https://api.opennode.com/v2' : 'https://dev-api.opennode.com/v2';
new_instance.defaults.timeout = 15000;

@@ -141,2 +141,32 @@ new_instance.defaults.headers = { 'Authorization' : api_key, 'user_agent' : version };

async function refundCharge(refund) {
try {
const response = await instance.post(`/refunds`, refund);
return response.data.data;
}
catch (error) {
throw Exception(error.response.status, error.response.statusText, error.response.data.message);
}
}
async function listRefunds() {
try {
const response = await instance.get(`/refunds`);
return response.data.data;
}
catch (error) {
throw Exception(error.response.status, error.response.statusText, error.response.data.message);
}
}
async function refundInfo(id) {
try {
const response = await instance.get(`/refund/${id}`);
return response.data.data;
}
catch (error) {
throw Exception(error.response.status, error.response.statusText, error.response.data.message);
}
}
function Exception(statusCode, statusText, message) {

@@ -164,3 +194,6 @@ var error = new Error(message);

getBalance: userBalance,
refundCharge: refundCharge,
listRefunds: listRefunds,
refundInfo: refundInfo
};
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