

# Supportroom
The SupportRooms (SR) web application is designed to bring together patients and therapists to provide a safe platform to find, meet a therapist and a guided consistent way of completing therapy remotely and online. 



# Stripe Configuration
You will need to create a product in your Stripe account and set a webhook, and some enviroment variables in the project.
#### Enviroment Variables

    STRIPE_API_KEY={Key from Live/Dev Stripe Account}
    STRIPE_PRODUCT_ID={Product id here}
    STRIPE_WEBHOOK_SECRET={Webhook Secret here}
#### How to Get Stripe API Key
In your Stripe account under developers, go to API keys section  there you will find `Secret key` that will be used in `STRIPE_API_KEY` env variable. For frontend you will use `Publishable key`
#### How to Add Product in Stripe
In your Stripe account go to products section, and add a product there, copy that newly created product id and put it in your `STRIPE_PRODUCT_ID` env variable. 
*Reason for this step is because the dynamically created plans and subscriptions will be  maintained under this product.*
#### How to Set Stripe webhook
Open your stripe account, under developers page go to webhook settings section and add the following endpoint

    api/payment/stripe-hook
Select following events:

    checkout.session.completed
	customer.discount.created
	customer.subscription.deleted
	invoice.payment_failed
	invoice.payment_succeeded

After adding webhook endpoint, you will get a `Signing secret key`, copy that and put it in `STRIPE_WEBHOOK_SECRET` env variable.

Cron job to therapist commision on daily basis(once in a day)
https://sr.trisec.io/cron/commission

Cron job to assign therapist for wating chatrooms(interval 2mins)
https://sr.trisec.io/cron/new_chatroom_request(remove)

Cron job to send email to therapist chatroom is waiting(interval 15mins)
https://sr.trisec.io/cron/waiting_chatroom_request(remove)

Cron job to send notification to patient to save their mood(once in a day)
https://sr.trisec.io/cron/moodbox_notification

Cron job to send email to patient to complete his questionnaire after 24 hours of signup(once in a day)
https://sr.trisec.io/cron/questionnaire_notification(remove)

Cron job to send notification to therapist to fill their journey(once in a day)
https://sr.trisec.io/cron/journey_notification

Cron job to send notification to company user to check their analytics(once in a week)
https://sr.trisec.io/cron/check_analytics

Cron job to send notification to patient that his subscription will expire in after 7 days(once in a day)
https://sr.trisec.io/cron/subscription_renewal

Cron job to send email to therapist to complete his profile(once in a day)
https://sr.trisec.io/cron/profile_complete_notification

Cron job to send email/sms to therapist to add in schedule for next week(every sunday)
https://sr.trisec.io/cron/availability_notification

Cron job to send email/sms to patient/therapist before 15mins of video call session(every minute)
https://sr.trisec.io/cron/video_call_start

Cron job to send email to patient who has not subscribe after 48hours of registration(every 30mins)
https://sr.trisec.io/cron/subscription_pending_notification

Cron job to send email to patient who has not logged in 5days(once in day)
https://sr.trisec.io/cron/notify_after_five_days

Cron job to send email to patient who has not verified their account(every hour)
https://sr.trisec.io/cron/notify_nverified_user

Cron job to unsubscribe patient(run daily at 59:55)
https://sr.trisec.io/cron/unsubscribe

Cron job to unsubscribe patient(run daily)
https://sr.trisec.io/cron/remove_inactive_patients

Cron job to update expiration time on teams to sync message(run every 5min)
https://sr.trisec.io/cron/update-team-subscription

Cron job to Send Survey Emails for scheduled surveys(run every 1min)
https://sr.trisec.io/cron/send-schedule-survey