コード例 #1
0
        public async Task <CompanySearchResultModel> GetCompanyFromRegiXAsync(string identifier)
        {
            if (!_integrationSettings.UseRegiX)
            {
                throw new Exception("Integration with RegiX is not configured!");
            }

            if (String.IsNullOrWhiteSpace(identifier))
            {
                throw new Exception("Company identifier is missing");
            }

            RegiXReportModel report = await GetRegiXReportForCompanyValidation();

            if (report == null)
            {
                throw new Exception("RegiX report configuration not found for company validation");
            }

            ServiceRequestData request = GetServiceRequestDataForCompany(report, identifier);

            if (request == null)
            {
                throw new Exception("Company service request was not created");
            }

            // TODO: user, timestamp
            long requestId = await SaveRegiXRequest(request, report);

            // TODO: is context needed for transfering eAuth and certificate info?
            CustomCallContext context  = new CustomCallContext();
            RegiXResponse     response = await CallRegiXAsync(context, request);

            // TODO: errors
            await SaveRegiXResponse(requestId, response, "");

            BaseResponse parsedObject = XsdToObjectUtility.GetResponseObjectFromXsd <ValidUICResponse>(response);


            CompanySearchResultModel resultModel = new CompanySearchResultModel
            {
                CompanyIdentifier = identifier,
                RequestId         = requestId,
                ResponseObject    = parsedObject
            };

            return(resultModel);
        }
コード例 #2
0
        private BaseResponse GetResponseObject(Shared.Enums.PropertyType propertyType, RegiXResponse response)
        {
            BaseResponse parsedObject = null;

            switch (propertyType)
            {
            case Shared.Enums.PropertyType.AIRCRAFT:
                parsedObject = XsdToObjectUtility.GetResponseObjectFromXsd <AircraftsResponse>(response);
                break;

            case Shared.Enums.PropertyType.VEHICLE:
                if (_regixCertificateSettings.UseVehicleV3)
                {
                    #region VehicleV3Example
                    //    string content = @"<?xml version=""1.0"" encoding=""utf-16""?>
                    //<s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" xmlns:a=""http://www.w3.org/2005/08/addressing"">
                    //  <s:Header>
                    //    <a:Action s:mustUnderstand=""1"">http://tempuri.org/IRegiXEntryPoint/ExecuteSynchronousResponse</a:Action>
                    //    <ActivityId CorrelationId=""ca165853-c30d-4f6c-a10b-97604a5c2ca8"" xmlns=""http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics"">00000000-0000-0000-0000-000000000000</ActivityId>
                    //    <a:RelatesTo>urn:uuid:973e940f-0520-4006-a53e-b21090539887</a:RelatesTo>
                    //  </s:Header>
                    //  <s:Body xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
                    //    <ExecuteSynchronousResponse xmlns=""http://tempuri.org/"">
                    //      <ExecuteSynchronousResult>
                    //        <IsReady>true</IsReady>
                    //        <Data id=""data"">
                    //          <Request id=""request"">
                    //            <GetMotorVehicleRegistrationInfoV3Request xmlns=""http://egov.bg/RegiX/MVR/MPS/GetMotorVehicleRegistrationInfoV3Request"">
                    //              <Identifier>test123</Identifier>
                    //            </GetMotorVehicleRegistrationInfoV3Request>
                    //          </Request>
                    //          <Response id=""response"">
                    //            <GetMotorVehicleRegistrationInfoV3Response xmlns=""http://egov.bg/RegiX/MVR/MPS/GetMotorVehicleRegistrationInfoV3Response"">
                    //              <Header>
                    //                <MessageID>7e5361c4-3867-403d-9158-02aa848cf562</MessageID>
                    //                <MessageRefID>c384287d-19fb-4512-b64c-7b2062360a4a</MessageRefID>
                    //                <DateTime>2020-01-27T16:47:12.795</DateTime>
                    //                <Operation>003</Operation>
                    //              </Header>
                    //              <Response>
                    //                <Results>
                    //                  <Result>
                    //                    <VehicleData>
                    //                      <RegistrationNumber>СТ0503СК</RegistrationNumber>
                    //                      <FirstRegistrationDate>1986-11-10</FirstRegistrationDate>
                    //                      <VIN>WVWZZZ19ZHW316647</VIN>
                    //                      <EngineNumber>JP466028</EngineNumber>
                    //                      <VehicleType>ЛЕК АВТОМОБИЛ</VehicleType>
                    //                      <Model>ФОЛКСВАГЕН ГОЛФ</Model>
                    //                      <Color>МАСЛЕНО ЗЕЛЕН</Color>
                    //                      <Category>M1</Category>
                    //                      <MassG>980</MassG>
                    //                      <MassF1>1430</MassF1>
                    //                      <MassF2>1430</MassF2>
                    //                      <MassF3>2780</MassF3>
                    //                      <VehNumOfAxles>2</VehNumOfAxles>
                    //                      <VehMassO1>2812</VehMassO1>
                    //                      <VehMassO2>2823</VehMassO2>
                    //                      <Capacity>1600</Capacity>
                    //                      <MaxPower>40</MaxPower>
                    //                      <Fuel>ДИЗЕЛ</Fuel>
                    //                      <EnvironmentalCategory>EURO 1</EnvironmentalCategory>
                    //                      <VehicleDocument>
                    //                        <VehDocumentNumber>008072092</VehDocumentNumber>
                    //                        <VehDocumentDate>2018-01-02</VehDocumentDate>
                    //                      </VehicleDocument>
                    //                    </VehicleData>
                    //                    <OwnersData>
                    //                      <Owner>
                    //                        <BulgarianCitizen>
                    //                          <PIN>5409234132</PIN>
                    //                          <Names>
                    //                            <First>МАРИЯНА</First>
                    //                            <Surname>СТОЯНОВА</Surname>
                    //                            <Family>АРНАУДОВА</Family>
                    //                          </Names>
                    //                        </BulgarianCitizen>
                    //                        <ForeignCitizen />
                    //                        <Company />
                    //                      </Owner>
                    //                    </OwnersData>
                    //                  </Result>
                    //                </Results>
                    //                <ReturnInformation>
                    //                  <ReturnCode>0</ReturnCode>
                    //                  <Info>OK</Info>
                    //                </ReturnInformation>
                    //              </Response>
                    //            </GetMotorVehicleRegistrationInfoV3Response>
                    //          </Response>
                    //          <Matrix xsi:nil=""true"" />
                    //        </Data>
                    //        <HasError>false</HasError>
                    //        <Error xsi:nil=""true"" />
                    //      </ExecuteSynchronousResult>
                    //    </ExecuteSynchronousResponse>
                    //  </s:Body>
                    //</s:Envelope>";

                    #endregion
                    parsedObject = XsdToObjectUtility.GetResponseObjectFromXsd <GetMotorVehicleRegistrationInfoV3Response>(response);
                }
                else
                {
                    parsedObject = XsdToObjectUtility.GetResponseObjectFromXsd <MotorVehicleRegistrationResponse>(response);
                }

                break;

            case Shared.Enums.PropertyType.VESSEL:
                parsedObject = XsdToObjectUtility.GetResponseObjectFromXsd <RegistrationInfoByOwnerResponse>(response);
                break;

            default:
                break;
            }

            return(parsedObject);
        }