Git Product home page Git Product logo

stripe-mock-data's Introduction

Stripe Mock Data Gitter chat

Stripe webhook & resource object data for mocking / testing purposes.

Install

$ npm install stripe-mock-data --save-dev

Features

  • Quick access to entire dataset via .collection
  • Quick select of a specific version using constructor.

Versioning

Resource Object Builders

Webhook Data

Don't see your version? Open an issue, or start a pull request by forking.

Usage

Basic usage:

var StripeMockData = require('stripe-mock-data')
console.log(StripeMockData.collection)

Access Specific Version:

var StripeMockData = require('stripe-mock-data')
var StripeVersion = '2015-10-01'

// Access Version
var StripeData = StripeMockData(StripeVersion)

// View data
console.log(StripeData)

When attempting to access a version that doesn't exist, an error is thrown:

try {
  StripeData = StripeMockData('Invalid')
} catch (e) {
  console.log(e.message, e.stack)
}

Using resource object builders:

console.log(StripeData.resources.account({
  id: 'cus_CUSTOM_ID' // overrides default parameters
}))

Todo

  • Write tests (entry file, resource objects)
  • Clean up older webhook objects of invalid identifiers
  • Core for webhooks / resources, extend off core objects.

License

MIT © Nijiko Yonskai

stripe-mock-data's People

Contributors

golmansax avatar nijikokun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stripe-mock-data's Issues

1.0.4 release

The NPM package was last published a year ago. A release that incorporates this fix would be great:
28c7a0a

Webhooks inside an array

Hi,

Is it normal that all the webhooks fixtures are inside an array?
It could be convenient to directly return js objects.

Currently I use the mocks like this:

var event = stripeMocks.webhooks['invoice.payment_succeeded'][0];

Avoid side effect

The functions to generate data changes the parameter passed to them. Those parameter should not be changed in the assign function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.