├── CHANGELOG.md ├── .editorconfig ├── grumphp.yml ├── src ├── Message │ ├── AuthorizeRequest.php │ ├── Response.php │ └── AbstractRequest.php └── SkeletonGateway.php ├── .phpstorm.meta.php ├── LICENSE.md ├── composer.json ├── CONTRIBUTING.md └── README.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All Notable changes to `:package_name` will be documented in this file 4 | 5 | ## NEXT - YYYY-MM-DD 6 | 7 | ### Added 8 | - Nothing 9 | 10 | ### Deprecated 11 | - Nothing 12 | 13 | ### Fixed 14 | - Nothing 15 | 16 | ### Removed 17 | - Nothing 18 | 19 | ### Security 20 | - Nothing 21 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | ; This file is for unifying the coding style for different editors and IDEs. 2 | ; More information at http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_size = 4 9 | indent_style = space 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /grumphp.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | git_dir: . 3 | bin_dir: vendor/bin 4 | tasks: 5 | phpunit: 6 | config_file: ~ 7 | testsuite: ~ 8 | group: [] 9 | always_execute: false 10 | phpcs: 11 | standard: PSR2 12 | warning_severity: ~ 13 | ignore_patterns: 14 | - tests/ 15 | triggered_by: [php] -------------------------------------------------------------------------------- /src/Message/AuthorizeRequest.php: -------------------------------------------------------------------------------- 1 | validate('amount', 'card'); 13 | $this->getCard()->validate(); 14 | $data = $this->getBaseData(); 15 | return $data; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.phpstorm.meta.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'Skeleton' instanceof \Omnipay\Skeleton\SkeletonGateway, 10 | ], 11 | \Omnipay\Common\GatewayFactory::create('') => [ 12 | 'Skeleton' instanceof \Omnipay\Skeleton\SkeletonGateway, 13 | ], 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /src/Message/Response.php: -------------------------------------------------------------------------------- 1 | request = $request; 16 | $this->data = $data; 17 | } 18 | 19 | public function isSuccessful() 20 | { 21 | return isset($this->data['success']); 22 | } 23 | 24 | public function getTransactionReference() 25 | { 26 | if (isset($this->data['reference'])) { 27 | return $this->data['reference']; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/SkeletonGateway.php: -------------------------------------------------------------------------------- 1 | '', 21 | 'testMode' => false, 22 | ); 23 | } 24 | 25 | public function getKey() 26 | { 27 | return $this->getParameter('key'); 28 | } 29 | 30 | public function setKey($value) 31 | { 32 | return $this->setParameter('key', $value); 33 | } 34 | 35 | /** 36 | * @return Message\AuthorizeRequest 37 | */ 38 | public function authorize(array $parameters = array()) 39 | { 40 | return $this->createRequest('\Omnipay\Skeleton\Message\AuthorizeRequest', $parameters); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2015 :author_name <:author_email> 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": ":vendor/omnipay-:gateway", 3 | "description": ":package_description", 4 | "keywords": [ 5 | "omnipay", 6 | ":gateway" 7 | ], 8 | "homepage": "https://github.com/:vendor/omnipay-:gateway", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": ":author_name", 13 | "email": ":author_email", 14 | "homepage": ":author_website" 15 | } 16 | ], 17 | "require": { 18 | "omnipay/common": "v3.0-alpha.2" 19 | }, 20 | "require-dev": { 21 | "omnipay/tests": "~3.0", 22 | "squizlabs/php_codesniffer": "^3", 23 | "phpro/grumphp": "^0.14" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "Omnipay\\Skeleton\\": "src" 28 | } 29 | }, 30 | "autoload-dev": { 31 | "psr-4": { 32 | "League\\Skeleton\\Test\\": "tests" 33 | } 34 | }, 35 | "scripts": { 36 | "test": "phpunit", 37 | "check-style": "phpcs -p --standard=PSR2 src/", 38 | "fix-style": "phpcbf -p --standard=PSR2 src/" 39 | }, 40 | "extra": { 41 | "branch-alias": { 42 | "dev-master": "1.0-dev" 43 | } 44 | }, 45 | "minimum-stability": "dev", 46 | "prefer-stable": true 47 | } 48 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/:package_name). 6 | 7 | 8 | ## Pull Requests 9 | 10 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). 11 | 12 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 13 | 14 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 15 | 16 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 17 | 18 | - **Create feature branches** - Don't ask us to pull from your master branch. 19 | 20 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 21 | 22 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 23 | 24 | 25 | ## Running Tests 26 | 27 | ``` bash 28 | $ phpunit 29 | ``` 30 | 31 | 32 | **Happy coding**! 33 | -------------------------------------------------------------------------------- /src/Message/AbstractRequest.php: -------------------------------------------------------------------------------- 1 | getParameter('key'); 19 | } 20 | 21 | public function setKey($value) 22 | { 23 | return $this->setParameter('key', $value); 24 | } 25 | 26 | public function sendData($data) 27 | { 28 | $url = $this->getEndpoint().'?'.http_build_query($data, '', '&'); 29 | $response = $this->httpClient->get($url); 30 | 31 | $data = json_decode($response->getBody(), true); 32 | 33 | return $this->createResponse($data); 34 | } 35 | 36 | protected function getBaseData() 37 | { 38 | return [ 39 | 'transaction_id' => $this->getTransactionId(), 40 | 'expire_date' => $this->getCard()->getExpiryDate('mY'), 41 | 'start_date' => $this->getCard()->getStartDate('mY'), 42 | ]; 43 | } 44 | 45 | protected function getEndpoint() 46 | { 47 | return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; 48 | } 49 | 50 | protected function createResponse($data) 51 | { 52 | return $this->response = new Response($this, $data); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Omnipay: :gateway 2 | 3 | **Skeleton gateway for the Omnipay PHP payment processing library** 4 | 5 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor/omnipay-:gateway.svg?style=flat-square)](https://packagist.org/packages/:vendor/omnipay-:gateway) 6 | [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) 7 | [![Build Status](https://img.shields.io/travis/:vendor/omnipay-:gateway/master.svg?style=flat-square)](https://travis-ci.org/:vendor/omnipay-:gateway) 8 | [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/:vendor/omnipay-:gateway.svg?style=flat-square)](https://scrutinizer-ci.com/g/:vendor/omnipay-:gateway/code-structure) 9 | [![Quality Score](https://img.shields.io/scrutinizer/g/:vendor/omnipay-:gateway.svg?style=flat-square)](https://scrutinizer-ci.com/g/:vendor/omnipay-:gateway) 10 | [![Total Downloads](https://img.shields.io/packagist/dt/:vendor/omnipay-:gateway.svg?style=flat-square)](https://packagist.org/packages/:vendor/omnipay-:gateway) 11 | 12 | 13 | [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment 14 | processing library for PHP 5.3+. This package implements :gateway support for Omnipay. 15 | 16 | **Note:** Replace `:vendor`, `:author_name`, `:author_username`, `:author_website`, `:author_email`, `:gateway`, `:package_description` and `:gateway` with their correct values in [README.md](README.md), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.md](LICENSE.md) and [composer.json](composer.json) files, then delete this line. 17 | 18 | This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what 19 | PSRs you support to avoid any confusion with users and contributors. 20 | 21 | ## Install 22 | 23 | Instal the gateway using require. Require the `league/omnipay` base package and this gateway. 24 | 25 | ``` bash 26 | $ composer require league/omnipay :vendor/omnipay-:gateway 27 | ``` 28 | 29 | ## Usage 30 | 31 | The following gateways are provided by this package: 32 | 33 | * :gateway 34 | 35 | For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay) repository. 36 | 37 | ## Support 38 | 39 | If you are having general issues with Omnipay, we suggest posting on 40 | [Stack Overflow](http://stackoverflow.com/). Be sure to add the 41 | [omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found. 42 | 43 | If you want to keep up to date with release announcements, discuss ideas for the project, 44 | or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which 45 | you can subscribe to. 46 | 47 | If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/:vendor/omnipay-:gateway/issues), 48 | or better yet, fork the library and submit a pull request. 49 | 50 | ## Change log 51 | 52 | Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. 53 | 54 | ## Testing 55 | 56 | ``` bash 57 | $ composer test 58 | ``` 59 | 60 | ## Contributing 61 | 62 | Please see [CONTRIBUTING](CONTRIBUTING.md) for details. 63 | 64 | ## Security 65 | 66 | If you discover any security related issues, please email :author_email instead of using the issue tracker. 67 | 68 | ## Credits 69 | 70 | - [:author_name](https://github.com/:author_username) 71 | - [All Contributors](../../contributors) 72 | 73 | ## License 74 | 75 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 76 | --------------------------------------------------------------------------------