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

Solution For "Regarding ability to override stripe api url per API re… #1476

Merged
merged 17 commits into from
Dec 29, 2022
Merged

Solution For "Regarding ability to override stripe api url per API re… #1476

merged 17 commits into from
Dec 29, 2022

Conversation

yasirshabbir44
Copy link
Contributor

…quest #1181".

#1181

@CLAassistant
Copy link

CLAassistant commented Nov 14, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ yasirshabbir44
❌ javaProgrammer44
You have signed the CLA already but the status is still pending? Let us recheck it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@richardm-stripe
Copy link
Contributor

Hello @yasirshabbir44. Thank you for this change. It makes sense to me!

Can you sign the CLA per CLAassistant's comment above?

@yasirshabbir44
Copy link
Contributor Author

Hello @richardm-stripe
Done

@richardm-stripe
Copy link
Contributor

Ah, I see you have changed src/main/java/com/stripe/model/PaymentMethod.java to replace Stripe.getApiBase() with options.getApiBase() but

  • This file is generated, so we have to change the generator (which alas, is private) otherwise the change to this file will be reverted.
  • Many other models also need to be changed to use options.getApiBase().
  • We need to account for the possibility that options is null, since passing null RequestOptions is allowed into methods like PaymentMethod.create.

So we can't merge as-is. I'll see if I can get a generator change in this week.

@yasirshabbir44
Copy link
Contributor Author

Waiting for to get merge if you all get well please merge it.

thanks

@richardm-stripe
Copy link
Contributor

Hello @yasirshabbir44, I'm working on this and made a number of changes:

  • I changed apiBase to baseUrl. I wanted to give it a different name from Stripe.apiBase because Stripe.connectBase (which defaults to connect.stripe.com) and Stripe.uploadBase (which defaulst to files.stripe.com) also exist, but specifying RequestOptions.baseUrl will override all of these, not just Stripe.apiBase.
  • I changed it so that defaulting to Stripe.getApiBase() happens in a new method ApiResource.fullUrl which is called from each resource method. It needs to be this way, since we need to handle null RequestOptions, and methods that use connectBase or uploadBase need a way to specify that they have different defaults from other methods.
  • I changed our generator so that all methods in the SDK respect RequestOptions.baseUrl and committed the resulting changes.

@richardm-stripe
Copy link
Contributor

r? @pakrym-stripe

@yasirshabbir44
Copy link
Contributor Author

Could you please merge it

@richardm-stripe
Copy link
Contributor

richardm-stripe commented Dec 29, 2022

Sure, we can merge! We aren't scheduled cut a release until next week, though.

@richardm-stripe
Copy link
Contributor

@yasirshabbir44
Copy link
Contributor Author

yasirshabbir44 commented Jan 8, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants