Skip to content

Commit

Permalink
Merge pull request #1 from paytrail/master
Browse files Browse the repository at this point in the history
CL-788 Update Paytrail SDK fork
  • Loading branch information
slipslop authored May 26, 2023
2 parents 5256120 + 12989e7 commit be9a125
Show file tree
Hide file tree
Showing 84 changed files with 2,226 additions and 1,023 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/run-phpunit.yaml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/run-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run Checks

on:
- push
- pull_request
- fork

jobs:
run-checks:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2']
experimental: [false]
steps:
- uses: actions/checkout@v3

- name: Validate Composer Files
run: composer validate --strict

- name: Run composer install
uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php-version }}

- name: Run linter
run: composer lint

- name: Run phpstan
uses: php-actions/phpstan@v3
with:
php_version: ${{ matrix.php-version }}
version: 1.9.14
configuration: phpstan.neon
memory_limit: 256M

- name: Run tests
uses: php-actions/phpunit@v3
with:
php_version: ${{ matrix.php-version }}
version: 9
configuration: phpunit.xml
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.phpunit.result.cache
test-reports/
composer.lock
composer.lock
*.cache
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.5.2] - 2023-05-05
### Fixed
- Improved refundRequest Validation
- Fix to allow zero amount items

## [2.5.1] - 2023-04-19
### Fixed
- Fixed requestSettlements url parameters
- Fixed item validation

## [2.5.0] - 2023-04-11
### Added
- You can now request payment report by settlement ID
- Added new improved way for requesting payment reports: requestSettlements()
### Fixed
- Fixed date validation on report requests
- Code cleanup for request classes

## [2.3.2] - 2023-02-22
### Added
- PHPStan (static analyser) added in workflow
- Tests are now run also on PHP 8.2
### Fixed
- Code quality improvements and other fixes

## [2.4.1] - 2023-01-11
- Add missing transaction property to activateInvoice request
- Use PSR-12 standard

## [2.4.0] - 2022-11-15
### Added
- Add missing properties to RefundRequest
- Add missing fields to PaymentResponse model
- Add method for activate-invoice endpoint
### Fixed
- Fix function parameter types

## [2.3.0] - 2022-09-05
### Added
- Payment report endpoint added
- companyName added to Customer model
### Fixed
- Fixed cUrlClient query parameters

## [2.2.0] - 2022-06-15
### Added
- Added PHPUnit test workflow
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ To use the payment service, you need to sign up for a Paytrail account. Transact
### General requirements

- PHP version >= 7.3
- [Guzzle](https://github.com/guzzle/guzzle) 7 or 6 - PHP HTTP client for performing HTTP request.
- ext-curl PHP cURL extension
- ext-json PHP JSON extension

### Development requirements

- [PHPUnit](https://github.com/sebastianbergmann/phpunit) - A programmer-oriented testing framework for running unit tests in PHP.
- [Guzzle](https://github.com/guzzle/guzzle) 7 or 6 - PHP HTTP client for performing HTTP request.

### Guzzle
PHP-SDK will use Guzzle 6 or 7, if in present application, otherwise it will fall back to cURL. Guzzle is still used as dev dependency to make testing easier.

Using Guzzle is recommended on applications using PHP-SDK.

## Installation

Expand Down Expand Up @@ -76,6 +83,10 @@ Some of the key features are:

- [Requesting merchant settlements](https://docs.paytrail.com/#/?id=settlements)

### Reports

- [Request payment report](https://docs.paytrail.com/#/?id=payment-report-request)

## Methods

List of `Client::class` methods
Expand All @@ -98,4 +109,12 @@ List of `Client::class` methods
| createMitPaymentAuthorizationHold() | Create MiT authorization hold |
| createMitPaymentCommit() | Commit MiT authorization hold |
| revertPaymentAuthorizationHold() | Revert existing Mit or CiT authorization hold |
| getSettlements() | Request settlements |
| getSettlements() [Deprecated] | Deprecated Request settlements |
| requestSettlements() | Request settlements |
| requestPaymentReport() | Request payment report |
| requestPaymentReportBySettlement() | Request payment report by settlement ID |


---

**_Disclaimer:_** *This open source project is made available to assist coders in getting started with our API. However, we do not provide any warranty or guarantee that the code will work as intended and offer limited support for it. Use at your own risk.*
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.0 | ^8.4",
"phpunit/phpunit": "^10.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.6",
"phpcompatibility/php-compatibility": "^9.3",
"phpmd/phpmd": "^2.10",
"phpstan/phpstan": "1.9.14",
"mockery/mockery": "^1.5",
"guzzlehttp/guzzle": "^7.0|^6.0"
},
Expand All @@ -33,6 +34,9 @@
}
},
"scripts": {
"analyze": [
"vendor/bin/phpstan"
],
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"test": "\"vendor/bin/phpunit\"",
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 3
paths:
- src
- tests
7 changes: 6 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true" stopOnFailure="false">
<phpunit
bootstrap="vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="true"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Paytrail PHP-SDK testsuite">
<directory>tests</directory>
Expand Down
Loading

0 comments on commit be9a125

Please sign in to comment.