Skip to content

Commit e6ef27f

Browse files
committed
use the current ease core 1.45
added link to "How to connect to API of Česká spořitelna" first initial oAuth redirect endpoint script added balance example update
1 parent 23566c1 commit e6ef27f

File tree

9 files changed

+64
-35
lines changed

9 files changed

+64
-35
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
2-
# ref: https://mustache.github.io/mustache.5.html
32

4-
composer.phar
3+
comoser.lock
54
/vendor/
65

76
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
@@ -14,4 +13,4 @@ composer.phar
1413

1514
# PHPUnit cache
1615
.phpunit.result.cache
17-
composer.lock
16+
/.env

.openapi-generator/FILES

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,3 @@ lib/Model/TransactionList.php
5858
lib/Model/TransactionListTransactionsInner.php
5959
lib/ObjectSerializer.php
6060
phpunit.xml.dist
61-
test/Api/DefaultApiTest.php
62-
test/Model/AccountBalanceTest.php
63-
test/Model/AccountCurrencyExchangeTest.php
64-
test/Model/AccountRelatedAgentsTest.php
65-
test/Model/AccountTest.php
66-
test/Model/GetAccounts400ResponseTest.php
67-
test/Model/GetAccounts403ResponseTest.php
68-
test/Model/GetAccounts404ResponseTest.php
69-
test/Model/GetAccounts405ResponseTest.php
70-
test/Model/GetAccounts412ResponseTest.php
71-
test/Model/GetAccounts429ResponseTest.php
72-
test/Model/GetAccounts500ResponseTest.php
73-
test/Model/GetAccounts503ResponseTest.php
74-
test/Model/GetStatements400ResponseTest.php
75-
test/Model/GetStatements403ResponseTest.php
76-
test/Model/GetStatements404ResponseTest.php
77-
test/Model/GetTransactions400ResponseTest.php
78-
test/Model/GetTransactions401ResponseTest.php
79-
test/Model/GetTransactions404ResponseTest.php
80-
test/Model/StatementListAccountStatementsInnerPeriodTest.php
81-
test/Model/StatementListAccountStatementsInnerTest.php
82-
test/Model/StatementListTest.php
83-
test/Model/TransactionListTest.php
84-
test/Model/TransactionListTransactionsInnerTest.php

.openapi-generator/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ additionalProperties:
77
UserId: SpojeNet
88
RepoId: php-vitexsoftware-rbczpremiumapi
99
infoEmail: [email protected]
10-
infoUrl: https://github.com/Spoje-NET/php-csas-webapi
10+
infoUrl: https://www.csas.cz/content/dam/cz/csas/www_csas_cz/dokumenty/obecne/how-to-connect-to-api-of-cs.pdf
1111
artifactUrl: https://github.com/Spoje-NET/php-csas-webapi
1212
appDescription: PHP API client for CSAS Premium Accounts WebAPI
1313
apiVersion: 3.0.0

.openapi-generator/templates/composer.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"ext-mbstring": "*",
3535
"guzzlehttp/guzzle": "^7.3",
3636
"guzzlehttp/psr7": "^1.7 || ^2.0",
37-
"vitexsoftware/ease-core": ">=1.41"
37+
"vitexsoftware/ease-core": "^1.45"
3838
},
3939
"require-dev": {
4040
"phpunit/phpunit": "^8.0 || ^9.0",

.openapi-generator/templates/gitignore.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ composer.phar
1515
# PHPUnit cache
1616
.phpunit.result.cache
1717
composer.lock
18+
/.env

Examples/balance.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
require_once(dirname(__DIR__) . '/vendor/autoload.php');
44

55
$apiInstance = new \SpojeNET\Csas\Accounts\DefaultApi(
6-
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
7-
// This is optional, `GuzzleHttp\Client` will be used as default.
8-
new GuzzleHttp\Client()
6+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
7+
// This is optional, `GuzzleHttp\Client` will be used as default.
8+
new GuzzleHttp\Client()
99
);
1010
$id = 'id_example'; // string | Opaque system ID of the account
1111

Examples/redirectedFromBank.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
// redirectedFromBank.php
4+
5+
// Load Ease Framework
6+
require_once __DIR__ . '/vendor/autoload.php';
7+
8+
// Initialize Ease Framework and load .env file
9+
\Ease\Shared::init(['.env'], __DIR__);
10+
11+
// Use environment variables
12+
$clientId = \Ease\Functions::cfg('CLIENT_ID');
13+
$clientSecret = \Ease\Functions::cfg('API_KEY');
14+
$redirectUri = 'http://localhost/php-csas-webapi/Examples/redirectedFromBank.php';
15+
$tokenUrl = 'https://sandbox.csas.cz/sandbox/api/token';
16+
17+
// Start session
18+
session_start();
19+
20+
// Check if the authorization code is set
21+
if (isset($_GET['code'])) {
22+
$code = $_GET['code'];
23+
24+
// Prepare the POST request to exchange the authorization code for an access token
25+
$postFields = [
26+
'grant_type' => 'authorization_code',
27+
'code' => $code,
28+
'redirect_uri' => $redirectUri,
29+
'client_id' => $clientId,
30+
'client_secret' => $clientSecret
31+
];
32+
33+
$ch = curl_init();
34+
curl_setopt($ch, CURLOPT_URL, $tokenUrl);
35+
curl_setopt($ch, CURLOPT_POST, true);
36+
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
37+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
38+
39+
$response = curl_exec($ch);
40+
curl_close($ch);
41+
42+
$responseData = json_decode($response, true);
43+
44+
if (isset($responseData['access_token'])) {
45+
// Store the access token in the session
46+
$_SESSION['access_token'] = $responseData['access_token'];
47+
echo 'Access token obtained successfully!';
48+
} else {
49+
echo 'Error obtaining access token!';
50+
}
51+
} else {
52+
echo 'Authorization code not found!';
53+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
API for managing production accounts.
44

5-
For more information, please visit [https://github.com/Spoje-NET/php-csas-webapi](https://github.com/Spoje-NET/php-csas-webapi).
5+
For more information, please visit [https://www.csas.cz/content/dam/cz/csas/www_csas_cz/dokumenty/obecne/how-to-connect-to-api-of-cs.pdf](https://www.csas.cz/content/dam/cz/csas/www_csas_cz/dokumenty/obecne/how-to-connect-to-api-of-cs.pdf).
66

77
## Installation & Usage
88

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"Česká Spořitelna",
1414
"Spořka"
1515
],
16-
"homepage": "https://github.com/Spoje-NET/php-csas-webapi",
16+
"homepage": "https://www.csas.cz/content/dam/cz/csas/www_csas_cz/dokumenty/obecne/how-to-connect-to-api-of-cs.pdf",
1717
"license": "MIT",
1818
"authors": [
1919
{
@@ -29,7 +29,7 @@
2929
"ext-mbstring": "*",
3030
"guzzlehttp/guzzle": "^7.3",
3131
"guzzlehttp/psr7": "^1.7 || ^2.0",
32-
"vitexsoftware/ease-core": ">=1.41"
32+
"vitexsoftware/ease-core": "^1.45"
3333
},
3434
"require-dev": {
3535
"phpunit/phpunit": "^8.0 || ^9.0",

0 commit comments

Comments
 (0)