Skip to content

Commit

Permalink
OnboardingAPI: Add debug email address (#1543)
Browse files Browse the repository at this point in the history
* Add debug email address

* Remove migrations
  • Loading branch information
sophialittlejohn authored Aug 21, 2023
1 parent 392c832 commit 1d1e0ba
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 77 deletions.
5 changes: 3 additions & 2 deletions onboarding-api/src/controllers/emails/signAndSendDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const signAndSendDocumentsInput = object({
poolId: string().required(),
trancheId: string().required(),
transactionInfo: transactionInfoSchema.required(),
debugEmail: string().optional(), // sends email to specified address instead of issuer
})

export const signAndSendDocumentsController = async (
Expand All @@ -28,7 +29,7 @@ export const signAndSendDocumentsController = async (
try {
await validateInput(req.body, signAndSendDocumentsInput)

const { poolId, trancheId, transactionInfo } = req.body
const { poolId, trancheId, transactionInfo, debugEmail } = req.body
const { wallet } = req

const { poolSteps, globalSteps, investorType, name, email, ...user } = await fetchUser(wallet)
Expand Down Expand Up @@ -74,7 +75,7 @@ export const signAndSendDocumentsController = async (
)

if ((investorType === 'entity' && globalSteps.verifyBusiness.completed) || investorType === 'individual') {
await sendDocumentsMessage(wallet, poolId, trancheId, signedAgreementPDF)
await sendDocumentsMessage(wallet, poolId, trancheId, signedAgreementPDF, debugEmail)
}

const updatedUser: Subset<OnboardingUser> = {
Expand Down
68 changes: 0 additions & 68 deletions onboarding-api/src/controllers/migrations/migrateWallets.ts

This file was deleted.

5 changes: 3 additions & 2 deletions onboarding-api/src/emails/sendDocumentsMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const sendDocumentsMessage = async (
wallet: Request['wallet'],
poolId: string,
trancheId: string,
signedAgreement: Uint8Array
signedAgreement: Uint8Array,
debugEmail?: string
) => {
const { metadata, pool } = await new NetworkSwitch(wallet.network).getPoolById(poolId)
const payload: UpdateInvestorStatusPayload = { wallet, poolId, trancheId }
Expand All @@ -36,7 +37,7 @@ export const sendDocumentsMessage = async (
{
to: [
{
email: metadata?.pool?.issuer?.email,
email: debugEmail ?? metadata?.pool?.issuer?.email,
},
],
dynamic_template_data: {
Expand Down
4 changes: 0 additions & 4 deletions onboarding-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { initProxiesController } from './controllers/init/initProxies'
import { confirmOwnersController } from './controllers/kyb/confirmOwners'
import { manualKybCallbackController } from './controllers/kyb/manualKybCallback'
import { verifyBusinessController } from './controllers/kyb/verifyBusiness'
import { migrateWalletsController } from './controllers/migrations/migrateWallets'
import { getGlobalOnboardingStatusController } from './controllers/user/getGlobalOnboardingStatus'
import { getTaxInfoController } from './controllers/user/getTaxInfo'
import { getUserController } from './controllers/user/getUser'
Expand Down Expand Up @@ -74,7 +73,4 @@ onboarding.get('/getTaxInfo', verifyAuth, getTaxInfoController)
// init
onboarding.get('/initProxies', initProxiesController)

// migrations
onboarding.get('/migrateWallets', migrateWalletsController)

exports.onboarding = onboarding
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HttpError } from './httpError'
import { getCentrifuge } from './networks/centrifuge'
import { NetworkSwitch } from './networks/networkSwitch'

interface SignatureInfo extends InferType<typeof signAndSendDocumentsInput> {
interface SignatureInfo extends Omit<InferType<typeof signAndSendDocumentsInput>, 'debugEmail'> {
name: string
wallet: Request['wallet']
email: string
Expand Down

0 comments on commit 1d1e0ba

Please sign in to comment.