Skip to content

rabie-sulman/MyTheatre

Repository files navigation

MyTheatre

This is a mock website which integrates with Encore's APIs and runs a user journey from stock availability until creating a booking. The static config will run for the show "Wicked" as follows:

For the purpose of this demo, the mock site uses static data for environment and data inputs in config.js as follows:

// staging environment
const env = {
    inventory: {
        host: 'https://inventory-service.stagingtixuk.io/',
        affiliateId: '',
    },
    eapi: {
        host: 'https://eapi.staging.aws.encoretix.co.uk/api/v1/xtest',
        affiliateId: '',
        affiliatePassword: '',
        agentId: '',
        agentPassword: '',
        env: 'test',
    }
};

const inputs = {
    productId: 1587,
    venueId: 138,
    ticketQuantity: 2,
    periodAvailability: 7 //days
}

module.exports.env = env;
module.exports.inputs = inputs;

The values left as empty '' are the API credentials which Encore will provide. The API hosts are environment-specific.

The inputs are:

  • productId: is the Encore ID for "Wicked"
  • venueId: is the Encore ID for "Apollo Victoria Theatre"
  • ticketQuantity: is the wanted number of tickets (this will affect the availability calls - so they need to be dynamic)
  • periodAvailability: for this demo, I am using a dynamic dates range from the day the demo is run and for a period or days equal to this variable. In this demo, it is set for a week from today.

For creating booking, the API will require customer details, for the purpose of the example, a static json object in customerData.json which will be used rather than using a form to capture the data.

note: once deployed to prod, hosts and credentials will change and the env will have to change from test to live

Technical details

environment info

This demo was developed and run with:

  • node (v13.3.0) and npm (6.13.2)
  • macOS Catalina (10.15.2)

However, this demo should work on any OS with latest node installed. This application do not use environment variables but static config.js to make this simple and easy to test on multiple environments

Application tech stack

This application is built with expressJS (for routing) and Pug, formally known as Jade (template engine for view)

How to run

In order to run this demo, please do the following:

  • Ask Encore to provide API's credentials for both the capability APIs (inventory) and the Entertain API (basket and booking)
  • Copy config.js.dist to config.js and use the above credentials to fill in the empty credentials (see above description in code example)
  • From your terminal, navigate to the code folder and run:
> npm i

this would install the application dependencies. Then start the application:

> npm run dev

the website will run on your localhost port 3000: http://localhost:3000/

Happy path & errors

For the purpose of the demo, this website deals with happy paths and doesn't handle specific errors but catches generic errors and renders a static error template. You would be able to check logs in the terminal which you started the application on.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published