Skip to content

Commit

Permalink
Merge upstream and update generated code for v1452
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe-openapi[bot] committed Jan 17, 2025
2 parents 6adbcfd + e81186f commit dd805ec
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1450
v1452
2 changes: 1 addition & 1 deletion lib/Util/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function convertToStripeObject($resp, $opts, $apiMode = 'v1')
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)) {
Expand Down
7 changes: 6 additions & 1 deletion lib/V2/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
namespace Stripe\V2;

/**
* Base class for V2 events.
*
* This is concrete for use in our generated tests. Events returned from the \Stripe\V2\Core\EventService
* will be a subtype of \Stripe\V2\Event.
*
* @property string $id Unique identifier for the event.
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
* @property int $created Time at which the object was created.
* @property \Stripe\StripeObject $reason Reason for the event.
* @property string $type The type of the event.
* @property null|string $context The Stripe account of the event
*/
abstract class Event extends \Stripe\ApiResource
class Event extends \Stripe\ApiResource
{
const OBJECT_NAME = 'v2.core.event';
}
14 changes: 14 additions & 0 deletions tests/Stripe/GeneratedExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,20 @@ public function testCheckoutSessionsPost2()
static::assertInstanceOf(\Stripe\Checkout\Session::class, $result);
}

public function testCoreEventsGet()
{
$this->stubRequest(
'get',
'/v2/core/events/ll_123',
[],
[],
false,
['object' => \Stripe\V2\Event::OBJECT_NAME]
);
$result = $this->client->v2->core->events->retrieve('ll_123', []);
static::assertInstanceOf(\Stripe\V2\Event::class, $result);
}

public function testCountrySpecsGet()
{
$this->expectsRequest('get', '/v1/country_specs');
Expand Down

0 comments on commit dd805ec

Please sign in to comment.