diff --git a/.env b/.env index 174cb8f..b49a04d 100644 --- a/.env +++ b/.env @@ -1,8 +1 @@ -PORT = 6320 -MONGO_URL = "mongodb://digifi:digifi@10.10.10.48:27017" - -VERIFY_ME_ENDPOINT = "https://vapi.verifyme.ng/v1/verifications/identities/bvn" -VERIFY_ME_PUBLIC_KEY = "pk_live_9f4c2642862cb0190d3b72ca94579b2670fd797a124" -VERIFY_ME_PUBLIC_TEST_SECRET = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE1MjgzNywiZW52IjoidGVzdCIsImlhdCI6MTY1ODgyMzY0OH0.PszalhCuvCv6Y7kK41o3LuJh_R9kIlodbtWSi8HoFnI" -VERIFY_ME_PUBLIC_LIVE_SECRET = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE1MjgzNywiZW52IjoibGl2ZSIsImlhdCI6MTY1ODgyMzY0OH0.jGwa1S6BKr14-QC_0isfVdmhjo_geC1EgyqIh65fhY4" - +PORT = 9088 diff --git a/controller/cardsController.js b/controller/cardsController.js index 24fd746..8907e58 100644 --- a/controller/cardsController.js +++ b/controller/cardsController.js @@ -1,15 +1,38 @@ import User from "../model/cardModel.js"; +// Set your secret key. Remember to switch to your live secret key in production. +// See your keys here: https://dashboard.stripe.com/apikeys +const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); + export const createCard = async (req,res)=>{ try { const userData = new User(req.body); const { email } = userData; - const userExist = await User.findOne({email}); - if (userExist) { - return res.status(400).json({message: "User already exixt"}); - } - const saveUser = await userData.save(); + + const cardholder = await stripe.issuing.cardholders.create({ + name: 'Jenny Rosen', + email: 'jenny.rosen@example.com', + phone_number: '+18008675309', + status: 'active', + type: 'individual', + individual: { + first_name: 'Jenny', + last_name: 'Rosen', + dob: {day: 1, month: 11, year: 1981}, + }, + billing: { + address: { + line1: '123 Main Street', + city: 'San Francisco', + state: 'CA', + postal_code: '94111', + country: 'US', + }, + }, + }); + + res.status(200).json(saveUser); } catch (error) {