| 1 |
<?php |
| 2 |
|
| 3 |
namespace Bookit\Gateways\StripeConnect; |
| 4 |
|
| 5 |
use Bookit\Gateways\Contracts\Abstract_Requests; |
| 6 |
|
| 7 |
/** |
| 8 |
* Stripe Requests. |
| 9 |
* |
| 10 |
* @since 2.5.0 |
| 11 |
* |
| 12 |
* @package Bookit\Gateways\StripeConnect; |
| 13 |
*/ |
| 14 |
class Requests extends Abstract_Requests { |
| 15 |
|
| 16 |
/** |
| 17 |
* The Merchant class reference to use. |
| 18 |
* |
| 19 |
* @since 2.5.0 |
| 20 |
* |
| 21 |
* @var string |
| 22 |
*/ |
| 23 |
public static $merchant = Merchant::class; |
| 24 |
|
| 25 |
/** |
| 26 |
* The Gateway class reference to use. |
| 27 |
* |
| 28 |
* @since 2.5.0 |
| 29 |
* |
| 30 |
* @var string |
| 31 |
*/ |
| 32 |
public static $gateway = Gateway::class; |
| 33 |
|
| 34 |
/** |
| 35 |
* The Stripe API base URL. |
| 36 |
* |
| 37 |
* @since 2.5.0 |
| 38 |
* |
| 39 |
* @var string |
| 40 |
*/ |
| 41 |
private static $api_base_url = 'https://api.stripe.com/v1'; |
| 42 |
|
| 43 |
/** |
| 44 |
* @inheritDoc |
| 45 |
*/ |
| 46 |
public static function get_api_url( $endpoint, array $query_args = [] ) { |
| 47 |
$base_url = static::get_environment_url(); |
| 48 |
$endpoint = ltrim( $endpoint, '/' ); |
| 49 |
|
| 50 |
return add_query_arg( $query_args, "{$base_url}/{$endpoint}" ); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Get environment base URL. |
| 55 |
* |
| 56 |
* @since 2.5.0 |
| 57 |
* |
| 58 |
* @return string |
| 59 |
*/ |
| 60 |
public static function get_environment_url() { |
| 61 |
return static::$api_base_url; |
| 62 |
} |
| 63 |
|
| 64 |
} |