npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-ccavenue

v1.0.5

Published

Node Module for integrating CCAvenue Payment gateway in Node.js

Downloads

3,049

Readme

Node CCAvenue

Node Module for integrating CCAvenue Payment gateway in Node.js

Prerequisite

Before using this module, please make sure you have your merchant_id and working_key for test and production environment from CCAVenue payment gateway.

Installation

$ npm install node-ccavenue --save

or

$ yarn add node-ccavenue

Initialization

Make sure your test / production workingKey and merchantId are stored as environment variables (best practice)

const nodeCCAvenue = require('node-ccavenue');
const ccav = new nodeCCAvenue.Configure({
  merchant_id: process.env.merchant_id,
  working_key: process.env.test_working_key || process.env.prod_working_key,
});

Usage

You are free to use the encryption and decryption methods from the package. Which are exported as is.

Encryption

const encryptedData = ccav.encrypt('Just plain text to encrypt or uri encoded order information');
console.log(encryptedData); // Proceed further

Decryption

const decryptedData = ccav.decrypt(encryptedData);
console.log(decryptedData); // Proceed further

Creating encrypted text for generating an order

No need to use the encrypt function in this case.

const orderParams = {
  order_id: 8765432,
  currency: 'INR',
  amount: '100',
  redirect_url: encodeURIComponent(`http://localhost:3000/api/redirect_url/`),
  billing_name: 'Name of the customer',
  // etc etc
};

const encryptedOrderData = ccav.getEncryptedOrder(orderParams);
console.log(encryptedOrderData); // Proceed further

Decrypting the response from CCAvenue to a JSON output

// Considering this is your redirect_url
router.post('/api/redirect_url', (req, res) => {
  const { encResp } = req.body;
  const decryptedJsonResponse = ccav.redirectResponseToJson(encResp);
  // To check order_status: - 
  console.log(decryptedJsonResponse.order_status);
});

Sample JSON Response from CCAvenue

This is the json response output after passing the encrypted request to redirectResponseToJson(encResp)


{
    "order_id": "9840661",
    "tracking_id": "308005007091",
    "bank_ref_no": "1555842850653",
    "order_status": "Success",
    "failure_message": "",
    "payment_mode": "Net Banking",
    "card_name": "AvenuesTest",
    "status_code": "null",
    "status_message": "Y",
    "currency": "INR",
    "amount": "1000.00",
    "billing_name": "OPTIONAL",
    "billing_address": "OPTIONAL",
    "billing_city": "OPTIONAL",
    "billing_state": "OPTIONAL",
    "billing_zip": "OPTIONAL",
    "billing_country": "India",
    "billing_tel": "99999999999",
    "billing_email": "[email protected]",
    "delivery_name": "OPTIONAL",
    "delivery_address": "OPTIONAL",
    "delivery_city": "OPTIONAL",
    "delivery_state": "OPTIONAL",
    "delivery_zip": "OPTIONAL",
    "delivery_country": "India",
    "delivery_tel": "99999999999",
    "merchant_param1": "",
    "merchant_param2": "",
    "merchant_param3": "",
    "merchant_param4": "",
    "merchant_param5": "",
    "vault": "N",
    "offer_type": "null",
    "offer_code": "null",
    "discount_value": "0.0",
    "mer_amount": "1200.00",
    "eci_value": "null",
    "retry": "N",
    "response_code": "0",
    "billing_notes": "",
    "trans_date": "21/04/2019 16:04:38",
    "bin_country": ""
}

Contributing

Feel free to open issues if you find any, or simply fork and create a pull request