beam-community / stripity-stripe

An Elixir Library for Stripe
Other
965 stars 344 forks source link

Request.put_endpoint/2 doesn't function as described #819

Closed aidanranney closed 9 months ago

aidanranney commented 10 months ago

Package Version

3.0.0

Are you using the latest version?

Steps to Reproduce

Since updating to 3.0.0, a request we're building ourselves with stripity_stripe is no longer successfully hitting the Stripe API when the endpoint is provided following the published documentation.

  1. In a shell, try sending a request with an endpoint without an initial slash or v1 prefix
    iex(7)> Stripe.Request.new_request |> Stripe.Request.put_endpoint("refunds") |> Stripe.Request.make_request()

Expected Result

A valid network response is returned when using the function as documented.

{:error,
 %Stripe.Error{
   source: :stripe,
   code: :unknown_error,
   request_id: nil,
   extra: %{http_status: 403},
   message: "An unknown HTTP code of 403 was received.",
   user_message: nil
 }}

Actual Result

A network error is returned.

{:error,
 %Stripe.Error{
   source: :network,
   code: :network_error,
   request_id: nil,
   extra: %{hackney_reason: :nxdomain},
   message: "An error occurred while making the network request. The HTTP client returned the following reason: :nxdomain",
   user_message: nil
 }}

Since updating, providing an endpoint like /v1/refunds to Stripe.Request.put_endpoint/2 will return a valid response from Stripe.

aidanranney commented 10 months ago

Dug into this a bit more - it appears that this issue may stem from the default configuration no longer including the API version and trailing slash. [Although I don't have the full context behind this change]

Given that the path provided to Request.put_endpoint/2 in the resource modules and elsewhere includes the additional params, would this just be a matter of updating the documentation?

github-actions[bot] commented 9 months ago

This issue has been automatically marked as "stale:discard". If this issue still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment.

github-actions[bot] commented 9 months ago

Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!