//Postback for Precision Samples public IHttpActionResult PostbackPrecisionSample([FromUri] string ug, string sub_id, decimal gross, decimal reward, string status, DateTime date, int surveyid) { //http://devmapi.cashbackresearch.com/api/surveys/postback/2?ug=F1CA2526-4995-47A1-89BE-474A223505D9&sub_id=eeeeeeeeeeee&reward=1.2&status=S&date=1-1-2017&title=&surveyid=12345&gross=2.4 try { var p = new PostbackManager(); p.PostbackPrecisionSample(ug, sub_id, reward, status, date, surveyid, gross); return(Ok()); } catch (Exception e) { var msg = e; return(InternalServerError()); } }
//Postback for your surveys public IHttpActionResult PostbackYourSurveys([FromUri] string ssi2, string ssi3, string ip, string transactionId, string signature_md5, string supplier_sub_id) { //http://devmapi.cashbackresearch.com/api/surveys/postback/1?ssi2=c5b6b137-2cf8-4ac7-99ce-44f4609d7002&ssi3=33476&ssi3=bbb&ip=68.225.172.87&transactionId=ccccc&signature_md5=ddddddddddd var p = new PostbackManager(); //the md5 hash is OurTransactionId:transactionidYS:secretkey //params are supplier_sub_id:transaction_id(YS):secret_key. // we return the following to YourSurveys: //surveyURL = $"{surveyURL}&supplier_sub_id={transationID}&supplier_sub_id2={routerContactId}"; // add key = "YourSurveysSecretKey" value = "0f75db394bd25ea21977e147a527be5e" if (ConfigurationManager.AppSettings["CheckYourSurveysHash"] == "true") { //test 6AB71E5A-FF7B-4BB8-B93D-9D956F7BD67B:ccccc:0f75db394bd25ea21977e147a527be5e //test hashed = 4fc4941aed12393d5844529353768d22 //test2 :ccccc:0f75db394bd25ea21977e147a527be5e //test2 hashed = f34692a4e347aabbabc6720c9773cfb6 //test2 url http://devmapi.cashbackresearch.com/api/surveys/postback/1?ssi2=c5b6b137-2cf8-4ac7-99ce-44f4609d7002&ssi3=33476&ip=68.225.172.87&transactionId=ccccc&signature_md5=f34692a4e347aabbabc6720c9773cfb6 //http://mapi.cashbackresearch.com/api/surveys/postback/1?ssi2=c5b6b137-2cf8-4ac7-99ce-44f4609d7002&ssi3=33476&ip=68.225.172.87&transactionId=ccccc&signature_md5=f34692a4e347aabbabc6720c9773cfb6 //if (!p.VerifyYourSurveysHash(supplier_sub_id,transactionId, signature_md5 )) if (!p.VerifyYourSurveysHash(supplier_sub_id, transactionId, signature_md5)) { return(BadRequest()); } ; } try { p.PostbackYourSurveys(ssi2, ssi3, ip, transactionId, signature_md5); return(Ok()); } catch (Exception e) { var msg = e; return(InternalServerError()); } }
public void MessageProcess(Event item, ReceievedMessage receivedMessage) { try { switch (item.type) { case "postback": PostbackManager postbackManager = new PostbackManager(); postbackManager.Process(item, receivedMessage, ChannelAccessToken); break; case "join": break; case "message": MessageManager messageManager = new MessageManager(); messageManager.Process(item, receivedMessage, ChannelAccessToken, bot); break; case "follow": FollowManager followManager = new FollowManager(); followManager.process(item, receivedMessage, ChannelAccessToken, bot); break; default: break; } } catch (Exception ex) { } }
//Redirect for Precision Samples public IHttpActionResult RedirectPrecisionSample([FromUri] string ug, string sub_id, decimal gross, decimal reward, string status, DateTime date, int surveyid) { try { //test url //http://devmapi.cashbackresearch.com/api/surveys/postback/2?ug=F1CA2526-4995-47A1-89BE-474A223505D9 var m = new RouterManager(); var p = new PostbackManager(); p.PostbackPrecisionSample(ug, sub_id, reward, status, date, surveyid, gross); var uniqueId = m.GetRouterUserFromPrecisionSampleId(ug); var url = $"{ConfigurationManager.AppSettings["BaseWebUrl"]}mysurveys?ug={uniqueId}"; return(Redirect(url)); } catch (Exception e) { var msg = e; return(InternalServerError()); } }