mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 10:38:15 +01:00
Update Stripe lib to 10.7.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
class BaseStripeClient implements StripeClientInterface
|
||||
class BaseStripeClient implements StripeClientInterface, StripeStreamingClientInterface
|
||||
{
|
||||
/** @var string default base URL for Stripe's API */
|
||||
const DEFAULT_API_BASE = 'https://api.stripe.com';
|
||||
@@ -139,6 +139,25 @@ class BaseStripeClient implements StripeClientInterface
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a request to Stripe's API, passing chunks of the streamed response
|
||||
* into a user-provided $readBodyChunkCallable callback.
|
||||
*
|
||||
* @param string $method the HTTP method
|
||||
* @param string $path the path of the request
|
||||
* @param callable $readBodyChunkCallable a function that will be called
|
||||
* @param array $params the parameters of the request
|
||||
* @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
|
||||
* with chunks of bytes from the body if the request is successful
|
||||
*/
|
||||
public function requestStream($method, $path, $readBodyChunkCallable, $params, $opts)
|
||||
{
|
||||
$opts = $this->defaultOpts->merge($opts, true);
|
||||
$baseUrl = $opts->apiBase ?: $this->getApiBase();
|
||||
$requestor = new \Stripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl);
|
||||
list($response, $opts->apiKey) = $requestor->requestStream($method, $path, $readBodyChunkCallable, $params, $opts->headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a request to Stripe's API.
|
||||
*
|
||||
@@ -163,6 +182,30 @@ class BaseStripeClient implements StripeClientInterface
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a request to Stripe's API.
|
||||
*
|
||||
* @param string $method the HTTP method
|
||||
* @param string $path the path of the request
|
||||
* @param array $params the parameters of the request
|
||||
* @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
|
||||
*
|
||||
* @return \Stripe\SearchResult of ApiResources
|
||||
*/
|
||||
public function requestSearchResult($method, $path, $params, $opts)
|
||||
{
|
||||
$obj = $this->request($method, $path, $params, $opts);
|
||||
if (!($obj instanceof \Stripe\SearchResult)) {
|
||||
$received_class = \get_class($obj);
|
||||
$msg = "Expected to receive `Stripe\\SearchResult` object from Stripe API. Instead received `{$received_class}`.";
|
||||
|
||||
throw new \Stripe\Exception\UnexpectedValueException($msg);
|
||||
}
|
||||
$obj->setFilters($params);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Stripe\Util\RequestOptions $opts
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user