fidor_starter_kits 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/fidor_starter_kits.rb +1 -1
- data/lib/fidor_starter_kits/version.rb +1 -1
- data/starter_kits/php_advanced/.fidor_meta.json +8 -0
- data/starter_kits/php_advanced/Fidor/SDK/Accounts.php +47 -0
- data/starter_kits/php_advanced/Fidor/SDK/Authorization.php +276 -0
- data/starter_kits/php_advanced/Fidor/SDK/Autoload.php +33 -0
- data/starter_kits/php_advanced/Fidor/SDK/Client.php +239 -0
- data/starter_kits/php_advanced/Fidor/SDK/Config.php +272 -0
- data/starter_kits/php_advanced/Fidor/SDK/Customers.php +27 -0
- data/starter_kits/php_advanced/Fidor/SDK/Transactions.php +47 -0
- data/starter_kits/php_advanced/Fidor/SDK/Transfers.php +65 -0
- data/starter_kits/php_advanced/Fidor/SDK/Transfers/Batch.php +18 -0
- data/starter_kits/php_advanced/Fidor/SDK/Transfers/Global.php +18 -0
- data/starter_kits/php_advanced/Fidor/SDK/Transfers/Internal.php +33 -0
- data/starter_kits/php_advanced/Fidor/SDK/Transfers/SEPA.php +18 -0
- data/starter_kits/php_advanced/Fidor/SDK/Users.php +23 -0
- data/starter_kits/php_advanced/README.md +19 -0
- data/starter_kits/php_advanced/curl-test.php +1 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.css +587 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.css.map +1 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.min.css +6 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.min.css.map +1 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap.css +6760 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap.css.map +1 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap.min.css +6 -0
- data/starter_kits/php_advanced/demo/assets/css/bootstrap.min.css.map +1 -0
- data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.svg +288 -0
- data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/starter_kits/php_advanced/demo/assets/js/bootstrap.js +2363 -0
- data/starter_kits/php_advanced/demo/assets/js/bootstrap.min.js +7 -0
- data/starter_kits/php_advanced/demo/assets/js/jquery.min.js +6 -0
- data/starter_kits/php_advanced/demo/assets/js/npm.js +13 -0
- data/starter_kits/php_advanced/demo/authorize.php +103 -0
- data/starter_kits/php_advanced/demo/config.php +15 -0
- data/starter_kits/php_advanced/demo/dashboard.php +154 -0
- data/starter_kits/php_advanced/demo/error_auth.php +71 -0
- data/starter_kits/php_advanced/demo/error_auth_refresh.php +71 -0
- data/starter_kits/php_advanced/demo/error_token_expired.php +76 -0
- data/starter_kits/php_advanced/demo/get_accounts.php +152 -0
- data/starter_kits/php_advanced/demo/get_customers.php +130 -0
- data/starter_kits/php_advanced/demo/get_transactions.php +146 -0
- data/starter_kits/php_advanced/demo/index.php +84 -0
- data/starter_kits/php_advanced/demo/refresh_token.php +39 -0
- data/starter_kits/php_advanced/demo/revoke_access.php +38 -0
- data/starter_kits/php_advanced/demo/setup.php +14 -0
- data/starter_kits/php_advanced/demo/transfer_money.php +241 -0
- data/starter_kits/php_advanced/demo/transfer_money_results.php +126 -0
- metadata +50 -2
@@ -0,0 +1,84 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Startup
|
4
|
+
*/
|
5
|
+
require_once 'setup.php';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Alias Fidor SDK namespace
|
9
|
+
*/
|
10
|
+
use Fidor\SDK as Fidor;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Load Fido API settings
|
14
|
+
*/
|
15
|
+
$settings = include 'config.php';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Create Config instance. Check Config class for alternative calls.
|
19
|
+
*/
|
20
|
+
$config = Fidor\Config::fromArray( $settings );
|
21
|
+
|
22
|
+
?>
|
23
|
+
<!DOCTYPE html>
|
24
|
+
<html lang="en">
|
25
|
+
<head>
|
26
|
+
<meta charset="UTF-8" />
|
27
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
28
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
29
|
+
|
30
|
+
<title>FIDOR API - Starter Kit</title>
|
31
|
+
|
32
|
+
<!-- Bootstrap -->
|
33
|
+
<link href="assets/css/bootstrap.css" rel="stylesheet">
|
34
|
+
|
35
|
+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
36
|
+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
37
|
+
<!--[if lt IE 9]>
|
38
|
+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
39
|
+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
40
|
+
<![endif]-->
|
41
|
+
</head>
|
42
|
+
<body>
|
43
|
+
|
44
|
+
<div class="container">
|
45
|
+
<h1>Fidor API Starter Kit</h1>
|
46
|
+
|
47
|
+
<p>
|
48
|
+
With this small program you can test the basic functions of the Fidor API. Look into the code and learn how it works.
|
49
|
+
You can also integrate the code into your own software.
|
50
|
+
</p>
|
51
|
+
|
52
|
+
<h2>Current configuration (you can change this in the code): </h2>
|
53
|
+
|
54
|
+
<div class="row">
|
55
|
+
<div class="col-md-6">
|
56
|
+
<table class="table table-bordered table-condensed table-hover table-striped col-md-6">
|
57
|
+
<tbody>
|
58
|
+
<tr>
|
59
|
+
<th scope="row">Authorization</th>
|
60
|
+
<td><?php echo $config->getOAuthUrl(); ?></td>
|
61
|
+
</tr>
|
62
|
+
<tr>
|
63
|
+
<th scope="row">API</th>
|
64
|
+
<td><?php echo $config->getApiUrl(); ?></td>
|
65
|
+
</tr>
|
66
|
+
</tbody>
|
67
|
+
</table>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<p>
|
72
|
+
<a href="authorize.php" class="btn btn-primary">Connect to Fidor and get new access token</a>
|
73
|
+
</p>
|
74
|
+
|
75
|
+
<p>Documentation reference: </p>
|
76
|
+
<ul>
|
77
|
+
<li><a href="http://docs.fidor.de/#understand-oauth" target="_blank">http://docs.fidor.de/#understand-oauth</a></li>
|
78
|
+
</ul>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<script src="assets/js/jquery.min.js"></script>
|
82
|
+
<script src="assets/js/bootstrap.min.js"></script>
|
83
|
+
</body>
|
84
|
+
</html>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Startup
|
4
|
+
*/
|
5
|
+
require_once 'setup.php';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Alias Fidor SDK namespace
|
9
|
+
*/
|
10
|
+
use Fidor\SDK as Fidor;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Load Fido API settings
|
14
|
+
*/
|
15
|
+
$settings = include 'config.php';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Create Config instance. Check Config class for alternative calls.
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
$config = Fidor\Config::fromArray( $settings );
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Add oauth parameters ( access token, refresh token and expiration time ) to config
|
25
|
+
*/
|
26
|
+
$config->setAccessToken( $_SESSION['oauth']['access_token'] )
|
27
|
+
->setRefreshToken( $_SESSION['oauth']['refresh_token'] );
|
28
|
+
|
29
|
+
$auth = new Fidor\Authorization( $config );
|
30
|
+
$resp = $auth->refresh();
|
31
|
+
if ( ! empty( $resp['access_token'] ) ) {
|
32
|
+
$resp['auth_at'] = time();
|
33
|
+
$_SESSION['oauth'] = $resp;
|
34
|
+
header( 'Location: dashboard.php' );
|
35
|
+
} elseif ( ! empty( $resp['error'] ) ) {
|
36
|
+
header( 'Location: error_auth.php?error=' . $resp['error'] );
|
37
|
+
}
|
38
|
+
|
39
|
+
exit;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Startup
|
4
|
+
*/
|
5
|
+
require_once 'setup.php';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Alias Fidor SDK namespace
|
9
|
+
*/
|
10
|
+
use Fidor\SDK as Fidor;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Load Fido API settings
|
14
|
+
*/
|
15
|
+
$settings = include 'config.php';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Create Config instance. Check Config class for alternative calls.
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
$config = Fidor\Config::fromArray( $settings );
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Add oauth parameters ( access token, refresh token and expiration time ) to config
|
25
|
+
*/
|
26
|
+
$config->setAccessToken( $_SESSION['oauth']['access_token'] )
|
27
|
+
->setRefreshToken( $_SESSION['oauth']['refresh_token'] )
|
28
|
+
->setExpiresIn( $_SESSION['oauth']['expires_in'] + $_SESSION['oauth']['auth_at'] );
|
29
|
+
|
30
|
+
/*if ( $config->hasTokenExpired() ) {
|
31
|
+
header( 'Location: index.php' );
|
32
|
+
exit;
|
33
|
+
}*/
|
34
|
+
|
35
|
+
$auth = new Fidor\Authorization( $config );
|
36
|
+
$auth->revoke();
|
37
|
+
header( 'Location: index.php' );
|
38
|
+
exit;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
error_reporting( E_ALL );
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Set session lifetime to 24 hours for testing
|
7
|
+
*/
|
8
|
+
session_set_cookie_params( 24 * 60 * 60 );
|
9
|
+
session_start();
|
10
|
+
|
11
|
+
/*
|
12
|
+
* Load class loader. You can remove this line when using composer.
|
13
|
+
*/
|
14
|
+
require_once '../Fidor/SDK/Autoload.php';
|
@@ -0,0 +1,241 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Startup
|
4
|
+
*/
|
5
|
+
require_once 'setup.php';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Alias Fidor SDK namespace
|
9
|
+
*/
|
10
|
+
use Fidor\SDK as Fidor;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Load Fido API settings
|
14
|
+
*/
|
15
|
+
$settings = include 'config.php';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Create Config instance. Check Config class for alternative calls.
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
$config = Fidor\Config::fromArray( $settings );
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Add oauth parameters ( access token, refresh token and expiration time ) to config
|
25
|
+
*/
|
26
|
+
$config->setAccessToken( $_SESSION['oauth']['access_token'] )
|
27
|
+
->setRefreshToken( $_SESSION['oauth']['refresh_token'] )
|
28
|
+
->setExpiresIn( $_SESSION['oauth']['expires_in'] + $_SESSION['oauth']['auth_at'] );
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Check if token has expired and try refreshing it
|
32
|
+
*/
|
33
|
+
/*if ( $config->hasTokenExpired() ) {
|
34
|
+
$auth = new Fidor\Authorization( $config );
|
35
|
+
$resp = $auth->refresh( $_SESSION['oauth']['refresh_token'] );
|
36
|
+
print_r( $resp );
|
37
|
+
die();
|
38
|
+
}*/
|
39
|
+
|
40
|
+
$notices = array();
|
41
|
+
|
42
|
+
/*
|
43
|
+
* Handling request for money transfer
|
44
|
+
*/
|
45
|
+
if ( isset( $_REQUEST['send-money'] ) ) {
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Validation (ensure we have the mandatory information with correct format)
|
49
|
+
*/
|
50
|
+
if ( '' === trim( $_REQUEST['account_id'] ) ) {
|
51
|
+
$notices[] = '<p class="alert alert-danger">Your account ID is required</p>';
|
52
|
+
}
|
53
|
+
if ( '' === trim( $_REQUEST['receiver'] ) ) {
|
54
|
+
$notices[] = '<p class="alert alert-danger">Receiver is required</p>';
|
55
|
+
}
|
56
|
+
if ( '' === preg_replace( '/[\.0\s]/s', '', trim( $_REQUEST['amount'] ) ) ) {
|
57
|
+
$notices[] = '<p class="alert alert-danger">Amount is required</p>';
|
58
|
+
} elseif ( ! preg_match( '/^\d+(\.\d+)?$/', trim( $_REQUEST['amount'] ) ) ) {
|
59
|
+
$notices[] = '<p class="alert alert-danger">Amount is not a valid number</p>';
|
60
|
+
} elseif ( $_REQUEST['amount'] < 1 ) {
|
61
|
+
$notices[] = '<p class="alert alert-danger">1€ minimum required</p>';
|
62
|
+
}
|
63
|
+
if ( '' === trim( $_REQUEST['external_uid'] ) ) {
|
64
|
+
$notices[] = '<p class="alert alert-danger">External UID is required</p>';
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* No validation errors, proceed with transaction
|
69
|
+
*/
|
70
|
+
if ( count( $notices ) === 0 ) {
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Create API client
|
74
|
+
*/
|
75
|
+
$client = new Fidor\Client( $config );
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Send money
|
79
|
+
*/
|
80
|
+
$resp = $client->transfers->internal->create( array(
|
81
|
+
'account_id' => $_REQUEST['account_id'],
|
82
|
+
'receiver' => $_REQUEST['receiver'],
|
83
|
+
'external_uid' => $_REQUEST['external_uid'],
|
84
|
+
'amount' => $_REQUEST['amount'] * 100, // e.g.: 100 for 1 EUR
|
85
|
+
'subject' => $_REQUEST['subject'],
|
86
|
+
) );
|
87
|
+
|
88
|
+
if ( ! empty( $resp['id'] ) ) {
|
89
|
+
header( 'Location: transfer_money_results.php?' . http_build_query( $resp ) );
|
90
|
+
exit;
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* If transaction failed show errors to user.
|
95
|
+
*/
|
96
|
+
if ( isset( $resp['errors'] ) && ! empty( $resp['message'] ) ) {
|
97
|
+
$notices[] = sprintf( '<p class="alert alert-danger">Transfer failed - Reason: <strong>%s</strong> (Code: %s)</p>', $resp['message'], $resp['code'] );
|
98
|
+
//echo Fidor\Client::get_debug_log();
|
99
|
+
//exit;
|
100
|
+
} elseif ( ! empty( $resp['message'] ) ) {
|
101
|
+
header( 'Location: error_token_expired.php?error=' . $resp['message'] );
|
102
|
+
exit;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
$client = new Fidor\Client( $config );
|
108
|
+
$current_account = $client->users->current();
|
109
|
+
if ( ! empty( $current_account['message'] ) ) {
|
110
|
+
header( 'Location: error_token_expired.php?error=' . $current_account['message'] );
|
111
|
+
exit;
|
112
|
+
}
|
113
|
+
$accounts = $client->accounts->get();
|
114
|
+
$account = current( $accounts );
|
115
|
+
$currency_code = 'EUR';
|
116
|
+
$currency_html = '€';
|
117
|
+
if ( ! empty( $account['currency'] ) && 'GBP' === $account['currency'] ) {
|
118
|
+
$currency_code = 'GBP';
|
119
|
+
$currency_html = '£';
|
120
|
+
}
|
121
|
+
|
122
|
+
?>
|
123
|
+
<!DOCTYPE html>
|
124
|
+
<html lang="en">
|
125
|
+
<head>
|
126
|
+
<meta charset="UTF-8" />
|
127
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
128
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
129
|
+
|
130
|
+
<title>FIDOR API Starter Kit: Transfer</title>
|
131
|
+
|
132
|
+
<!-- Bootstrap -->
|
133
|
+
<link href="assets/css/bootstrap.css" rel="stylesheet">
|
134
|
+
|
135
|
+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
136
|
+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
137
|
+
<!--[if lt IE 9]>
|
138
|
+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
139
|
+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
140
|
+
<![endif]-->
|
141
|
+
</head>
|
142
|
+
<body>
|
143
|
+
|
144
|
+
<div class="container">
|
145
|
+
|
146
|
+
<h1>Fidor API Starter Kit: Transfer</h1>
|
147
|
+
|
148
|
+
<p class="alert alert-info">Be careful! If you are connected to the live system this will take real money from your account send it to somewhere!</p>
|
149
|
+
|
150
|
+
<?php
|
151
|
+
if ( ! empty( $notices ) ) {
|
152
|
+
foreach ( $notices as $notice ) {
|
153
|
+
echo $notice;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
?>
|
157
|
+
|
158
|
+
<p>
|
159
|
+
The call "POST /internal_transfers" with the following data:
|
160
|
+
</p>
|
161
|
+
|
162
|
+
<div class="row">
|
163
|
+
<div class="col-md-8">
|
164
|
+
|
165
|
+
<form action="" method="post" class="form-horizontal">
|
166
|
+
|
167
|
+
<div class="form-group">
|
168
|
+
<label for="account_id" class="col-sm-4 control-label">(your) account_id</label>
|
169
|
+
<div class="col-sm-6">
|
170
|
+
<input type="text" class="form-control" name="account_id" id="account_id" value="<?php echo ( ! empty( $_REQUEST['account_id'] ) ? $_REQUEST['account_id'] : $current_account['id'] ); ?>" placeholder="" />
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
<div class="form-group">
|
174
|
+
<label for="receiver" class="col-sm-4 control-label">receiver (nickname, e-mail, etc...)</label>
|
175
|
+
<div class="col-sm-6">
|
176
|
+
<input type="text" class="form-control" name="receiver" id="receiver" value="<?php echo ( ! empty( $_REQUEST['receiver'] ) ? $_REQUEST['receiver'] : '' ); ?>" placeholder="" />
|
177
|
+
</div>
|
178
|
+
</div>
|
179
|
+
<div class="form-group">
|
180
|
+
<label for="amount" class="col-sm-4 control-label">amount (<?php echo $currency_code; ?>)</label>
|
181
|
+
<div class="col-sm-6">
|
182
|
+
<div class="input-group">
|
183
|
+
<div class="input-group-addon"><?php echo $currency_html; ?></div>
|
184
|
+
<input type="text" class="form-control" name="amount" id="amount" value="<?php echo ( ! empty( $_REQUEST['amount'] ) ? $_REQUEST['amount'] : '' ); ?>" placeholder="">
|
185
|
+
<div class="input-group-addon">.00</div>
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
<div class="form-group">
|
190
|
+
<label for="subject" class="col-sm-4 control-label">subject</label>
|
191
|
+
<div class="col-sm-6">
|
192
|
+
<input type="text" class="form-control" name="subject" id="subject" value="<?php echo ( ! empty( $_REQUEST['subject'] ) ? $_REQUEST['subject'] : '' ); ?>" placeholder="" />
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
<div class="form-group">
|
196
|
+
<label for="external_uid" class="col-sm-4 control-label">external uid</label>
|
197
|
+
<div class="col-sm-6">
|
198
|
+
<input type="text" class="form-control" name="external_uid" id="external_uid" value="<?php echo ( ! empty( $_REQUEST['external_uid'] ) ? $_REQUEST['external_uid'] : Fidor\Transfers::make_external_uid() ); ?>" placeholder="" />
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
<div class="form-group">
|
202
|
+
<div class="col-sm-offset-4">
|
203
|
+
<button type="submit" name="send-money" id="send-money" class="btn btn-danger">Send money (you should know what you do)!</button>
|
204
|
+
<br /><br /><a href="dashboard.php" class="btn btn-primary">cancel and go back</a>
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
</form>
|
209
|
+
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<p>You can now try the following: </p>
|
214
|
+
|
215
|
+
<p>
|
216
|
+
<a href="get_customers.php" class="btn btn-primary">Retrieve personal data: GET /customers</a>
|
217
|
+
</p>
|
218
|
+
|
219
|
+
<p>
|
220
|
+
<a href="get_accounts.php" class="btn btn-primary">Retrieve personal data: GET /accounts</a>
|
221
|
+
</p>
|
222
|
+
|
223
|
+
<p>
|
224
|
+
<a href="get_transactions.php" class="btn btn-primary">Retrieve personal data: GET /transactions</a>
|
225
|
+
</p>
|
226
|
+
|
227
|
+
<p>
|
228
|
+
<a href="transfer_money.php" class="btn btn-primary">Transfer money...</a>
|
229
|
+
</p>
|
230
|
+
|
231
|
+
<p>Documentation reference: </p>
|
232
|
+
<ul>
|
233
|
+
<li><a href="http://docs.fidor.de/#internal-transfer---fidor-to-fidor" target="_blank">http://docs.fidor.de/#internal-transfer---fidor-to-fidor</a></li>
|
234
|
+
</ul>
|
235
|
+
|
236
|
+
</div>
|
237
|
+
|
238
|
+
<script src="assets/js/jquery.min.js"></script>
|
239
|
+
<script src="assets/js/bootstrap.min.js"></script>
|
240
|
+
</body>
|
241
|
+
</html>
|
@@ -0,0 +1,126 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Startup
|
4
|
+
*/
|
5
|
+
require_once 'setup.php';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Alias Fidor SDK namespace
|
9
|
+
*/
|
10
|
+
use Fidor\SDK as Fidor;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Load Fido API settings
|
14
|
+
*/
|
15
|
+
$settings = include 'config.php';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Create Config instance. Check Config class for alternative calls.
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
$config = Fidor\Config::fromArray( $settings );
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Add oauth parameters ( access token, refresh token and expiration time ) to config
|
25
|
+
*/
|
26
|
+
$config->setAccessToken( $_SESSION['oauth']['access_token'] )
|
27
|
+
->setRefreshToken( $_SESSION['oauth']['refresh_token'] )
|
28
|
+
->setExpiresIn( $_SESSION['oauth']['expires_in'] + $_SESSION['oauth']['auth_at'] );
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Check if token has expired and try refreshing it
|
32
|
+
*/
|
33
|
+
/*if ( $config->hasTokenExpired() ) {
|
34
|
+
$auth = new Fidor\Authorization( $config );
|
35
|
+
$resp = $auth->refresh( $_SESSION['oauth']['refresh_token'] );
|
36
|
+
print_r( $resp );
|
37
|
+
die();
|
38
|
+
}*/
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Transaction ID is required.
|
42
|
+
*
|
43
|
+
*/
|
44
|
+
if ( empty( $_GET['id'] ) ) {
|
45
|
+
header( 'Location: transfer_money.php' );
|
46
|
+
exit;
|
47
|
+
}
|
48
|
+
|
49
|
+
?>
|
50
|
+
<!DOCTYPE html>
|
51
|
+
<html lang="en">
|
52
|
+
<head>
|
53
|
+
<meta charset="UTF-8" />
|
54
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
55
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
56
|
+
|
57
|
+
<title>FIDOR API Starter Kit: Transfer (Response)</title>
|
58
|
+
|
59
|
+
<!-- Bootstrap -->
|
60
|
+
<link href="assets/css/bootstrap.css" rel="stylesheet">
|
61
|
+
|
62
|
+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
63
|
+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
64
|
+
<!--[if lt IE 9]>
|
65
|
+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
66
|
+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
67
|
+
<![endif]-->
|
68
|
+
</head>
|
69
|
+
<body>
|
70
|
+
|
71
|
+
<div class="container">
|
72
|
+
|
73
|
+
<h1>Fidor API Starter Kit: Transfer (Response)</h1>
|
74
|
+
|
75
|
+
<p>
|
76
|
+
The call "POST /internal_transfer" retrieved the following data:
|
77
|
+
</p>
|
78
|
+
|
79
|
+
<div class="row">
|
80
|
+
<div class="col-md-6">
|
81
|
+
<table class="table table-bordered table-condensed table-hover table-striped col-md-6">
|
82
|
+
<tbody>
|
83
|
+
|
84
|
+
<?php
|
85
|
+
foreach ( $_GET as $k => $v ) {
|
86
|
+
if ( ! in_array( $k, array( 'id', 'external_uid', 'account_id', 'user_id', 'receiver', 'amount', 'subject', 'state', 'created_at', 'updated_at' ) ) ) {
|
87
|
+
continue;
|
88
|
+
}
|
89
|
+
echo '<tr><th scope="row" style="text-align: left;">' . $k . '</th><td>' . $v . '</td></tr>';
|
90
|
+
}
|
91
|
+
?>
|
92
|
+
|
93
|
+
</tbody>
|
94
|
+
</table>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<p>You can now try the following: </p>
|
99
|
+
|
100
|
+
<p>
|
101
|
+
<a href="get_customers.php" class="btn btn-primary">Retrieve personal data: GET /customers</a>
|
102
|
+
</p>
|
103
|
+
|
104
|
+
<p>
|
105
|
+
<a href="get_accounts.php" class="btn btn-primary">Retrieve personal data: GET /accounts</a>
|
106
|
+
</p>
|
107
|
+
|
108
|
+
<p>
|
109
|
+
<a href="get_transactions.php" class="btn btn-primary">Retrieve personal data: GET /transactions</a>
|
110
|
+
</p>
|
111
|
+
|
112
|
+
<p>
|
113
|
+
<a href="transfer_money.php" class="btn btn-primary">Transfer money...</a>
|
114
|
+
</p>
|
115
|
+
|
116
|
+
<p>Documentation reference: </p>
|
117
|
+
<ul>
|
118
|
+
<li><a href="http://docs.fidor.de/#internal-transfer---fidor-to-fidor" target="_blank">http://docs.fidor.de/#internal-transfer---fidor-to-fidor</a></li>
|
119
|
+
</ul>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<script src="assets/js/jquery.min.js"></script>
|
124
|
+
<script src="assets/js/bootstrap.min.js"></script>
|
125
|
+
</body>
|
126
|
+
</html>
|