Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CL-788 Update Paytrail SDK fork #1

Merged
merged 122 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
e073f7e
Add possible query parameters to URL on CurlClient
VuorelaJ-P Sep 1, 2022
efdfa9e
Add companyName to Customer model
VuorelaJ-P Sep 1, 2022
32e2ad6
Merge pull request #46 from paytrail/fix_language_query
loueranta-paytrail Sep 2, 2022
f43e2b0
Add report request
VuorelaJ-P Jun 22, 2022
d8d30e5
Filter out empty parameters from settlement request
VuorelaJ-P Jun 22, 2022
068d091
Update readme
VuorelaJ-P Jun 22, 2022
5558fa9
Add extra validation
VuorelaJ-P Jun 22, 2022
a55effb
Clean ReportRequest validation, add dockblocks
VuorelaJ-P Jun 28, 2022
bd78dff
Add tests for validation, remove date validations
VuorelaJ-P Jun 28, 2022
e0bcae0
Add Guzzle recommendation to README
VuorelaJ-P Aug 10, 2022
b811e09
Fix ReportRequest ReportFields validation
Saggre Aug 30, 2022
5a0d15f
Add validation and tests for API requirement limit >= 0
Saggre Aug 30, 2022
9aa976b
Fix ReportRequest setReportFields input type
Saggre Aug 30, 2022
68117c3
Add documentation for payment request dates
Saggre Aug 30, 2022
4e0359b
Add report request response and tests
Saggre Aug 30, 2022
a6f1d5b
Fix typo
Saggre Aug 30, 2022
e835e3a
Merge pull request #47 from paytrail/add_companyName
loueranta-paytrail Sep 2, 2022
85bcc65
Merge pull request #40 from paytrail/payment_report_endpoint
loueranta-paytrail Sep 2, 2022
cc55002
Preparing for 2.3.0 release
loueranta-paytrail Sep 5, 2022
cd57010
Merge pull request #48 from paytrail/preparing-for-2.3.0-release
loueranta-paytrail Sep 5, 2022
2aa4f4f
Add missing properties to RefundRequest
VuorelaJ-P Sep 7, 2022
c2a3d99
Fix RefundRequest return types
VuorelaJ-P Sep 7, 2022
06547b6
Add refundStamp and reference to unit tests
VuorelaJ-P Sep 7, 2022
998b817
Add meethod for activate-invoice endpoint
VuorelaJ-P Sep 14, 2022
63b7007
Allow null for some response setters, fix dockblock type hints
VuorelaJ-P Sep 15, 2022
6d8a934
Allow null in CIT/MIT response transactionId setters
VuorelaJ-P Sep 27, 2022
3b45537
Add manualInvoiceActivation option to payment request
VuorelaJ-P Sep 28, 2022
c3cf9f6
Remove default value from manualInvoiceActivation
VuorelaJ-P Sep 28, 2022
b30f0cf
Add missing dockblocks and type casting
VuorelaJ-P Oct 6, 2022
b60b74d
Fix payment response function and docs types
Saggre Oct 24, 2022
164299e
Merge remote-tracking branch 'paytrail/fix-parameter-types' into add/…
Saggre Oct 24, 2022
6ad6471
Add payment method group model
Saggre Oct 24, 2022
51e0aee
Update payment response model
Saggre Oct 24, 2022
5872a03
Simplify payment response provider setter
Saggre Oct 24, 2022
ff711a9
Map payment reponse fields
Saggre Oct 24, 2022
6b5ac38
Add base test case for payment request tests and tests for payment re…
Saggre Oct 24, 2022
9601a46
Add phpcs fixes
Saggre Oct 24, 2022
19c983e
Merge pull request #49 from paytrail/add_refundRequest_parameters
loueranta-paytrail Oct 27, 2022
cf0e1e3
Merge pull request #52 from paytrail/fix-parameter-types
loueranta-paytrail Oct 27, 2022
db605eb
Merge pull request #53 from Saggre/add/payment-response-fields
loueranta-paytrail Nov 15, 2022
4ec97a5
Merge pull request #51 from paytrail/invoice-activation-endpoint
loueranta-paytrail Nov 15, 2022
61ca027
Preparing for 2.4.0 release
loueranta-paytrail Nov 15, 2022
04ad625
Fix PSR-12 stadard errors
VuorelaJ-P Nov 15, 2022
2ea3336
Add linter to workflow
VuorelaJ-P Nov 15, 2022
f9393e3
Fix workflow syntax
VuorelaJ-P Nov 15, 2022
1bd773d
Remove unused variale and commented out code
VuorelaJ-P Nov 15, 2022
30ccdc0
Store header keys in lower case
Kimitri Nov 16, 2022
0903237
Split arrays to multiline
VuorelaJ-P Nov 16, 2022
6706aa4
Merge pull request #56 from Kimitri/patch-1
loueranta-paytrail Nov 16, 2022
0f1e60b
Merge pull request #54 from paytrail/preparing-for-2.4.0-release
loueranta-paytrail Nov 16, 2022
4eb9be5
Improve workflow
VuorelaJ-P Nov 18, 2022
af43197
Run workflow on all cases instead of 'OR'
VuorelaJ-P Nov 18, 2022
5d69112
Fix 8.2 experimental checks
VuorelaJ-P Nov 18, 2022
3abca8d
Attempt to fix 8.2 pipeline
VuorelaJ-P Nov 18, 2022
5fff937
Add extensions to php8.2 setup
VuorelaJ-P Nov 18, 2022
3c578e6
Add extensions as env parameters
VuorelaJ-P Nov 18, 2022
4931f72
Remove PHP 8.2 from workflow
VuorelaJ-P Nov 18, 2022
a9df82b
Add missing transaction-id to activateInvoice POST request
tommi-martin Dec 19, 2022
30906d5
Merge pull request #55 from paytrail/psr12
loueranta-paytrail Jan 11, 2023
44ff64c
Merge pull request #57 from tommi-martin/fix-manual-invoice-activation
loueranta-paytrail Jan 11, 2023
abed442
Update CHANGELOG.md
loueranta-paytrail Jan 11, 2023
7ac0fcd
Merge pull request #58 from paytrail/preparing-for-2.4.1-release
loueranta-paytrail Jan 11, 2023
d06c4ed
Remove useless statement
mpesari Jan 25, 2023
67332e1
Add missing abstract function declaration
mpesari Jan 25, 2023
2f4c03f
Fix invalid @param annotations
mpesari Jan 25, 2023
912b0b3
Fix wrong @return annotation
mpesari Jan 25, 2023
d5b6dbf
Remove useless inherited variable declaration
mpesari Jan 25, 2023
8e11773
Remove references to Respect\Validation
mpesari Jan 25, 2023
921efdb
Fix wrong @var annotations
mpesari Jan 25, 2023
6d18422
Add missing use
mpesari Jan 25, 2023
b69d532
Fix wrong class used in PaymentResponse
mpesari Jan 25, 2023
8232d0d
Don't use dynamic properties (deprecated in PHP 8.2)
mpesari Jan 25, 2023
6a3f95f
Fix return type
mpesari Jan 25, 2023
fa438c6
Fix closure param type
mpesari Jan 26, 2023
62c5684
Install phpstan static analyzer
mpesari Jan 25, 2023
be1ee4b
Run phpstan in workflow
mpesari Jan 25, 2023
b3937f5
Add script "composer analyze"
mpesari Jan 26, 2023
d905338
Add disclaimer
loueranta-paytrail Feb 3, 2023
62e38c4
Merge pull request #63 from paytrail/disclaimer
loueranta-paytrail Feb 15, 2023
9430c8e
Merge pull request #62 from mpesari/phpstan
loueranta-paytrail Feb 15, 2023
545e1cd
Merge pull request #60 from mpesari/remove-useless-statement
loueranta-paytrail Feb 15, 2023
814b630
Add missing validation, fix validation exception text
VuorelaJ-P Jan 24, 2023
5e04bd2
Split long if statement to two lines (PSR-12 lint error)
VuorelaJ-P Jan 24, 2023
2781c68
Remove platform requirement ignoring from composer install
VuorelaJ-P Feb 15, 2023
3b998dd
Remove phpunit 9 for now
VuorelaJ-P Feb 15, 2023
76a73dc
Fix workflow
VuorelaJ-P Feb 17, 2023
d4cea99
Merge pull request #59 from paytrail/addMissingValidation
loueranta-paytrail Feb 17, 2023
167ab2b
Fix deprecated methods
VuorelaJ-P Feb 17, 2023
838bdeb
Fail phpunit tests on deprecation notices
mpesari Jan 25, 2023
6df0e33
Merge pull request #61 from mpesari/php-8.2
loueranta-paytrail Feb 20, 2023
ae22936
Return empy array instead of null in PaymentResponse::getProviders()
VuorelaJ-P Feb 22, 2023
4ce42b0
Merge pull request #65 from paytrail/fixDeprecatedMethods
loueranta-paytrail Feb 22, 2023
2bbe961
Update CHANGELOG.md
loueranta-paytrail Feb 22, 2023
d39be05
Merge pull request #66 from paytrail/preparing-for-2.3.2-release
loueranta-paytrail Feb 22, 2023
4c651ad
Update CHANGELOG.md
loueranta-paytrail Feb 22, 2023
721e156
Merge pull request #67 from paytrail/still-preparing-for-2.3.2-release
loueranta-paytrail Feb 22, 2023
942c385
Add proper settlement endpoint, deprecate old methods
VuorelaJ-P Mar 1, 2023
6b2e7bf
Updte readme
VuorelaJ-P Mar 1, 2023
6a7a8c2
fix autoformat error on inline
VuorelaJ-P Mar 1, 2023
7fee94e
Fix Report date validation, throw exception in status 400 when not us…
VuorelaJ-P Mar 9, 2023
e47789c
Shorten error message on report date valiadtion
VuorelaJ-P Mar 9, 2023
f9c3f04
Merge pull request #70 from paytrail/fixReportValidation
loueranta-paytrail Mar 15, 2023
8870deb
Merge pull request #68 from paytrail/AddProperSettlementEndpoint
loueranta-paytrail Apr 3, 2023
5c22f71
Add settlements by id endpoint
VuorelaJ-P Mar 1, 2023
446f33d
Fix styling errors
VuorelaJ-P Mar 1, 2023
2833924
Change private methods to protected for future abstract parent
VuorelaJ-P Mar 1, 2023
1e1847c
Remove unused use statements
VuorelaJ-P Mar 30, 2023
1f2f70f
Merge pull request #69 from paytrail/addReportBySettlementIdEndpoint
loueranta-paytrail Apr 11, 2023
5b3c98f
Update CHANGELOG.md
loueranta-paytrail Apr 11, 2023
ed22be2
Merge pull request #71 from paytrail/preparing-for-2.5.0-release
loueranta-paytrail Apr 12, 2023
826eca2
Fix item validation
VuorelaJ-P Apr 18, 2023
713c86a
Pass request parameters as url parameters in requestSettlements
VuorelaJ-P Apr 18, 2023
1b1c293
Merge pull request #75 from paytrail/fixRequestSettlementsUrlParameters
VuorelaJ-P Apr 19, 2023
e32611f
Merge pull request #74 from paytrail/fixItemValidation
loueranta-paytrail Apr 19, 2023
e4e85cc
Update CHANGELOG.md
loueranta-paytrail Apr 19, 2023
c1df05e
Merge pull request #76 from paytrail/preparing-for-2.5.1-release
loueranta-paytrail Apr 19, 2023
5756ed3
Allow zero amount items
VuorelaJ-P Apr 24, 2023
2b17aca
Merge pull request #79 from paytrail/fixUnitPriceValidationForZeroAmount
loueranta-paytrail May 5, 2023
56be907
Preparing for 2.5.2 release
loueranta-paytrail May 5, 2023
2bb8f34
Improve refundRequest Validation
VuorelaJ-P Apr 19, 2023
cdee831
Merge pull request #77 from paytrail/improveRefundRequestValidation
loueranta-paytrail May 5, 2023
12989e7
Merge pull request #81 from paytrail/preparing-for-2.5.2-release
loueranta-paytrail May 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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