Skip to content

Commit f16ae08

Browse files
committed
Version 3.0.0
1 parent 9c79a6e commit f16ae08

File tree

227 files changed

+19375
-1291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+19375
-1291
lines changed

.gitignore

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
/vendor
1+
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
2+
3+
composer.phar
4+
/vendor/
5+
/bin/
6+
!/bin/.gitkeep
7+
8+
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
9+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
10+
# composer.lock
11+
12+
# php-cs-fixer cache
13+
.php_cs.cache
14+
.php-cs-fixer.cache
15+
16+
# PHPUnit cache
17+
.phpunit.result.cache
18+
/.cache/

.php-cs-fixer.dist.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* @generated
5+
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst
6+
*/
7+
$finder = PhpCsFixer\Finder::create()
8+
->in(__DIR__)
9+
->exclude('vendor')
10+
->exclude('test')
11+
->exclude('tests')
12+
;
13+
14+
$config = new PhpCsFixer\Config();
15+
return $config->setRules([
16+
'@PSR12' => true,
17+
'phpdoc_order' => true,
18+
'array_syntax' => [ 'syntax' => 'short' ],
19+
'strict_comparison' => true,
20+
'strict_param' => true,
21+
'no_trailing_whitespace' => false,
22+
'no_trailing_whitespace_in_comment' => false,
23+
'braces' => false,
24+
'single_blank_line_at_eof' => false,
25+
'blank_line_after_namespace' => false,
26+
'no_leading_import_slash' => false,
27+
])
28+
->setFinder($finder)
29+
;

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: php
2+
# Bionic environment has preinstalled PHP from 7.1 to 7.4
3+
# https://docs.travis-ci.com/user/reference/bionic/#php-support
4+
dist: bionic
5+
php:
6+
- 7.4
7+
before_install: "composer install"
8+
script: "vendor/bin/phpunit"

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM devilbox/php-fpm-7.4:latest as cli
2+
3+
RUN sed -e 's/max_execution_time = 30/max_execution_time = 100/' -i /usr/local/etc/php/docker-php.ini
4+
5+
RUN apt-get update && apt-get install -y git unzip curl
6+
7+
# Install Composer
8+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
9+
RUN composer --version
10+
11+
ENV COMPOSER_MEMORY_LIMIT=-1
12+
ENV COMPOSER_ALLOW_SUPERUSER=1
13+
14+
FROM cli
15+
COPY . /app/
16+
WORKDIR /app/
17+
18+
RUN composer install

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Krzysztof Grzelak
3+
Copyright (c) 2023-present Payments Solution sp. z o.o.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
bash-root: #login into container as root
2+
docker exec -it -u root php bash
3+
4+
bash: ## login into container
5+
docker-compose exec php bash
6+
7+
lint: ## Check code style
8+
docker-compose exec php bin/ecs check --ansi --config ecs.php --fix
9+
docker-compose exec php bin/rector --ansi
10+
docker-compose exec php bin/psalm
11+
docker-compose exec php bin/phpstan analyse --ansi --no-progress --configuration phpstan.neon --memory-limit=1G
12+
13+
test: ## Run tests
14+
docker-compose exec php bin/phpunit --colors=always --coverage-text --coverage-html=build/coverage
15+
16+
build: ## Builds the Docker images
17+
docker-compose build --pull --no-cache
18+
19+
up: ## Start containers in detached mode (no logs)
20+
docker-compose up --detach
21+
22+
stop: ## Stop containers
23+
docker-compose stop
24+
25+
remove: ## Remove containers
26+
docker-compose stop
27+
docker-compose rm -fv php
28+

README.md

Lines changed: 184 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,214 @@
1-
# SimPay-API-php
2-
Znajdziesz tu pliki do pobrania i instalacji oficjalnego klienta PHP wszystkich dostępnych API SimPay.
1+
## Simpay.pl API PHP SDK
32

4-
Dzięki naszemu klientowi *zyskasz narzędzia i biblioteki* do integracji API systemu płatności SimPay z Twoją stroną. Dzięki temu zyskasz pełen dostęp do wszystkich funkcji SimPay.
3+
# Description
54

6-
## Dokumentacja
7-
[Kliknij tutaj](https://docs.simpay.pl/pl/php/?php#wstep)
5+
This documentation is intended for current and future Simpay Partners. Prior to implementation, it is necessary to define the service in the Partner Panel and wait for its activation directly from the operators.
86

9-
## Wymagania
10-
* PHP 7.4+
7+
## Installation & Usage
118

12-
## Instalacja
9+
### Requirements
1310

14-
SimPay API php można zainstalować za pomocą [Composer](https://packagist.org/packages/simpaypl/simpay).
11+
PHP 7.4 and later.
12+
Should also work with PHP 8.0.
1513

1614
### Composer
1715

18-
#### Instalacja automatyczna
19-
```composer require simpaypl/simpay```
16+
To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
2017

21-
#### Instalacja ręczna
22-
Wewnątrz `composer.json` dodaj następujący wpis:
23-
24-
``` json
18+
```json
2519
{
20+
"repositories": [
21+
{
22+
"type": "vcs",
23+
"url": "https://github.com/8lines/simpay-php-sdk.git"
24+
}
25+
],
2626
"require": {
27-
"simpaypl/simpay": "dev-master"
27+
"8lines/simpay-php-sdk": "*@dev"
2828
}
2929
}
3030
```
3131

32-
## Dlaczego warto wybrać SimPay?
33-
* *Prosta i szybka integracja* – nasz klient API jest intuicyjny w obsłudze, dzięki czemu poradzisz sobie z integracją nawet bez większych umiejętności.
34-
* *Natychmiastowe zarobki* – ażdego dnia prześlemy Ci zyski z płatności online
35-
* *Bezpieczeństwo i ciągłe wsparcie techniczne* – gwarantujemy odpowiednie zabezpieczenie wszystkich płatności. A w razie problemów z integracją lub działaniem systemów SimPay, natychmiast reagujemy wsparciem.
32+
Then run `composer install`
3633

37-
Masz problem z integracją lub chcesz dowiedzieć się więcej? Napisz na [email protected]
34+
### Manual Installation
3835

39-
---
36+
Download the files and include `autoload.php`:
4037

41-
# SimPay-API-php
42-
Here you will find files to download and install the official PHP client of all available SimPay APIs.
38+
```php
39+
<?php
40+
require_once('/prject/path/vendor/autoload.php');
41+
```
4342

44-
With our client, you will get *the tools and libraries* to integrate the SimPay payment system API into your site. This will give you full access to all SimPay features.
43+
## Getting Started
4544

46-
## Documentation
47-
[Click here](https://docs.simpay.pl/en/php/?php#wstep)
45+
```php
46+
<?php
4847

49-
## Requirements
50-
* PHP 7.4+
48+
require_once(__DIR__ . '/vendor/autoload.php');
5149

52-
## Installation
50+
$configuration = new Configuration('your_api_key', 'your_api_password', 'en');
51+
$client = new Client([
52+
'base_uri' => Configuration::API_BASE_URI,
53+
]);
5354

54-
The SimPay API php can be installed using [Composer](https://packagist.org/packages/simpaypl/simpay).
55+
$api = new Simpay\DirectBillingApi(
56+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
57+
// This is optional, `GuzzleHttp\Client` will be used as default.
58+
$client,
59+
$config
60+
);
5561

56-
### Composer
62+
try {
63+
$result = $api->directBillingGetServices();
64+
print_r($result);
65+
} catch (\Exception $e) {
66+
echo 'Exception when calling DirectBillingApi->directbillingGetServices: ', $e->getMessage(), PHP_EOL;
67+
}
5768

58-
#### Automatic install
59-
```composer require simpaypl/simpay```
69+
```
70+
### Examples
71+
72+
All examples are in the [examples](docs/examples/) directory.
73+
74+
## Documentation for API Endpoints
75+
76+
## API Endpoints
77+
78+
All URIs are relative to *https://api.simpay.pl*
79+
- [Configuration](docs/Configuration.md)
80+
- [DirectBillingApi](docs/DirectBillingApi.md)
81+
- [DirectBillingCalculateApi](docs/DirectBillingCalculateApi.md)
82+
- [DirectBillingTransactionApi](docs/DirectBillingTransactionApi.md)
83+
- [HttpClientFactory](docs/HttpClientFactory.md)
84+
- [PaymentApi](docs/PaymentApi.md)
85+
- [SmsNumberApi](docs/SmsNumberApi.md)
86+
- [SmsServiceApi](docs/SmsServiceApi.md)
87+
- [SmsTransactionApi](docs/SmsTransactionApi.md)
88+
89+
## Models
90+
91+
### Requests:
92+
- [Amount](docs/Model/Amount.md)
93+
- [AmountType](docs/Model/AmountType.md)
94+
- [Billing](docs/Model/Billing.md)
95+
- [CallbackReturnUrl](docs/Model/Request/CallbackReturnUrl.md)
96+
- [CartItem](docs/Model/Request/CartItem.md)
97+
- [Channel](docs/Model/Request/Channel.md)
98+
- [ChannelType](docs/Model/Request/ChannelType.md)
99+
- [Control](docs/Model/Request/Control.md)
100+
- [CreatePayment](docs/Model/Request/CreatePayment.md)
101+
- [Currency](docs/Model/Request/Currency.md)
102+
- [Customer](docs/Model/Request/Customer.md)
103+
- [Description](docs/Model/Request/Description.md)
104+
- [DirectBillingTransaction](docs/Model/Request/DirectBillingTransaction.md)
105+
- [DirectBillingTransactionStatus](docs/Model/Request/DirectBillingTransactionStatus.md)
106+
- [DirectChannel](docs/Model/Request/DirectChannel.md)
107+
- [Filters](docs/Model/Request/Filters.md)
108+
- [Operator](docs/Model/Request/Operator.md)
109+
- [PaymentTransactionId](docs/Model/Request/PaymentTransactionId.md)
110+
- [PhoneNumber](docs/Model/Request/PhoneNumber.md)
111+
- [Referer](docs/Model/Request/Referer.md)
112+
- [ServiceId](docs/Model/Request/ServiceId.md)
113+
- [ServiceNumber](docs/Model/Request/ServiceNumber.md)
114+
- [Shipping](docs/Model/Request/Shipping.md)
115+
- [SmsCode](docs/Model/Request/SmsCode.md)
116+
- [SmsNumber](docs/Model/Request/SmsNumber.md)
117+
- [SmsTransactionId](docs/Model/Request/SmsTransactionId.md)
118+
- [StreamId](docs/Model/Request/StreamId.md)
119+
120+
### Responses:
121+
- [Amount](docs/Model/Response/Amount.md)
122+
- [AmountType](docs/Model/Response/AmountType.md)
123+
- [CallbackReturnUrl](docs/Model/Response/CallbackReturnUrl.md)
124+
- [DirectBillingTransaction](docs/Model/Response/DirectBillingTransaction.md)
125+
- [DirectBillingTransactionCollection](docs/Model/Response/DirectBillingTransactionCollection.md)
126+
- [DirectBillingTransactionList](docs/Model/Response/DirectBillingTransactionList.md)
127+
- [DirectBillingTransactionNotify](docs/Model/Response/DirectBillingTransactionNotify.md)
128+
- [Operator](docs/Model/Response/Operator.md)
129+
- [Pagination](docs/Model/Response/Pagination.md)
130+
- [PaginationLinks](docs/Model/Response/PaginationLinks.md)
131+
- [PaymentChannel](docs/Model/Response/PaymentChannel.md)
132+
- [PaymentChannelCollection](docs/Model/Response/PaymentChannelCollection.md)
133+
- [PaymentCreate](docs/Model/Response/PaymentCreate.md)
134+
- [PaymentService](docs/Model/Response/PaymentService.md)
135+
- [PaymentServiceCollection](docs/Model/Response/PaymentServiceCollection.md)
136+
- [PaymentServiceTransaction](docs/Model/Response/PaymentServiceTransaction.md)
137+
- [PaymentServiceTransactionCollection](docs/Model/Response/PaymentServiceTransactionCollection.md)
138+
- [PaymentServiceTransactionStatus](docs/Model/Response/PaymentServiceTransactionStatus.md)
139+
- [PaymentServiceTransaction](docs/Model/Response/PaymentServiceTransaction.md)
140+
- [PaymentServiceTransactionAddress](docs/Model/Response/PaymentTransactionAddress.md)
141+
- [PaymentServiceTransactionAmount](docs/Model/Response/PaymentTransactionAmount.md)
142+
- [PaymentServiceTransactionCartItems](docs/Model/Response/PaymentTransactionCartItem.md)
143+
- [PaymentServiceTransactionCustomer](docs/Model/Response/PaymentTransactionCustomer.md)
144+
- [PaymentServiceTransactionRedirect](docs/Model/Response/PaymentTransactionRedirect.md)
145+
- [Service](docs/Model/Response/Service.md)
146+
- [ServiceCalculation](docs/Model/Response/ServiceCalculation.md)
147+
- [ServiceCalculationOperatorAmount](docs/Model/Response/ServiceCalculationOperatorAmount.md)
148+
- [ServiceCollection](docs/Model/Response/ServiceCollection.md)
149+
- [ServiceNumber](docs/Model/Response/ServiceNumber.md)
150+
- [ServiceStatus](docs/Model/Response/ServiceStatus.md)
151+
- [ServiceType](docs/Model/Response/ServiceType.md)
152+
- [SmsNumber](docs/Model/Response/SmsNumber.md)
153+
- [SmsNumberCollection](docs/Model/Response/SmsNumberCollection.md)
154+
- [SmsService](docs/Model/Response/SmsService.md)
155+
- [SmsServiceCheckCodeData](docs/Model/Response/SmsServiceCheckCodeData.md)
156+
- [SmsServiceCollection](docs/Model/Response/SmsServiceCollection.md)
157+
- [SmsTransaction](docs/Model/Response/SmsTransaction.md)
158+
- [SmsTransactionCollection](docs/Model/Response/SmsTransactionCollection.md)
159+
160+
### Exceptions:
161+
162+
- [Simpay\Exception\ExceptionFactory](docs/Exception/ExceptionFactory.md)
163+
- [Simpay\Exception\Forbidden](docs/Exception/Forbidden.md)
164+
- [Simpay\Exception\InternalServerError](docs/Exception/InternalServerError.md)
165+
- [Simpay\Exception\NotFound](docs/Exception/NotFound.md)
166+
- [Simpay\Exception\Unauthorized](docs/Exception/Unauthorized.md)
167+
- [Simpay\Exception\Unknown](docs/Exception/Unknown.md)
168+
- [Simpay\Exception\UnprocessableEntity](docs/Exception/UnprocessableEntity.md)
169+
170+
All the exceptions have the `getErrors` method which returns an array of errors returned by the API.
171+
172+
## Tests
173+
174+
To run the tests, use:
175+
176+
```bash
177+
composer install
178+
bin/phpunit
179+
```
60180

61-
#### Manual install
62-
Inside of `composer.json` specify the following:
181+
## Docker
63182

64-
``` json
65-
{
66-
"require": {
67-
"simpaypl/simpay": "dev-master"
68-
}
69-
}
183+
To build the Docker image:
184+
185+
```bash
186+
make build
187+
```
188+
To run the Docker image:
189+
190+
```bash
191+
make up
192+
```
193+
194+
Enter the container (bash):
195+
196+
```bash
197+
make bash
198+
```
199+
200+
To run the tests:
201+
202+
```bash
203+
make test
204+
```
205+
206+
To run the linter:
207+
208+
```bash
209+
make lint
70210
```
71211

72-
## Why should I choose SimPay?
73-
* *Easy and fast integration* – our API client is inuitive to use, so you can handle the integration even without much skill.
74-
* *Instant earnings* – we will send you profits from online payments every day.
75-
* *Safety and continuous technical support* – we guarantee proper security for all payments. And in case of problems with the integration or operation of SimPay systems, we immediately respond with support.
212+
## About this package
76213

77-
Do you have an issue with integration or want to learn more? Write to [email protected]
214+
- API version: `1.0.0`

0 commit comments

Comments
 (0)