computop-node-client
This module is designed to help you integrate Computop Paygate more easily into your Node.js application. For this purpose, it contains classes for encryption and decryption, for generating a SHA-256 MAC hash, and for converting a key-value pair string into a JSON object.
Install
npm install --save
- Create a file named ".env" and store your Computop keys like this:
KEY_BLOWFISH=<BF Key goes here>
KEY_HMAC=<MAC key goes here>
Usage
const computop = require('computop-node-client')
Encrypt to blowfish
computop.encryptBlowfish('Hello world');
Decrypt from blowfish
computop.decryptBlowfish('3FBEA4D5D8AD6CEE824F5BD7B5D6730FF41E214E67D515EC');
Encrypt to AES
computop.encryptAES('Hello world');
Decrypt from AES
computop.decryptAES('C0C8D486569F39C4DE13B2CA13697A92-50A271A52F8A72665DBE92A91DF1FB34BCC5752BD3A43E0D');
generate hash
computop.generateHash('123*Hello*World');
Convert JS object to key-value pairs
let myObject = {}
myObject.MerchantID = "myMID";
myObject.Amount = "100";
computop.buildRequest(myObject);
Parse response
computop.parseResponse('mid=YourMID&code=00000000&status=success);