Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix related object fetch #1761

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions lib/Events/V1BillingMeterErrorReportTriggeredEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@

namespace Stripe\Events;

/**
* @property \Stripe\RelatedObject $related_object Object containing the reference to API resource relevant to the event
* @property \Stripe\EventData\V1BillingMeterErrorReportTriggeredEventData $data data associated with the event
*/
class V1BillingMeterErrorReportTriggeredEvent extends \Stripe\V2\Event
{
const LOOKUP_TYPE = 'v1.billing.meter.error_report_triggered';

/**
* @var \Stripe\EventData\V1BillingMeterErrorReportTriggeredEventData data associated with the event
*/
public $data;

/**
* @var \Stripe\RelatedObject Object containing the reference to API resource relevant to the event
*/
public $related_object;

/**
* Retrieves the related object from the API. Make an API request on every call.
*
Expand Down
8 changes: 3 additions & 5 deletions lib/Events/V1BillingMeterNoMeterFoundEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

namespace Stripe\Events;

/**
* @property \Stripe\EventData\V1BillingMeterNoMeterFoundEventData $data data associated with the event
*/
class V1BillingMeterNoMeterFoundEvent extends \Stripe\V2\Event
{
const LOOKUP_TYPE = 'v1.billing.meter.no_meter_found';

/**
* @var \Stripe\EventData\V1BillingMeterNoMeterFoundEventData data associated with the event
*/
public $data;
}
17 changes: 12 additions & 5 deletions tests/Stripe/V2/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function setUpFixture()
['id' => 'pm_456', 'object' => 'pageablemodel'],
],
'next_page_url' => '/v2/pageablemodel?page=page_2',
'previous_page_url' => null,
], ['api_key' => 'sk_test', 'stripe_context' => 'wksp_123'], 'v2');
}

Expand Down Expand Up @@ -52,7 +53,8 @@ public function testCanIterate()
{
$collection = \Stripe\V2\Collection::constructFrom([
'data' => [['id' => '1'], ['id' => '2'], ['id' => '3']],
'next_page' => null,
'next_page_url' => null,
'previous_page_url' => null,
]);

$seen = [];
Expand All @@ -67,7 +69,8 @@ public function testCanIterateBackwards()
{
$collection = \Stripe\V2\Collection::constructFrom([
'data' => [['id' => '1'], ['id' => '2'], ['id' => '3']],
'next_page' => null,
'next_page_url' => null,
'previous_page_url' => null,
]);

$seen = [];
Expand Down Expand Up @@ -96,7 +99,8 @@ public function testAutoPagingIteratorSupportsOnePage()
['id' => '2'],
['id' => '3'],
],
'next_page' => null,
'next_page_url' => null,
'previous_page_url' => null,
]);

$seen = [];
Expand All @@ -114,6 +118,7 @@ public function testAutoPagingIteratorSupportsTwoPages()
['id' => '1'],
],
'next_page_url' => '/v2/pageablemodel?foo=bar&page=page_2',
'previous_page_url' => null,
]);

$this->stubRequest(
Expand All @@ -128,6 +133,7 @@ public function testAutoPagingIteratorSupportsTwoPages()
['id' => '3'],
],
'next_page_url' => null,
'previous_page_url' => null,
]
);

Expand All @@ -150,6 +156,7 @@ public function testAutoPagingIteratorSupportsIteratorToArray()
[
'data' => [['id' => 'pm_789']],
'next_page_url' => null,
'previous_page_url' => null,
]
);

Expand All @@ -170,11 +177,11 @@ public function testForwardsRequestOpts()

$curlClientStub->method('executeRequestWithRetries')
->willReturnOnConsecutiveCalls([
'{"data": [{"id": "pm_777"}], "next_page_url": "page_3"}',
'{"data": [{"id": "pm_777"}], "next_page_url": "/v2/pageablemodel?page_3", "previous_page_url": "/v2/pageablemodel?page_1"}',
200,
[],
], [
'{"data": [{"id": "pm_888"}], "next_page_url": null}',
'{"data": [{"id": "pm_888"}], "next_page_url": null, "previous_page_url": "/v2/pageablemodel?page_2"}',
200,
[],
])
Expand Down
Loading