Code Monkey home page Code Monkey logo

nchl's Introduction

NCHL

Connect IPS payment gateway package.

Latest Stable Version Total Downloads

License Build StyleCI All Contributors

Installation

Require this package with composer.

composer require yubarajshrestha/nchl

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Laravel 5.5+:

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

YubarajShrestha\NCHL\NchlServiceProvider::class,

If you want to use the facade to log messages, add this to your facades in app.php:

'NCHL' => YubarajShrestha\NCHL\Facades\NchlFacade::class,

Copy the package config to your local config with the publish command:

php artisan vendor:publish --provider="YubarajShrestha\NCHL\NchlServiceProvider"

Copy the environment variables and setup as per required in .env:

NCHL_MERCHANT_ID=
NCHL_APP_ID=
NCHL_APP_NAME=
NCHL_APP_PASSWORD=
NCHL_GATEWAY=
NCHL_VALIDATION_URL=
NCHL_TRANSACTION_DETAIL_URL=

Basic Usage

A NCHL is Service Class and can be instanciated like this:

// In Controller
$nchl = NCHL::__init([
    "txn_id" => '3',
    "txn_date" => '1-10-2020',
    "txn_amount" => '500',
    "reference_id" => 'REF-001',
    "remarks" => 'RMKS-001',
    "particulars" => 'PART-001',
]);

And then in view you will create a form to start payment, which redirects you to Connect IPS.

// In View
<form action="{{ $nchl->core->gatewayUrl() }}" method="post">
    <label>MERCHANT ID</label>
    <input type="text" name="MERCHANTID" id="MERCHANTID" value="{{ $nchl->core->getMerchantId() }}"/>
    <label>APP ID</label>
    <input type="text" name="APPID" id="APPID" value="{{ $nchl->core->getAppId() }}"/>
    <label>APP NAME</label>
    <input type="text" name="APPNAME" id="APPNAME" value="{{ $nchl->core->getAppName() }}"/>
    <label>TXN ID</label>
    <input type="text" name="TXNID" id="TXNID" value="{{ $nchl->core->getTxnId() }}"/>
    <label>TXN DATE</label>
    <input type="text" name="TXNDATE" id="TXNDATE" value="{{ $nchl->core->getTxnDate() }}"/>
    <label>TXN CRNCY</label>
    <input type="text" name="TXNCRNCY" id="TXNCRNCY" value="{{ $nchl->core->getCurrency() }}"/>
    <label>TXN AMT</label>
    <input type="text" name="TXNAMT" id="TXNAMT" value="{{ $nchl->core->getTxnAmount() }}"/>
    <label>REFERENCE ID</label>
    <input type="text" name="REFERENCEID" id="REFERENCEID" value="{{ $nchl->core->getReferenceId() }}"/>
    <label>REMARKS</label>
    <input type="text" name="REMARKS" id="REMARKS" value="{{ $nchl->core->getRemarks() }}"/>
    <label>PARTICULARS</label>
    <input type="text" name="PARTICULARS" id="PARTICULARS" value="{{ $nchl->core->getParticulars() }}"/>
    <label>TOKEN</label>
    <input type="text" name="TOKEN" id="TOKEN" value="{{ $nchl->core->token() }}"/>
    <input type="submit" value="Submit">
</form>

After success or failure payment it will redirect you to the redirect url that you've provided to Connect IPS.

Validating Payment and retrieving Payment Details

Re-instantiate the NCHL serivce class same like before.

// In Controller
$nchl = NCHL::__init([
    "txn_id" => '3',
    "txn_date" => '1-10-2020',
    "txn_amount" => '500',
    "reference_id" => 'REF-001',
    "remarks" => 'RMKS-001',
    "particulars" => 'PART-001',
]);

/** Validating Payment **/
$response = $nchl->paymentValidate();

/** Retrieving payment details **/
$response = $nchl->paymentDetails();

Well that's it. Enjoy

Contributors


Yubaraj Shrestha

License

nchl's People

Contributors

yubarajshrestha avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.