fidor_starter_kits 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/fidor_starter_kits.rb +1 -1
  4. data/lib/fidor_starter_kits/version.rb +1 -1
  5. data/starter_kits/php_advanced/.fidor_meta.json +8 -0
  6. data/starter_kits/php_advanced/Fidor/SDK/Accounts.php +47 -0
  7. data/starter_kits/php_advanced/Fidor/SDK/Authorization.php +276 -0
  8. data/starter_kits/php_advanced/Fidor/SDK/Autoload.php +33 -0
  9. data/starter_kits/php_advanced/Fidor/SDK/Client.php +239 -0
  10. data/starter_kits/php_advanced/Fidor/SDK/Config.php +272 -0
  11. data/starter_kits/php_advanced/Fidor/SDK/Customers.php +27 -0
  12. data/starter_kits/php_advanced/Fidor/SDK/Transactions.php +47 -0
  13. data/starter_kits/php_advanced/Fidor/SDK/Transfers.php +65 -0
  14. data/starter_kits/php_advanced/Fidor/SDK/Transfers/Batch.php +18 -0
  15. data/starter_kits/php_advanced/Fidor/SDK/Transfers/Global.php +18 -0
  16. data/starter_kits/php_advanced/Fidor/SDK/Transfers/Internal.php +33 -0
  17. data/starter_kits/php_advanced/Fidor/SDK/Transfers/SEPA.php +18 -0
  18. data/starter_kits/php_advanced/Fidor/SDK/Users.php +23 -0
  19. data/starter_kits/php_advanced/README.md +19 -0
  20. data/starter_kits/php_advanced/curl-test.php +1 -0
  21. data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.css +587 -0
  22. data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.css.map +1 -0
  23. data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.min.css +6 -0
  24. data/starter_kits/php_advanced/demo/assets/css/bootstrap-theme.min.css.map +1 -0
  25. data/starter_kits/php_advanced/demo/assets/css/bootstrap.css +6760 -0
  26. data/starter_kits/php_advanced/demo/assets/css/bootstrap.css.map +1 -0
  27. data/starter_kits/php_advanced/demo/assets/css/bootstrap.min.css +6 -0
  28. data/starter_kits/php_advanced/demo/assets/css/bootstrap.min.css.map +1 -0
  29. data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  30. data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.svg +288 -0
  31. data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  32. data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  33. data/starter_kits/php_advanced/demo/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  34. data/starter_kits/php_advanced/demo/assets/js/bootstrap.js +2363 -0
  35. data/starter_kits/php_advanced/demo/assets/js/bootstrap.min.js +7 -0
  36. data/starter_kits/php_advanced/demo/assets/js/jquery.min.js +6 -0
  37. data/starter_kits/php_advanced/demo/assets/js/npm.js +13 -0
  38. data/starter_kits/php_advanced/demo/authorize.php +103 -0
  39. data/starter_kits/php_advanced/demo/config.php +15 -0
  40. data/starter_kits/php_advanced/demo/dashboard.php +154 -0
  41. data/starter_kits/php_advanced/demo/error_auth.php +71 -0
  42. data/starter_kits/php_advanced/demo/error_auth_refresh.php +71 -0
  43. data/starter_kits/php_advanced/demo/error_token_expired.php +76 -0
  44. data/starter_kits/php_advanced/demo/get_accounts.php +152 -0
  45. data/starter_kits/php_advanced/demo/get_customers.php +130 -0
  46. data/starter_kits/php_advanced/demo/get_transactions.php +146 -0
  47. data/starter_kits/php_advanced/demo/index.php +84 -0
  48. data/starter_kits/php_advanced/demo/refresh_token.php +39 -0
  49. data/starter_kits/php_advanced/demo/revoke_access.php +38 -0
  50. data/starter_kits/php_advanced/demo/setup.php +14 -0
  51. data/starter_kits/php_advanced/demo/transfer_money.php +241 -0
  52. data/starter_kits/php_advanced/demo/transfer_money_results.php +126 -0
  53. metadata +50 -2
@@ -0,0 +1,76 @@
1
+ <?php
2
+
3
+ /**
4
+ * Check the error code
5
+ */
6
+ if ( empty( $_REQUEST['error'] ) ) {
7
+ header( 'Location: index.php' );
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Startup
13
+ */
14
+ require_once 'setup.php';
15
+
16
+ /**
17
+ * Alias Fidor SDK namespace
18
+ */
19
+ use Fidor\SDK as Fidor;
20
+
21
+ /**
22
+ * Load Fido API settings
23
+ */
24
+ $settings = include 'config.php';
25
+
26
+ /**
27
+ * Create Config instance. Check Config class for alternative calls.
28
+ */
29
+ $config = Fidor\Config::fromArray( $settings );
30
+
31
+ ?>
32
+ <!DOCTYPE html>
33
+ <html lang="en">
34
+ <head>
35
+ <meta charset="UTF-8" />
36
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
37
+ <meta name="viewport" content="width=device-width, initial-scale=1">
38
+
39
+ <title>FIDOR API Starter Kit - Error</title>
40
+
41
+ <!-- Bootstrap -->
42
+ <link href="assets/css/bootstrap.css" rel="stylesheet">
43
+
44
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
45
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
46
+ <!--[if lt IE 9]>
47
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
48
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
49
+ <![endif]-->
50
+ </head>
51
+ <body>
52
+
53
+ <div class="container">
54
+
55
+ <h1>Error</h1>
56
+
57
+ <p>I was unable to get the requested data. The access-token was not accepted – did it expire?</p>
58
+
59
+ <p>The reported error code was:</p>
60
+
61
+ <p><?php echo $_REQUEST['error']; ?></p>
62
+
63
+ <p>
64
+ <a href="authorize.php" class="btn btn-primary">Start from scratch to get a new access token</a>
65
+ </p>
66
+ <p>
67
+ <a href="refresh_token.php" class="btn btn-primary">Try to renew the access token with the refresh token</a>
68
+ </p>
69
+
70
+ </div>
71
+
72
+ <script src="assets/js/jquery.min.js"></script>
73
+ <script src="assets/js/bootstrap.min.js"></script>
74
+
75
+ </body>
76
+ </html>
@@ -0,0 +1,152 @@
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
+ * Create API client
42
+ */
43
+ $client = new Fidor\Client( $config );
44
+
45
+ /**
46
+ * Load accounts
47
+ */
48
+ $accounts = $client->accounts->get();
49
+ if ( ! empty( $accounts['message'] ) ) {
50
+ header( 'Location: error_token_expired.php?error=' . $accounts['message'] );
51
+ exit;
52
+ }
53
+
54
+ ?>
55
+ <!DOCTYPE html>
56
+ <html lang="en">
57
+ <head>
58
+ <meta charset="UTF-8" />
59
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
60
+ <meta name="viewport" content="width=device-width, initial-scale=1">
61
+
62
+ <title>FIDOR API Starter Kit: Account data</title>
63
+
64
+ <!-- Bootstrap -->
65
+ <link href="assets/css/bootstrap.css" rel="stylesheet">
66
+
67
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
68
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
69
+ <!--[if lt IE 9]>
70
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
71
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
72
+ <![endif]-->
73
+ </head>
74
+ <body>
75
+
76
+ <div class="container">
77
+
78
+ <h1>Fidor API Starter Kit: Account data</h1>
79
+
80
+ <p>
81
+ The call &quot;GET /accounts&quot; retrieved the following data:
82
+ </p>
83
+
84
+ <?php foreach ( $accounts as $account ): ?>
85
+
86
+ <div class="row">
87
+ <div class="col-md-6">
88
+ <table class="table table-bordered table-condensed table-hover table-striped col-md-6">
89
+ <tbody>
90
+ <?php
91
+ foreach ( $account as $k => $v ) {
92
+ if ( is_array( $v ) ) {
93
+ continue;
94
+ }
95
+ echo '<tr><th scope="row" style="text-align: left;">' . $k . '</th><td>' . $v . '</td></tr>';
96
+ }
97
+ ?>
98
+ <tr>
99
+ <td colspan="2">
100
+ <p class="">Customers</p>
101
+ <table class="table table-bordered table-condensed table-hover table-striped">
102
+ <tbody>
103
+ <?php
104
+ foreach ( $account['customers'] as $customer ) {
105
+ foreach ( $customer as $k => $v ) {
106
+ if ( is_array( $v ) ) {
107
+ continue;
108
+ }
109
+ echo '<tr><th scope="row" style="text-align: left;">' . $k . '</th><td>' . $v . '</td></tr>';
110
+ }
111
+ }
112
+ ?>
113
+ </tbody>
114
+ </table>
115
+ </td>
116
+ </tr>
117
+ </tbody>
118
+ </table>
119
+ </div>
120
+ </div>
121
+
122
+ <?php endforeach; ?>
123
+
124
+ <p>You can now try the following: </p>
125
+
126
+ <p>
127
+ <a href="get_customers.php" class="btn btn-primary">Retrieve personal data: GET /customers</a>
128
+ </p>
129
+
130
+ <p>
131
+ <a href="get_accounts.php" class="btn btn-primary">Retrieve personal data: GET /accounts</a>
132
+ </p>
133
+
134
+ <p>
135
+ <a href="get_transactions.php" class="btn btn-primary">Retrieve personal data: GET /transactions</a>
136
+ </p>
137
+
138
+ <p>
139
+ <a href="transfer_money.php" class="btn btn-primary">Transfer money...</a>
140
+ </p>
141
+
142
+ <p>Documentation reference: </p>
143
+ <ul>
144
+ <li><a href="http://docs.fidor.de/#accounts" target="_blank">http://docs.fidor.de/#accounts</a></li>
145
+ </ul>
146
+
147
+ </div>
148
+
149
+ <script src="assets/js/jquery.min.js"></script>
150
+ <script src="assets/js/bootstrap.min.js"></script>
151
+ </body>
152
+ </html>
@@ -0,0 +1,130 @@
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
+ * Create API client
42
+ */
43
+ $client = new Fidor\Client( $config );
44
+
45
+ /**
46
+ * Get customers list
47
+ */
48
+ $customers = $client->customers->get();
49
+ if ( ! empty( $customers['message'] ) ) {
50
+ header( 'Location: error_token_expired.php?error=' . $customers['message'] );
51
+ exit;
52
+ }
53
+
54
+ ?>
55
+ <!DOCTYPE html>
56
+ <html lang="en">
57
+ <head>
58
+ <meta charset="UTF-8" />
59
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
60
+ <meta name="viewport" content="width=device-width, initial-scale=1">
61
+
62
+ <title>FIDOR API Starter Kit: Personal data</title>
63
+
64
+ <!-- Bootstrap -->
65
+ <link href="assets/css/bootstrap.css" rel="stylesheet">
66
+
67
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
68
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
69
+ <!--[if lt IE 9]>
70
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
71
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
72
+ <![endif]-->
73
+ </head>
74
+ <body>
75
+
76
+ <div class="container">
77
+
78
+ <h1>Fidor API Starter Kit: Personal data</h1>
79
+
80
+ <p>
81
+ The call &quot;GET /customers&quot; retrieved the following data:
82
+ </p>
83
+ <?php foreach ( $customers as $customer ): ?>
84
+ <div class="row">
85
+ <div class="col-md-6">
86
+ <table class="table table-bordered table-condensed table-hover table-striped col-md-6">
87
+ <tbody>
88
+ <?php
89
+ foreach ( $customer as $k => $v ) {
90
+ if ( is_array( $v ) ) {
91
+ continue;
92
+ }
93
+ echo '<tr><th scope="row" style="text-align: left;">' . $k . '</th><td>' . $v . '</td></tr>';
94
+ }
95
+ ?>
96
+ </tbody>
97
+ </table>
98
+ </div>
99
+ </div>
100
+ <?php endforeach; ?>
101
+
102
+ <p>You can now try the following: </p>
103
+
104
+ <p>
105
+ <a href="get_customers.php" class="btn btn-primary">Retrieve personal data: GET /customers</a>
106
+ </p>
107
+
108
+ <p>
109
+ <a href="get_accounts.php" class="btn btn-primary">Retrieve personal data: GET /accounts</a>
110
+ </p>
111
+
112
+ <p>
113
+ <a href="get_transactions.php" class="btn btn-primary">Retrieve personal data: GET /transactions</a>
114
+ </p>
115
+
116
+ <p>
117
+ <a href="transfer_money.php" class="btn btn-primary">Transfer money...</a>
118
+ </p>
119
+
120
+ <p>Documentation reference: </p>
121
+ <ul>
122
+ <li><a href="http://docs.fidor.de/#customers" target="_blank">http://docs.fidor.de/#customers</a></li>
123
+ </ul>
124
+
125
+ </div>
126
+
127
+ <script src="assets/js/jquery.min.js"></script>
128
+ <script src="assets/js/bootstrap.min.js"></script>
129
+ </body>
130
+ </html>
@@ -0,0 +1,146 @@
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
+ * Create API client
42
+ */
43
+ $client = new Fidor\Client( $config );
44
+
45
+ /**
46
+ * Get transactions
47
+ */
48
+ $transactions = $client->transactions->get( null, 1, 5 );
49
+ if ( ! empty( $transactions['message'] ) ) {
50
+ header( 'Location: error_token_expired.php?error=' . $transactions['message'] );
51
+ exit;
52
+ }
53
+
54
+ ?>
55
+ <!DOCTYPE html>
56
+ <html lang="en">
57
+ <head>
58
+ <meta charset="UTF-8" />
59
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
60
+ <meta name="viewport" content="width=device-width, initial-scale=1">
61
+
62
+ <title>FIDOR API Starter Kit: Transactions</title>
63
+
64
+ <!-- Bootstrap -->
65
+ <link href="assets/css/bootstrap.css" rel="stylesheet">
66
+
67
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
68
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
69
+ <!--[if lt IE 9]>
70
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
71
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
72
+ <![endif]-->
73
+ </head>
74
+ <body>
75
+
76
+ <div class="container">
77
+
78
+ <h1>Fidor API Starter Kit: Transactions</h1>
79
+
80
+ <p>
81
+ The call &quot;GET /transactions?page=1&amp;per_page=5&quot; retrieved the following data (listing only the last five entries):
82
+ </p>
83
+ <?php foreach ( $transactions as $transaction ): ?>
84
+
85
+ <div class="row">
86
+ <div class="col-md-6">
87
+ <table class="table table-bordered table-condensed table-hover table-striped col-md-6">
88
+ <tbody>
89
+ <?php
90
+ foreach ( $transaction as $k => $v ) {
91
+ if ( is_array( $v )) {
92
+ continue;
93
+ }
94
+ echo '<tr><th scope="row" style="text-align: left;">' . $k . '</th><td>' . $v . '</td></tr>';
95
+ }
96
+ ?>
97
+ <tr>
98
+ <td colspan="2">
99
+ <p>transaction_type_details</p>
100
+ <table class="table table-bordered table-condensed table-hover table-striped">
101
+ <tbody>
102
+ <?php
103
+ foreach ( $transaction['transaction_type_details'] as $k => $v ) {
104
+ echo '<tr><th scope="row" style="text-align: left;">' . $k . '</th><td>' . $v . '</td></tr>';
105
+ }
106
+ ?>
107
+ </tbody>
108
+ </table>
109
+ </td>
110
+ </tr>
111
+ </tbody>
112
+ </table>
113
+ </div>
114
+ </div>
115
+
116
+ <?php endforeach; ?>
117
+
118
+ <p>You can now try the following: </p>
119
+
120
+ <p>
121
+ <a href="get_customers.php" class="btn btn-primary">Retrieve personal data: GET /customers</a>
122
+ </p>
123
+
124
+ <p>
125
+ <a href="get_accounts.php" class="btn btn-primary">Retrieve personal data: GET /accounts</a>
126
+ </p>
127
+
128
+ <p>
129
+ <a href="get_transactions.php" class="btn btn-primary">Retrieve personal data: GET /transactions</a>
130
+ </p>
131
+
132
+ <p>
133
+ <a href="transfer_money.php" class="btn btn-primary">Transfer money...</a>
134
+ </p>
135
+
136
+ <p>Documentation reference: </p>
137
+ <ul>
138
+ <li><a href="http://docs.fidor.de/#transactions" target="_blank">http://docs.fidor.de/#transactions</a></li>
139
+ </ul>
140
+
141
+ </div>
142
+
143
+ <script src="assets/js/jquery.min.js"></script>
144
+ <script src="assets/js/bootstrap.min.js"></script>
145
+ </body>
146
+ </html>