beam-community / stripity-stripe

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

Custom fields checkout typespec is wrong #824

Closed leifertin closed 5 months ago

leifertin commented 7 months ago

Existing Issue or Pull Request Verification

Package Version

3.1.1

Are you using the latest version?

Steps to Reproduce

The API has many options for custom fields, none of which are the ones typed here. https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-custom_fields

https://hexdocs.pm/stripity_stripe/3.1.1/Stripe.Checkout.Session.html#t:custom_fields/0 Stripity only has :name and :value. Both of which are not even in the API.

Expected Result

should include key, label, type, dropdown, numeric, optional, text

Actual Result

only includes name and value (which aren't actually types)

maartenvanvliet commented 7 months ago

I had a quick look. There's some logic happening to make the function specs more succinct by unnesting them. In cases of name collisions this can give bugs.

I tried what happens if we inline the complete specs, the specs become really unwieldy and slow.

https://github.com/beam-community/stripity-stripe/assets/54566/327b6f73-f15a-400a-a5fc-5cabcdf5df6d

I'll try again with wider specs (e.g. map() instead of an map with each field listed). I think this is the way to go for now.

leifertin commented 7 months ago

Sure, whatever you think is best. I think the problem may be that it was copied from Invoice.custom_fields() which is correct.

github-actions[bot] commented 6 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 5 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!