mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Bump stripe-php from 16.4.0 to 17.2.1
This commit is contained in:
@@ -6,5 +6,5 @@ namespace Stripe\Util;
|
||||
|
||||
class ApiVersion
|
||||
{
|
||||
const CURRENT = '2024-12-18.acacia';
|
||||
const CURRENT = '2025-04-30.basil';
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ class EventTypes
|
||||
// The beginning of the section generated from our OpenAPI spec
|
||||
\Stripe\Events\V1BillingMeterErrorReportTriggeredEvent::LOOKUP_TYPE => \Stripe\Events\V1BillingMeterErrorReportTriggeredEvent::class,
|
||||
\Stripe\Events\V1BillingMeterNoMeterFoundEvent::LOOKUP_TYPE => \Stripe\Events\V1BillingMeterNoMeterFoundEvent::class,
|
||||
\Stripe\Events\V2CoreEventDestinationPingEvent::LOOKUP_TYPE => \Stripe\Events\V2CoreEventDestinationPingEvent::class,
|
||||
// The end of the section generated from our OpenAPI spec
|
||||
];
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ class ObjectTypes
|
||||
/**
|
||||
* @var array Mapping from object types to resource classes
|
||||
*/
|
||||
const mapping =
|
||||
[
|
||||
const mapping
|
||||
= [
|
||||
\Stripe\Collection::OBJECT_NAME => \Stripe\Collection::class,
|
||||
\Stripe\Issuing\CardDetails::OBJECT_NAME => \Stripe\Issuing\CardDetails::class,
|
||||
\Stripe\SearchResult::OBJECT_NAME => \Stripe\SearchResult::class,
|
||||
@@ -76,6 +76,7 @@ class ObjectTypes
|
||||
\Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class,
|
||||
\Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class,
|
||||
\Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class,
|
||||
\Stripe\InvoicePayment::OBJECT_NAME => \Stripe\InvoicePayment::class,
|
||||
\Stripe\InvoiceRenderingTemplate::OBJECT_NAME => \Stripe\InvoiceRenderingTemplate::class,
|
||||
\Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class,
|
||||
\Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class,
|
||||
@@ -149,8 +150,6 @@ class ObjectTypes
|
||||
\Stripe\Treasury\ReceivedDebit::OBJECT_NAME => \Stripe\Treasury\ReceivedDebit::class,
|
||||
\Stripe\Treasury\Transaction::OBJECT_NAME => \Stripe\Treasury\Transaction::class,
|
||||
\Stripe\Treasury\TransactionEntry::OBJECT_NAME => \Stripe\Treasury\TransactionEntry::class,
|
||||
\Stripe\UsageRecord::OBJECT_NAME => \Stripe\UsageRecord::class,
|
||||
\Stripe\UsageRecordSummary::OBJECT_NAME => \Stripe\UsageRecordSummary::class,
|
||||
\Stripe\WebhookEndpoint::OBJECT_NAME => \Stripe\WebhookEndpoint::class,
|
||||
// object classes: The end of the section generated from our OpenAPI spec
|
||||
];
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
namespace Stripe\Util;
|
||||
|
||||
/**
|
||||
* @phpstan-type RequestOptionsArray array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string, stripe_version?: string, api_base?: string }
|
||||
* @psalm-type RequestOptionsArray = array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string, stripe_version?: string, api_base?: string }
|
||||
* @phpstan-type RequestOptionsArray array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string, stripe_version?: string, api_base?: string, max_network_retries?: int }
|
||||
*
|
||||
* @psalm-type RequestOptionsArray = array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string, stripe_version?: string, api_base?: string, max_network_retries?: int }
|
||||
*/
|
||||
class RequestOptions
|
||||
{
|
||||
@@ -25,16 +26,21 @@ class RequestOptions
|
||||
/** @var null|string */
|
||||
public $apiBase;
|
||||
|
||||
/** @var null|int */
|
||||
public $maxNetworkRetries;
|
||||
|
||||
/**
|
||||
* @param null|string $key
|
||||
* @param array<string, string> $headers
|
||||
* @param null|string $base
|
||||
* @param null|int $maxNetworkRetries
|
||||
*/
|
||||
public function __construct($key = null, $headers = [], $base = null)
|
||||
public function __construct($key = null, $headers = [], $base = null, $maxNetworkRetries = null)
|
||||
{
|
||||
$this->apiKey = $key;
|
||||
$this->headers = $headers;
|
||||
$this->apiBase = $base;
|
||||
$this->maxNetworkRetries = $maxNetworkRetries;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,6 +52,7 @@ class RequestOptions
|
||||
'apiKey' => $this->redactedApiKey(),
|
||||
'headers' => $this->headers,
|
||||
'apiBase' => $this->apiBase,
|
||||
'maxNetworkRetries' => $this->maxNetworkRetries,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -67,6 +74,9 @@ class RequestOptions
|
||||
if (null === $other_options->apiBase) {
|
||||
$other_options->apiBase = $this->apiBase;
|
||||
}
|
||||
if (null === $other_options->maxNetworkRetries) {
|
||||
$other_options->maxNetworkRetries = $this->maxNetworkRetries;
|
||||
}
|
||||
$other_options->headers = \array_merge($this->headers, $other_options->headers);
|
||||
|
||||
return $other_options;
|
||||
@@ -90,9 +100,9 @@ class RequestOptions
|
||||
* @param null|array|RequestOptions|string $options a key => value array
|
||||
* @param bool $strict when true, forbid string form and arbitrary keys in array form
|
||||
*
|
||||
* @throws \Stripe\Exception\InvalidArgumentException
|
||||
*
|
||||
* @return RequestOptions
|
||||
*
|
||||
* @throws \Stripe\Exception\InvalidArgumentException
|
||||
*/
|
||||
public static function parse($options, $strict = false)
|
||||
{
|
||||
@@ -119,6 +129,7 @@ class RequestOptions
|
||||
$headers = [];
|
||||
$key = null;
|
||||
$base = null;
|
||||
$maxNetworkRetries = null;
|
||||
|
||||
if (\array_key_exists('api_key', $options)) {
|
||||
$key = $options['api_key'];
|
||||
@@ -146,6 +157,12 @@ class RequestOptions
|
||||
}
|
||||
unset($options['stripe_version']);
|
||||
}
|
||||
if (\array_key_exists('max_network_retries', $options)) {
|
||||
if (null !== $options['max_network_retries']) {
|
||||
$maxNetworkRetries = $options['max_network_retries'];
|
||||
}
|
||||
unset($options['max_network_retries']);
|
||||
}
|
||||
if (\array_key_exists('api_base', $options)) {
|
||||
$base = $options['api_base'];
|
||||
unset($options['api_base']);
|
||||
@@ -157,7 +174,7 @@ class RequestOptions
|
||||
throw new \Stripe\Exception\InvalidArgumentException($message);
|
||||
}
|
||||
|
||||
return new RequestOptions($key, $headers, $base);
|
||||
return new RequestOptions($key, $headers, $base, $maxNetworkRetries);
|
||||
}
|
||||
|
||||
$message = 'The second argument to Stripe API method calls is an '
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
|
||||
namespace Stripe\Util;
|
||||
|
||||
use ArrayIterator;
|
||||
use IteratorAggregate;
|
||||
|
||||
class Set implements IteratorAggregate
|
||||
class Set implements \IteratorAggregate
|
||||
{
|
||||
private $_elts;
|
||||
|
||||
@@ -38,11 +35,11 @@ class Set implements IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayIterator
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->toArray());
|
||||
return new \ArrayIterator($this->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ abstract class Util
|
||||
*/
|
||||
public static function convertToStripeObject($resp, $opts, $apiMode = 'v1')
|
||||
{
|
||||
$types = 'v1' === $apiMode ? \Stripe\Util\ObjectTypes::mapping
|
||||
: \Stripe\Util\ObjectTypes::v2Mapping;
|
||||
$types = 'v1' === $apiMode ? ObjectTypes::mapping
|
||||
: ObjectTypes::v2Mapping;
|
||||
if (self::isList($resp)) {
|
||||
$mapped = [];
|
||||
foreach ($resp as $i) {
|
||||
@@ -60,11 +60,11 @@ abstract class Util
|
||||
) {
|
||||
$class = $types[$resp['object']];
|
||||
if ('v2' === $apiMode && ('v2.core.event' === $resp['object'])) {
|
||||
$eventTypes = \Stripe\Util\EventTypes::thinEventMapping;
|
||||
$eventTypes = EventTypes::thinEventMapping;
|
||||
if (\array_key_exists('type', $resp) && \array_key_exists($resp['type'], $eventTypes)) {
|
||||
$class = $eventTypes[$resp['type']];
|
||||
} else {
|
||||
$class = \Stripe\StripeObject::class;
|
||||
$class = \Stripe\V2\Event::class;
|
||||
}
|
||||
}
|
||||
} elseif (\array_key_exists('data', $resp) && \array_key_exists('next_page_url', $resp)) {
|
||||
@@ -72,7 +72,7 @@ abstract class Util
|
||||
// to return something for `object` here.
|
||||
$class = \Stripe\V2\Collection::class;
|
||||
} else {
|
||||
$class = \Stripe\StripeObject::class;
|
||||
$class = StripeObject::class;
|
||||
}
|
||||
|
||||
return $class::constructFrom($resp, $opts, $apiMode);
|
||||
@@ -130,12 +130,10 @@ abstract class Util
|
||||
|
||||
if (!self::$isMbstringAvailable) {
|
||||
\trigger_error(
|
||||
'It looks like the mbstring extension is not enabled. ' .
|
||||
'UTF-8 strings will not properly be encoded. Ask your system '
|
||||
.
|
||||
'administrator to enable the mbstring extension, or write to '
|
||||
.
|
||||
'support@stripe.com if you have any questions.',
|
||||
'It looks like the mbstring extension is not enabled. '
|
||||
. 'UTF-8 strings will not properly be encoded. Ask your system '
|
||||
. 'administrator to enable the mbstring extension, or write to '
|
||||
. 'support@stripe.com if you have any questions.',
|
||||
\E_USER_WARNING
|
||||
);
|
||||
}
|
||||
@@ -262,7 +260,7 @@ abstract class Util
|
||||
self::flattenParams($value, $calculatedKey, $apiMode)
|
||||
);
|
||||
} else {
|
||||
\array_push($result, [$calculatedKey, $value]);
|
||||
$result[] = [$calculatedKey, $value];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,9 +294,9 @@ abstract class Util
|
||||
);
|
||||
} else {
|
||||
if ('v2' === $apiMode) {
|
||||
\array_push($result, ["{$calculatedKey}", $elem]);
|
||||
$result[] = ["{$calculatedKey}", $elem];
|
||||
} else {
|
||||
\array_push($result, ["{$calculatedKey}[{$i}]", $elem]);
|
||||
$result[] = ["{$calculatedKey}[{$i}]", $elem];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user