This repository has been archived by the owner on Apr 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
15,457 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const user = require('./user.json') | ||
|
||
var API = (function(user) { | ||
const _user = user | ||
|
||
const getUser = code => { | ||
if (code === user.login.code) { | ||
return _user | ||
} | ||
|
||
return null | ||
} | ||
|
||
const getMatches = () => [_user.login.code] | ||
|
||
return { | ||
getUser, | ||
getMatches, | ||
} | ||
})(user) | ||
|
||
module.exports = API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const API = require('./index') | ||
|
||
test('returns expected user with correct login.code', () => { | ||
const user = API.getUser('A5G98S4K1') | ||
expect(user).not.toBe(null) | ||
expect(user.personal.firstName).toBe('Gabrielle') | ||
expect(user.personal.lastName).toBe('Roy') | ||
}) | ||
|
||
test('returns null with a nonexistent login.code', () => { | ||
const user = API.getUser('H3LLY34H') | ||
expect(user).toBe(null) | ||
}) | ||
|
||
test('returns matching login code as an array', () => { | ||
const codes = API.getMatches() | ||
expect(codes).toBeInstanceOf(Array) | ||
expect(codes.length).toBe(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
{ | ||
"login": { | ||
"code": "A5G98S4K1", | ||
"auth": false | ||
}, | ||
"personal": { | ||
"firstName": "Gabrielle", | ||
"lastName": "Roy", | ||
"sin": "847339283", | ||
"dateOfBirth": "1977/09/09", | ||
"address": { | ||
"line1": "303 Blake Blvd.", | ||
"line2": "Unit 202", | ||
"postalCode": "K2R 3Z9", | ||
"city": "Ottawa", | ||
"province": "Ontario" | ||
}, | ||
"maritalStatus": "Single", | ||
"disability": false | ||
}, | ||
"financial": { | ||
"incomeSources": [ | ||
{ | ||
"name": "RT Holdings Inc.", | ||
"total": 7613.16 | ||
}, | ||
{ | ||
"name": "Morden Structural Ltd.", | ||
"total": 13691.94 | ||
} | ||
], | ||
"incomes": { | ||
"totalIncome": { | ||
"name": "Total Income", | ||
"line": 150, | ||
"amount": 21305.10 | ||
}, | ||
"netIncome": { | ||
"name": "Net Income", | ||
"line": 236, | ||
"amount": 19305.10 | ||
}, | ||
"taxableIncome": { | ||
"name": "Taxable Income", | ||
"line": 260, | ||
"amount": 19305.10 | ||
} | ||
}, | ||
"taxes": { | ||
"federal": { | ||
"name": "Net Federal tax", | ||
"amount": 1060.00, | ||
"line": 420 | ||
}, | ||
"provincial": { | ||
"name": "Net Ontario tax", | ||
"amount": 533.00, | ||
"line": 428 | ||
}, | ||
"CPP": { | ||
"name": "CPP", | ||
"amount": 1213.00 | ||
}, | ||
"EI": { | ||
"name": "EI", | ||
"amount": 456.00 | ||
} | ||
}, | ||
"totalTax": 3263.00, | ||
"taxableAmount": "$1,000.00" | ||
}, | ||
"partner": null, | ||
"dependents": [ | ||
{ | ||
"firstName": "Bernadette", | ||
"lastName": "Roy", | ||
"dateOfBirth": "1948/09/25", | ||
"disability": false, | ||
"netIncome": "0", | ||
"relationship": "child" | ||
}, | ||
{ | ||
"firstName": "Clémence", | ||
"lastName": "Roy", | ||
"dateOfBirth": "1949/10/16", | ||
"disability": false, | ||
"netIncome": "0", | ||
"relationship": "child" | ||
} | ||
], | ||
"deductions": { | ||
"disabilityClaim": null, | ||
"disabilityAmount": { | ||
"name": "Disability", | ||
"amount": 0.00 | ||
}, | ||
"rrspClaim": null, | ||
"rrspAmount": { | ||
"name": "RRSP", | ||
"line": 208, | ||
"amount": 0.00 | ||
}, | ||
"basicPersonalAmount": { | ||
"name": "Basic Personal Amount", | ||
"line": 300, | ||
"amount": 11809.00 | ||
}, | ||
"ageAmount": { | ||
"name": "Age Amount", | ||
"amount": 7500.00 | ||
}, | ||
"partnerAgeClaim": null, | ||
"canadaCaregiverClaim": null, | ||
"partnerDisabilityClaim": null, | ||
"partnerPensionIncomeClaim": null, | ||
"pensionIncomeClaim": null, | ||
"pensionIncomeClaimAmount": { | ||
"name": "Pension", | ||
"amount": 700.00 | ||
}, | ||
"childcareClaim": null, | ||
"childcareAmount": { | ||
"name": "Childcare Expenses", | ||
"amount": 0.00 | ||
}, | ||
"singleParentClaim": null, | ||
"dependentDisabilityClaim": null, | ||
"medicalExpenseClaim": null, | ||
"medicalExpenseClaimAmount": { | ||
"name": "Medical Expenses", | ||
"line": 330, | ||
"amount": 0.00 | ||
}, | ||
"amountsFromSpouse": { | ||
"name": "Amounts transfered from spouse", | ||
"amount": 0.00 | ||
}, | ||
"politicalContributionClaim": null, | ||
"politicalFederalAmount": 0, | ||
"politicalProvincialAmount": 0, | ||
"charitableDonationClaim": null, | ||
"charitableDonationAmount": null, | ||
"energyPropertyClaim": null, | ||
"northernEnergyClaim": null, | ||
"seniorHomeownerClaim": null, | ||
"trilliumRentAmount": 0, | ||
"trilliumPropertyTaxAmount": 0, | ||
"trilliumStudentResidence": null, | ||
"trilliumEnergyAmount": 0, | ||
"trilliumLongTermCareAmount": 0, | ||
"climateActionIncentiveIsRural": null | ||
}, | ||
"refund": { | ||
"totalPayable": { | ||
"name": "Total Payable", | ||
"line": 435, | ||
"amount": 1593.00 | ||
}, | ||
"totalDeducted": { | ||
"name": "Total Deducted", | ||
"line": 437, | ||
"amount": 2312.88 | ||
}, | ||
"totalCredits": { | ||
"name": "Total Credits", | ||
"amount": 2500.00 | ||
}, | ||
"totalRefund": { | ||
"name": "Total Refund", | ||
"line": 484, | ||
"amount": 719.88 | ||
} | ||
}, | ||
"benefits": { | ||
"climateActionIncentive": { | ||
"name": "Climate action incentive", | ||
"amount": "154.00" | ||
}, | ||
"gsthstc": { | ||
"name": "GST/HSTC", | ||
"amount": "440.00" | ||
}, | ||
"ontarioTrilliumBenefit": { | ||
"name": "Ontario Trillium Benefit", | ||
"amount": "307.92" | ||
}, | ||
"totalBenefits": { | ||
"name": "totalBenefits", | ||
"amount": "901.92" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// import environment variables. | ||
require('dotenv').config() | ||
const globalError = require('http-errors') | ||
|
||
// import node modules. | ||
const express = require('express'), | ||
cookieParser = require('cookie-parser'), | ||
compression = require('compression'), | ||
helmet = require('helmet'), | ||
morgan = require('morgan'), | ||
winston = require('./config/winston.config'), | ||
sassMiddleware = require('node-sass-middleware'), | ||
path = require('path'), | ||
cookieSession = require('cookie-session'), | ||
cookieSessionConfig = require('./config/cookieSession.config'), | ||
{ SINFilter, hasData, checkPublic, sortByLineNumber, checkLangQuery, currencyFilter } = require('./utils') | ||
|
||
// initialize application. | ||
var app = express() | ||
|
||
// view engine setup | ||
app.set('views', path.join(__dirname, './views')) | ||
app.set('view engine', 'pug') | ||
|
||
// if NODE_ENV does not equal 'test', add a request logger | ||
process.env.NODE_ENV !== 'test' && app.use(morgan('combined', { stream: winston.stream })) | ||
|
||
// general app configuration. | ||
app.use(express.json()) | ||
app.use(express.urlencoded({ extended: false })) | ||
app.use(cookieParser(process.env.app_session_secret)) | ||
app.use(require('./config/i18n.config').init) | ||
|
||
// in production: use redis for sessions | ||
// but this works for now | ||
app.use(cookieSession(cookieSessionConfig)) | ||
|
||
// in production: precompile CSS | ||
app.use( | ||
sassMiddleware({ | ||
src: path.join(__dirname, 'public'), | ||
dest: path.join(__dirname, 'public'), | ||
debug: false, | ||
indentedSyntax: false, // look for .scss files, not .sass files | ||
sourceMap: true, | ||
outputStyle: 'compressed', | ||
}), | ||
) | ||
|
||
// public assets go here (css, js, etc) | ||
app.use(express.static(path.join(__dirname, 'public'))) | ||
|
||
// dnsPrefetchControl controls browser DNS prefetching | ||
// frameguard to prevent clickjacking | ||
// hidePoweredBy to remove the X-Powered-By header | ||
// hsts for HTTP Strict Transport Security | ||
// ieNoOpen sets X-Download-Options for IE8+ | ||
// noSniff to keep clients from sniffing the MIME type | ||
// xssFilter adds some small XSS protections | ||
app.use(helmet()) | ||
// gzip response body compression. | ||
app.use(compression()) | ||
|
||
app.use(checkPublic) | ||
app.use(checkLangQuery) | ||
|
||
// Adding values/functions to app.locals means we can access them in our templates | ||
app.locals.GITHUB_SHA = process.env.GITHUB_SHA || null | ||
app.locals.SINFilter = SINFilter | ||
app.locals.hasData = hasData | ||
app.locals.currencyFilter = currencyFilter | ||
app.locals.sortByLineNumber = sortByLineNumber | ||
|
||
// configure routes | ||
require('./routes/start/start.controller')(app) | ||
require('./routes/login/login.controller')(app) | ||
require('./routes/personal/personal.controller')(app) | ||
require('./routes/deductions/deductions.controller')(app) | ||
require('./routes/dependants/dependants.controller')(app) | ||
require('./routes/partner/partner.controller')(app) | ||
require('./routes/financial/financial.controller')(app) | ||
require('./routes/confirmation/confirmation.controller')(app) | ||
require('./routes/offramp/offramp.controller')(app) | ||
|
||
// clear session | ||
app.get('/clear', (req, res) => { | ||
req.session = null | ||
res.redirect(302, '/') | ||
}) | ||
|
||
app.use(function(req, res, next) { | ||
next(globalError(404)) | ||
}) | ||
|
||
// handle global errors. | ||
app.use(function(err, req, res) { | ||
res.locals.message = err.message | ||
res.locals.error = req.app.get('env') === 'development' ? err : {} | ||
|
||
winston.debug(`Service error: ${err}`) | ||
winston.error( | ||
`${err.status || 500} - ${err.message} - ${req.originalUrl} - ${req.method} - ${req.ip}`, | ||
) | ||
|
||
res.status(err.status || 500).json({ message: 'Internal service error.' }) | ||
}) | ||
|
||
module.exports = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "claim-tax-benefits", | ||
"description": "We believe that preparing returns on behalf of people who are eligible for CVITP will result in more people receiving benefits", | ||
"formation": {}, | ||
"addons": [], | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/nodejs" | ||
} | ||
] | ||
} |
Oops, something went wrong.