Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #79 from dcsil/writeup-frank
Browse files Browse the repository at this point in the history
Update instruction for User authentication, Stripe Api call, and plan subscription.
  • Loading branch information
TevanB authored Dec 9, 2022
2 parents 1ff5719 + b7045b3 commit 8984829
Showing 1 changed file with 74 additions and 37 deletions.
111 changes: 74 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,82 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/40ef6e0914ef31702018/maintainability)](https://codeclimate.com/repos/6362eba2a7651b2e18001635/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/40ef6e0914ef31702018/test_coverage)](https://codeclimate.com/repos/6362eba2a7651b2e18001635/test_coverage)

# This is the Main Application for team B2ST in DCSIL
# Wellcome to B2ST!
## Deployment and Production

- Deployed to Heroku automatically once CI is green on master, using github workflow `heroku-deployment.ymml`.

- Production is available with Heroku.

- Client: https://b2st-app.herokuapp.com/

## Running App
- Server: https://b2st-server.herokuapp.com/

### Development
# Demo Instruction

## User Authentication
### Sign up
- Click Register button on the top right.
- Type in your first name, last name, email address and password. make sure all fields are valid and all checkings are passed.
- Click Sign up, you will be redirect to dashboard page. Your email address will be shown on top right corner of the dashboard.
- If you already have an account, click "Already have an account? Sign in" to sign in.
### Log in
- If you already have an account, Log in by type in your email, and the corresponding password.
- If logged in sucessfully you will be redirect to dashboard page. Your email address will be shown on top right corner of the dashboard.
- If you do not have an account, click "Don't have an account? Sign Up" to Sign up.
### Log out
- If you are already signed in, Click on Log out button at the left side, you will be logged out and redirect to main page.

## SMS
1. Pre: Get twilio credential if you want to test with your phone (Note: Twilio restrict trial account to send to unverified phone)
- Go to twilio website and register for a trial twilio account, it should ask you to verify with your phone
- Follow the instruction on twilio dashboard to get a twilio phone number
- click on "messaging/service" on side bar, create a messaging service with your twilio phone number
2. In our repo, in "server/.env", fill up following environment variables:
- TWILIO_ACCOUNT_SID: Account SID in your twilio account
- TWILIO_AUTH_TOKEN: Auth Token in your twilio account
- TWILIO_PHONE_NUMBER: My Twilio phone number in your twilio account info
- TWILIO_MESSAGING_SERVICE: The messaging service sid you just applied with your twilio account
3. After you build and run the app, and logged in:
- Go to Campaign page by clicking the side bar on dashboard
- The first table is the contact table, you should saw a blank one.
- Click on the "+" button to add a new contact linked to your account
- You should saw a dialog pop up, on the dialog, fill up the name and the phone number of the contact
- The phone number of contact is unique with each account and should be a real phone number
- After fill out all the input, Click submit, If everything is good, you should see a green alert popup at left buttom
- Click refresh to see the table updated
- After having some contacts in contact table, you can click on some rows to select
- Then, click on the "sendText" button, you will see a send text dialog pop up.
- Fill out the message, and you can toggle with the "promotion code" button to decide if send the text with a random generated promotion code
- Can also schedule a text in a range of 20 min after and 7 days from now
- Click submit. If all texts send without error, you will see a green alert popup.
- If you have sent some texts, you can click on "refresh" on the below table and should see some rows show up.


## Stripe Authentication:
Note: Users do not need to create a Stripe account to make payment/subscribe. This section is only for developers!
- Create a Stripe account. The Stripe API uses API keys to authenticate requests. You can view and manage your API keys in the Stripe Dashboard.

- Test mode secret keys have the prefix sk_test_ and live mode secret keys have the prefix sk_live_. Use your API key by setting it in the initial configuration of stripe. The Node.js library will then automatically send this key in each request. You can update this API key by replacing /server/.env STRIPE_SEC string.

## Revenue Model.
- After logging in, you will be redirect to dashboard page.
- By putting your mouse on the diagram, you will be able to check revenue for each day.
- You will see a default analysis with brand name “huawei”
- You can click on “add row” button to create a new row.
- The data provided to the machine learning model is currently based on the data we manually uploaded. We will make it dynamic after MVP level.

## Plan Subscription
- You need to login as a valid user to subscribe our plan, If you are not, follow User Authentication section to register as our new user.
- Go to Dashboard, click on Plans button at the left navbar.
- Choose a desired plan. By clicking it, you will be redirect to a Payment page. This page is supported by Stripe.
- Check whether the email and the price is correct. If so, use 4242 4242 4242 4242 as test visa card to pay.
- By clicking Subscribe button, if this payment is success, you will be redirect to main page.
- Go to Dashboard, there will be an updated plan shown up on top right corner of you dashboard.
- You can change your plan at anytime by repeating the same process.


# For developer

1. On macOs, install Docker/Docker Compose. Make sure docker daemon is running. If is LINUX, go to next step.
2. At root folder, run `sh script/bootstrap`. This will install the required dependencies for this app and run `docker-compose up`.
Expand Down Expand Up @@ -52,38 +123,4 @@ We used datasets from Kaggle to train our marketing system which originated at t
- Database
- After setup with bootstrap, run `docker-compose exec -it b2st-app_mongo_1 mongosh` to access the local DB.

## Deployment and Production

- Deployed to Heroku automatically once CI is green on master, using github workflow `heroku-deployment.ymml`.

- Production is available with Heroku.

- Client: https://b2st-app.herokuapp.com/

- Server: https://b2st-server.herokuapp.com/

## Demo Instruction
### SMS
1. Pre: Get twilio credential if you want to test with your phone (Note: Twilio restrict trial account to send to unverified phone)
- Go to twilio website and register for a trial twilio account, it should ask you to verify with your phone
- Follow the instruction on twilio dashboard to get a twilio phone number
- click on "messaging/service" on side bar, create a messaging service with your twilio phone number
2. In our repo, in "server/.env", fill up following environment variables:
- TWILIO_ACCOUNT_SID: Account SID in your twilio account
- TWILIO_AUTH_TOKEN: Auth Token in your twilio account
- TWILIO_PHONE_NUMBER: My Twilio phone number in your twilio account info
- TWILIO_MESSAGING_SERVICE: The messaging service sid you just applied with your twilio account
3. After you build and run the app, and logged in:
- Go to Campaign page by clicking the side bar on dashboard
- The first table is the contact table, you should saw a blank one.
- Click on the "+" button to add a new contact linked to your account
- You should saw a dialog pop up, on the dialog, fill up the name and the phone number of the contact
- The phone number of contact is unique with each account and should be a real phone number
- After fill out all the input, Click submit, If everything is good, you should see a green alert popup at left buttom
- Click refresh to see the table updated
- After having some contacts in contact table, you can click on some rows to select
- Then, click on the "sendText" button, you will see a send text dialog pop up.
- Fill out the message, and you can toggle with the "promotion code" button to decide if send the text with a random generated promotion code
- Can also schedule a text in a range of 20 min after and 7 days from now
- Click submit. If all texts send without error, you will see a green alert popup.
- If you have sent some texts, you can click on "refresh" on the below table and should see some rows show up.

0 comments on commit 8984829

Please sign in to comment.