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

iraq-epayment

v1.0.4

Published

To be written

Downloads

1

Readme

Documentation

This package will make the integration of online payment in iraq much easier than before.

Overview

To integrate any payment method (from the ones that are already supported) , all you have to do is the following:

Installation

npm i iraq-epayment

1 - Create a .json file that has the account information needed for each payment gateway (merchants information) so the json files will look as follows :

{
    "ZainCash":{
        "production":true OR false,
        "serviceType": "Any text", // This will appear to the customer in the payment page.
        "secret":"XXXXXXXXXXXXXX" //Your ZAIN SECRET
        "msisdn": "96478########", // The merchant wallet number
        "merchantId":"XXXX" //Merchant ID
        "redirectUrl": "https://YOUR-WEBSITE.com/PATH", // Your GET URL that the customer will be redirected to after the payment
        "lang":"ar" OR "en"
        'exp': 3 // days for the JWT token expiration
    },
    "PayTabs":{
        "Authorization":"TOKEN AUTH",
        "callback":"https://YOUR-WEBSITE.com/POSTPATH" //paytabs(AMWAL) will send a POST request to that route after payment process with information about the transaction",
        "returnUrl":"https://YOUR-WEBSITE.com/PATH" //Your GET URL that the customer will be redirected to after the payment ,
        "profile_id":"XXXX", //Your Profile ID given by paytabs(Amwal)
        "tran_class": "ecom" OR "moto" OR "cont",//Depends on bank account type
        "tran_type":"sale",
    },
    "Tasdid":{
        "userName":"YOUR USERNAME",
        "password":"YOUR PASSWORD"
    },
    "Aps":{
        "production":true OR false,
        "userName":"YOUR USERNAME",
        "password":"YOUR PASSWORD",
        "redirectUrl":"URL" //Your route that they will send GET request to it.
    },
    "Switch":{
        "Switch":{
        "production": false,
        "Authorization":
        "Bearer OGE4Mjk0MTc0ZDA1OTViYjAxNGQwNWQ4MjllNzAxZDF8OVRuSlBjMm45aA==",
        "entityId": "8a8294174d0595bb014d05d82e5b01d2",
        "bankBic": "TESTDETT421",
        "bankIban": "DE14940593100000012346",
        "bankCountry": "DE",
        "redirectUrl": "https://google.com"
    }

}

NOTE: The structure and keys must be identical to the above.

NOTE: You only need to put the payments information that you need and support in your application.

2 - Require the package as:

const Payment = require("iraq-epayment");
const accountInfos = require("YOUR JSON PATH");

3 - In your payment controller, you use (zaincash here as an example):

const payment_process = new Payment("ZainCash", accountInfos).inject;
const result = payment_process.checkout({ amount: 2548, orderId: "45849" });
console.log(result); //{status:bool, https://api.zaincash.iq/transaction/pay?id=xxxx,transactionId:'xxx',}

result will be an object and if the operation wass successful, the status will be true, else if there were any errors, it will return the object as follows:

{
    status:false,
    error:{
        //Depend on payment method
    }
}

For better usage, require the json file everytime when passing it to the class, in this case, you can update the information without restarting the server, like below:

const payment_process = new Payment("ZainCash", require("PATH_TO_JSON")).inject;