Bump stripe-php from 19.4.1 to 20.0.0

This commit is contained in:
johnnyq
2026-04-08 12:44:45 -04:00
parent 346d7ed9f0
commit 123a581583
160 changed files with 957 additions and 279 deletions

View File

@@ -49,18 +49,25 @@ abstract class AbstractService
}
/**
* Translate null values to empty strings. For service methods,
* we interpret null as a request to unset the field, which
* corresponds to sending an empty string for the field to the
* API.
* Translate null values to empty strings for v1 API requests.
* For v1, we interpret null as a request to unset the field,
* which corresponds to sending an empty string in the
* form-encoded body.
*
* For v2, null values are preserved as-is so they serialize
* to JSON null, which is the v2 mechanism for clearing fields.
*
* @param null|array $params
* @param 'v1'|'v2' $apiMode
*/
private static function formatParams($params)
private static function formatParams($params, $apiMode)
{
if (null === $params) {
return null;
}
if ('v2' === $apiMode) {
return $params;
}
\array_walk_recursive($params, static function (&$value, $key) {
if (null === $value) {
$value = '';
@@ -70,24 +77,44 @@ abstract class AbstractService
return $params;
}
protected function request($method, $path, $params, $opts)
protected function request($method, $path, $params, $opts, $schemas = null)
{
return $this->getClient()->request($method, $path, self::formatParams($params), $opts);
$apiMode = \Stripe\Util\Util::getApiMode($path);
$params = self::formatParams($params, $apiMode);
if (null !== $schemas && isset($schemas['request_schema'])) {
$params = \Stripe\Util\Int64::coerceRequestParams($params, $schemas['request_schema']);
}
return $this->getClient()->request($method, $path, $params, $opts);
}
protected function requestStream($method, $path, $readBodyChunkCallable, $params, $opts)
{
return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, self::formatParams($params), $opts);
$apiMode = \Stripe\Util\Util::getApiMode($path);
return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, self::formatParams($params, $apiMode), $opts);
}
protected function requestCollection($method, $path, $params, $opts)
protected function requestCollection($method, $path, $params, $opts, $schemas = null)
{
return $this->getClient()->requestCollection($method, $path, self::formatParams($params), $opts);
$apiMode = \Stripe\Util\Util::getApiMode($path);
$params = self::formatParams($params, $apiMode);
if (null !== $schemas && isset($schemas['request_schema'])) {
$params = \Stripe\Util\Int64::coerceRequestParams($params, $schemas['request_schema']);
}
return $this->getClient()->requestCollection($method, $path, $params, $opts);
}
protected function requestSearchResult($method, $path, $params, $opts)
protected function requestSearchResult($method, $path, $params, $opts, $schemas = null)
{
return $this->getClient()->requestSearchResult($method, $path, self::formatParams($params), $opts);
$apiMode = \Stripe\Util\Util::getApiMode($path);
$params = self::formatParams($params, $apiMode);
if (null !== $schemas && isset($schemas['request_schema'])) {
$params = \Stripe\Util\Int64::coerceRequestParams($params, $schemas['request_schema']);
}
return $this->getClient()->requestSearchResult($method, $path, $params, $opts);
}
protected function buildPath($basePath, ...$ids)