-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add billing module to handle /billing endpoints #398
Conversation
# Conflicts: # src/config/feature-manager/util/FeatureManager.class.ts
export const isUserInSession = (req: Request): boolean => { | ||
return !!req.session?.user | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point we should also save the user ID and the user object into session, so that we can migrate off the user object at our convenience.
# Conflicts: # src/app/controllers/admin-console.server.controller.js # src/loaders/express/index.ts
# Conflicts: # src/app/controllers/admin-console.server.controller.js # src/app/factories/spcp-myinfo.factory.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice! minor nits
endOfMonth.toDate(), | ||
) | ||
|
||
if (loginStatsResult.isErr()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original code has a loginStatsResult.isOk() && !loginStatsResult.value
case as well, is there any chance of that happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, aggregate
always returns an array; but the array can be empty
馃棐 This PR is complete with the exception of integration tests for BillingRouter, see note below in the test section.
Problem
This PR extracts out billing related functions in various controllers and services and reorganises them into the
modules/billing
directory.Related to #144
Solution
Features:
aggregateLoginStats
method toLoginModel
so it can be easily used by servicesBillingService#getSpLoginStats
function to retrieve SingPass login statisticsBillingFactory
to return correct function handler depending on whetherspcp-myinfo
feature is enabled in the Feature ManagerBillingController
controller handler for/billing
route/billing
route with the newBillingRouter
Tests
This will be delayed until #371 is merged in as that contains code for generated an authenticated session (or should I cherry pick the appropriate commits? Scared that will scare ppl off with the commit size again)