public void Test_AddCCI_ValidUrl() { SyncRequest synReq = new SyncRequest(); synReq.CustomerId = "010203040"; synReq.CustomerStatus = "A"; SubscriberSyncRequest ssynReq = new SubscriberSyncRequest(); ssynReq.creditLimit = 200; CustomerCreditRequest ccReq = new CustomerCreditRequest(ssynReq, synReq); String expRes = ccReq.AddCCI(); Assert.AreEqual("0000000",expRes, "Should be able to add Customer Credit "); }
public void Test_AddCCI() { SyncRequest synReq = new SyncRequest(); synReq.CustomerId = "010203040"; synReq.CustomerStatus = "A"; SubscriberSyncRequest ssynReq = new SubscriberSyncRequest(); ssynReq.creditLimit = 200; CustomerCreditRequest ccReq = new CustomerCreditRequest(ssynReq, synReq); /* ccReq.UrlPostFix = ""; String reqBody = "Test Body"; ccReq.RequestBody = reqBody; */ String expRes = ccReq.AddCCI(); Assert.AreEqual("0000000",expRes,"Credit Limit Added correctly"); }
public void Test_AddCCI_Exception() { SyncRequest synReq = new SyncRequest(); synReq.CustomerId = "010203040"; synReq.CustomerStatus = "A"; SubscriberSyncRequest ssynReq = new SubscriberSyncRequest(); ssynReq.creditLimit = 200; CustomerCreditRequest ccReq = new CustomerCreditRequest(ssynReq, synReq); ccReq.UrlPostFix = ""; String reqBody = "Test Body"; ccReq.RequestBody = reqBody; try { String expRes = ccReq.AddCCI(); } catch (Exception e) { Assert.Fail("["+e.Message+"]. All Exceptions should be handeled"); } }
/// <summary> /// Process ICOMS CCI messages. Messages will be translated in required format to invoke CRM 4c Rest Interface. /// </summary> /// <param name="strICOMS_CCI_Msg"></param> /// <param name="templistenerMembers"></param> /// <returns></returns> public string processCCIMessage(string strICOMS_CCI_Msg, ServiceListenerMembers templistenerMembers) { Dictionary<string, string> dictObj4c = new Dictionary<string, string>(); SyncRequest objSyncReq; SubscriberSyncRequest objCusCre; ServiceTranslationManager trsMgr; ServiceBusinessRulesManager busMgr; string retMsg2ICOM = "0000901"; string strResMainFormat = string.Empty; string strErrCode = string.Empty; trsMgr = new ServiceTranslationManager(); try { logger.Info("ServiceRunTimeManager::processCCIMessage() called"); busMgr = new ServiceBusinessRulesManager(); // Create dictionary object with all required tokens(key-value) for CCI dictObj4c = trsMgr.getDataFor4cInterface(strICOMS_CCI_Msg, ServiceConstantsManager.CONST_CCI, templistenerMembers); logger.Info(string.Format("Required tokens are extracted from CCI message... {0}", trsMgr.GetLine(dictObj4c))); // Validation for missing tokens strErrCode = busMgr.checkRequiredTokensPresent(dictObj4c, ServiceConstantsManager.CONST_CCI); if (strErrCode != string.Empty) { logger.Error(string.Format("Please verify all required tokens are present in the CCI message. Required Tokens... \"{0}\"", string.Join(",", ServiceConstantsManager.CONST_CCI))); return strErrCode; } // Validation for token length strErrCode = busMgr.checkRequiredLengthOfTokens(dictObj4c, templistenerMembers); if (strErrCode != string.Empty) { logger.Error(string.Format("Length is not matching for one of tokens present in the CCI message(): {0}", string.Join(",", ServiceConstantsManager.CONST_CCI))); return strErrCode; } // update Customerid(AN=AN+SI) based on flag value in config value dictObj4c = busMgr.AddSiteId2CustId(dictObj4c, templistenerMembers); objCusCre = new SubscriberSyncRequest(); objCusCre.CustomerId = dictObj4c["AN:"]; objCusCre.creditLimit = Convert.ToInt32(dictObj4c["CL:"]); objSyncReq = new SyncRequest(); objSyncReq.CustomerId = dictObj4c["AN:"]; objSyncReq.ICOMSMsgFormat = "CCI"; // Perform Add customer CustomerCreditRequest objCusCreReq = new CustomerCreditRequest(objCusCre, objSyncReq); retMsg2ICOM = objCusCreReq.AddCCI(); // Get success/failure error code to send to ICOMS retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "AddCCI"); logger.Info(string.Format("ServiceRunTimeManager::processCCIMessage() returning value {0}", retMsg2ICOM)); return retMsg2ICOM; } catch (Exception ex) { logger.Error(string.Format("processCIIMessage(): Exception: {0}", ex.Message)); logger.Error("ServiceRunTimeManager::processCCIMessage() returning error"); return retMsg2ICOM; } }
public void Test_updateCCI_ValidUrl() { SyncRequest synReq = new SyncRequest(); synReq.CustomerId = "010203040"; synReq.CustomerStatus = "A"; SubscriberSyncRequest ssynReq = new SubscriberSyncRequest(); ssynReq.creditLimit = 200; CustomerCreditRequest ccReq = new CustomerCreditRequest(ssynReq, synReq); ccReq.UrlPostFix = ""; String reqBody = "Test Body"; ccReq.RequestBody = reqBody; String expRes = ccReq.updateCCI(); Assert.AreEqual("0000000", expRes, "Should be able to update Customer Credit "); }