stripe / stripe-java

Java library for the Stripe API.

Home Page:https://stripe.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow Webhook class instance to be configured with java.time.Clock

lnhrdt opened this issue · comments

Is your feature request related to a problem? Please describe.

In our application every piece of code that references the current time uses a instance of java.time.Clock. This technique has allowed us to create a suite of reliable tests (aka not flakey tests) in a consistent way across our codebase.

com.stripe.net.Webhook makes a direct reference to java.lang.System.currentTimeMillis() which prevents us from using this technique when testing our Stripe webhook integration. I wish it were possible to create a configured instance of Webhook (perhaps in a similar way to the new StripeClient builder) passing in an instance of Clock so that we could test our Stripe webhook integration in the same way as the rest of our application.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Hello @lnhrdt, thanks for the feedback. This seems like a reasonable request to me. I'm marking this as future as we won't be able to prioritize this right away.