@@ -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'; |
@@ -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; |
@@ -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 |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | * @see https://revolut-engineering.github.io/api-docs/business-api/#counterparties-add-revolut-counterparty Official API documentation |
19 | 19 | */ |
20 | 20 | public function create(array $json) |
21 | - { |
|
21 | + { |
|
22 | 22 | return $this->client->post(self::ENDPOINT, ['json' => $json]); |
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | - * Get all counterparties |
|
26 | + * Get all counterparties |
|
27 | 27 | * |
28 | 28 | * @see https://revolut-engineering.github.io/api-docs/business-api/#counterparties-get-counterparties Official API documentation |
29 | - * @return array |
|
30 | - */ |
|
31 | - public function all() |
|
32 | - { |
|
33 | - return $this->client->get('/counterparties'); |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + public function all() |
|
32 | + { |
|
33 | + return $this->client->get('/counterparties'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @return array |
42 | 42 | */ |
43 | 43 | public function get(string $id) |
44 | - { |
|
45 | - return $this->client->get(self::ENDPOINT . '/' . $id); |
|
44 | + { |
|
45 | + return $this->client->get(self::ENDPOINT . '/' . $id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | public function delete(string $id) : void |
56 | - { |
|
57 | - $this->client->delete(self::ENDPOINT . '/' . $id); |
|
56 | + { |
|
57 | + $this->client->delete(self::ENDPOINT . '/' . $id); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -15,43 +15,43 @@ |
||
15 | 15 | const ENDPOINT = '/pay'; |
16 | 16 | |
17 | 17 | /** |
18 | - * @see https://revolut-engineering.github.io/api-docs/business-api/#payments-create-payment Official API documentation |
|
19 | - */ |
|
20 | - public function create(array $json) |
|
21 | - { |
|
22 | - return $this->client->post(self::ENDPOINT, ['json' => $json]); |
|
23 | - } |
|
18 | + * @see https://revolut-engineering.github.io/api-docs/business-api/#payments-create-payment Official API documentation |
|
19 | + */ |
|
20 | + public function create(array $json) |
|
21 | + { |
|
22 | + return $this->client->post(self::ENDPOINT, ['json' => $json]); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Schedule a payment for up to 30 days |
|
27 | - * |
|
28 | - * @see https://revolut-engineering.github.io/api-docs/business-api/#payments-schedule-payment Official API documentation |
|
29 | - * @param array $json The request parameters |
|
30 | - * @param string $date a future ISO date (Up to 30 days) |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - public function schedule(array $json, string $date) |
|
34 | - { |
|
35 | - return $this->create(array_merge($json, ['schedule_for' => $date])); |
|
36 | - } |
|
25 | + /** |
|
26 | + * Schedule a payment for up to 30 days |
|
27 | + * |
|
28 | + * @see https://revolut-engineering.github.io/api-docs/business-api/#payments-schedule-payment Official API documentation |
|
29 | + * @param array $json The request parameters |
|
30 | + * @param string $date a future ISO date (Up to 30 days) |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + public function schedule(array $json, string $date) |
|
34 | + { |
|
35 | + return $this->create(array_merge($json, ['schedule_for' => $date])); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Cancel a scheduled payment |
|
40 | - * |
|
41 | - * @see https://revolut-engineering.github.io/api-docs/business-api/#payments-cancel-payment Official API documentation |
|
42 | - * @param string $id The ID of the payment in UUID format |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function cancel(string $id) : void |
|
46 | - { |
|
47 | - $this->client->delete('/transaction/' . $id); |
|
48 | - } |
|
38 | + /** |
|
39 | + * Cancel a scheduled payment |
|
40 | + * |
|
41 | + * @see https://revolut-engineering.github.io/api-docs/business-api/#payments-cancel-payment Official API documentation |
|
42 | + * @param string $id The ID of the payment in UUID format |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function cancel(string $id) : void |
|
46 | + { |
|
47 | + $this->client->delete('/transaction/' . $id); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @return \tbclla\Revolut\Builders\PaymentBuilder |
|
52 | - */ |
|
53 | - public function build() |
|
54 | - { |
|
55 | - return new PaymentBuilder($this, $this->client->generateRequestId()); |
|
56 | - } |
|
50 | + /** |
|
51 | + * @return \tbclla\Revolut\Builders\PaymentBuilder |
|
52 | + */ |
|
53 | + public function build() |
|
54 | + { |
|
55 | + return new PaymentBuilder($this, $this->client->generateRequestId()); |
|
56 | + } |
|
57 | 57 | } |
@@ -23,8 +23,8 @@ |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | - * @return \tbclla\Revolut\Builders\ExchangeBuilder |
|
27 | - */ |
|
26 | + * @return \tbclla\Revolut\Builders\ExchangeBuilder |
|
27 | + */ |
|
28 | 28 | public function build() |
29 | 29 | { |
30 | 30 | return new ExchangeBuilder($this, $this->client->generateRequestId()); |
@@ -15,18 +15,18 @@ |
||
15 | 15 | const ENDPOINT = '/transfer'; |
16 | 16 | |
17 | 17 | /** |
18 | - * @see https://revolut-engineering.github.io/api-docs/business-api/#transfers-create-transfer Official API documentation |
|
19 | - */ |
|
20 | - public function create(array $json) |
|
21 | - { |
|
22 | - return $this->client->post(self::ENDPOINT, ['json' => $json]); |
|
23 | - } |
|
18 | + * @see https://revolut-engineering.github.io/api-docs/business-api/#transfers-create-transfer Official API documentation |
|
19 | + */ |
|
20 | + public function create(array $json) |
|
21 | + { |
|
22 | + return $this->client->post(self::ENDPOINT, ['json' => $json]); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * @return \tbclla\Revolut\Builders\TransferBuilder |
|
27 | - */ |
|
28 | - public function build() |
|
29 | - { |
|
30 | - return new TransferBuilder($this, $this->client->generateRequestId()); |
|
31 | - } |
|
25 | + /** |
|
26 | + * @return \tbclla\Revolut\Builders\TransferBuilder |
|
27 | + */ |
|
28 | + public function build() |
|
29 | + { |
|
30 | + return new TransferBuilder($this, $this->client->generateRequestId()); |
|
31 | + } |
|
32 | 32 | } |