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 the Checkout Session resource #740

Merged
merged 1 commit into from
Apr 16, 2019

Conversation

remi-stripe
Copy link
Contributor

@remi-stripe remi-stripe commented Dec 20, 2018

This resource is now ready to be released. The PR has been updated to match the latest spec.

r? @brandur-stripe
cc @stripe/api-libraries

@remi-stripe remi-stripe force-pushed the remi-add-checkout-sessions branch from 4c49cb0 to e59dba0 Compare January 17, 2019 04:03
@remi-stripe remi-stripe force-pushed the remi-add-checkout-sessions branch from e59dba0 to 7bb4688 Compare April 15, 2019 21:19
@remi-stripe remi-stripe changed the title [WIP] Add support for the Checkout Session resource Add support for the Checkout Session resource Apr 15, 2019
@remi-stripe
Copy link
Contributor Author

Related to stripe/stripe-dotnet#1440

Copy link
Contributor

@brandur-stripe brandur-stripe left a comment

Choose a reason for hiding this comment

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

Awesome Remi. Left a couple minor comments, but looking great.

ptal @remi-stripe

})
assert.Nil(t, err)
assert.NotNil(t, session)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we try to exercise Get as well?

// creation on a checkout session.
type CheckoutSessionSubscriptionDataParams struct {
Items *CheckoutSessionSubscriptionDataItemsParams `form:"items"`
TrialEnd *int64 `form:"trial_end"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This might also need its own Params so that it can get a Metadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes I forgot to ask you: does it just work? Do we explicitly go through nested Params the right way?

Copy link
Contributor

Choose a reason for hiding this comment

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

You'd have to write a test to be 100% sure, but yeah, Params doesn't do anything special really, so it should work fine even if nested down on a substructure like this.

The one downside of course is that Params has a bunch of things on it that are not relevant to this struct (e.g. idempotency key, headers, Stripe-Account ...), so another alternative would be just to add Metadata map[string]string form:"metadata"`` directly. The downside of that of course is that you'd also have to manually add the AddMetadata helper to the struct if you wanted to support that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Woot that magically just works. Nice catch! I think it's likely easier and more explicit that way than having to do something custom that users would not expect.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, WFM.

// CheckoutSessionPaymentIntentDataTransferDataParams is the set of parameters allowed for the
// transfer_data hash.
type CheckoutSessionPaymentIntentDataTransferDataParams struct {
Destination *string `form:"destination"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also have Amount?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No amount is gated in theory (and there for PI because it was ungated before launch)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, got it. Okay, thanks!

@remi-stripe remi-stripe force-pushed the remi-add-checkout-sessions branch from 7bb4688 to ea3749a Compare April 16, 2019 02:36
@remi-stripe
Copy link
Contributor Author

@brandur-stripe Thanks for catching those issues. I just fixed each one. PTAL

@remi-stripe remi-stripe merged commit 2d5c3a4 into master Apr 16, 2019
@remi-stripe remi-stripe deleted the remi-add-checkout-sessions branch April 16, 2019 17:22
nadaismail-stripe pushed a commit that referenced this pull request Oct 18, 2024
* More logging info when creating a new phase

* More refactoring and logging additions in prep for pulling existing price from order line

* Pulling price reuse tests into a dedicated file

* Nilclass fix
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.

3 participants