NuroDev / lemonsqueezy.ts

🍋 JavaScript / TypeScript SDK for the Lemon Squeezy API
https://paka.dev/npm/lemonsqueezy.ts
MIT License
158 stars 17 forks source link

Make Create Checkout options deeply partial #5

Closed squaick closed 1 year ago

squaick commented 1 year ago

Hi. first of all, thank you for this package! It saved me a lot of time.

When I was implementing the createCheckout method I noticed that all the sub-attributes of LemonsqueezyCheckout.attributes which are product_options, checkout_options and checkout_data were required. But this isn't the case for the API which sub-attributes of these objects are all optional.

For example, if I just want to set custom data in checkout_data like this:

{
  checkout_data:{
     custom: {
       user_id = "blablabla"
     }
  }
}

I can't achieve this since the sub-types were non-partial. I was forced to fill in email, name, billing_address... etc columns.

By making these sub-types partial I believe I have fixed this and all tests passed

squaick commented 1 year ago

Hi, any updates on this?

NuroDev commented 1 year ago

Sorry I'm only now seeing / replying to this.

Creating checking logic is actually currently broken as someone else reported to me & I have already begun work on fixing (#6) the creating checkout logic all together as well as fixing the types, which in this case includes the partial types.

I should hopefully have this fix merged & a new release out within the next day or so.