You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an easy way to hydrate, say an Recurly_Subscription object, from a Recurly_PushNotification object?
When I try to access a date property from the subscription attribute on a notification, instead of getting a DateTime object as I would expect and would get from Recurly_Subscription object, I get an SimpleXMLElement.
The text was updated successfully, but these errors were encountered:
@NicholasJohn16 If you are referring to taking a push notification object and turning it into a Recurly_Subscription, then no we don't directly support that. Part of the problem is that we don't guarantee a 1:1 mapping of these objects to the resource objects. Also, you could maybe get away with constructing the Subscription from xml and it would be accurate 95% of the time, but the xml parsing code is protected and we don't recommend relying on the webhook mappings.
For now, I'd say your best option is to use the uuid to fetch the subscription:
Considering that webhooks may be stale when they arrive, you'll get more reliable data this way too. I hope this answers your question. If you think we should make some changes to this library to help I'd be happy to consider it.
It would be nice if the properties of push notification were instances of their object counterparts, like the account property is an instance of Recurly_Account and the subscription property is a property of Recurly_Subscription. It could just be understood that if you're getting the info from a notification object, it's just not going to be fully loaded or possibly outdated.
But I get that it doesn't work that way. Thanks for the info.
Is there an easy way to hydrate, say an
Recurly_Subscription
object, from aRecurly_PushNotification
object?When I try to access a date property from the subscription attribute on a notification, instead of getting a
DateTime
object as I would expect and would get fromRecurly_Subscription
object, I get anSimpleXMLElement
.The text was updated successfully, but these errors were encountered: