Skip to content

Commit

Permalink
Add frontendDomain field to Sessions collection
Browse files Browse the repository at this point in the history
  • Loading branch information
calebtuttle committed Feb 5, 2024
1 parent dd16c2e commit f121644
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ async function initializeMongoDb() {
// provided by the IDV provider). The possible values of status are:
// 'NEEDS_PAYMENT' | 'IN_PROGRESS' | 'ISSUED' | 'VERIFICATION_FAILED' | 'REFUNDED'
status: String,
// frontendDomain allows mods to change their suggestions based on whether the domain
// is old Holonym or Holonym-within-Silk.
frontendDomain: {
type: String, // "app.holonym.id" | "silksecure.net"
required: false,
},
deletedFromIDVProvider: {
type: Boolean,
required: false,
Expand Down
1 change: 1 addition & 0 deletions src/services/admin/user-sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ async function userSessions(req, res) {
refundTxHash: s.refundTxHash,
check_id: s.check_id,
sessionId: s.sessionId,
frontendDomain: s.frontendDomain,
sid: s._id.toString(),
}));

Expand Down
8 changes: 8 additions & 0 deletions src/services/sessions/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,18 @@ async function postSession(req, res) {
.json({ error: "idvProvider must be one of 'veriff', 'idenfy', 'onfido'" });
}

let domain = null;
if (req.body.domain === "app.holonym.id") {
domain = "app.holonym.id";
} else if (req.body.domain === "silksecure.net") {
domain = "silksecure.net";
}

const session = new Session({
sigDigest: sigDigest,
idvProvider: idvProvider,
status: sessionStatusEnum.NEEDS_PAYMENT,
frontendDomain: domain,
});
await session.save();

Expand Down

0 comments on commit f121644

Please sign in to comment.