express = require("express") app = express() bodyParser = require('body-parser') app.use(bodyParser.json()) module.exports = MockRecurlyApi = subscriptions: {} accounts: {} run: () -> app.get '/subscriptions/:id', (req, res, next) => subscription = @subscriptions[req.params.id] if !subscription? res.status(404).end() else res.send """ #{subscription.plan_code} #{subscription.currency} #{subscription.state} #{subscription.tax_in_cents} #{subscription.tax_rate} #{subscription.current_period_ends_at} #{subscription.unit_amount_in_cents} #{subscription.trial_ends_at} """ app.get '/accounts/:id', (req, res, next) => account = @accounts[req.params.id] if !account? res.status(404).end() else res.send """ #{account.hosted_login_token} """ app.listen 6034, (error) -> throw error if error? MockRecurlyApi.run()