public void ThrowEndPointNotFoundExceptionWithValidBulkregistrationRequest_ShouldLogFailedTransmission() { var techModel = new TechModelOne(_sovosContractor.CspCode); var bulkOperation = new BulkOperationNew(EntityType.LL.ToString(), "123456", _physicalUsaAddress, _contactSellerInfo, techModel) { MailingAddress = _mailUsaAddress }; foreach (var state in _sstStates) { bulkOperation.RegistrationIndicatorItems.Add(new BulkNewRegistrationIndicatorOperation(state, "R", DateTime.UtcNow, "Y", "Y") { RemoteEffectiveDate = DateTime.UtcNow }); } var seller = new FeinTaxpayer(_sovosContractor, bulkOperation, "12345678", "Walmart", StateType.TN.ToString(), "1234567890", "Sovos1234"); var user = new User("regulatory-analisys", "Sovos1234!"); _root.AddUser(user, _genericRepository, new UserRepository()); var mockEnvironment = new TransmittalEnvironment("Mock service", "dummy-endpoint", "mock", "Sovos1234!", "v1", ETransmissionMode.OnlyValidate) { SetupMockParameters = new ServiceMockParameters { ThrowEndpointNotFoundException = true } }; var transmitter = new SstRegistrationTransmitter(_sovosContractor, mockEnvironment); var manager = new SimplifiedElectronicReturnManager(transmitter, user, _root, _genericRepository); var response = manager.SubmitTaxpayerData(new List <Taxpayer> { seller }); Assert.IsTrue(response.HasErrors); Assert.IsNotNull(response.ContentSent); Assert.IsNull(response.ContentReceived); Assert.IsNotNull(response.OriginalResponse); var logs = _genericRepository.ListAll <TransmittalLog>(); Assert.AreEqual(1, _genericRepository.Count <TransmittalLog>()); var log = logs.ElementAt(0); Assert.AreEqual(ETransmittalStatus.Rejected, log.TransmissionStatus); Assert.IsNotNull(log.ContentSent); foreach (var item in log.LogItems) { Assert.AreEqual(ETransmittalStatus.Rejected, item.DocumentStatus); Assert.AreEqual("Endpoint not found exception.", item.Errors); } }
public SimplifiedReturnResponse BulkRegistration(BulkRegistrationTransmissionType request) { var serviceBuilder = TransmittalEnvironment.CrateServiceBuilder(); var serviceClient = serviceBuilder.Build(); var contentSent = XmlHelper.Serialize(request); BulkRegistrationAcknowledgementType serviceResponse; try { serviceResponse = serviceClient.BulkRegistration(request); } catch (Exception ex) { var errors = new List <string> { ex.Message }; var response = new SimplifiedReturnResponse { ContentSent = contentSent }; foreach (var item in request.BulkRegistrationDocument) { response.Errors.Add(new SstError(item.DocumentId, errors)); } return(response); } var contentReceived = XmlHelper.Serialize(serviceResponse); var simplifiedResponse = new SimplifiedReturnResponse(contentSent, contentReceived, serviceResponse); if (serviceResponse.TransmissionAcknowledgement.TransmissionStatus == StatusType.R) { simplifiedResponse.Errors.Add(new SstError(serviceResponse.TransmissionAcknowledgement.TransmissionId, serviceResponse.TransmissionAcknowledgement.Errors.Error.Select(x => x.ToString()).ToList())); return(simplifiedResponse); } foreach (var status in serviceResponse.BulkRegAcknowledgement.Where(x => x.DocumentStatus == StatusType.R)) { var error = new SstError(status.DocumentId, status.Errors.Error.Select(x => x.ToString())); simplifiedResponse.Errors.Add(error); } return(simplifiedResponse); }
public void TestInitialize() { EntityFrameworkDbContextHelper.Instance.BeginTransaction(); _genericRepository = new EntityFrameworkGenericRepository <Guid>(); _root = new SstRegistrationTestHarnessSystem(Guid.NewGuid()); _genericRepository.Save(_root); var adminUser = new User("admin", "Sovos1234!"); _root.AddUser(adminUser, _genericRepository, new UserRepository()); _sovosContractor = new Contractor("Sovos") { CspCode = "CSP000011" }; _root.AddContractor(_sovosContractor, _genericRepository, new ContractorRepository()); _sstStates = new List <string> { "VT", "MN", "WY", "UT", "MI", "GA", "ND", "OH", "RI", "KY", "NC", "IA", "WV", "IN", "KS", "NJ", "OK", "WA", "AR", "SD", "WI", "NE", "NV", "TN" }; var states = Enum.GetNames(typeof(StateType)); _nonSstStates = states.Except(_sstStates).ToList(); _physicalUsaAddress = new UsaAddress(StateType.AA.ToString(), "01887", "5th Avenue", "Wilmington"); _mailUsaAddress = new UsaAddress(StateType.WY.ToString(), "10023", "6th Avenue", "New York"); _contactSellerInfo = new ContactSellerInfo("Federico", "Navarro", "1234567890", "*****@*****.**"); var mockEnvironment = new TransmittalEnvironment("Mock service", "dummy-endpoint", "sst", "Sovos1234!", "SST2015V01", ETransmissionMode.OnlyValidate); var transmitter = new SstRegistrationTransmitter(_sovosContractor, mockEnvironment); _manager = new SimplifiedElectronicReturnManager(transmitter, adminUser, _root, new EntityFrameworkGenericRepository <Guid>()); }
public ServiceBuilder(TransmittalEnvironment transmittalEnvironment) { _transmittalEnvironment = transmittalEnvironment; }
public SstRegistrationTransmitter(Contractor contractor, TransmittalEnvironment transmittalEnvironment) { Contractor = contractor; TransmittalEnvironment = transmittalEnvironment; }