Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
creditguard
Advanced tools
A simple wrapper for creditguard api
$ npm install creditguard
var creditguard = require('creditguard');
var env = {
user: 'username',
password: 'password',
server: 'https://cguat2.creditguard.co.il',
terminal: '1234567',
mid: '531', // required only for redirect
// optional callback addresses when using cg redirect api
// when left empty, cg will use the predefined terminal value
success_url: 'localhost/payment/proceed?',
error_url: 'localhost/payment/rejected?',
cancel_url: 'localhost/payment/rejected?',
// optional interface language of MPI hosted payment page
language: 'heb', // default value is 'eng'
version: '2000' // terminal version. At the moment CG works with EMV ('2000') and Credit96 ('1001') terminals. Default value is '1001'
};
var options = {
cleanup: true // remove empty fields from result, default to false
};
var cg = creditguard(env, options);
creditguard-node
follows cg xml-api (see their docs) parameters names. For example, if their api expects the following xml :
<ashrait>
<request>
<command>doDeal</command>
<requestId/>
<version>1001</version>
<language>Eng</language>
<mayBeDuplicate>0</mayBeDuplicate>
<doDeal>
<terminalNumber>0962XXX</terminalNumber>
<cardNo>458045XXXXXX4580</cardNo>
<cardExpiration>1212</cardExpiration>
<creditType>RegularCredit</creditType>
<currency>USD</currency>
<transactionCode>Phone</transactionCode>
<transactionType>Debit</transactionType>
<total>10010</total>
<validation>AutoComm</validation>
<user>567890</user>
</doDeal>
</request>
</ashrait>
Then the proper use would be :
// basically create an object with everything you want to put under 'doDeal' element
// (no need to inset terminal number or any other value from 'env')
let charge = {
cardNo: '458045XXXXXX4580',
cardExpiration: '1212',
creditType: 'RegularCredit',
currency: 'USD',
transactionCode: 'Phone',
transactionType: 'Debit',
total: 10010,
validation: 'AutoComm',
user: '567890'
};
try {
let res = await cg.call(charge);
// ...
} catch (err) {
// ...
}
If you are using the xml api to get a redirect page and you want to use customerData
fields to pass some data into that page, you can do it simply by attaching it to charge
object:
charge.customerData = {
userData1: 'userData1',
userData3: 'userData3',
...
}
If your terminal supports invoices you can easily attach invoice to the call, again, by attaching it to the charge
object:
// check out cg invoice documentation for complete list of properties
charge.invoice = {
invoiceCreationMethod: 'wait',
invoiceSubject: 'Subject',
invoiceItemQuantity: 1,
invoiceItemPrice: 10010,
companyInfo: 'Vandelay Industries',
mailTo: 'george@vandelay.com',
...
}
creditguard-node
takes cg xml
response and converts it to a javascript
object so there's no need for you to parse any xml. It also verifies that the transaction result code is 000
(OK) and if not, throws an informative error that you can catch.
FAQs
Simple wrapper for Creditguard API
The npm package creditguard receives a total of 0 weekly downloads. As such, creditguard popularity was classified as not popular.
We found that creditguard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.