Key Information

Register
Submit
The challenge is finished.

Challenge Overview

Cloud Hub is looking to build a sample company that will be reset daily. We want to use our seed/demo.csv file to create a script that we can schedule to delete and rebuild a demo company, charges, and users. We want to expose this logic in a new jobs endpoint (/jobs/{key}/demo). This script should check for an existing company named “Klowd” and email domain klowd.io.

Requirements
1. Create or update existing company.
2. Create company apps records for each matching app in demo.cv. We adding use createCompanyApp method in service.
3. Create charges for each company app. See detailed logic below.
4. Create 1500 random users, 1 static user. You can see similar logic in prokure.js
5. Delete any existing data for Klowd, including users, charges, apps, etc.

Company Apps (mapping)
app_name (need to look up appId, match should be exact)
renewal_date (current date + value in file)
start_date (current date - value in file)
business_unit
license_count
is_sso
spend_estimated
billing_frequency
source (“AP”)

Charges
1. For company_apps where billing_frequency === ‘Annual’, we want to create a single charge matching actual_cost and create that charge.amount, within 30 days of the activation date. The date can be random between start date and (start date + 30).
2. For company_apps where billing_frequency === ‘Monthly’, we want to create a number of charges since the start_date to today. For example if the start_date was 90 days ago, we would divide 90 days by 30 days for each month. This would create 3 charges, each having 1/3 of the actual_cost amount.

Charges (mapping)
company_app_id => from company apps
amount => see logic above
charge_time => see logic above
source_id => random value (12 letters/digits)
source_business_unit => ap_business_unit (demo.cv)
charge_type => “AP"
currency => “USD"

Final Submission Guidelines

1. Any additions or modifications to the code project pass on "npm run lint". Any modifications to the base project needs to pass the tests, npm run test.
2. Provide your code and documentation in a single zip file. Please include a git patch for easier integration of changes.
3. The bulk of your documentation should be in the Readme.md and you should assume that this will be open source so make sure you cover all the steps to set up,  If you have specific information that should not be included in a public readme (like links to your video) put them in a file called submission.txt and they will be omitted from the project if it is open sourced.

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30054837