Skip to content
Permalink
Browse files

updated to a serverelss module

  • Loading branch information...
eahefnawy committed Dec 12, 2015
1 parent ba1ee74 commit 55a2a4951f3b88c776460707d7dc1b330dbfc5f0
Showing with 117 additions and 141 deletions.
  1. +1 −1 LICENSE.md
  2. +6 −5 README.md
  3. +0 −14 awsm.json
  4. +0 −49 awsm/webhook/awsm.json
  5. +0 −1 awsm/webhook/event.json
  6. +0 −19 awsm/webhook/handler.js
  7. +0 −43 awsm/webhook/index.js
  8. +21 −0 lib/index.js
  9. +11 −9 package.json
  10. +14 −0 s-module.json
  11. +3 −0 webhook/event.json
  12. +22 −0 webhook/handler.js
  13. +39 −0 webhook/s-function.json
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Sitapati
Copyright (c) 2016 Eslam A. Hefnawy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,16 +1,17 @@
# 💳 awsm-stripe-webhook
# 💳 serverless-stripe-webhook

In your JAWS project root directory, run:
In your Serverless project root directory, run:

```
npm install awsm-stripe-webhook
sls module install https://github.com/eahefnawy/awsm-stripe-webhook
```

open `<JAWS project name>/aws_modules/awsm-stripe-webhook/webhook/index.js` and add your callback code. This is the code that will handle the webhook.
open `<serverelss project name>/back/modules/sl-stripe-webhook/lib/index.js` and add your callback code. This is the code that will handle the webhook.

when you're done, deploy with:

```
jaws dash
serverless function deploy
serverless endpoint deploy
```
After deployment, add this webhook URL to Stripe: `<endpoint>/webhooks/stripe`, and test it out!

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,21 @@
/**
* Lib
*/

module.exports.respond = function(event, cb) {
/**
*
*
*
* Write your callback code here. Make sure you validate the request
* by checking the event.id with stripe before processing.
*
*
*
*/
var response = {
message: "Your Serverless function ran successfully!"
};

return cb(null, response);
};
@@ -1,15 +1,17 @@
{
"name": "awsm-stripe-webhook",
"version": "1.3.0",
"description": "AWSM Stripe endpint/Webhook for your JAWS projects.",
"author": "Eslam A. Hefnawy <eahefnawy@gmail.com>",
"name": "sl-stripe-webhook",
"version": "0.0.1",
"description": "Dependencies for a Serverless Module written in Node.js",
"author": "Eslam A. Hefnawy <eslam@serverless.com>",
"license": "MIT",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/eahefnawy/awsm-stripe-webhook"
"url": "git://github.com/eahefnawy/serverless-stripe-webhook"
},
"keywords": ["JAWS", "AWSM", "AWS API endpint", "Stripe", "Webhook"],
"scripts": {
"postinstall" : "jaws postinstall awsm-stripe-webhook npm"
"keywords": ["serverless", "module", "stripe", "webhook"],
"devDependencies": {},
"dependencies": {
"serverless-helpers-js": "~0.0.3"
}
}
}
@@ -0,0 +1,14 @@
{
"name": "sl-stripe-webhook",
"version": "0.0.1",
"profile": "aws-0",
"location": "https://github.com/eahefnawy/serverless-stripe-webhook",
"author": "Eslam A. Hefnawy <eslam@serverless.com>",
"description": "Serverless Module that creates a webhook for Stripe",
"custom": {},
"cloudFormation": {
"lambdaIamPolicyDocumentStatements": [],
"resources": {}
},
"runtime": "nodejs"
}
@@ -0,0 +1,3 @@
{
"webhook": {}
}
@@ -0,0 +1,22 @@
'use strict';

/**
* Serverless Module: Lambda Handler
* - Your lambda functions should be a thin wrapper around your own separate
* modules, to keep your code testable, reusable and AWS independent
* - 'serverless-helpers-js' module is required for Serverless ENV var support. Hopefully, AWS will add ENV support to Lambda soon :)
*/

// Require Serverless ENV vars
var ServerlessHelpers = require('serverless-helpers-js').loadEnv();

// Require Logic
var lib = require('../lib');

// Lambda Handler
module.exports.handler = function(event, context) {

lib.respond(event, function(error, response) {
return context.done(error, response);
});
};
@@ -0,0 +1,39 @@
{
"functions": {
"Sl-stripe-webhookWebhook": {
"custom": {
"excludePatterns": [],
"envVars": []
},
"handler": "modules/sl-stripe-webhook/webhook/handler.handler",
"timeout": 6,
"memorySize": 1024,
"endpoints": {
"sl-stripe-webhook/webhook": {
"method": "POST",
"authorizationType": "none",
"apiKeyRequired": false,
"requestParameters": {},
"requestTemplates": {
"application/json": ""
},
"responses": {
"400": {
"statusCode": "400"
},
"default": {
"statusCode": "200",
"responseParameters": {},
"responseModels": {},
"responseTemplates": {
"application/json": ""
}
}
}
}
},
"pathFunction": "/Users/eslam/serverless-stuff/real-projects/sandbox/back/modules/sl-stripe-webhook/webhook/s-function.json",
"name": "webhook"
}
}
}

0 comments on commit 55a2a49

Please sign in to comment.
You can’t perform that action at this time.