Skip to content

Commit

Permalink
Add investor option to purchase
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcrammer committed Jun 19, 2024
1 parent 83350d9 commit e849bc2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/routes/purchase.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,19 @@ import checkProrated from "../utils/checkProrated"
const router = express.Router()

router.post("/", authMiddleware("payments_create", { allowSelf: true }), async (req, res) => {
const { product_id, email, phone, card_token, exp_month, exp_year, cardholder_name, api_token, whitelabel, slug } =
req.body
const {
product_id,
email,
phone,
card_token,
exp_month,
exp_year,
cardholder_name,
api_token,
whitelabel,
slug,
isInvestor,
} = req.body

try {
if (!product_id) throw new CodedError("product_id is required", "PUR01")
Expand Down Expand Up @@ -95,6 +106,7 @@ router.post("/", authMiddleware("payments_create", { allowSelf: true }), async (
active: 0,
name: cardholder_name,
whitelabel_id: whitelabelID,
role: isInvestor ? "INVESTOR" : "AGENT",
slug,
})
const newUserRequest = await fetch(process.env.API_URL + "/users", {
Expand Down

0 comments on commit e849bc2

Please sign in to comment.