arlyon / async-stripe

Async (and blocking!) Rust bindings for the Stripe API
https://payments.rs
Apache License 2.0
445 stars 128 forks source link

Added attribute for previous event object #407

Closed hzargar2 closed 1 year ago

hzargar2 commented 1 year ago

Summary

Added attribute for previous event object in webhook events. Used a HashMap<String, Value> to represent it but I am not sure if this is a good choice. My reasoning is that not all attributes of the object are present, only ones that have been updated, so deserializing to a specific EventObject variant may not be a good fit as all the attributes in the EventObject struct will need to be iterated to check which ones are set. Additionally, since the developer doesn't know which attributes will be updated, it is best to keep the entries flexible and let the developer choose how to access the data in "previous_attributes" depending on the attributes present.

Open to feedback. Thanks!

Checklist

arlyon commented 1 year ago

I think that this is reasonable. Approving / running CI

arlyon commented 1 year ago

Running again thanks for your patience