stripe-perl icon indicating copy to clipboard operation
stripe-perl copied to clipboard

missing support for Events, trying to add it, need help

Open yahermann opened this issue 10 years ago • 3 comments

I created a get_events() method, and I created a Net::Stripe::Event object model. The get_events() method appears to work because I can see it in the logs on the Stripe dashboard. However, I get the following error:

Can't locate object method "new" via package "Net::Stripe::Net::Stripe::Customer=HASH(0x6f0e1d0)"

I try different types of events, and the message above varies but is always present.

I think the issue is the returned 'data' field. Two issues specifically:

  1. 'data' contains an 'object' hash which in turn contains stuff. _make_request appears to assume 'object' is always a string describing the current object. Not so with /events/(event_id)
  2. In contrast to other endpoints, 'data' may vary a great deal depending on the type of event, and in some cases may include objects that are not yet available on Net::Stripe.

On Net::Stripe::Event, I have 'data' defined as: has 'data' => (is => 'ro', isa => 'Maybe[Hashref]');

Thoughts? Ideas?

yahermann avatar Jan 22 '15 02:01 yahermann

If you put your code up in a branch, we'll be able to look closer at the problem.

rustyconover avatar Jan 22 '15 02:01 rustyconover

Ok, just synced my repo to yours, added a new branch with Events: https://github.com/yahermann/stripe-perl/tree/adding_events

yahermann avatar Jan 22 '15 06:01 yahermann

amazing what a good night's sleep can do.

I've added another commit to the branch. It works now, but it's a bit kludgy in that 'data' is not converted to a proper object. this is somewhat by design, given Net::Stripe does not support all possible objects that might come through an Event.... I greatly appreciate any feedback, suggestions, or better yet, actual code :)

yahermann avatar Jan 22 '15 19:01 yahermann