public void CallTheDataProvider(ICollection<IPointToLaceProvider> response) { try { _logCommand.LogRequest(new ConnectionTypeIdentifier(AutoCarstatsConfiguration.Database) .ForDatabaseType(), new { _dataProvider }, _dataProvider.BillablleState.NoRecordState); _carInformation = new LightstoneVehicleDataFactory().CarInformation(response, _dataProvider.GetRequest<IAmLightstoneAutoRequest>(), _repository); GetMetricType.OfBaseRetrievalMetric(_carInformation.CarInformationRequest, _repository, out _metrics); _logCommand.LogResponse(_carInformation != null && _carInformation.CarInformationDto != null &&_carInformation.CarInformationDto.CarId > 0 ? DataProviderResponseState.Successful : DataProviderResponseState.NoRecords, new ConnectionTypeIdentifier(AutoCarstatsConfiguration.Database) .ForDatabaseType(), new { _carInformation, _metrics }, _dataProvider.BillablleState.NoRecordState); TransformResponse(response); } catch (Exception ex) { Log.ErrorFormat("Error calling Lightstone Data Provider {0}", ex, ex.Message); _logCommand.LogFault(ex, new {ErrorMessage = "Error calling Lightstone Data Provider"}); LightstoneResponseFailed(response); } }
public when_transforming_lighstone_response() { _request = new[] {new LicensePlateNumberLightstoneOnlyRequest()}; _carInformationRequest = LaceRequestCarInformationRequestBuilder.ForCarId_107483_ButNoVin(); _retrieveValuationFromMetrics = LighstoneVehicleInformationBuilder.ForValuationFromMetrics(_carInformationRequest); _retrieveCarInformation = LighstoneVehicleInformationBuilder.ForCarInformation("SB1KV58E40F039277"); }
public TransformLightstoneResponse(IRetrieveValuationFromMetrics metricResponse, IRetrieveCarInformation carInformation) { Continue = metricResponse != null && carInformation != null && carInformation.CarInformationDto != null && carInformation.IsSatisfied && metricResponse.IsSatisfied; Result = Continue ? null : LightstoneAutoResponse.Empty(); _metricResponse = metricResponse; _carInformation = carInformation; }
public void CallTheDataProvider(ICollection<IPointToLaceProvider> response) { try { _logCommand.LogRequest(new ConnectionTypeIdentifier(AutoCarstatsConfiguration.Database) .ForDatabaseType(), new { _dataProvider }, _dataProvider.BillablleState.NoRecordState); _carInformation = new RgtVehicleDataFactory().CarInformation(response, _dataProvider.GetRequest<IAmRgtRequest>(), _repository); GetSpecifications.ForCar(new CarSpecificationsQuery(_repository), _carInformation.CarInformationRequest, out _carSpecifications); _logCommand.LogResponse(_carSpecifications.Any() ? DataProviderResponseState.Successful : DataProviderResponseState.NoRecords, new ConnectionTypeIdentifier(AutoCarstatsConfiguration.Database) .ForDatabaseType(), new { _carSpecifications }, _dataProvider.BillablleState.NoRecordState); if (_carInformation == null || _carInformation.CarInformationRequest == null) { _logCommand.LogFault(new {_dataProvider}, new {NoRequestReceived = "No car specifications received from RGT Data Provider"}); RgtResponseFailed(response); } if (!_carSpecifications.Any()) _logCommand.LogFault(new {_dataProvider}, new { NoRequestReceived = string.Format("Could not get car information for Car id {0} Vin {1}", _carInformation.CarInformationRequest.CarId, _carInformation.CarInformationRequest.Vin) }); TransformResponse(response); } catch (Exception ex) { _log.ErrorFormat("Error calling RGT Data Provider because of {0}", ex, ex.Message); _logCommand.LogFault(new {ex}, new {ErrorMessage = "Error calling RGT Data Provider"}); RgtResponseFailed(response); } }