Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds code style fixer. Updates code style. Updates md files
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Jan 10, 2017
1 parent 714b162 commit 1eda9ca
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 10 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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**!
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
13 changes: 11 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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
}
}
2 changes: 1 addition & 1 deletion src/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.']');
Expand Down
4 changes: 2 additions & 2 deletions src/Preparable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -64,4 +64,4 @@ protected function prepare($data, array $params)

return $array;
}
}
}
3 changes: 2 additions & 1 deletion src/Receipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 5 additions & 3 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 1eda9ca

Please sign in to comment.