Membership registration & payment API (#4)

* remove newrelic from use in devenv

* add endpoint for membership payments

* fix some wierd spaces

* minor code styling and logging stuff

* replace non-breaking spaces with normal ones

* remove duplicate function

* minor code styling

* add functionality for writing new member to google sheets

* add config example

* update example config, start using config in google credentials

* remove var creds from google sheets auth

* rename config.example to config.template and fix readme

* add async and google-spreadsheet packages

* rename workingWithRows to addRow

* return missing header from readme

* minor code styling

* flatten google config structure, add address fields

* add request validation to membership endpoint

* fix config field names

* more error handling, fix indentation
This commit is contained in:
Cihan Bebek
2017-07-08 22:23:16 +03:00
committed by Riku Rouvila
parent 181a48c0f6
commit f783a27045
8 changed files with 167 additions and 16 deletions

View File

@@ -1,8 +1,8 @@
'use strict';
var validator = require('validator');
var slack = require('../services/slack');
var github = require('../services/github');
var slack = require('../services/slack');
var github = require('../services/github');
module.exports = function (app) {
/*
@@ -10,13 +10,13 @@ module.exports = function (app) {
* Endpoint for sending invitations automatically
*/
app.post('/invites', function(req, res, next) {
app.post('/invites', function(req, res, next) {
if(!validator.isEmail(req.body.email)) {
return res.status(400).send('invalid_email');
}
function success() {
function success() {
res.status(200).end();
}
@@ -34,7 +34,7 @@ module.exports = function (app) {
var message = 'User ' + user.login + ' invited to GitHub organization.'
slack.createMessage(message);
})
.catch(function(err) {
.catch(function(err) {
var message = 'Creating GitHub invitation failed for: ' + req.body.email + ' reason: ' + err;
slack.createMessage(message);
});