예제 #1
0
        /// <summary>
        /// Activates the service order.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="headerArgs"></param>
        /// <returns></returns>
        public ActivateServiceOrderResponseDto ActivateServiceOrder(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            Random random = new Random();
            if (random.Next(0, 1) == 0)
            {
                return new ActivateServiceOrderResponseDto
                {
                    Status = true
                };
            }

            return new ActivateServiceOrderResponseDto
            {
                Status = false
            };
        }
예제 #2
0
 /// <summary>
 /// Activates the service order.
 /// TODO:Logic inside this method will be changed later when we have operation ready in 
 /// either Rosettian or ESB.
 /// </summary>
 /// <param name="tn">telephone number</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public LineNumberPortabilityStatusDto GetLineNumberPortabilityStatus(string tn, HeaderArgs headerArgs)
 {
     var request = new ActivateServiceOrderRequestDto()
     {
         TN = tn
     };
     return _enterpriseService.GetLineNumberPortabilityStatus(request, headerArgs);
 }
예제 #3
0
 /// <summary>
 /// Gets status of SOA Activation for TN
 /// </summary>
 /// <param name="request">contains TN</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public LineNumberPortabilityStatusDto GetLineNumberPortabilityStatus(ActivateServiceOrderRequestDto request,
     HeaderArgs headerArgs)
 {
     return new LineNumberPortabilityStatusDto()
     {
         StatusCode = "FakeStatusCode",
         StatusSource = "FakeStatusSource",
         Message = "FakeMessage"
     };
 }
예제 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="headerArgs"></param>
        /// <returns></returns>
        public ActivateServiceOrderResponseDto ActivateServiceOrder(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            if (string.IsNullOrWhiteSpace(request.TN)) throw new ArgumentNullException(request.TN);

            var getActivateServiceOrderResponse = new ActivateServiceOrderResponseDto()
            {
                Status = false
            };

            try
            {
                if (Boolean.Parse(ConfigurationManager.AppSettings["NewPerformSOAEnabled"]))
                {
                    var esbRequest = CreateWpsActivateServiceOrderRequest(request, headerArgs);
                    var client = new ManageTelephoneNumberRegistrationClient();
                    var esbResponse = client.UpdateLineNumberPortability(esbRequest.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest);

                    // Handle any unsuccessful conditions
                    if (esbResponse.ExecutionContext.ExecutionStatus.ExecutionStatusSuccessFlag == false)
                    {
                        var messages = esbResponse.ExecutionContext.ExecutionStatus.ExecutionStatusMessage;
                        var errorMessage = String.Empty;
                        var sb = new StringBuilder();

                        for (int i = 0; i < messages.Length; i++)
                        {
                            sb.AppendLine(String.Format("Error {0}:: Severity: {1}, Code: {2}, Message: {3}",
                                i + 1,
                                messages[i].ExecutionStatusSeverity.ToString(),
                                messages[i].ExecutionStatusCode,
                                messages[i].ExecutionStatusDescription));
                        }

                        if (sb.ToString().Length > 0)
                        {
                            errorMessage =
                                String.Concat(
                                    String.Format(
                                        "The activation process for TN # {0} has failed with the following errors: \n\n",
                                        request.TN), sb.ToString());
                        }
                        else
                        {
                            errorMessage = String.Format(
                                "The activation process for TN # {0} has failed for unknown reasons.",
                                request.TN);
                        }

                        throw new EnterpriseServiceException(errorMessage);
                    }
                }
                else
                {
                    var esbRequest = CreateActivateServiceOrderRequest(request, headerArgs);
                    _serviceOrderOrchestration.resumeServiceOrder(esbRequest);
                }

               getActivateServiceOrderResponse.Status = true;
            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);
                if (isServiceException)
                {
                    var myException = new System.Exception(Constants.IsServiceExceptionUpperCase, e);
                    throw myException;
                }

                throw;
            }

            return getActivateServiceOrderResponse;
        }
예제 #5
0
        /// <summary>
        /// Create the ESB Request method for ActivateService Order using WPS endpoints.
        /// </summary>
        /// <param name="request">Contains Subscriber Telephone Number to Activate</param>
        /// <param name="headerArgs">Contains User Info</param>
        /// <returns></returns>
        private static UpdateLineNumberPortabilityRequest CreateWpsActivateServiceOrderRequest(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            try
            {
                var _executionContext = new ExecutionContext();
                if (request.ExecutionContext == null)
                {
                    var consumerInfo = new ConsumerInfo();
                    consumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    consumerInfo.EmployeeID = headerArgs.CrisId;
                    consumerInfo.UserID = headerArgs.CorpId ?? String.Empty;

                    var esbHeader = new ESBHeader();
                    esbHeader.ConsumerInfo = consumerInfo;
                    _executionContext.ESBHeader = esbHeader;
                    _executionContext.ESBHeader.ConsumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    _executionContext.ESBHeader.ConsumerInfo.EmployeeID = headerArgs.CrisId;
                    _executionContext.ESBHeader.ConsumerInfo.UserID = headerArgs.CorpId ?? String.Empty;
                }
                else
                {
                    _executionContext.ESBHeader.ConsumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    _executionContext.ESBHeader.ConsumerInfo.EmployeeID =
                        request.ExecutionContext.EsbHeader.ConsumerInfo.EmployeeID;
                    _executionContext.ESBHeader.ConsumerInfo.UserID =
                        request.ExecutionContext.EsbHeader.ConsumerInfo.UserID ?? String.Empty;
                }

                var _requestCriteria = new NumberRegistrationRequest();
                _requestCriteria.Action = NumberRegistrationActionEnum.Activate;
                _requestCriteria.RequestDateTimeSpecified = true;
                _requestCriteria.RequestDateTime = DateTime.Now;
                _requestCriteria.PortedTelephoneNumber = new TelephoneNumber();
                _requestCriteria.PortedTelephoneNumber.Item = request.TN;
                _requestCriteria.PortAction = PortActionEnum.SOAOnlyPortIn;

                var _request = new UpdateLineNumberPortabilityRequest();
                _request.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest =
                    new ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest();
                _request.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest.ExecutionContext =
                    _executionContext;
                _request.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest.RequestCriteria = _requestCriteria;

                return _request;
            }
            catch (System.Exception ex)
            {
                var myException = new System.Exception("Error Creating ActivateServiceOrderRequest", ex);
                throw myException;
            }
        }
예제 #6
0
        /// <summary>
        /// Create the ESB Request method for getting the Line Activation Portability Status using WPS endpoints.
        /// </summary>
        /// <param name="request">Contains Subscriber Telephone Number to Query</param>
        /// <param name="headerArgs">Contains User Info</param>
        /// <returns></returns>
        private static GetLineNumberPortabilityStatusRequest CreateLineTestPortabilityStatusRequest(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            try
            {
                var _executionContext = new ExecutionContext();
                if (request.ExecutionContext == null)
                {
                    var consumerInfo = new ConsumerInfo();
                    consumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    consumerInfo.EmployeeID = headerArgs.CrisId;
                    consumerInfo.UserID = headerArgs.CorpId ?? String.Empty;

                    var esbHeader = new ESBHeader();
                    esbHeader.ConsumerInfo = consumerInfo;
                    _executionContext.ESBHeader = esbHeader;
                    _executionContext.ESBHeader.ConsumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    _executionContext.ESBHeader.ConsumerInfo.EmployeeID = headerArgs.CrisId;
                    _executionContext.ESBHeader.ConsumerInfo.UserID = headerArgs.CorpId ?? String.Empty;
                }
                else
                {
                    _executionContext.ESBHeader.ConsumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    _executionContext.ESBHeader.ConsumerInfo.EmployeeID =
                        request.ExecutionContext.EsbHeader.ConsumerInfo.EmployeeID;
                    _executionContext.ESBHeader.ConsumerInfo.UserID =
                        request.ExecutionContext.EsbHeader.ConsumerInfo.UserID ?? String.Empty;
                }

                var tn = new TelephoneNumber();
                tn.Item = request.TN;

                var _requestCriteria = new GetNumberRegistrationStatusRequest();
                _requestCriteria.TelephoneNumber = tn;

                var manage = new ManageTelephoneNumberRegistrationGetLineNumberPortabilityStatusRequest();
                manage.ExecutionContext = _executionContext;
                manage.RequestCriteria = _requestCriteria;

                var _request = new GetLineNumberPortabilityStatusRequest();
                _request.ManageTelephoneNumberRegistrationGetLineNumberPortabilityStatusRequest = manage;

                return _request;
            }
            catch (System.Exception ex)
            {
                var myException = new System.Exception("Error Creating ActivateServiceOrderRequest", ex);
                throw myException;
            }
        }
예제 #7
0
        /// <summary>
        /// Create the ESB Request method for ActivateService Order using the deprecated BPM endpoints.
        /// </summary>
        /// <param name="request">Contains Subscriber Telephone Number to Activate</param>
        /// <param name="headerArgs">Contains User Info</param>
        /// <returns></returns>
        private static resumeServiceOrderRequest CreateActivateServiceOrderRequest(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            try
            {
                serviceOrder.Header header = null;
                resumeServiceOrderRequest esbRequest = null;

                // construct header
                header = new serviceOrder.Header
                {
                    Source = "SIMPL",
                    Security_T = new serviceOrder.CharacteristicSpecification[2],
                    ConsumerInfo = new serviceOrder.CharacteristicSpecification[4]
                };

                header.Security_T[0] = new serviceOrder.CharacteristicSpecification
                {
                    name = "employeeID",
                    Value = new serviceOrder.CharacteristicValue
                    {
                        value = headerArgs.CrisId
                    }
                };

                header.Security_T[1] = new serviceOrder.CharacteristicSpecification
                {
                    name = "userID",
                    Value = new serviceOrder.CharacteristicValue
                    {
                        value = headerArgs.CorpId ?? string.Empty
                    }
                };

                header.ConsumerInfo[0] = new serviceOrder.CharacteristicSpecification
                {
                    name = "DPIEnvironment",
                    Value = new serviceOrder.CharacteristicValue
                    {
                        value = headerArgs.DpiRegion ?? string.Empty
                    }
                };

                header.ConsumerInfo[1] = new serviceOrder.CharacteristicSpecification
                {
                    name = "name",
                    Value = new serviceOrder.CharacteristicValue
                    {
                        value = headerArgs.Name ?? string.Empty
                    }
                };

                header.ConsumerInfo[2] = new serviceOrder.CharacteristicSpecification
                {
                    name = "email",
                    Value = new serviceOrder.CharacteristicValue
                    {
                        value = headerArgs.Email ?? string.Empty
                    }
                };

                header.ConsumerInfo[3] = new serviceOrder.CharacteristicSpecification
                {
                    name = "role",
                    Value = new serviceOrder.CharacteristicValue
                    {
                        value = headerArgs.Role ?? string.Empty
                    }
                };

                // construct payload
                esbRequest = new resumeServiceOrderRequest
                {

                    resumeServiceOrder = new resumeServiceOrder
                    {
                        resumeServiceOrderInput = new serviceOrder.msg_LookupRequest
                        {
                            Header = header,
                            Payload = new serviceOrder.LookupRequest
                            {
                                SearchCriteria = new[]
                                {
                                    new serviceOrder.Entity
                                    {
                                        type = "ServiceOrder",
                                        Characteristics = new[]
                                        {
                                            new serviceOrder.CharacteristicSpecification
                                            {
                                                name = "telephoneNumber",
                                                valueType = "WTN",
                                                Value = new serviceOrder.CharacteristicValue
                                                {
                                                    value = request.TN
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                };

                return esbRequest;
            }
            catch (System.Exception ex)
            {
                var myException = new System.Exception("Error Creating ActivateServiceOrderRequest", ex);
                throw myException;
            }
        }
예제 #8
0
        /// <summary>
        /// Gets status of SOA for subscriber
        /// </summary>
        /// <param name="request"></param>
        /// <param name="headerArgs"></param>
        /// <returns></returns>
        public LineNumberPortabilityStatusDto GetLineNumberPortabilityStatus(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            if (string.IsNullOrWhiteSpace(request.TN)) throw new ArgumentNullException(request.TN);

            try
            {
                var esbRequest = CreateLineTestPortabilityStatusRequest(request, headerArgs);
                var client = new ManageTelephoneNumberRegistrationClient();
                var esbResponse =
                    client.GetLineNumberPortabilityStatus(esbRequest.ManageTelephoneNumberRegistrationGetLineNumberPortabilityStatusRequest);

                // Handle any unsuccessful conditions
                if (esbResponse.ExecutionContext.ExecutionStatus.ExecutionStatusSuccessFlag == false)
                {
                    var messages = esbResponse.ExecutionContext.ExecutionStatus.ExecutionStatusMessage;
                    var errorMessage = String.Empty;
                    var sb = new StringBuilder();

                    for (int i = 0; i < messages.Length; i++)
                    {
                        sb.AppendLine(String.Format("Error {0}:: Severity: {1}, Code: {2}, Message: {3}",
                            i + 1,
                            messages[i].ExecutionStatusSeverity.ToString(),
                            messages[i].ExecutionStatusCode,
                            messages[i].ExecutionStatusText));
                    }

                    if (sb.ToString().Length > 0)
                    {
                        errorMessage =
                            String.Concat(
                                String.Format(
                                    "The activation process for TN # {0} has failed with the following errors: \n\n",
                                    request.TN), sb.ToString());
                    }
                    else
                    {
                        errorMessage = String.Format(
                            "The activation process for TN # {0} has failed for unknown reasons.",
                            request.TN);
                    }

                    throw new EnterpriseServiceException(errorMessage);
                }

                // Parse Data

                return new LineNumberPortabilityStatusDto()
                {
                    StatusCode = esbResponse.LineNumberPortabilityStatus.StatusCode,
                    StatusSource = esbResponse.LineNumberPortabilityStatus.StatusSource,
                    Message = esbResponse.LineNumberPortabilityStatus.Message
                };

            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);
                if (isServiceException)
                {
                    var myException = new System.Exception(Constants.IsServiceExceptionUpperCase, e);
                    throw myException;
                }
                throw;
            }
        }