beam-community / stripity-stripe

An Elixir Library for Stripe
Other
951 stars 340 forks source link

Stripe.PaymentIntent.create is missing a type option #844

Open michelboaventura opened 1 week ago

michelboaventura commented 1 week ago

Existing Issue or Pull Request Verification

Package Version

3.2.0

Are you using the latest version?

Steps to Reproduce

Stripe's PaymentIntent allows for a payment method option for us bank accounts called verification_method as can be seen here, but on the lib's spec there's no such option.

Expected Result

No dialyzer error when using the option

Actual Result

The function call will not succeed.

Stripe.PaymentIntent.create(
  _stripe_params :: %{
    :amount => _,
    :application_fee_amount => _,
    :currency => _,
    :metadata => %{<<_::136>> => _},
    :payment_method_options => %{:us_bank_account => %{:verification_method => <<_::72>>}},
    :payment_method_types => [<<_::32, _::size(88)>>, ...],
    :setup_future_usage => :on_session
  },
  [{:api_key, _} | {:connect_account, _}, ...]
)

breaks the contract
(
  params :: %{
    :amount => integer(),
    :application_fee_amount => integer(),
    :automatic_payment_methods => automatic_payment_methods(),
    :capture_method => :automatic | :automatic_async | :manual,
    :confirm => boolean(),
    :confirmation_method => :automatic | :manual,
    :currency => binary(),
    :customer => binary(),
    :description => binary(),
    :error_on_requires_action => boolean(),
    :expand => [binary()],
    :mandate => binary(),
    :mandate_data => mandate_data() | binary(),
    :metadata => %{binary() => binary()},
    :off_session => boolean() | :one_off | :recurring,
    :on_behalf_of => binary(),
    :payment_method => binary(),
    :payment_method_configuration => binary(),
    :payment_method_data => payment_method_data(),
    :payment_method_options => payment_method_options(),
    :payment_method_types => [binary()],
    :radar_options => radar_options(),
    :receipt_email => binary(),
    :return_url => binary(),
    :setup_future_usage => :off_session | :on_session,
    :shipping => shipping(),
    :statement_descriptor => binary(),
    :statement_descriptor_suffix => binary(),
    :transfer_data => transfer_data(),
    :transfer_group => binary(),
    :use_stripe_sdk => boolean()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
michelboaventura commented 1 week ago

I noticed that if I run mix stripe.generate on the lib's folder the new generated code does contain this, so maybe it's just a matter of releasing a new version?

yordis commented 1 week ago

Is this related to https://github.com/beam-community/stripity-stripe/pull/843

michelboaventura commented 1 week ago

I don't think so. Mine seems related to a difference between open api spec versions.