Skip to content

Commit 97658cb

Browse files
Merge pull request #808 from ProgramEquity/strawberrie68/issue654
Testing whether user input was in input - letter merge variables created
2 parents 086ec1f + e72adfc commit 97658cb

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

server/routes/api/lob.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,20 @@ router.post('/createAddress', async (req, res) => {
157157
})
158158

159159
router.post('/createLetter', async (req, res) => {
160-
// Get description, to, and template_id, and Stripe session id from request body
161-
162-
const { description, to, from, template_id, sessionId } = req.body || {}
160+
// Get description, to, template_id, and merge_variables (reason_input, community_input, benefit_input,and impact_input)
161+
// and Stripe session id from request body
162+
163+
const {
164+
description,
165+
to,
166+
from,
167+
template_id,
168+
sessionId,
169+
reason_input,
170+
community_input,
171+
benefit_input,
172+
impact_input
173+
} = req.body || {}
163174
const lobApiKey = getLobApiKey()
164175
const lob = new Lob({ apiKey: lobApiKey })
165176
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY)
@@ -205,7 +216,13 @@ router.post('/createLetter', async (req, res) => {
205216
},
206217
from: from,
207218
file: template_id,
208-
color: false
219+
color: false,
220+
merge_variables: {
221+
reason_input: reason_input,
222+
community_input: community_input,
223+
benefit_input: benefit_input,
224+
impact_input: impact_input
225+
}
209226
})
210227

211228
return res

0 commit comments

Comments
 (0)