/// <summary>
        ///  Add equipment information to customer
        /// </summary>
        /// <returns></returns>
        public string AddEQI()
        {
            string strRetErrCode2ICOM = "0000901";
            try
            {
                logger.Info("CRMCustomerEquipmentRequest::AddEQI() called");
                SyncRequest objSyncReq = new SyncRequest();
                objSyncReq.CustomerId = CustomerId;
                objSyncReq.CustomerStatus = CustomerStatus;
                objSyncReq.ICOMSMsgFormat = "EQI";

                CustomerInformationRequest objCusReq = new CustomerInformationRequest(objSyncReq, objSyncReq);
                objCusReq.DeviceId = CustomerMACAddress;

                // Perform Add Customer
                strRetErrCode2ICOM = objCusReq.AddCustomer(false);
                if (strRetErrCode2ICOM != "0000000")
                {
                    logger.Error("CRMCustomerEquipmentRequest::AddCustomer(): failed");
                    logger.Error("CRMCustomerEquipmentRequest::AddEQI() returning false");
                    return strRetErrCode2ICOM;
                }

                // Perform Add Device
                strRetErrCode2ICOM = objCusReq.AddCrmDevice();
                if (strRetErrCode2ICOM != "0000000")
                {
                    logger.Error("CRMCustomerEquipmentRequest::AddCrmDevice(): failed");
                    logger.Error("CRMCustomerEquipmentRequest::AddEQI() returning false");
                    return strRetErrCode2ICOM;
                }

                // Perform Add Device to Customer
                strRetErrCode2ICOM = objCusReq.AssignDevice();
                if (strRetErrCode2ICOM != "0000000")
                {
                    logger.Error("CRMCustomerEquipmentRequest::AssignDevice(): failed");
                    logger.Error("CRMCustomerEquipmentRequest::AddEQI() returning false");
                    return strRetErrCode2ICOM;
                }

                // Perform add/delete products for Customer
                strRetErrCode2ICOM = EntitlementReplaced();
                if (strRetErrCode2ICOM != "0000000")
                {
                    logger.Error("CRMCustomerEquipmentRequest::EntitlementReplaced() failed");
                    logger.Error("CRMCustomerEquipmentRequest::AddEQI() returning false");
                    return strRetErrCode2ICOM;
                }

                logger.Info("CRMCustomerEquipmentRequest::AddEQI() returning true");
                return strRetErrCode2ICOM;
            }
            catch (Exception ee)
            {
                logger.Error(string.Format("AddEQI(): Exception: {0}", ee.Message));
                logger.Error("CRMCustomerEquipmentRequest::AddEQI() returning false");
                return strRetErrCode2ICOM;
            }
        }
 public CustomerEquipmentRequest(EquipmentSyncRequest obj, SyncRequest sr)
     : base(sr)
 {
     this.CustomerId = obj.CustomerId;
     this.CustomerStatus = sr.CustomerStatus;
     this.CustomerMACAddress = obj.macAddress;
     this.CustomerSMARTCardId = obj.smartCardId;
     this.OfferingIdList = obj.offeringId;
 }
 public void Test_AddCustomer()
 {
     SyncRequest synReq = new SyncRequest();
     synReq.CustomerId = "010203040";
     synReq.CustomerStatus = "A";
     CustomerInformationRequest ciReq = new CustomerInformationRequest("010203040", synReq);
     String expRes = ciReq.AddCustomer();
     Assert.AreEqual("0000000", expRes, "Customer Added successfully");
 }
Esempio n. 4
0
        public void Test_SendRequest()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203040";
            synReq.CustomerStatus = "A";
            CRM4cInterfaceAccessManager crmReq = new CRM4cInterfaceAccessManager(synReq);
            crmReq.UrlPostFix = "";
            String reqBody = "Test Body";
            HttpStatusCode httpCode = HttpStatusCode.OK;
            bool expRes = crmReq.SendRequest(ref reqBody, ref httpCode);

            Assert.IsFalse(expRes,"Should not able to send Request as URL is not correct");
        }
        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 ");
        }
Esempio n. 6
0
        public void Test_SendRequest_ValidUrl()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203040";
            synReq.CustomerStatus = "A";
            CRM4cInterfaceAccessManager crmReq = new CRM4cInterfaceAccessManager(synReq);
            crmReq.UrlPostFix = String.Format("/Customers/{0}", "010203040");
            crmReq.RequestBody = String.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?> <Customer id=\"{0}\" xmlns=\"urn:eventis:crm:2.0\"><IsBarred xmlns=\"urn:eventis:crm:2.0\">{1}</IsBarred></Customer>", "010203040", "false");
            crmReq.Method = "PUT";
            HttpStatusCode httpCode = HttpStatusCode.NotImplemented;
            string ResponseBody = "";
            bool expRes = crmReq.SendRequest(ref ResponseBody, ref httpCode);

            Assert.IsTrue(expRes, "Should be able to send Request to URL");
        }
        public void Test_AddCustomer_ValidUrl()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203040";
            synReq.CustomerStatus = "A";

            CustomerInformationRequest ciReq = new CustomerInformationRequest("010203040", synReq);
            ciReq.UrlPostFix = "";
            String reqBody = "Test Body";

            ciReq.RequestBody = reqBody;
            String expRes = ciReq.AddCustomer();

            Assert.AreEqual("0000000", expRes, "Should able to add customer info as URL is correct");
        }
 public void Test_AddEQI()
 {
     SyncRequest synReq = new SyncRequest();
     synReq.CustomerId = "010203040";
     synReq.CustomerStatus = "A";
     EquipmentSyncRequest esynReq = new EquipmentSyncRequest();
     esynReq.CustomerId = "010203040";
     esynReq.macAddress = "00:00:40:C4:2A:1E";
     esynReq.offeringId = new List<string>("0001234/0001236/0001237".Split('/'));
     esynReq.smartCardId = "";
     CustomerEquipmentRequest ceReq = new CustomerEquipmentRequest(esynReq, synReq);
     ServiceRunTimeManager srvRunMgr = new ServiceRunTimeManager();
     String expRes = srvRunMgr.transalteResCode2ICOM4m4C(ceReq.AddEQI(), "AddEQI");
     Assert.AreEqual("0000901", expRes, "Should not able to add customer Equipment as Device Id is passes as incorrect format");
 }
        public void Test_DeleteEQI()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203040";
            synReq.CustomerStatus = "A";
            EquipmentSyncRequest esynReq = new EquipmentSyncRequest();
            esynReq.CustomerId = "010203040";
            esynReq.macAddress = "00002986685810000000000000000987123";
            esynReq.offeringId = new List<string>("0001234/0001236/0001237".Split('/'));
            esynReq.smartCardId = "";
            CustomerEquipmentRequest ceReq = new CustomerEquipmentRequest(esynReq, synReq);
            ServiceRunTimeManager srvRunMgr = new ServiceRunTimeManager();
            String expRes = srvRunMgr.transalteResCode2ICOM4m4C(ceReq.DeleteEQI(), "DeleteEQI");

            Assert.AreEqual("0000301", expRes, "Should not be able to delete customer Equipment as device id is passed as incorrect value");
        }
        public void Test_AddEQI_ValidUrl()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203551";
            synReq.CustomerStatus = "A";
            EquipmentSyncRequest esynReq = new EquipmentSyncRequest();
            esynReq.CustomerId = "010203551";
            esynReq.macAddress = "00002986685810000000000000000551";
            esynReq.offeringId = new List<string>("0001234/0001236/0001237".Split('/'));
            esynReq.smartCardId = "";
            CustomerEquipmentRequest ceReq = new CustomerEquipmentRequest(esynReq, synReq);
            ServiceRunTimeManager srvRunMgr = new ServiceRunTimeManager();
            String expRes = srvRunMgr.transalteResCode2ICOM4m4C(ceReq.AddEQI(), "AddEQI");

            Assert.AreEqual("0000000", expRes, "Should be able to add Customer Equipment ");
        }
        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 CustomerInformationRequest(SyncRequest obj , SyncRequest sr)
            : base(sr)
        {
            this.CustomerId = obj.CustomerId;
            this.CustomerStatus = obj.CustomerStatus;

            switch (obj.CustomerStatus)
            {
                case "A":
                    this.isBarredFlag = false;
                    break;
                case "I":
                    this.isBarredFlag = true;
                    break;

            }
        }
        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");
            }
        }
        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 ");
        }
Esempio n. 15
0
        /// <summary>
        ///  Update Product(s) information to customer
        /// </summary>
        /// <returns></returns>
        public string EntitlementReplaced()
        {
            bool PackageFailed = false;
            string strRetErrCode2ICOM = "0000901";

            try
            {
                logger.Info("CRMCustomerEquipmentRequest::EntitlementReplaced() called");
                SyncRequest objSyncReq = new SyncRequest();
                objSyncReq.CustomerId = CustomerId;
                objSyncReq.CustomerStatus = CustomerStatus;
                objSyncReq.ICOMSMsgFormat = "EQI";

                CustomerInformationRequest objCusReq = new CustomerInformationRequest(CustomerId, objSyncReq);

                // 1. Remove all subscription products from a customer
                strRetErrCode2ICOM = objCusReq.RemoveAllSubscriptions();
                if (strRetErrCode2ICOM != "0000000")
                {
                    logger.Error("EntitlementReplaced(): RemoveAllSubscriptions() failed, returning false");
                    return strRetErrCode2ICOM;
                }
                ResponseStatus = objCusReq.ResponseStatus;
                // 2. Assign a subscription product to a customer (send this multiple times depending on number of offerings)
                foreach (string OfferId in OfferingIdList)
                {
                    objCusReq.ProductId = OfferId;

                    strRetErrCode2ICOM = objCusReq.AssignSubscription();
                    if (strRetErrCode2ICOM != "0000000")
                    {
                        PackageFailed = true;
                        logger.Error(string.Format("EntitlementReplaced(): AssignSubscription() failed: OfferId = {0}", OfferId));
                    }
                }
                ResponseStatus = objCusReq.ResponseStatus;
                if (PackageFailed == true)
                {
                    logger.Error("EntitlementReplaced(): Some or all of the entitlements were not synchronized to CRM");
                    return strRetErrCode2ICOM;
                }
                logger.Info("CRMCustomerEquipmentRequest::EntitlementReplaced() successful");
                return "0000000";
            }
            catch (Exception ee)
            {
                logger.Error(string.Format("EntitlementReplaced(): Exception: {0}", ee.Message));
                logger.Error("CRMCustomerEquipmentRequest::EntitlementReplaced() returning false");
                return strRetErrCode2ICOM;
            }
        }
Esempio n. 16
0
        public string DeleteEQI()
        {
            string strRetErrCode2ICOM = "0000901";
            try
            {
                logger.Info("CRMCustomerEquipmentRequest::DeleteEQI() called");
                SyncRequest objSyncReq = new SyncRequest();
                objSyncReq.CustomerId = CustomerId;
                objSyncReq.CustomerStatus = CustomerStatus;
                objSyncReq.ICOMSMsgFormat = "EQI";

                CustomerInformationRequest objCusReq = new CustomerInformationRequest(objSyncReq, objSyncReq);
                objCusReq.DeviceId = CustomerMACAddress;

                // Perform Deleting device from Customer
                strRetErrCode2ICOM = objCusReq.RemoveDevice();
                if (strRetErrCode2ICOM != "0000000")
                {
                    logger.Error("CRMCustomerEquipmentRequest::RemoveDevice() failed");
                    logger.Error("CRMCustomerEquipmentRequest::DeleteEQI() returning false");
                    return strRetErrCode2ICOM;
                }

                // Perform Deleting device
                strRetErrCode2ICOM = objCusReq.DeleteCrmDevice();
                if (strRetErrCode2ICOM != "0000000")
                {
                    logger.Error("CRMCustomerEquipmentRequest::DeleteCrmDevice() failed");
                    logger.Error("CRMCustomerEquipmentRequest::DeleteEQI() returning false");
                    return strRetErrCode2ICOM;
                }
                return strRetErrCode2ICOM;

            }
            catch (Exception ee)
            {
                logger.Error(string.Format("DeleteEQI(): Exception: {0}", ee.Message));
                logger.Error("CustomerEquipmentRequest::DeleteEQI() returning false");
                return strRetErrCode2ICOM;
            } // end try catch
        }
 public CRM4cInterfaceAccessManager(SyncRequest sr)
 {
     //CrmBaseUrl = CrmBridgeConfig.CrmUrl;
     syncRequest = sr;
 }
        public void Test_UpdateEQI()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203040";
            synReq.CustomerStatus = "A";
            EquipmentSyncRequest esynReq = new EquipmentSyncRequest();
            esynReq.CustomerId = "010203040";
            esynReq.macAddress = "00002986685810000000000000000001";
            esynReq.offeringId = new List<string>("0005432".Split('/'));
            esynReq.smartCardId = "";
            CustomerEquipmentRequest ceReq = new CustomerEquipmentRequest(esynReq, synReq);
            ServiceRunTimeManager srvRunMgr = new ServiceRunTimeManager();
            String expRes = srvRunMgr.transalteResCode2ICOM4m4C(ceReq.UpdateEQI(), "UpdateEQI");

            Assert.AreEqual("0000901", expRes, "Should not able to update customer Equipment as product id is not in correct format");
        }
Esempio n. 19
0
        /// <summary>
        /// Process ICOMS EQI messages. Messages will be translated in required format to invoke CRM 4c Rest Interface.
        /// </summary>
        /// <param name="strICOMS_EQI_Msg"></param>
        /// <param name="templistenerMembers"></param>
        /// <returns></returns>
        public string processEQIMessage(string strICOMS_EQI_Msg, ServiceListenerMembers templistenerMembers)
        {
            Dictionary<string, string> dictObj4c = new Dictionary<string, string>();
             SyncRequest objSyncReq;
             EquipmentSyncRequest objCusEqi;
             ServiceTranslationManager trsMgr;
             ServiceBusinessRulesManager busMgr;
             string retMsg2ICOM = "0000901";
             string strResMainFormat = string.Empty;
             string strErrCode = string.Empty;
             trsMgr = new ServiceTranslationManager();

             try
             {
             logger.Info("ServiceRunTimeManager::processEQIMessage() called");
             busMgr = new ServiceBusinessRulesManager();

             // Create dictionary object with all required tokens(key-value) for EQI
             dictObj4c = trsMgr.getDataFor4cInterface(strICOMS_EQI_Msg, ServiceConstantsManager.CONST_EQI, templistenerMembers);
             logger.Info(string.Format("Required tokens are extracted from EQI message...  {0}", trsMgr.GetLine(dictObj4c)));

             // Validation for missing tokens
             strErrCode = busMgr.checkRequiredTokensPresent(dictObj4c, ServiceConstantsManager.CONST_EQI);
             if (strErrCode != string.Empty)
             {
                 logger.Error(string.Format("Please verify all required tokens are present in the EQI message. Required Tokens... \"{0}\"", string.Join(",", ServiceConstantsManager.CONST_EQI)));
                 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 EQI message(): {0}", string.Join(",", ServiceConstantsManager.CONST_EQI)));
                 return strErrCode;
             }

             // update Customerid(AN=AN+SI) based on flag value in config value
             dictObj4c = busMgr.AddSiteId2CustId(dictObj4c, templistenerMembers);

             // Get Native format device id from ICOMS "EA" token based config value of "DeviceIdFormat" & "NativeFormat4cFlag"
             dictObj4c = busMgr.getNativeFormat4cAddress(dictObj4c, templistenerMembers);

             objCusEqi = new EquipmentSyncRequest();
             objCusEqi.CustomerId = dictObj4c["AN:"];
             objCusEqi.macAddress = dictObj4c["EA:"];
             // Create new list for product Ids
             objCusEqi.offeringId = busMgr.getProductIdList(dictObj4c);
             objSyncReq = new SyncRequest();
             objSyncReq.CustomerId = dictObj4c["AN:"];
             objSyncReq.CustomerStatus = string.Empty;
             objSyncReq.ICOMSMsgFormat = "EQI";

             CustomerEquipmentRequest objCusEQIReq = new CustomerEquipmentRequest(objCusEqi, objSyncReq);

             switch (dictObj4c["AC:"])
             {
                 // Add EQI
                 case "A":
                     logger.Info("ADD EQI action called");
                     retMsg2ICOM = objCusEQIReq.AddEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "AddEQI");
                     break;
                 // Update EQI
                 case "U":
                     logger.Info("Update EQI action called");
                     retMsg2ICOM = objCusEQIReq.UpdateEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "UpdateEQI");
                     break;
                 // Delete EQI
                 case "R":
                     logger.Info("Delete EQI action called");
                     retMsg2ICOM = objCusEQIReq.DeleteEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "DeleteEQI");
                     break;
                 default:
                     logger.Warn(string.Format("Invalid token value received from EQI message for AC operation : {0}", dictObj4c["AC:"]));
                     break;
             }
             logger.Info(string.Format("ServiceRunTimeManager::processEQIMessage() returning value {0}", retMsg2ICOM));
             return retMsg2ICOM;
             }
             catch (Exception ex)
             {
             logger.Error(string.Format("processEQIMessage(): Exception: {0}", ex.Message));
             logger.Error("ServiceRunTimeManager::processEQIMessage() returning error");
             return retMsg2ICOM;
             }
        }
Esempio n. 20
0
        /// <summary>
        /// Process ICOMS CUI messages. Messages will be translated in required format to invoke CRM 4c Rest Interface.
        /// </summary>
        /// <param name="strICOMS_CUI_Msg"></param>
        /// <param name="templistenerMembers"></param>
        /// <returns></returns>
        public string processCUIMessage(string strICOMS_CUI_Msg, ServiceListenerMembers templistenerMembers)
        {
            Dictionary<string, string> dictObj4c = new Dictionary<string, string>();
             SyncRequest objSyncReq;
             ServiceTranslationManager trsMgr;
             ServiceBusinessRulesManager busMgr;
             string retMsg2ICOM = "0000901";
             string strResMainFormat=string.Empty;
             string strErrCode = string.Empty;
             trsMgr = new ServiceTranslationManager();
             string[] arrConfigSiteIdName=new string[2];

             try
             {

               logger.Info("ServiceRunTimeManager::processCUIMessage() called");

               busMgr = new ServiceBusinessRulesManager();

               // Create dictionary object with all required tokens(key-value) for CUI
               dictObj4c = trsMgr.getDataFor4cInterface(strICOMS_CUI_Msg, ServiceConstantsManager.CONST_CUI, templistenerMembers);

               logger.Info(string.Format("Required tokens are extracted from CUI message...  {0}", trsMgr.GetLine(dictObj4c)));

               // Validation for missing tokens
               strErrCode = busMgr.checkRequiredTokensPresent(dictObj4c, ServiceConstantsManager.CONST_CUI);
               if (strErrCode != string.Empty)
               {
               logger.Error(string.Format("Please verify all required tokens are present in the CUI message. Required Tokens... \"{0}\"", string.Join(",", ServiceConstantsManager.CONST_CUI)));
               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 CUI message(): {0}", string.Join(",", ServiceConstantsManager.CONST_CUI)));
               return strErrCode;
               }

               // update Customerid(AN=AN+SI) based on flag value in config value
               dictObj4c = busMgr.AddSiteId2CustId(dictObj4c, templistenerMembers);

               objSyncReq = new SyncRequest();
               objSyncReq.CustomerId = dictObj4c["AN:"];
               objSyncReq.CustomerStatus = dictObj4c["AS:"];
               objSyncReq.ICOMSMsgFormat = "CUI";

               CustomerInformationRequest crmreq = new CustomerInformationRequest(objSyncReq, objSyncReq);
               // Perform Add customer
               retMsg2ICOM = crmreq.AddCustomer();

               // Get success/failure error code to send to ICOMS
               retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "AddCustomer");

               logger.Info(string.Format("ServiceRunTimeManager::processCUIMessage() returning value {0}", retMsg2ICOM));
               return retMsg2ICOM;
             }
             catch (Exception ex)
             {
             logger.Error(string.Format("processCUIMessage(): Exception: {0}", ex.Message));
             logger.Error("ServiceRunTimeManager::processCUIMessage() returning error");
             return "0000901";
             }
        }
Esempio n. 21
0
 public CustomerCreditRequest(SubscriberSyncRequest obj, SyncRequest sr)
     : base(sr)
 {
     this.CustomerId = sr.CustomerId;
     this.CustomerExpLimit = obj.creditLimit;
 }
 public CustomerInformationRequest(string CustomerId, SyncRequest sr)
     : base(sr)
 {
     this.CustomerId = CustomerId;
 }