From 1eda9ca3a65b4114848651bd7eb0387155d77a9b Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Mon, 9 Jan 2017 19:45:17 -0600 Subject: [PATCH] Adds code style fixer. Updates code style. Updates md files --- CHANGELOG.md | 20 ++++++++++++++++++++ CONTRIBUTING.md | 29 +++++++++++++++++++++++++++++ README.md | 29 ++++++++++++++++++++++++++++- composer.json | 13 +++++++++++-- src/Customer.php | 2 +- src/Preparable.php | 4 ++-- src/Receipt.php | 3 ++- src/Response.php | 8 +++++--- 8 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a4ea7f..70a0a7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ #Moneris API Changelog +###0.6.2 (2017-01-09) + +####Changed + +- Updates card_verification validation to not require amount [`714b1624ce`](https://github.com/craigpaul/moneris-api/commit/714b1624ce) + +###0.6.1 (2016-12-28) + +####Changed + +- Merge pull request #4 from tappleby/bugfix-payment-success [`cb3b75ed84`](https://github.com/craigpaul/moneris-api/commit/cb3b75ed84) +- Updates transaction to reset errors array indices [`262617c3ac`](https://github.com/craigpaul/moneris-api/commit/262617c3ac) +- Update successful payment logic, AVS + CVD can fail but the transaction will still be successful. [`bbd85b8063`](https://github.com/craigpaul/moneris-api/commit/bbd85b8063) +- Merge remote-tracking branch 'upstream/master' [`0f4f6597a6`](https://github.com/craigpaul/moneris-api/commit/0f4f6597a6) + +####Added + +- Adds another caveat to docs [`14525afdce`](https://github.com/craigpaul/moneris-api/commit/14525afdce) +- Adds caveat example to readme [`7c35112183`](https://github.com/craigpaul/moneris-api/commit/7c35112183) + ###0.6.0 (2016-11-27) ####Changed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..46ecd6e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# Contributing + +Contributions are **welcome** and will be fully **credited**. + +We accept contributions via Pull Requests on [Github](https://github.com/craigpaul/moneris-api). + +## Pull Requests + +- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - Check the code style with ``$ composer check-style`` and fix it with ``$ composer fix-style``. + +- **Add tests!** - Your patch won't be accepted if it doesn't have tests. + +- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. + +- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. + +- **Create feature branches** - Don't ask us to pull from your master branch. + +- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. + +- **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. + +## Running Tests + +``` bash +$ composer test +``` + +**Happy coding**! \ No newline at end of file diff --git a/README.md b/README.md index 71481c8..3519178 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Moneris API -[![Build Status](https://travis-ci.org/craigpaul/moneris-api.svg?branch=master)](https://travis-ci.org/craigpaul/moneris-api) +[![Latest Version on Packagist][ico-version]][link-packagist] +[![Software License][ico-license]](LICENSE.md) +[![Build Status][ico-travis]][link-travis] +[![Total Downloads][ico-downloads]][link-downloads] ## Requirements @@ -523,6 +526,30 @@ transaction - The Moneris id of the transaction. (string) type - The transaction type. (string) ``` +## Change log + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Contributing + +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. + +## Credits + +- [Craig Paul][link-author] +- [All Contributors][link-contributors] + ## License Moneris API is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). + +[ico-version]: https://img.shields.io/packagist/v/craigpaul/moneris-api.svg?style=flat-square +[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square +[ico-travis]: https://img.shields.io/travis/craigpaul/moneris-api/master.svg?style=flat-square +[ico-downloads]: https://img.shields.io/packagist/dt/craigpaul/moneris-api.svg?style=flat-square + +[link-packagist]: https://packagist.org/packages/craigpaul/moneris-api +[link-travis]: https://travis-ci.org/craigpaul/moneris-api +[link-downloads]: https://packagist.org/packages/craigpaul/moneris-api +[link-author]: https://github.com/craigpaul +[link-contributors]: ../../contributors \ No newline at end of file diff --git a/composer.json b/composer.json index 01e0567..87dcc7d 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "mockery/mockery": "~0.9", "phpunit/php-code-coverage": "^4.0", "symfony/var-dumper": "^3.1", - "fzaninotto/faker": "^1.6" + "fzaninotto/faker": "^1.6", + "squizlabs/php_codesniffer": "^2.7" }, "autoload": { "psr-4": { @@ -34,6 +35,14 @@ "tests/helpers.php" ] }, + "scripts": { + "test": "phpunit", + "check-style": "phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src", + "fix-style": "phpcbf -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src" + }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "config": { + "sort-packages": true + } } diff --git a/src/Customer.php b/src/Customer.php index bbde651..92fef03 100644 --- a/src/Customer.php +++ b/src/Customer.php @@ -85,7 +85,7 @@ public function __set($property, $value) { if (property_exists($this, $property)) { $this->$property = $value; - } else if (!is_null($this->data)) { + } elseif (!is_null($this->data)) { $this->data[$property] = $value; } else { throw new \InvalidArgumentException('['.get_class($this).'] does not contain a property named ['.$property.']'); diff --git a/src/Preparable.php b/src/Preparable.php index e9fb789..fc1ca15 100644 --- a/src/Preparable.php +++ b/src/Preparable.php @@ -22,7 +22,7 @@ protected function prepare($data, array $params) if ($key === 'ResolveData' && count($data->xpath('//ResolveData')) > 1) { $resolves = $data->xpath('//ResolveData'); - foreach($resolves as $index => $resolve) { + foreach ($resolves as $index => $resolve) { $resolves[$index] = array_map('strval', (array)$resolve); } @@ -64,4 +64,4 @@ protected function prepare($data, array $params) return $array; } -} \ No newline at end of file +} diff --git a/src/Receipt.php b/src/Receipt.php index 0f662bf..43f21f2 100644 --- a/src/Receipt.php +++ b/src/Receipt.php @@ -39,7 +39,8 @@ public function __construct($data) ]); } - public function successful() { + public function successful() + { $complete = $this->read('complete'); $valid_code = $this->read('code') !== 'null'; $code = (int)$this->read('code'); diff --git a/src/Response.php b/src/Response.php index 352b422..58b6f51 100644 --- a/src/Response.php +++ b/src/Response.php @@ -190,7 +190,8 @@ public function validate() return $this; } - protected function convertReceiptCodeToStatus(Receipt $receipt) { + protected function convertReceiptCodeToStatus(Receipt $receipt) + { $code = $receipt->read('code'); if ($code === 'null' && $message_status = $this->convertReceiptMessageToStatus($receipt)) { @@ -251,13 +252,14 @@ protected function convertReceiptCodeToStatus(Receipt $receipt) { return $status; } - protected function convertReceiptMessageToStatus(Receipt $receipt) { + protected function convertReceiptMessageToStatus(Receipt $receipt) + { $message = (string)$receipt->read('message'); $status = null; if (preg_match('/invalid pan/i', $message)) { $status = self::INVALID_CARD; - } else if (preg_match('/invalid expiry date/i', $message)) { + } elseif (preg_match('/invalid expiry date/i', $message)) { $status = self::INVALID_EXPIRY_DATE; }