Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnboardingAPI: Add debug email address #1543

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading