@@ -13,5 +13,5 @@ |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | Route::group(['namespace' => 'tbclla\Revolut\Controllers'], function() { |
16 | - Route::get(parse_url(config('revolut.redirect_uri'))['path'], 'AuthorizationController'); |
|
16 | + Route::get(parse_url(config('revolut.redirect_uri'))['path'], 'AuthorizationController'); |
|
17 | 17 | }); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public static function buildUri(string $endpoint = '') |
131 | - { |
|
131 | + { |
|
132 | 132 | $url = config('revolut.sandbox', true) ? self::SANDBOX_URL : self::PRODUCTION_URL; |
133 | 133 | |
134 | 134 | return $url . self::apiUri() . $endpoint; |
@@ -146,37 +146,37 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * Perform a POST request against a specified endpoint |
148 | 148 | * |
149 | - * @param string $endpoint |
|
150 | - * @param array $options |
|
151 | - * @return array |
|
149 | + * @param string $endpoint |
|
150 | + * @param array $options |
|
151 | + * @return array |
|
152 | 152 | * @throws \tbclla\Revolut\Exceptions\ApiException |
153 | - */ |
|
154 | - public function post(string $endpoint, array $options = []) |
|
155 | - { |
|
153 | + */ |
|
154 | + public function post(string $endpoint, array $options = []) |
|
155 | + { |
|
156 | 156 | return $this->httpClient->post($this->buildUri($endpoint), $this->buildOptions($options)); |
157 | - } |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
159 | + /** |
|
160 | 160 | * Perform a GET request against a specified endpoint |
161 | 161 | * |
162 | - * @param string $endpoint |
|
163 | - * @return array |
|
162 | + * @param string $endpoint |
|
163 | + * @return array |
|
164 | 164 | * @throws \tbclla\Revolut\Exceptions\ApiException |
165 | - */ |
|
166 | - public function get(string $endpoint, array $options = []) |
|
167 | - { |
|
165 | + */ |
|
166 | + public function get(string $endpoint, array $options = []) |
|
167 | + { |
|
168 | 168 | return $this->httpClient->get($this->buildUri($endpoint), $this->buildOptions($options)); |
169 | 169 | } |
170 | 170 | |
171 | - /** |
|
171 | + /** |
|
172 | 172 | * Perform a DELETE request against a specified endpoint |
173 | 173 | * |
174 | - * @param string $endpoint |
|
175 | - * @return void |
|
174 | + * @param string $endpoint |
|
175 | + * @return void |
|
176 | 176 | * @throws \tbclla\Revolut\Exceptions\ApiException |
177 | - */ |
|
178 | - public function delete(string $endpoint) |
|
179 | - { |
|
177 | + */ |
|
178 | + public function delete(string $endpoint) |
|
179 | + { |
|
180 | 180 | return $this->httpClient->delete($this->buildUri($endpoint), $this->buildOptions()); |
181 | 181 | } |
182 | 182 |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | * @throws \tbclla\Revolut\Exceptions\ApiException |
20 | 20 | */ |
21 | 21 | public function all() |
22 | - { |
|
23 | - return $this->client->get(self::ENDPOINT); |
|
22 | + { |
|
23 | + return $this->client->get(self::ENDPOINT); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
27 | + /** |
|
28 | 28 | * Get an account by its ID |
29 | 29 | * @throws \tbclla\Revolut\Exceptions\ApiException |
30 | 30 | * |
31 | 31 | * @see https://revolut-engineering.github.io/api-docs/business-api/#accounts-get-account Official API documentation |
32 | - * @param string $id The account ID in UUID format |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function get(string $id) |
|
36 | - { |
|
37 | - return $this->client->get(self::ENDPOINT . '/' . $id); |
|
32 | + * @param string $id The account ID in UUID format |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function get(string $id) |
|
36 | + { |
|
37 | + return $this->client->get(self::ENDPOINT . '/' . $id); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return array |
46 | 46 | */ |
47 | 47 | public function details(string $id) |
48 | - { |
|
49 | - return $this->client->get(self::ENDPOINT . '/' . $id . '/bank-details'); |
|
50 | - } |
|
48 | + { |
|
49 | + return $this->client->get(self::ENDPOINT . '/' . $id . '/bank-details'); |
|
50 | + } |
|
51 | 51 | } |
@@ -7,10 +7,10 @@ |
||
7 | 7 | class Revolut extends Facade |
8 | 8 | { |
9 | 9 | /** |
10 | - * Get the registered name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
10 | + * Get the registered name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | 14 | protected static function getFacadeAccessor() |
15 | 15 | { |
16 | 16 | return 'revolut'; |
@@ -16,66 +16,66 @@ |
||
16 | 16 | |
17 | 17 | class RevolutServiceProvider extends ServiceProvider |
18 | 18 | { |
19 | - /** |
|
20 | - * Register services. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function register() |
|
25 | - { |
|
26 | - $this->app->bind(MakesHttpRequests::class, GuzzleHttpClient::class); |
|
19 | + /** |
|
20 | + * Register services. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function register() |
|
25 | + { |
|
26 | + $this->app->bind(MakesHttpRequests::class, GuzzleHttpClient::class); |
|
27 | 27 | |
28 | - $this->app->bind(ClientAssertion::class, function() { |
|
29 | - return new ClientAssertion( |
|
30 | - config('revolut.client_id'), |
|
31 | - config('revolut.private_key'), |
|
32 | - config('revolut.redirect_uri') |
|
33 | - ); |
|
34 | - }); |
|
28 | + $this->app->bind(ClientAssertion::class, function() { |
|
29 | + return new ClientAssertion( |
|
30 | + config('revolut.client_id'), |
|
31 | + config('revolut.private_key'), |
|
32 | + config('revolut.redirect_uri') |
|
33 | + ); |
|
34 | + }); |
|
35 | 35 | |
36 | - $this->app->bind(AuthorizationCodeRequest::class, function() { |
|
37 | - return new AuthorizationCodeRequest( |
|
38 | - resolve(TokenRepository::class), |
|
39 | - config('revolut.client_id'), |
|
40 | - config('revolut.redirect_uri'), |
|
41 | - config('revolut.sandbox') |
|
42 | - ); |
|
43 | - }); |
|
36 | + $this->app->bind(AuthorizationCodeRequest::class, function() { |
|
37 | + return new AuthorizationCodeRequest( |
|
38 | + resolve(TokenRepository::class), |
|
39 | + config('revolut.client_id'), |
|
40 | + config('revolut.redirect_uri'), |
|
41 | + config('revolut.sandbox') |
|
42 | + ); |
|
43 | + }); |
|
44 | 44 | |
45 | - $this->app->singleton('revolut', function() { |
|
46 | - return resolve(Client::class); |
|
47 | - }); |
|
48 | - } |
|
45 | + $this->app->singleton('revolut', function() { |
|
46 | + return resolve(Client::class); |
|
47 | + }); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Bootstrap services. |
|
52 | - * |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function boot() |
|
56 | - { |
|
57 | - $this->publishes([ |
|
58 | - __DIR__ . '/../config/revolut.php' => config_path('revolut.php') |
|
59 | - ]); |
|
50 | + /** |
|
51 | + * Bootstrap services. |
|
52 | + * |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function boot() |
|
56 | + { |
|
57 | + $this->publishes([ |
|
58 | + __DIR__ . '/../config/revolut.php' => config_path('revolut.php') |
|
59 | + ]); |
|
60 | 60 | |
61 | - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
61 | + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
62 | 62 | |
63 | - $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); |
|
63 | + $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); |
|
64 | 64 | |
65 | - $this->commands([ |
|
66 | - JWTCommand::class, |
|
67 | - CleanupCommand::class, |
|
68 | - ResetCommand::class, |
|
69 | - AuthorizeCommand::class, |
|
70 | - ]); |
|
65 | + $this->commands([ |
|
66 | + JWTCommand::class, |
|
67 | + CleanupCommand::class, |
|
68 | + ResetCommand::class, |
|
69 | + AuthorizeCommand::class, |
|
70 | + ]); |
|
71 | 71 | |
72 | - // if ($this->app->runningInConsole()) { |
|
73 | - // $this->commands([ |
|
74 | - // JWTCommand::class, |
|
75 | - // CleanupCommand::class, |
|
76 | - // ResetCommand::class, |
|
77 | - // AuthorizeCommand::class, |
|
78 | - // ]); |
|
79 | - // } |
|
80 | - } |
|
72 | + // if ($this->app->runningInConsole()) { |
|
73 | + // $this->commands([ |
|
74 | + // JWTCommand::class, |
|
75 | + // CleanupCommand::class, |
|
76 | + // ResetCommand::class, |
|
77 | + // AuthorizeCommand::class, |
|
78 | + // ]); |
|
79 | + // } |
|
80 | + } |
|
81 | 81 | } |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | | authorization process. |
24 | 24 | | |
25 | 25 | */ |
26 | - 'private_key' => env('REVOLUT_PRIVATE_KEY'), |
|
26 | + 'private_key' => env('REVOLUT_PRIVATE_KEY'), |
|
27 | 27 | |
28 | - /* |
|
28 | + /* |
|
29 | 29 | |-------------------------------------------------------------------------- |
30 | 30 | | Client ID |
31 | 31 | |-------------------------------------------------------------------------- |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | | selecting the relevant API certificate. |
36 | 36 | | |
37 | 37 | */ |
38 | - 'client_id' => env('REVOLUT_CLIENT_ID'), |
|
38 | + 'client_id' => env('REVOLUT_CLIENT_ID'), |
|
39 | 39 | |
40 | - /* |
|
40 | + /* |
|
41 | 41 | |-------------------------------------------------------------------------- |
42 | 42 | | Oauth Redirect URI |
43 | 43 | |-------------------------------------------------------------------------- |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | | process. This must match the uri provided to Revolut. |
47 | 47 | | |
48 | 48 | */ |
49 | - 'redirect_uri' => env('REVOLUT_REDIRECT_URI'), |
|
49 | + 'redirect_uri' => env('REVOLUT_REDIRECT_URI'), |
|
50 | 50 | |
51 | - /* |
|
51 | + /* |
|
52 | 52 | |-------------------------------------------------------------------------- |
53 | 53 | | Encryption |
54 | 54 | |-------------------------------------------------------------------------- |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | | production environment |
59 | 59 | | |
60 | 60 | */ |
61 | - 'encrypt_tokens' => true, |
|
61 | + 'encrypt_tokens' => true, |
|
62 | 62 | |
63 | - /* |
|
63 | + /* |
|
64 | 64 | |-------------------------------------------------------------------------- |
65 | 65 | | Tokens table |
66 | 66 | |-------------------------------------------------------------------------- |
@@ -68,5 +68,5 @@ discard block |
||
68 | 68 | | Set the name of the table that will hold your Revolut tokens. |
69 | 69 | | |
70 | 70 | */ |
71 | - 'tokens_table' => 'revolut_tokens' |
|
71 | + 'tokens_table' => 'revolut_tokens' |
|
72 | 72 | ]; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | // if the state doesn't match the latest state, abort |
23 | - if($tokenManager->getState()->value != request('state')) { |
|
23 | + if ($tokenManager->getState()->value != request('state')) { |
|
24 | 24 | abort(405, 'Invalid State'); |
25 | 25 | } |
26 | 26 |
@@ -18,15 +18,15 @@ |
||
18 | 18 | $model->is_encrypted = true; |
19 | 19 | $model->value = $model->encryptValue(); |
20 | 20 | } |
21 | - }); |
|
21 | + }); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | - * Get the decrypted value attribute. |
|
26 | - * |
|
27 | - * @param string $value |
|
28 | - * @return string |
|
29 | - */ |
|
25 | + * Get the decrypted value attribute. |
|
26 | + * |
|
27 | + * @param string $value |
|
28 | + * @return string |
|
29 | + */ |
|
30 | 30 | public function getValueAttribute($value) |
31 | 31 | { |
32 | 32 | return $this->is_encrypted ? $this->decryptValue() : $value; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public static function bootEncryptable() |
15 | 15 | { |
16 | - static::saving(function ($model) { |
|
16 | + static::saving(function($model) { |
|
17 | 17 | if (config('revolut.encrypt_tokens', true)) { |
18 | 18 | $model->is_encrypted = true; |
19 | 19 | $model->value = $model->encryptValue(); |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | protected $fillable = ['value']; |
26 | 26 | |
27 | 27 | /** |
28 | - * The attributes that should be cast to native types. |
|
29 | - * |
|
30 | - * @var array |
|
31 | - */ |
|
28 | + * The attributes that should be cast to native types. |
|
29 | + * |
|
30 | + * @var array |
|
31 | + */ |
|
32 | 32 | protected $casts = [ |
33 | 33 | 'is_encrypted' => 'boolean', |
34 | 34 | 'expires_at' => 'datetime', |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | ]; |
37 | 37 | |
38 | 38 | /** |
39 | - * The "booting" method of the model. |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - protected static function boot() |
|
44 | - { |
|
39 | + * The "booting" method of the model. |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + protected static function boot() |
|
44 | + { |
|
45 | 45 | parent::boot(); |
46 | 46 | |
47 | 47 | static::creating(function($model) { |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | $model->expires_at = static::getExpiration(); |
50 | 50 | }); |
51 | 51 | |
52 | - static::addGlobalScope('type', function(Builder $builder) { |
|
53 | - $builder->whereType(static::getType()); |
|
52 | + static::addGlobalScope('type', function(Builder $builder) { |
|
53 | + $builder->whereType(static::getType()); |
|
54 | 54 | }); |
55 | 55 | } |
56 | 56 |