Giter Club home page Giter Club logo

omnipay-elavon's Introduction

omnipay-shell

=============

basic file structure to provide a starting point for an Omnipay Gateway plugin

Build Status Latest Stable Version Total Downloads

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Mollie support for Omnipay.

Installation

Omnipay is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "omnipay/elavon": "~3.0"
    }
}

And run composer to update your dependencies:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

Basic Usage

The following gateways are provided by this package:

  • Mollie

For general usage instructions, please see the main Omnipay repository.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

  1. update the composer.json in your root (ie. the folder above vendor) - add the repository
    "repositories": [
           {
               "type": "git",
               "url":  "https://github.com/eileenmcnaughton/omnipay-shell.git"
           },

and the new 'require' - instead of the second one here

      "require":
      {
          "omnipay/omnipay": "~2.0",
          "fuzion/omnipay-shell": "dev-master"
      },
  1. run composer update in your root folder (ie. vendor should be a folder of the folder you are in) using prefer-dist so as to use the files in place ie. composer update --prefer-dist

  2. run the unit tests. You should not proceed further until the tests pass. The tests use phpunit which you can google. The command will look something like php vendor/phpunit/phpunit/phpunit.php Omnipay/Shell/GatewayTest vendor/fuzion/omnipay-shell/tests/GatewayTest.php

If you are using phpstorm you can run the tests from within the IDE - to configure go to file/settings/php/phpunit ensure that custom autoloader is selected & the path is set to the phpunit file in your root - e.g

{path}\vendor\phpunit\phpunit\phpunit.php

You can then right-click on the test & choose 'run' or even better 'run with coverage'

  1. sign your site up to travis https://travis-ci.org/ and push your extension to github. Once you have done your first build you are ready to start developing your plugin

Writing your plugin

Note that Omnipay does not think of processors as having on-site & off-site distinctions. The point is to provide a model for 2 types in one package and to demonstrate the functions that are specific to processors that use callbacks - ie IPNs/ Silent Posts / other http or api calls.

  1. Set up your payment classes. Generally you should start with the 'AuthorizeRequest', 'PurchaseRequest' & CaptureRequest classes. It is likely there will be very little difference between the 3 and in the shell extension the PurchaseRequest & CaptureRequest extend the AuthorizeRequest, declaring only a different transaction type. Start by looking at the following functions
  • sendData - is the browser is to be redirected the function should look like

    function sendData($data) {
          return $this->response = new AuthorizeResponse($this, $data, $this->getEndpoint());
    }
    

    If the server is to communicate directly with the other site then the sendData function encapsulates this interaction

    function sendData($data) {
         $httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();
         return $this->response = new AIMResponse($this, $httpResponse->getBody());
    }
    
  1. Declaring & validating required fields.

There are 2 types of required fields 'card' fields and 'core' fields - the difference is that the core fields are about your site and the transaction and card fields are about the person. For a list look at https://github.com/thephpleague/omnipay

The shell extension uses functions to declare the required fields and the getData function in the shell extension validates these. (It is hoped these functions would also be accessible to the calling app to do pre-validation Note that you are referencing the normalised Omnipay fields here not the ones defined by the processor

public function getRequiredCoreFields()
{
    return array
    (
        'amount',
        'currency',
    );
}

public function getRequiredCardFields()
{
    return array
    (
        'email',
    );
}
  1. getTransactionData()

This is where you declare the mappings between the omnipay normalised fields and the payment gateway's field names as a simple array.

  • to get the amount you can use $this->getAmount() for an amount like '1.00' or getAmountInteger() for an amount like 100 (for the same amount)

omnipay-elavon's People

Contributors

eileenmcnaughton avatar

Watchers

 avatar  avatar

omnipay-elavon's Issues

composer error

Hi there,

Thank you! for making this available, when you list in composer and run composer install it throws an error the package is not found on packgist.

alirz23

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.