-
Notifications
You must be signed in to change notification settings - Fork 757
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 UsageRecords so it passes through the rest of the arguments #453
Conversation
9354f3c
to
fe94fd8
Compare
fe94fd8
to
654c723
Compare
@jlomas-stripe Thanks for taking a crack at this! Just to make sure that I understand this correctly: what exactly is unusual about this function that means we need this custom code here, but not most other places? |
Ah, this is needed to make sure the callback is passed through! Thanks for taking this. I'm also a bit worried that the test-suite didn't catch this - i.E. the timestamp is marked as required in our API docs ( https://stripe.com/docs/api#usage_record_create ) but I had a typo in |
@brandur-stripe I think that because the If we were to switch it to:
Then it could use the regular I have those changes sitting in my local copy; happy to add them to this PR if that makes more sense, though that would require docs changes, and might mean a breaking change / major version bump at this point...? |
@jlomas-stripe Sorry, I totally lost track of this one! Looking over this again ... I'm thinking that I might have been a little hasty merging the original PR. This should be modeled closely after application fee refunds, which have a similar setup in that their a subresource of another resource. Its implementation is quite simple: module.exports = StripeResource.extend({
path: 'application_fees/{feeId}/refunds',
includeBasic: ['create', 'list', 'retrieve', 'update'],
}); I'm actually not 100% sure that the stripe.applicationFees.createRefund(
"fee_1B73DOKbnvuxQXGuhY8Aw0TN",
function(err, applicationFee) {
// asynchronously called
}
); Which also has a very simple implementation: createRefund: stripeMethod({
method: 'POST',
path: '/{feeId}/refunds',
urlParams: ['feeId'],
}), I'm sort of thinking that we should change usage records over to use that system instead of what we have now ... what do you think? |
@brandur-stripe Agreed. I actually had those changes queued up in my local repo already. This just adds the |
Ah, nice. Thanks @jlomas-stripe! (And my mistake — you said this before, but I didn't quite get it.) Alright, I just looked at stripe-node usage on this endpoint, and unfortunately there is some already, so I think we're going to have to roll this as a major version bump given the breaking API change. Still, it just be a very easy migration. |
could we support both and deprecate the old one? |
Yeah probably, but because both methods would have the same name ( IMO, given that this is a relatively new product and there can't be that many users on it yet, we should try to just roll forward on this one. Thoughts? |
I'm assuming you meant keeping the move forward as a major version? If so I agree, it's just that major versions should also be used to remove/deprecate things we've wanted remove for a while. |
Yeah, agreed in principle — did you have anything in mind? If there's nothing that we want to do opportunistically though, I'd rather not block too long on this (the longer we wait, the more likely people are to start using the older/current API). If we want to change something again later, we can always bump the major version again — users upgrading to compensate for 5 breaking changes across two major version numbers is the same amount of work as compensating for 5 breaking changes across one major version number. |
Okay, I'm fine to leave as is then and we can always prioritize a v6 soon! Sorry for the chunder |
Just to be clear, I'm suggesting that we release V6 now (and if there are any immediate backwards-incompatible changes I can bundle them in), then release V7 later if we want to bundle up any larger backwards-incompatible changes. Are you still okay with that? |
yes, sorry, I got my major versions number mixed up. Please go ahead and ignore most of what I said earlier. |
Okay, great. Thanks @jlomas-stripe @remi-stripe! Pulling this in. |
(By the way, I'll take updating the docs.) |
Released as 6.0.0. |
Makes sure that all of the elements of the original
arguments
array - with the first one being modified to extract and remove the SubscriptionItem ID - are passed through to thestripeMethod()
call.Fixes #451.
r? @brandur-stripe