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

Add support for Subscription Schedules #590

Merged
merged 1 commit into from
Feb 12, 2019

Conversation

remi-stripe
Copy link
Contributor

This adds two new resources: Subscription Schedule and Subscription Schedule Revision. The latter is nested under the former.

This should be ready even though we won't merge until all libraries are ready and stripe-mock supports those new endpoints publicly.

r? @ob-stripe
cc @stripe/api-libraries @alexander-stripe

/**
* @return string The API URL for this Subscription Schedule Revision.
*/
public function instanceUrl()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOC do we really need this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really: SubscriptionScheduleRevision doesn't have any instance methods, so this is never called. It's fine to leave it though.

public function instanceUrl()
{
$id = $this['id'];
$schedule = $this['schedule'];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soooo I just realized we do a lot of magic in the library to find the parent id. And I worry a liiiiittle bit that this is not documented anywhere (internally at Stripe). And that one day we would rename this to subscription_schedule because it seems more consistent and then break half the libraries out there.

I wonder if settling on parent for the name across all parent resources would be safer. Just food for thoughts

*
* @throws \Stripe\Error\InvalidRequest
*/
public static function all($params = null, $opts = null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weirdly this was not verified in Person.php. Should it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced those methods that immediately raise an exception are very useful, but it's better to be consistent, so I'd say yes.

@remi-stripe remi-stripe force-pushed the remi-add-subscription-schedules branch from 2c1355f to dabd5f9 Compare February 12, 2019 00:40
@remi-stripe
Copy link
Contributor Author

@ob-stripe I retried the tests numerous times to no avail. Looks like the hhvm builds are failing but I don't think it's related to my changes. Can you double check and if it's all good review and release?

@ob-stripe
Copy link
Contributor

Looks like the hhvm builds are failing but I don't think it's related to my changes.

Yeah, this is unrelated. HHVM 4.0 was released yesterday, and it's no longer compatible with PHP. We'll have to remove HHVM from the CI, or maybe pin it to the last 3.x version.

Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One missing test, otherwise LGTM.

/**
* @return string The API URL for this Subscription Schedule Revision.
*/
public function instanceUrl()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really: SubscriptionScheduleRevision doesn't have any instance methods, so this is never called. It's fine to leave it though.

*
* @throws \Stripe\Error\InvalidRequest
*/
public static function all($params = null, $opts = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced those methods that immediately raise an exception are very useful, but it's better to be consistent, so I'd say yes.

tests/Stripe/SubscriptionScheduleTest.php Show resolved Hide resolved
@stripe-ci stripe-ci assigned remi-stripe and unassigned ob-stripe Feb 12, 2019
* Add support for Subscription Schedule
* Add support for Subscription Schedule Revision
* Upgrade stripe-mock to 0.44
* Update resources and tests impacted by the Payment Intent changes
@remi-stripe remi-stripe force-pushed the remi-add-subscription-schedules branch from dabd5f9 to 3e7e4d3 Compare February 12, 2019 16:34
@remi-stripe
Copy link
Contributor Author

@ob-stripe Fixed! PTAL

@remi-stripe remi-stripe assigned ob-stripe and unassigned remi-stripe Feb 12, 2019
Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stripe-ci stripe-ci assigned remi-stripe and unassigned ob-stripe Feb 12, 2019
@remi-stripe remi-stripe merged commit b162a55 into master Feb 12, 2019
@remi-stripe remi-stripe deleted the remi-add-subscription-schedules branch February 12, 2019 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants