beam-community / stripity-stripe

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

Stripe.Refund.list requires a charge #848

Open sb8244 opened 1 month ago

sb8244 commented 1 month ago

Existing Issue or Pull Request Verification

Package Version

2.17.1

Are you using the latest version?

Steps to Reproduce

Invoke Stripe.Refund.list() and get error about function not existing.

Try to invoke it with Stripe.Refund.list(%{}) and get String replacement functions

Expected Result

Stripe's API supports listing all refunds without passing the charge parameter

Actual Result

The generated code requires charge to be passed in, possibly due to documentation bug on Stripe side?

Stripes docs show it's possible to request refunds without the charge ID:

image
sb8244 commented 1 month ago

There is a workaround to define my own list_refunds function like so:

  def list_refunds(params \\ %{}, opts \\ []) do
    path = "/v1/refunds"

    Stripe.Request.new_request(opts)
    |> Stripe.Request.put_endpoint(path)
    |> Stripe.Request.put_params(params)
    |> Stripe.Request.put_method(:get)
    |> Stripe.Request.make_request()
  end

So this is probably a low priority issue

dmitry-loves-elixir-not commented 3 weeks ago

I've also stumbled upon this issue while trying to upgrade from stripity_stripe v"2.17.3" to "3.2.0". %Stripe.PaymentIntent structure no longer contains the list of charges, so I need to pull them from https://docs.stripe.com/api/refunds/list API, which takes either charge or payment_intent ID as a parameter and stripity-stripe only supports charge ID for this API

yordis commented 3 weeks ago

I have a lot of work to do at https://github.com/beam-community/stripity-stripe/pull/843

Primarily, I need to readjust what I am doing and add another indirection that allows manual mapping of endpoints so that I can avoid breaking changes, for now.