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