njosefbeck/gatsby-source-stripe

Expand all the objects and sub-objects, oh my!

Opened this issue · 3 comments

The Stripe API allows for the auto-expansion of objects returned. To handle auto-expansion, I've added a methodArgs key to each Stripe Object in stripeObjects.json. Inside that methodArgs key, an expand array is defined (example here).

Ultimately this looks like:

"methodArgs": {
  "expand": [
    "data.source.destination",
    "data.source.customer",
    "data.source.invoice"
  ]
}

Where I need help, is that there are MANY more expansion possibilities across the Stripe objects that this plugin supports. I need help looking through the Stripe API documentation for "expandable" fields, and also subsequent "expandable" sub-fields.

Additionally, someone would need to test to ensure that these expandable fields actually work, by running the plugin in a Gatsby project. If the field isn't expandable, and you've specified that it is, stripe-node will error out. We want to avoid fields that error out!

Feel free to:

  1. Fork the project
  2. Update stripeObjects.json with additional expandable fields
  3. Test in a local Gatsby project that those additions actually work
  4. Submit a pull request so I can test

Any and all help would be awesome. ❤️

If we could 'pair' for a while and get a repo running on my machine, I'd be happy to poke through the Stripe API documentation and contribute time/effort to this.

Example: in the readme you said:

To set up the project locally, follow these steps.

1. Make sure you're on at least Node v.10.
2. Fork the repo and pull it down locally. For ease of testing, we recommend pulling it into an existing Gatsby project, in a plugins directory.
3. Run npm run build in the console, to transpile the code for testing and running in your project.
4. Add the plugin, with options, to gatsby-config.js.
5. Hack away!

I'm embarrassed to say this, but I don't know how to do step 2 (into a plugins directory). If you help me with that... I'll do step 5 for days and days.

@DavidSabine Thanks so much for reaching out! If you'd like to e-mail me at njosefbeck@gmail.com we can figure out a time to pair and get you set up. Thanks for your interest and enthusiasm for this project :D.