Customer-facing PNA generation
Created by: RujitRaval
Customer-facing PNA automation
This pull request introduces a Django app called 'externalPna' for customer-facing PNA automation.
This app introduces 4 views/endpoints:
- http://0.0.0.0:5410/buildings/12345/epna/verify-user/
- http://0.0.0.0:5410/buildings/12345/epna/verify-token/
- http://0.0.0.0:5410/buildings/12345/epna/submit-building/
- http://0.0.0.0:5410/buildings/12345/epna/submit-answer/
Test: Pull from pna-external from bloclink. Use postman for testing purpose.
PUT http://0.0.0.0:5410/buildings/12345/epna/verify-user/.
-
Body: {"firstName":"RJ", "lastName":"RJ", "phoneNumber":"", "email":"hello@hello.com", "userType":1} Response: {"success": false, "message": "Seems like you are a returning user!"}
-
{"firstName":"RJ", "lastName":"RJ", "phoneNumber":"", "email":"helllo@hello.com", "userType":2} Response: {"success": false, "message": "Email not found!"}
-
Try with totally new values. Should return a token.
PUT http://0.0.0.0:5410/buildings/12345/epna/verify-token/
-
Body: {"token":"PfhcEvUYC9FKnDix"} Response: {"success": false, "message": "No token found in database!"}
-
Body: {"token":"HN29cjIk2Qge9ubG"}: Response:
{ "success": true, "message": { "user": { "firstName": "RJ", "lastName": "RJ", "email": "hello@hello.com", "phoneNumber": "" }, "questions": { "2": "How is heat distributed in the building?", "1": "What type of fuel do you use to heat your building?", "4": "How soon do you plan to replace your heating system?", "3": "How old is your heating system?", "6": "Building Type", "5": "Who pays the following utility bills? (Heat and Hot Water)", "8": "Who pays the following utility bills? (Electricity in Unit)", "7": "In winter, which of the following tenant comfort issues apply?" }, "answers": { "1": "Yes", "2": "No", "3": "Fuel Oil", "4": "Natural Gas", "5": "Electric Resistance", "6": "Dual Fuel", "7": "Other/I do not know", "8": "Steam", "9": "Hot Water/Hydronic", "10": "Electric Baseboard", "11": "Forced Air/Vents", "12": "I am not sure", "13": "New (0-3 Years)", "14": "Pretty New (4-10 Years)", "15": "Pretty Old (11-20 Years)", "16": "Old (21+ Years)", "17": "As soon as possible", "18": "In less than a year", "19": "In a year or two", "20": "Single Family Building", "21": "Multi Family Building", "22": "Commercial Building", "23": "Co-op Building", "24": "Tenant", "25": "Landlord", "26": "They complain it is too hot", "27": "They keep the windows open", "28": "The complain it is too cold", "29": "They use space heaters", "30": "They say their apartment is DRAFT", "31": "They do not complain at all" }, "buildings": {} } }
PUT http://0.0.0.0:5410/buildings/12345/epna/submit-building/
-
Body: {"buildingId":12345, "address": "98 Grove st.", "token": "HN29cjIk2Qge9ubG"} Response: {"success": true, "message": {"user_building_id": 15}}
-
Body: {"buildingId":12345, "address": "98 Grove st.", "token": "HN29cjek2Qge9ubG"} Response: {"success": false, "message": "Token does not exists!"}
PUT http://0.0.0.0:5410/buildings/12345/epna/submit-answer/
-
Body: {"questionId": 3, "answerId": 9, "userId": 15} Response: {"success": true, "message": "Saved"}
-
Body: {"questionId": N, "answerId": N, "userId": 15} [Try to change question and answer ID.] Response: {"success": true, "message": "Updated"}