Giter Club home page Giter Club logo

comgate-old's Introduction

Comgate

This is small Nette Framework wrapper for Comgate.

Installation

The easiest way to install library is via Composer.

$ composer require lzaplata/comgate: dev-master

or edit composer.json in your project

"require": {
        "lzaplata/comgate": "dev-master"
}

You have to register the library as extension in config.neon file.

extensions:
        comgate: LZaplata\Comgate\DI\Extension

Now you can set parameters...

comgate:
        merchant        : *
        secret          : *
        sandbox         : true
        preauth         : false                    

...and autowire library to presenter

use LZaplata\Comgate\Service;

/** @var Service @inject */
public $comgate;

Usage

Create payment.

$payment = $this->comgate->createPayment(
    $price                  // total price - float
);

Get payment ID and save it to database.

$payId = $payment->getPayId();

Send payment.

$response = $payment->send();

Redirect to payment gateway.

$this->sendResponse($response->getRedirectResponse());

...or get redirect url.

$response->getRedirectUrl();

After return from gateway

Get response and check if payment was successful

$response = $this->comgate->getReturnResponse();

if ($response->isOk()) {
    $payId = $response->getPayId();
    
    // do something
}

// output must be clean, so you have to terminate presenter and turn off Tracy
$this->terminate();

comgate-old's People

Contributors

pecan987 avatar lzaplata avatar eflyax avatar

Watchers

James Cloos avatar  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.