1function fetchData(gradeId, stuKey, stuMobile, isVisa, stuResultID) { 2 let userHtml; 3 let erorr; 4 userHtml = 5 '<p class="userText"><span>' + i18next.t("yes_button_text") + "</span></p>"; 6 time = displayTime(); 7 $("#chatbox").append(time); 8 $("#chatbox").append(userHtml); 9 $("#yesBtn").remove(); 10 $("#noBtn").remove(); 11 hideTyping(); 12 displayTyping(); 13 14 return fetch( 15 `https://eduserv.cairo.gov.eg/api/results/ChatBot/RequestResult?isArabicLanguage=${true}&MerchantRefNo=${Math.floor( 16 Math.random() * 10000 + 1 17 )}&GradeId=${gradeId}&StudentKey=${stuKey}&MobileNo=${stuMobile}&isVisa=${isVisa}&ResultId=${stuResultID}` 18 ) 19 .then((response) => response.json()) 20 .then((data) => { 21 hideTyping(); 22 23 // Faild Request 24 if (data.Success == false) { 25 let errorMessage; 26 // Handle different error cases 27 if (data.FawryCode == -1 || data.FawryCode == -8) { 28 errorMessage = `<div class="botTextMsgStyle erorrStyle"><img src=${logo}><span>${i18next.t( 29 "seat_number_error" 30 )}<br><br>${data.Message}</span></div>`; 31 printBotResponses(errorMessage); 32 stuRes.studentKey = ""; 33 stage = 1; 34 } else if (data.FawryCode == -4) { 35 errorMessage = `<div class="botTextMsgStyle erorrStyle"><img src=${logo}><span>${i18next.t( 36 "national_id_error" 37 )}<br><br>${data.Message}</span></div>`; 38 printBotResponses(errorMessage); 39 stuRes.studentKey = ""; 40 stage = 1; 41 } else if (data.FawryCode == -6) { 42 errorMessage = `<div class="botTextMsgStyle erorrStyle"><img src=${logo}><span>${i18next.t( 43 "phone_number_error" 44 )}<br><br>${data.Message}</span></div>`; 45 printBotResponses(errorMessage); 46 stuRes.mobileNo = ""; 47 stage = 2; 48 } else { 49 errorMessage = `<div class="botTextMsgStyle erorrStyle"><img src=${logo}><span>${data.Message}</span></div>`; 50 printBotResponses(errorMessage); 51 stage = 4; 52 } 53 } else if (data.FawryCode == -13) { 54 duplicateSeatNum = true; 55 botHtml = `<div class="botTextMsgStyle"><img src=${logo}><span> 56 <label for="govDropdown${stuRes.gradeId}">${i18next.t( 57 "educational_administration" 58 )}</label> 59 <div class="listMainContainer"> 60 <select class="listStyle" id="govDropdown${stuRes.gradeId 61 }"> 62 <option selected disabled value="-1">${i18next.t( 63 "educational_administration_err" 64 )}</option> 65 ${data.Data 66 .map( 67 (option) => `<option value="${option.ResultID}">${option.EducationName}</option>` 68 ) 69 .join("")} 70 </select> 71 <button id="confirmSchoolGovBtn" class='answertBtn' onclick="confirmSchool()">تأÙÙØ¯</button> 72 </div> 73 74 </span></div>`; 75 printBotResponses(botHtml); 76 77 } 78 else if (isVisa == 1) { 79 // Handle Visa payment option 80 let choice = `<div class="gradesBox"> 81 <button id="getResultAfterPaymentBtn" class="choiseNextProcessBtn" onclick="getResult(stuRes.studentKey)">${i18next.t( 82 "receive_result_after_payment" 83 )}</button> 84 <button id="finishBtn" class="choiseNextProcessBtn" onclick="endChat()">${i18next.t( 85 "finish_button" 86 )}</button> <button id="startNwBtn" class="choiseNextProcessBtn" onclick="defaultChatState()">${i18next.t( 87 "new_chat_button" 88 )}</button></div>`; 89 window.open( 90 `https://eduserv.cairo.gov.eg/Results/Fawry?isArabicLanguage=${true}&MerchantRefNo=${data.Message}`, 91 "_blank" 92 ); 93 printBotResponses( 94 `<div class="botTextMsgStyle"><img src=${logo}><span>${i18next.t( 95 "credit_card_payment" 96 )}${choice}</span></div>` 97 ); 98 isVisa = 0; 99 stage = 4; 100 return; 101 } else { 102 // Success request 103 printSuccessProcess( 104 data.FawryCode, 105 stuRes.gradeId, 106 stuRes.studentKey, 107 stuRes.mobileNo 108 ); 109 } 110 });
111} 112 113function getResult(stuKey, resultID = null) { 114 time = displayTime(); 115 hideTyping(); 116 displayTyping(); 117 return fetch( 118 `https://eduserv.cairo.gov.eg/api/results/ChatBot/GetResultByFawryCode?isArabicLanguage=${true}&Code=null&StudentKey=${stuKey}&GradeId=${stuRes.gradeId}&IsFawryCode=${false}&ResultId=${resultID}` 119 ) 120 .then((response) => response.json()) 121 .then((data) => { 122 hideTyping(); 123 //Success Request 124 if (data.Success == true) { 125 if (data.Code == -13) { 126 duplicateSeatNum = true; 127 botHtml = `<div class="botTextMsgStyle"><img src=${logo}><span> 128 <label for="govDropdown${stuRes.gradeId}">${i18next.t( 129 "educational_administration" 130 )}</label> 131 <div class="listMainContainer"> 132 <select class="listStyle" id="govDropdown${stuRes.gradeId 133 }"> 134 <option selected disabled value="-1">${i18next.t( 135 "educational_administration_err" 136 )}</option> 137 ${data.Data 138 .map( 139 (option) => `<option value="${option.ResultID}">${option.EducationName}</option>` 140 ) 141 .join("")} 142 </select> 143 <button id="confirmSchoolGovBtn" class='answertBtn' onclick="confirmGov()">تأÙÙØ¯</button> 144 </div> 145 </span></div>`; 146 printBotResponses(botHtml); 147 148 } 149 else if (data.Code == 1) { 150 //Success request 151 stage = 12; 152 let choise = `<div class="gradesBox"><button id="finishBtn" class="choiseNextProcessBtn" onclick="endChat()">${i18next.t( 153 "finish_button" 154 )}</button> <button id="startNwBtn" class="choiseNextProcessBtn" onclick="defaultChatState()">${i18next.t( 155 "new_chat_button" 156 )}</button></div>`; 157 let botHtml = `<div class="botTextMsgStyle"><img src=${logo}><span>${data.Message} 158 ${choise} 159 </span></div>`; 160 printBotResponses(botHtml); 161 } else if (data.Code == 2) { 162 stage = 11; 163 let botHtml = `<div class="botTextMsgStyle"><img src=${logo}><span>${data.Message}</span></div>`; 164 printBotResponses(botHtml); 165 } 166 } else { 167 console.log("error"); 168 } 169 }); 170}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.