leadRevenue - not working

PHOTO EMBED

Sat Oct 23 2021 15:22:26 GMT+0000 (Coordinated Universal Time)

Saved by @Amoro

/*
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
content_copyCOPY