1var Affordability = Affordability || {}; 2 3Affordability.Eligible = { 4 5 GetCopayEligibleCriteria: function () { 6 7 var copayEligible = { "801": { "requestcopay": { "Q00100": ["A00101"], "Q00200": ["A00201"], "Q00300": ["A00301"] }, "activatecopay": { "Q00100": ["A00101"], "Q00200": ["A00201"], "Q00300": ["A00301"] }, "activateFTO": { "Q00400": ["A00402"], "Q00100": ["A00101"], "Q00200": ["A00201"], "Q00500": ["A00501", "A00502"] }, "renewcopay": { "Q00100": ["A00101"], "Q00200": ["A00201"], "Q00300": ["A00301"] } } }; 8 return copayEligible; 9 }, 10 11 GetSupport360Criteria: function () { 12 13 var Support360Eligible = { "801": { "requestcopay": { "Q00100": ["A00101"], "Q00200": ["A00201"] }, "activatecopay": { "Q00100": ["A00101"], "Q00200": ["A00201"] }, "activateFTO": { "Q00100": ["A00101"], "Q00200": ["A00201"] }, "renewcopay": { "Q00100": ["A00101"], "Q00200": ["A00201"] } } }; 14 return Support360Eligible; 15 }, 16 17 GetEligibilityCode: function () { 18 var response = {"CopayEligible" :{"CopayEligible" :true,"SupportEligible" : true,"Ineligible" : false},"SupportEligible" :{"CopayEligible" :false,"SupportEligible" : true,"Ineligible" : false},"Ineligible" :{"CopayEligible" :false,"SupportEligible" : false,"Ineligible" : true}}; 19 return response; 20 }, 21 22 CheckEligibility: function (input, siteID, type) { 23 var copayJSON = Affordability.Eligible.GetCopayEligibleCriteria()[siteID][type]; 24 console.log(copayJSON); 25 var supportJSON = Affordability.Eligible.GetSupport360Criteria()[siteID][type];; 26 var responses = ''; 27 var result = ''; 28 responses = Affordability.Eligible.compare(input, copayJSON); 29 if (responses == Object.keys(copayJSON).length) { 30 result = Affordability.Eligible.GetEligibilityCode()['CopayEligible']; 31 console.log('CopayEligible: ' + result); 32 } 33 else { 34 responses = undefined; 35 responses = Affordability.Eligible.compare(input, supportJSON); 36 if (responses == Object.keys(supportJSON).length) { 37 result = Affordability.Eligible.GetEligibilityCode()['SupportEligible']; 38 console.log('SupportEligible:' + result); 39 } 40 else { 41 result = Affordability.Eligible.GetEligibilityCode()['Ineligible']; 42 console.log('inEligible:' + result); 43 } 44 } 45 console.log('Result:' + result); 46 return result; 47 }, 48 49 compare: function (input, eligibleJSON) { 50 var counter = 0; 51 var isValid = false; 52 try{ 53 for (var key in input) { 54 55 for (var j = 0; j < input[key].length; j++) { 56 if (eligibleJSON.hasOwnProperty(key)) { 57 console.log('input ' + input[key][j]); 58 for (var i = 0; i < eligibleJSON[key].length; i++) { 59 console.log('eligibleJSON ' + eligibleJSON[key][i]); 60 if (eligibleJSON[key][i] == input[key][j]) { 61 isValid = true; 62 break; 63 } 64 else { 65 isValid = false; 66 } 67 } 68 } else { 69 isValid = false; 70 break; 71 } 72 } 73 74 75 if (isValid) 76 counter++; 77 } 78 console.log(counter); 79 return counter; 80 } 81 catch(err){ 82 console.log(err); 83 return err.message; 84 }} 85 86}
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.