/*
Current pricing scheme:
Reject - 4 cents
Approved and Sold - 50 cents
Overflow - 33 cents
Reject Criteria:
leadType is vendor, agentID does not exist
Approved and Sold Criteria:
leadType is vendor, agentID exists, leadPrice is not 0
Overflow Criteria:
leadType is vendor, agentID exists, leadPrice is 0
*/
if (doc['leadType.keyword'].size() > 0)
{
if (doc['leadType.keyword'].value == 'vendor')
{
if (doc['agentID.keyword'].size() <= 0)
if (doc['enhancedProfileResult.keyword'].size() > 0)
{
return 0.04; //Rejected Charge
}
else if(doc['agentID.keyword'].size() > 0)
{
if(doc['leadPrice'].size() > 0)
{
if(doc['leadPrice'].value != 0)
{
return 0.5; //Approved and Sold Charge
}
if(doc['leadPrice'].value == 0)
{
return 0.33; //Overflow Charge
}
}
}
}
}
return 0
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter