PaddleHQ / paddle-node-sdk

Node.js SDK for working with the Paddle API in server-side apps.
https://developer.paddle.com/
Apache License 2.0
28 stars 5 forks source link

[Bug]: casting event SubscriptionPriceNotification to Price throw error #25

Closed jobcespedes closed 2 months ago

jobcespedes commented 2 months ago

What happened?

Getting casting error from SubscriptionPriceNotification to Price

Type 'SubscriptionPriceNotification' is missing the following properties from type 'Price': createdAt, updatedAt, product

Steps to reproduce

  1. Cast from SubscriptionPriceNotification to Price

What did you expect to happen?

SubscriptionPriceNotification becomes a Price entity for storage purposes

Logs

Type 'SubscriptionPriceNotification' is missing the following properties from type 'Price': createdAt, updatedAt, product
vijayasingam-paddle commented 2 months ago

Hello, This is similar to #26 , the notification classes and their API counterparts are different by design.

I would recommend updating your function to accept both classes. Worst case, you can manually typecast them to read the fields you need. But be very careful while manually typecasting as you will lose type safety.

Please let us know if we can help you with anything else.

Thank you.