Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
accept-admin
Advanced tools
Package for managing integration with the accept payment service provided by paymobsolutions for lack of an offical one.
npm install accept-admin
Include your paymob accept credentials in a gitingnored .env
or configuration file
// config.js
module.exports = {
credentials: {
username: process.env.ACCEPT_USERNAME,
password: process.env.ACCEPT_PASSWORD,
expiration: 36000,
},
hmac_secret: process.env.ACCEPT_HMAC_SECRET,
integration_id: process.env.ACCEPT_INTEGRATION_ID,
host: "https://example.com/api",
notification_callback_url: "/accept/notification",
response_callback_url: "/accept/response",
}
Import the accept admin instance and configure it
import AcceptAdmin from "accept-admin"
// or in node < 10 you can
// const { Accept } = require("accept-admin")
// const AcceptAdmin = require("accept-admin").default
AcceptAdmin.config(ACCEPT_CONFIG)
//... later in your code
await AcceptAdmin.pay({
// credentials: ACCEPT_CREDENTIALS, // include if you want to pay having not called configuration prior
amount: 20,
source: {
"identifier": "5123456789012346",
"sourceholder_name": "Test Account",
"subtype": "CARD",
"expiry_month": "05",
"expiry_year": "21",
"cvn": "123"
}
})
Package includes a router and middelware functions to deal with Hmac validation
one possible workflow with express
// app.js
const express = require("express")
const { AcceptRouter } = require("accept-admin")
// or
// const { AcceptRouter } = require("accept-admin/lib/express_router")
const app = express()
app.use(AcceptRouter({
hmac_secret: process.env.ACCEPT_HMAC_SECRET, // or get from a config file
notificationEndpoint: '/accept/notifaction', // default
responseEndpoint: '/accept/response', // default
onNotification(req, res) { // if not set will default to simply responding with 200
console.log("Notification", req.body)
},
onResponse(req, res) { // if not set will default to simply responding with 200
console.log("Response", req.query)
return { message: "success" } // instead of res.status(200).send({ message: "success" })
},
}))
and when starting your server
// server.js
const app = require("./app")
const { Accept } = require("./accept-admin")
const ACCEPT_CONFIG = require("./config")
Accept.config(ACCEPT_CONFIG)
(async () => {
// get auth_token and assign it ot the instance
// and set integration callback hooks to
// integration.host + integration.response_callback_url as configured
await Accept.init()
// then start app
app.listen(process.env.PORT, ()=> console.log("server started"))
})()
See tests for the rest of the available functions, like tokenization, refunding and voiding transactions
This package has partial coverage of the accept admin API but is mainly meant for manging payment and an tokanization of credit cards.
The package is maintianed by DREIDEV and is not an offical paymobsolutions/accept package
Licence MIT
FAQs
A package for managing integration with accept payment service
The npm package accept-admin receives a total of 0 weekly downloads. As such, accept-admin popularity was classified as not popular.
We found that accept-admin 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.