Skip to content

Commit

Permalink
Merge branch 'v1.x' into v1.x-spring1
Browse files Browse the repository at this point in the history
  • Loading branch information
Triplkrypl committed May 19, 2022
2 parents 3f1b314 + 43eec4e commit 2744e19
Show file tree
Hide file tree
Showing 39 changed files with 712 additions and 245 deletions.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/apiary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Apiary
description: Issue about documentation for ThePay.cz WS API
labels: ["Apiary"]
body:
- type: markdown
attributes:
value: "If you don't understand something in ThePay WS API documentation, miss some information, or find the documentation inconsistent with returned values from the API, let us know in the description below."
- type: textarea
attributes:
label: Description
description: Describe the problem as detailed as you can.
render: markdown
validations:
required: true
- type: input
attributes:
label: Merchant/project
description: |
If you need to identify yourself for the troubleshooting process, prefer to use your project ID or public URL.
Do not share your merchant ID or any other authentication information.
validations:
required: false
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PHP SDK
description: Issue about PHP SDK for ThePay.cz WS API
labels: ["PHP SDK"]
body:
- type: markdown
attributes:
value: "If you have any problem with your SDK implementation, you found anything inconsistent with the WS API documentation, or you need anything new, let us know in the description below."
- type: textarea
attributes:
label: Description
description: Describe the problem as detailed as you can.
render: markdown
validations:
required: true
- type: dropdown
attributes:
label: Environment
description: What environment do you call?
multiple: true
options:
- Production
- Demo
- Apiary mock
- Apiary proxy
validations:
required: false
- type: input
attributes:
label: PHP version
description: What PHP version do you use?
validations:
required: false
- type: input
attributes:
label: SDK version
description: What SDK version do you use?
validations:
required: false
- type: input
attributes:
label: Merchant/project
description: |
If you need to identify yourself for the troubleshooting process, prefer to use your project ID or public URL.
Do not share your merchant ID or any other authentication information.
validations:
required: false
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/ws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: WS API
description: Issue about server implementation of ThePay.cz WS API
labels: ["WS API", "bug"]
body:
- type: markdown
attributes:
value: "If the API call failed for some reason, returned unexpected data, or if the API is slow, let us know in the description below."
- type: textarea
attributes:
label: Description
description: Describe the problem as detailed as you can.
render: markdown
validations:
required: true
- type: dropdown
attributes:
label: Environment
description: What environment do you call?
multiple: true
options:
- Production
- Demo
- Apiary mock
- Apiary proxy
validations:
required: true
- type: input
attributes:
label: Platform
description: What platform do you use? (PHP, Java, Js, ...)
validations:
required: false
- type: input
attributes:
label: Merchant/project
description: |
If you need to identify yourself for the troubleshooting process, prefer to use your project ID or public URL.
Do not share your merchant ID or any other authentication information.
validations:
required: false
35 changes: 21 additions & 14 deletions README.md → .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ interacts with The Pay's REST API. To get started see examples below.

To install the SDK we recommend to use [Composer](https://getcomposer.org/):

composer require thepay/api-client
```console
composer require thepay/api-client
```

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Support & Contributions

If you find any bug, please submit the [issue](https://github.com/ThePay/api-client/issues/new/choose) in Github directly.

Feel free to contribute via Github [issues](https://github.com/ThePay/api-client/issues) and
[pull requests](https://github.com/ThePay/api-client/pulls). We will response as soon as possible.
Please have on mind the backwards compatibility and do not change requirements without previous admin agreement.

## Preconditions

Expand All @@ -28,7 +40,7 @@ Make sure that you have all required credentials and that you've set up the API

You can find all the necessary credentials in "Implementation" section under your merchant profile:

![](https://bitbucket.org/thepaygate/thepay-v2-php-sdk/raw/HEAD/doc/img/the-admin-credentials.png)
![](../doc/img/the-admin-credentials.png)

## Usage

Expand All @@ -38,7 +50,7 @@ You will work with only two classes when using this SDK.

## Configuration

All constructor parameters are described in [php doc](https://bitbucket.org/thepaygate/thepay-v2-php-sdk/src/HEAD/src/TheConfig.php)
All constructor parameters are described in [php doc](../src/TheConfig.php)

```php
$config = new ThePay\ApiClient\TheConfig(
Expand Down Expand Up @@ -73,7 +85,7 @@ No matter what method you choose, you have two more options, based on preselecti

Even if you (or your customer) preselect the payment method, it can still be changed after redirection, unless specifically forbidden.

![](https://bitbucket.org/thepaygate/thepay-v2-php-sdk/raw/HEAD/doc/img/payment_flow.png)
![](../doc/img/payment_flow.png)

#### REST API
You can create payment (link) via REST API and redirect user to that link. The payment itself is created through an API call.
Expand Down Expand Up @@ -109,7 +121,7 @@ These are the usual ways for payment creation:

Always create only one payment for your order for all payment creation options, unless you need to change the payment amount. In that case, consider it a whole new payment.

For more examples see [create-payment.md](https://bitbucket.org/thepaygate/thepay-v2-php-sdk/src/HEAD/doc/create-payment.md)
For more examples see [create-payment.md](../doc/create-payment.md)

```php
use ThePay\ApiClient\TheConfig;
Expand Down Expand Up @@ -203,18 +215,13 @@ if ($payment->wasPaid()) {

## More and detailed usage examples

You can find more usage examples at [folder /doc](https://bitbucket.org/thepaygate/thepay-v2-php-sdk/src/HEAD/doc/index.md).
You can find more usage examples at [folder /doc](../doc/index.md).

## Money calculations

For safe money calculations we recommend to use [moneyphp/money](https://github.com/moneyphp/money) package.
Please, do not use float to save information about prices because of its inaccuracy.

composer require moneyphp/money

## Support & Contributions

If you find any bug, please submit the issue in Github directly or contact us on email: [[email protected]](mailto:[email protected])

Feel free to contribute via Github issues and pull requests. We will response as soon as possible.
Please have on mind the backwards compatibility and do not change requirements without previous admin agreement.
```console
composer require moneyphp/money
```
187 changes: 187 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: CI

on:
push:
branches:
- "*"

jobs:
php81:
name: "php 8.1"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.1"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction
- name: Phpstan has to be added in pipeline bc it requires PHP 7.1+
run: composer require phpstan/phpstan --dev --no-interaction
- name: Old phpunit compatibility for php 8
run: composer require christiaanbye/polyfill-each --dev --no-interaction

- name: Check code style
run: composer cs-check

- name: Run static analysis
run: composer stan

- name: Run tests
run: composer test81

php80:
name: "php 8.0"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.0"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction
- name: Phpstan has to be added in pipeline bc it requires PHP 7.1+
run: composer require phpstan/phpstan --dev --no-interaction
- name: Old phpunit compatibility for php 8
run: composer require christiaanbye/polyfill-each --dev --no-interaction

- name: Check code style
run: composer cs-check

- name: Run static analysis
run: composer stan

- name: Run tests
run: composer test

php74:
name: "php 7.4"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:7.4"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction
- name: Phpstan has to be added in pipeline bc it requires PHP 7.1+
run: composer require phpstan/phpstan --dev --no-interaction

- name: Run static analysis
run: composer stan7

- name: Run tests
run: composer test

php73:
name: "php 7.3"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:7.3"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction
- name: Phpstan has to be added in pipeline bc it requires PHP 7.1+
run: composer require phpstan/phpstan --dev --no-interaction

- name: Run static analysis
run: composer stan7

- name: Run tests
run: composer test

php72:
name: "php 7.2"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:7.2"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction
- name: Phpstan has to be added in pipeline bc it requires PHP 7.1+
run: composer require phpstan/phpstan --dev --no-interaction

- name: Run static analysis
run: composer stan7

- name: Run tests
run: composer test

php71:
name: "php 7.1"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:7.1"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction
- name: Phpstan has to be added in pipeline bc it requires PHP 7.1+
run: composer require phpstan/phpstan --dev --no-interaction

- name: Run static analysis
run: composer stan7

- name: Run tests
run: composer test

php70:
name: "php 7.0"
runs-on: ubuntu-latest
container: "nofutur3/php-component:7.0"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction

- name: Run tests
run: composer test

php56:
name: "php 5.6"
runs-on: ubuntu-latest
container: "nofutur3/php-component:5.6"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction

- name: Run tests
run: composer test

php55:
name: "php 5.5"
runs-on: ubuntu-latest
container: "nofutur3/php-component:5.5"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction

- name: Run tests
run: composer test

php53:
name: "php 5.3"
runs-on: ubuntu-latest
container: "nofutur3/php-component:5.3"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-interaction

- name: Run tests
run: composer test
5 changes: 2 additions & 3 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
EOF;

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
;

$config = new PhpCsFixer\Config();
Expand All @@ -46,7 +46,6 @@
'no_useless_else' => true,
'no_useless_return' => true,
'no_unused_imports' => true,
'not_operator_with_space' => true,
'trailing_comma_in_multiline' => true,
'normalize_index_brace' => true,
'cast_spaces' => true,
Expand Down
Loading

0 comments on commit 2744e19

Please sign in to comment.