Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
This commit is contained in:
@@ -10,6 +10,7 @@ require_once WD . '/modules/stripe/endpoints/stripe_endpoint_prices.php';
|
||||
require_once WD . '/modules/stripe/endpoints/stripe_endpoint_invoice.php';
|
||||
require_once WD . '/modules/stripe/endpoints/stripe_endpoint_readers.php';
|
||||
require_once WD . '/modules/stripe/endpoints/stripe_endpoint_payment_intents.php';
|
||||
require_once WD . '/classes/stripe_fake_http_client.php';
|
||||
|
||||
|
||||
// Require all helper classes
|
||||
@@ -29,6 +30,7 @@ use stripe\endpoints\stripe_endpoint_prices;
|
||||
use stripe\endpoints\stripe_endpoint_product;
|
||||
use stripe\endpoints\stripe_endpoint_readers;
|
||||
use stripe\stripe_c;
|
||||
use Stripe\ApiRequestor;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
/**
|
||||
@@ -104,6 +106,13 @@ class stripe implements stripe_i
|
||||
{
|
||||
// Get the stripe client
|
||||
if (!isset($this->client)) {
|
||||
if (self::isFakeModeEnabled()) {
|
||||
ApiRequestor::setHttpClient(new stripe_fake_http_client());
|
||||
$this->client = new StripeClient([
|
||||
'api_key' => 'sk_test_fake'
|
||||
]);
|
||||
return $this->client;
|
||||
}
|
||||
// Require the module to be enabled
|
||||
self::requireModuleEnabled();
|
||||
// Require the secret key to be set
|
||||
@@ -118,6 +127,11 @@ class stripe implements stripe_i
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
private static function isFakeModeEnabled(): bool
|
||||
{
|
||||
return getenv('STRIPE_FAKE_MODE') === '1';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception
|
||||
@@ -153,4 +167,4 @@ class stripe implements stripe_i
|
||||
throw new Exception('Invalid publishable key');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user