Split DB Updates into seperate files, with the cutoff being 2.0.0

This commit is contained in:
johnnyq
2026-07-22 18:43:11 -04:00
parent 17e4c61067
commit 2b756f6ea4
252 changed files with 4161 additions and 4875 deletions

View File

@@ -6,6 +6,6 @@ namespace Stripe\Util;
class ApiVersion
{
const CURRENT = '2026-02-25.clover';
const CURRENT_MAJOR = 'clover';
const CURRENT = '2026-06-24.dahlia';
const CURRENT_MAJOR = 'dahlia';
}

View File

@@ -8,6 +8,10 @@ class EventNotificationTypes
// The beginning of the section generated from our OpenAPI spec
\Stripe\Events\V1BillingMeterErrorReportTriggeredEventNotification::LOOKUP_TYPE => \Stripe\Events\V1BillingMeterErrorReportTriggeredEventNotification::class,
\Stripe\Events\V1BillingMeterNoMeterFoundEventNotification::LOOKUP_TYPE => \Stripe\Events\V1BillingMeterNoMeterFoundEventNotification::class,
\Stripe\Events\V2CommerceProductCatalogImportsFailedEventNotification::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsFailedEventNotification::class,
\Stripe\Events\V2CommerceProductCatalogImportsProcessingEventNotification::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsProcessingEventNotification::class,
\Stripe\Events\V2CommerceProductCatalogImportsSucceededEventNotification::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsSucceededEventNotification::class,
\Stripe\Events\V2CommerceProductCatalogImportsSucceededWithErrorsEventNotification::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsSucceededWithErrorsEventNotification::class,
\Stripe\Events\V2CoreAccountClosedEventNotification::LOOKUP_TYPE => \Stripe\Events\V2CoreAccountClosedEventNotification::class,
\Stripe\Events\V2CoreAccountCreatedEventNotification::LOOKUP_TYPE => \Stripe\Events\V2CoreAccountCreatedEventNotification::class,
\Stripe\Events\V2CoreAccountUpdatedEventNotification::LOOKUP_TYPE => \Stripe\Events\V2CoreAccountUpdatedEventNotification::class,

View File

@@ -8,6 +8,10 @@ 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\V2CommerceProductCatalogImportsFailedEvent::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsFailedEvent::class,
\Stripe\Events\V2CommerceProductCatalogImportsProcessingEvent::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsProcessingEvent::class,
\Stripe\Events\V2CommerceProductCatalogImportsSucceededEvent::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsSucceededEvent::class,
\Stripe\Events\V2CommerceProductCatalogImportsSucceededWithErrorsEvent::LOOKUP_TYPE => \Stripe\Events\V2CommerceProductCatalogImportsSucceededWithErrorsEvent::class,
\Stripe\Events\V2CoreAccountClosedEvent::LOOKUP_TYPE => \Stripe\Events\V2CoreAccountClosedEvent::class,
\Stripe\Events\V2CoreAccountCreatedEvent::LOOKUP_TYPE => \Stripe\Events\V2CoreAccountCreatedEvent::class,
\Stripe\Events\V2CoreAccountUpdatedEvent::LOOKUP_TYPE => \Stripe\Events\V2CoreAccountUpdatedEvent::class,

View File

@@ -0,0 +1,128 @@
<?php
namespace Stripe\Util;
/**
* Handles coercion between PHP int and JSON string for int64_string fields.
*
* V2 API fields marked as int64_string are transmitted as JSON strings on
* the wire but exposed as PHP ints in the SDK.
*/
class Int64
{
/**
* Coerce outbound request params: convert PHP ints to strings where
* the request schema indicates an int64_string field.
*
* @param mixed $params
* @param array $schema e.g. ['kind' => 'object', 'fields' => ['amount' => ['kind' => 'int64_string']]]
*
* @return mixed
*/
public static function coerceRequestParams($params, $schema)
{
if (null === $params) {
return null;
}
if (!isset($schema['kind'])) {
return $params;
}
if ('int64_string' === $schema['kind']) {
if (\is_int($params)) {
return (string) $params;
}
return $params;
}
if ('array' === $schema['kind'] && isset($schema['items'])) {
if (\is_array($params)) {
$result = [];
foreach ($params as $key => $value) {
$result[$key] = self::coerceRequestParams($value, $schema['items']);
}
return $result;
}
return $params;
}
if ('object' === $schema['kind'] && isset($schema['fields'])) {
if (\is_array($params)) {
$result = $params;
foreach ($schema['fields'] as $field => $fieldSchema) {
if (\array_key_exists($field, $result)) {
$result[$field] = self::coerceRequestParams($result[$field], $fieldSchema);
}
}
return $result;
}
return $params;
}
return $params;
}
/**
* Coerce inbound response values: convert JSON strings to PHP ints where
* the field encodings indicate an int64_string field.
*
* @param mixed $values
* @param array $encodings e.g. ['amount' => ['kind' => 'int64_string'], 'nested' => ['kind' => 'object', 'fields' => [...]]]
*
* @return mixed
*/
public static function coerceResponseValues($values, $encodings)
{
if (!\is_array($values)) {
return $values;
}
foreach ($encodings as $field => $encoding) {
if (!\array_key_exists($field, $values)) {
continue;
}
$value = $values[$field];
if (!isset($encoding['kind'])) {
continue;
}
if ('int64_string' === $encoding['kind']) {
if (\is_string($value) && \is_numeric($value)) {
$values[$field] = (int) $value;
}
} elseif ('array' === $encoding['kind'] && isset($encoding['items'])) {
if (\is_array($value)) {
foreach ($value as $i => $item) {
if (!isset($encoding['items']['kind'])) {
continue;
}
if ('int64_string' === $encoding['items']['kind']) {
if (\is_string($item) && \is_numeric($item)) {
$values[$field][$i] = (int) $item;
}
} elseif ('object' === $encoding['items']['kind'] && isset($encoding['items']['fields'])) {
if (\is_array($item)) {
$values[$field][$i] = self::coerceResponseValues($item, $encoding['items']['fields']);
}
}
}
}
} elseif ('object' === $encoding['kind'] && isset($encoding['fields'])) {
if (\is_array($value)) {
$values[$field] = self::coerceResponseValues($value, $encoding['fields']);
}
}
}
return $values;
}
}

View File

@@ -172,6 +172,7 @@ class ObjectTypes
\Stripe\V2\Billing\MeterEvent::OBJECT_NAME => \Stripe\V2\Billing\MeterEvent::class,
\Stripe\V2\Billing\MeterEventAdjustment::OBJECT_NAME => \Stripe\V2\Billing\MeterEventAdjustment::class,
\Stripe\V2\Billing\MeterEventSession::OBJECT_NAME => \Stripe\V2\Billing\MeterEventSession::class,
\Stripe\V2\Commerce\ProductCatalogImport::OBJECT_NAME => \Stripe\V2\Commerce\ProductCatalogImport::class,
\Stripe\V2\Core\Account::OBJECT_NAME => \Stripe\V2\Core\Account::class,
\Stripe\V2\Core\AccountLink::OBJECT_NAME => \Stripe\V2\Core\AccountLink::class,
\Stripe\V2\Core\AccountPerson::OBJECT_NAME => \Stripe\V2\Core\AccountPerson::class,

View File

@@ -154,11 +154,17 @@ abstract class Util
* ApiResource, then it is replaced by the resource's ID.
* Also clears out null values.
*
* When $serializeNull is true (used for V2 POST request
* bodies), null values in associative arrays are preserved instead of
* stripped. This is necessary because V2 JSON bodies use explicit null
* to signal "delete this field / metadata key".
*
* @param mixed $h
* @param bool $serializeNull when true, preserve null values instead of stripping them
*
* @return mixed
*/
public static function objectsToIds($h)
public static function objectsToIds($h, $serializeNull)
{
if ($h instanceof \Stripe\ApiResource) {
return $h->id;
@@ -166,7 +172,7 @@ abstract class Util
if (static::isList($h)) {
$results = [];
foreach ($h as $v) {
$results[] = static::objectsToIds($v);
$results[] = static::objectsToIds($v, $serializeNull);
}
return $results;
@@ -175,9 +181,21 @@ abstract class Util
$results = [];
foreach ($h as $k => $v) {
if (null === $v) {
if ($serializeNull) {
$results[$k] = null;
}
continue;
}
$results[$k] = static::objectsToIds($v);
$results[$k] = static::objectsToIds($v, $serializeNull);
}
// If the input was an associative array with string keys but
// all values were stripped, $results is an empty indexed array.
// PHP's json_encode would render that as [] (JSON array) instead
// of {} (JSON object). Cast to object to preserve the type.
if (empty($results) && !empty($h)) {
return (object) $results;
}
return $results;
@@ -256,12 +274,12 @@ abstract class Util
if (self::isList($elem)) {
$result = \array_merge(
$result,
self::flattenParamsList($elem, $calculatedKey)
self::flattenParamsList($elem, "{$calculatedKey}[{$i}]", $apiMode)
);
} elseif (\is_array($elem)) {
$result = \array_merge(
$result,
self::flattenParams($elem, "{$calculatedKey}[{$i}]")
self::flattenParams($elem, "{$calculatedKey}[{$i}]", $apiMode)
);
} else {
// Always use indexed format for arrays