mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
240 stars 64 forks source link

Missing Typescript properties in Payment model #390

Open PaquitoSoft opened 2 weeks ago

PaquitoSoft commented 2 weeks ago

Hello 👋

We're starting to consume Mollie APIs and I think I'm missing some properties in the Payment model typescript definition.

Based on the API documentation (reference), a payment can have these optional properties:

However the Typescript type describing this model does not contain those properties (reference).

Are we missing something?

Thanks.

fjbender commented 2 weeks ago

You're not missing anything :)

The properties you mentioned have been introduced fairly recently to eventually enable transition from the Orders API to the Payments API. We will include them in a future version of this library to support this.

janpaepke commented 2 weeks ago

Especially since payments should replace the orders API, these are very sensible additions. As these are only type additions, I am confident, we can add them fairly soon to the client.

In the meantime, you can get around Typescript complaining by spreading them into your payment.create options like this:

lines = {
  [...]
}
client.payments.create({
    amount: {
        value: 100
        currency: "EUR",
    },
    ...{ lines }, // tmp syntax, until @mollie/api-client includes correct property types
});

This way you don't have to disable ts checking for the whole object.

PaquitoSoft commented 1 week ago

Ok. Thanks for your reply 🙇

Should we keep this opened until the types are added to the package?

fjbender commented 1 week ago

Should we keep this opened until the types are added to the package?

Yes! :)