- Starting with the FINAL repo version from section 3:
- Removed checks related functionality
- Removed workers related functionality
- Added
secrets.jsconfig file for storing confidential config items. It is not included in the project's git repo by design. Asecrets.js.templateis provided for setting up the project in new hosting environments. - Added
mailgun.jslibrary that provides ability to send emails via mailgun's REST api. - Added
stripe.jslibrary that provides functions for creating stripe customers and ringing up charges using the stripe REST api. - Replaced phone with email for unique identifier for users.
- Added a cart attribute to users.
- When retrieving a user, include their cart details.
- When creating a new user, capture credit card details and use them to create a stripe customer token for later use.
- Added an API endpoint for users to retrieve a menu.
- Added
confirmationEmail.jslibrary that provides functions for generating order confirmation email bodies. - Added an API endpoint to place an order. This takes the user's cart, generates an order, charges for the order via stripe, and sends an order confirmation email via mailgun.
- Added a user verification check when deleting a token.
Create a new user. Each user must have a unique email address.
Required fields: (in JSON payload) name, email, street address, password, creditCardNumber, exp_mon, exp_year, cvc
Requires Token: No
Retrieve data for an existing user as JSON.
Required fields: (in CGI parameter) email
Requires Token: Yes
Update an existing user.
Required fields: (in JSON payload) email
Optional fields: (in JSON payload) name, address, password (at least one must be specified)
Requires Token: Yes
Delete an existing user.
Required fields: (in CGI parameter) email
Requires Token: Yes
Create a token for a user.
Required fields: (in JSON payload) email, password
Requires Token: No
Create a token for a user.
Required fields: (in JSON payload) email, extend
Requires Token: Yes
Remove a token for a user.
Required fields: (in JSON payload) email
Requires Token: Yes
Get pizza menu. Returns a JSON object containing menu information.
Required fields: (in CGI parameter) email
Requires Token: Yes
Add a menu item to the user's cart.
Required fields: (in JSON payload) email, item, quantity
Requires Token: Yes
Fetch the cart for the user. Returns a JSON object containing cart information.
Required fields: (in CGI parameter) email
Requires Token: Yes
Make an order for the user using their current cart contents and account information on file.
Required fields: (in JSON payload) email
Requires Token: Yes