1
0
Fork 0

Initial commit

master
Christiaan Goossens 7 years ago
commit 64d7fa13d7

1
.gitignore vendored

@ -0,0 +1 @@
/vendor/

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Christiaan Goossens, Verictas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,93 @@
# Omnipay: Inforbank
**Inforbank gateway for the Omnipay PHP payment processing library**
[Omnipay](https://github.com/omnipay/omnipay) is a framework agnostic, multi-gateway payment
processing library for PHP 5.3+. This package implements Inforbank support for Omnipay.
## Installation
Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
to your `composer.json` file:
```json
{
"repositories": [
{
"url": "https://git.verictas.com/InformaticaD4p/omnipay-plugin.git",
"type": "git"
}
],
"require": {
"inforbank/omnipay-inforbank": "dev-master"
}
}
```
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:
* Inforbank
For general usage instructions, please see the main [Omnipay](https://github.com/omnipay/omnipay)
repository.
## Example
```php
$gateway = \Omnipay\Omnipay::create('Inforbank');
$gateway->initialize(array(
'clientId' => 'PUT THE CLIENT_ID HERE',
'clientSecret' => 'PUT THE CLIENT_SECRET HERE'
));
// Start the purchase
if (!isset($_GET['status'])) {
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$response = $gateway->purchase(array(
'amount' => "1.50",
'description' => "Testorder #1234",
'transactionId' => 1234,
'returnUrl' => $url
))->send();
if ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} elseif ($response->isPending()) {
// This will never occur, because the gateway always returns a redirect to the bank pages.
return "Pending, Reference: ". $response->getTransactionReference();
} else {
// payment failed: display message to customer
return "Error " .$response->getCode() . ': ' . $response->getMessage();
}
} else {
/**
* Because the 'status' GET parameter is present, this is a return URL request and the purchase should be completed.
*/
// Check the status
$response = $gateway->completePurchase()->send();
if ($response->isSuccessful()) {
$reference = $response->getTransactionReference(); // TODO; Check the reference/id with your database
return "Transaction '" . $response->getTransactionId() . "' succeeded!";
} else {
return "Error " .$response->getCode() . ': ' . $response->getMessage();
}
}
```
## Support
If you are having general issues with Omnipay, we suggest posting on
[Stack Overflow](http://stackoverflow.com/). Be sure to add the
[omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found.
If you want to keep up to date with release anouncements, discuss ideas for the project,
or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which
you can subscribe to.

@ -0,0 +1,17 @@
{
"name": "inforbank/omnipay-inforbank",
"description": "An omnipay plugin for payments through the Inforbank.",
"authors": [
{
"name": "Christiaan Goossens",
"email": "contact@christiaangoossens.nl"
}
],
"license": "MIT",
"autoload": {
"psr-4": { "Omnipay\\Inforbank\\" : "src/" }
},
"require": {
"omnipay/common": "~2.2"
}
}

384
composer.lock generated

@ -0,0 +1,384 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "cf13b3ab60392a179dc1f7dc5fb05dfe",
"packages": [
{
"name": "guzzle/guzzle",
"version": "v3.9.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle3.git",
"reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9",
"reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.3.3",
"symfony/event-dispatcher": "~2.1"
},
"replace": {
"guzzle/batch": "self.version",
"guzzle/cache": "self.version",
"guzzle/common": "self.version",
"guzzle/http": "self.version",
"guzzle/inflection": "self.version",
"guzzle/iterator": "self.version",
"guzzle/log": "self.version",
"guzzle/parser": "self.version",
"guzzle/plugin": "self.version",
"guzzle/plugin-async": "self.version",
"guzzle/plugin-backoff": "self.version",
"guzzle/plugin-cache": "self.version",
"guzzle/plugin-cookie": "self.version",
"guzzle/plugin-curlauth": "self.version",
"guzzle/plugin-error-response": "self.version",
"guzzle/plugin-history": "self.version",
"guzzle/plugin-log": "self.version",
"guzzle/plugin-md5": "self.version",
"guzzle/plugin-mock": "self.version",
"guzzle/plugin-oauth": "self.version",
"guzzle/service": "self.version",
"guzzle/stream": "self.version"
},
"require-dev": {
"doctrine/cache": "~1.3",
"monolog/monolog": "~1.0",
"phpunit/phpunit": "3.7.*",
"psr/log": "~1.0",
"symfony/class-loader": "~2.1",
"zendframework/zend-cache": "2.*,<2.3",
"zendframework/zend-log": "2.*,<2.3"
},
"suggest": {
"guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.9-dev"
}
},
"autoload": {
"psr-0": {
"Guzzle": "src/",
"Guzzle\\Tests": "tests/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Guzzle Community",
"homepage": "https://github.com/guzzle/guzzle/contributors"
}
],
"description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"abandoned": "guzzlehttp/guzzle",
"time": "2015-03-18T18:23:50+00:00"
},
{
"name": "omnipay/common",
"version": "2.5.2",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/omnipay-common.git",
"reference": "54910f2ece6b1be64f5e53e2111dd1254d50ee49"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/omnipay-common/zipball/54910f2ece6b1be64f5e53e2111dd1254d50ee49",
"reference": "54910f2ece6b1be64f5e53e2111dd1254d50ee49",
"shasum": ""
},
"require": {
"guzzle/guzzle": "~3.9",
"php": ">=5.3.2",
"symfony/http-foundation": "~2.1|~3.0"
},
"require-dev": {
"omnipay/tests": "~2.0",
"squizlabs/php_codesniffer": "~1.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5.x-dev"
},
"gateways": [
"AuthorizeNet_AIM",
"AuthorizeNet_SIM",
"Buckaroo_CreditCard",
"Buckaroo_Ideal",
"Buckaroo_PayPal",
"CardSave",
"Coinbase",
"Dummy",
"Eway_Rapid",
"FirstData_Connect",
"GoCardless",
"Manual",
"Migs_ThreeParty",
"Migs_TwoParty",
"Mollie",
"MultiSafepay",
"Netaxept",
"NetBanx",
"PayFast",
"Payflow_Pro",
"PaymentExpress_PxPay",
"PaymentExpress_PxPost",
"PayPal_Express",
"PayPal_Pro",
"Pin",
"SagePay_Direct",
"SagePay_Server",
"SecurePay_DirectPost",
"Stripe",
"TargetPay_Directebanking",
"TargetPay_Ideal",
"TargetPay_Mrcash",
"WorldPay"
]
},
"autoload": {
"psr-0": {
"Omnipay\\Common\\": "src/"
},
"classmap": [
"src/Omnipay/Omnipay.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Adrian Macneil",
"email": "adrian@adrianmacneil.com"
},
{
"name": "Omnipay Contributors",
"homepage": "https://github.com/thephpleague/omnipay-common/contributors"
}
],
"description": "Common components for Omnipay payment processing library",
"homepage": "https://github.com/thephpleague/omnipay-common",
"keywords": [
"gateway",
"merchant",
"omnipay",
"pay",
"payment",
"purchase"
],
"time": "2016-11-07T06:10:23+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.8.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "74877977f90fb9c3e46378d5764217c55f32df34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74877977f90fb9c3e46378d5764217c55f32df34",
"reference": "74877977f90fb9c3e46378d5764217c55f32df34",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0,>=2.0.5|~3.0.0",
"symfony/dependency-injection": "~2.6|~3.0.0",
"symfony/expression-language": "~2.6|~3.0.0",
"symfony/stopwatch": "~2.3|~3.0.0"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\EventDispatcher\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:30:24+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v3.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "a90da6dd679605d88c9803a57a6fc1fb7a19a6e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/a90da6dd679605d88c9803a57a6fc1fb7a19a6e0",
"reference": "a90da6dd679605d88c9803a57a6fc1fb7a19a6e0",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/polyfill-mbstring": "~1.1"
},
"require-dev": {
"symfony/expression-language": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\HttpFoundation\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2017-02-16T22:46:52+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2016-11-14T01:06:16+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

@ -0,0 +1,34 @@
<?php
namespace Omnipay\Inforbank;
use Omnipay\Common\AbstractGateway;
class Gateway extends AbstractGateway {
public function getName() {
return 'Inforbank';
}
public function getDefaultParameters() {
return array();
}
/**
* Start a purchase request.
* @param array $parameters An array of options
* @return \Omnipay\Inforbank\Message\PurchaseRequest
*/
public function purchase(array $parameters = array())
{
return $this->createRequest('\Omnipay\Inforbank\Message\PurchaseRequest', $parameters);
}
/**
* Complete a purchase.
* @param array $parameters An array of options
* @return \Omnipay\Inforbank\Message\CompletePurchaseRequest
*/
public function completePurchase(array $parameters = array())
{
return $this->createRequest('\Omnipay\Inforbank\Message\CompletePurchaseRequest', $parameters);
}
}