public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Hash != null ? Hash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShopifyCustomerId != null ? ShopifyCustomerId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress1 != null ? BillingAddress1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress2 != null ? BillingAddress2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingZip != null ? BillingZip.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingCity != null ? BillingCity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingCompany != null ? BillingCompany.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingProvince != null ? BillingProvince.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingCountry != null ? BillingCountry.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingPhone != null ? BillingPhone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProcessorType != null ? ProcessorType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ HasValidPaymentMethod.GetHashCode();
         hashCode = (hashCode * 397) ^ (ReasonPaymentMethodNotValid != null ? ReasonPaymentMethodNotValid.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ HasCardErrorInDunning.GetHashCode();
         hashCode = (hashCode * 397) ^ NumberActiveSubscriptions.GetHashCode();
         hashCode = (hashCode * 397) ^ NumberSubscriptions.GetHashCode();
         hashCode = (hashCode * 397) ^ (FirstChargeProcessedAt != null ? FirstChargeProcessedAt.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public void Create_BillingCompany_ExpectValidCompany()
        {
            //Arrange
            string billingCompanyIdString = "CoJ01";
            string billingCompanyName = "City of Johannesburg";
            BillingCompanyId billingCompanyId = new BillingCompanyId(billingCompanyIdString);

            //Act
            BillingCompany billingCompany = new BillingCompany(billingCompanyId, billingCompanyName);

            //Assert
            Assert.AreEqual(billingCompanyId, billingCompany.billingCompanyId);
            Assert.AreEqual(billingCompanyName, billingCompany.CompanyName);
        }
Example #3
0
        public void Create_BillingCompany_ExpectValidCompany()
        {
            //Arrange
            string           billingCompanyIdString = "CoJ01";
            string           billingCompanyName     = "City of Johannesburg";
            BillingCompanyId billingCompanyId       = new BillingCompanyId(billingCompanyIdString);

            //Act
            BillingCompany billingCompany = new BillingCompany(billingCompanyId, billingCompanyName);

            //Assert
            Assert.AreEqual(billingCompanyId, billingCompany.billingCompanyId);
            Assert.AreEqual(billingCompanyName, billingCompany.CompanyName);
        }
        public void DetectNewBillingAccountTaskTest()
        {
            // Arrange
            APSUser.APSUser user = new APSUser.APSUser(new APSUserId(Guid.NewGuid().ToString()), "usenrame1", "password1");
            BillingCompany billingCompany = new BillingCompany(new BillingCompanyId(Guid.NewGuid().ToString()), "PVC Test Company");
            BillingAccount billingAccount = new BillingAccount(new BillingAccountId(Guid.NewGuid().ToString()), billingCompany.billingCompanyId, "username1", "password1", user);

            Schedule MySchedule = new Schedule(taskRepo, billingAccountRepo, scrapeTaskFactory);

            // Act
            int TasksCreatedCount = MySchedule.CreateNewTasks();

            // Assert
            Assert.IsTrue(TasksCreatedCount == 1);
        }
Example #5
0
        public void DetectNewBillingAccountTaskTest()
        {
            // Arrange
            APSUser.APSUser user           = new APSUser.APSUser(new APSUserId(Guid.NewGuid().ToString()), "usenrame1", "password1");
            BillingCompany  billingCompany = new BillingCompany(new BillingCompanyId(Guid.NewGuid().ToString()), "PVC Test Company");
            BillingAccount  billingAccount = new BillingAccount(new BillingAccountId(Guid.NewGuid().ToString()), billingCompany.billingCompanyId, "username1", "password1", user);

            Schedule MySchedule = new Schedule(taskRepo, billingAccountRepo, scrapeTaskFactory);

            // Act
            int TasksCreatedCount = MySchedule.CreateNewTasks();

            // Assert
            Assert.IsTrue(TasksCreatedCount == 1);
        }
 public void FillBillingInfo(BillingInfo billingInfo)
 {
     OrderCommentsTextArea.SetText(billingInfo.OrderCommentsTextArea);
     BillingFirstName.SetText(billingInfo.FirstName);
     BillingLastName.SetText(billingInfo.LastName);
     BillingCompany.SetText(billingInfo.Company);
     BillingCountry.SelectByText(billingInfo.Country);
     BillingAddress1.SetText(billingInfo.Address1);
     BillingAddress2.SetText(billingInfo.Address2);
     BillingCity.SetText(billingInfo.City);
     BillingState.SelectByText(billingInfo.State);
     BillingZip.SetText(billingInfo.Zip);
     BillingPhone.SetPhone(billingInfo.Phone);
     BillingEmail.SetEmail(billingInfo.Email);
     if (billingInfo.ShouldCreateAccount)
     {
         CreateAccountCheckBox.Check();
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyCustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingFirstName != null ? BillingFirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingLastName != null ? BillingLastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress1 != null ? BillingAddress1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress2 != null ? BillingAddress2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ BillingZip.GetHashCode();
         hashCode = (hashCode * 397) ^ (BillingCity != null ? BillingCity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingCompany != null ? BillingCompany.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingProvince != null ? BillingProvince.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingCountry != null ? BillingCountry.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingPhone != null ? BillingPhone.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public void CreateScrapeSession(List <LoadManagerRule> rules, BillingCompanyInfo billingCompanyInfo)
        {
            Logging            log    = new Logging();
            ReferenceGenerator refGen = new ReferenceGenerator();
            string             refNum = refGen.GenerateReference();

            try
            {
                // Get scraping scripts per billing company
                log.LogMessage(Enumeration.LoggingPriority.Low, refNum, "Get scraping scripts per billing company");
                BillingCompany        getScrapingScripts = new BillingCompany(new BillingCompanyId(billingCompanyInfo.BillingCompanyId), billingCompanyInfo.BillingCompanyName);
                List <ScrapingScript> scrapingScripts    = getScrapingScripts.GetScrapingScripts();


                foreach (var scrapingScript in scrapingScripts)
                {
                    // Process errors
                    if (scrapingScript.ErrorCode == 91)
                    {
                        BrokenScript brokenScript = new BrokenScript(Enumeration.ErrorCode.BrokenScript, scrapingScript.ScriptSiteURL, DateTime.Now);
                    }
                }

                // Call the 3rd party provider to perform the scrape
                log.LogMessage(Enumeration.LoggingPriority.Low, refNum, "Call the 3rd party provider to perform the scrape");
                ScraperProvider   scraperProvider = new ScraperProvider();
                List <ScrapeData> scrapeData      = scraperProvider.RequestScrape();

                foreach (var data in scrapeData)
                {
                    // Process errors
                    if (data.ErrorCode == 91)
                    {
                        BillingCompanySiteDown siteDown = new BillingCompanySiteDown(Enumeration.ErrorCode.BillingCompanySiteDown, "", DateTime.Now);
                    }
                    else if (data.ErrorCode == 92)
                    {
                        CustomerActionRequired custActionReq = new CustomerActionRequired(Enumeration.ErrorCode.CustomerActionRequired, "", DateTime.Now);
                    }
                    else if (data.ErrorCode == 93)
                    {
                        IncorrectAccount incorrectAcc = new IncorrectAccount(Enumeration.ErrorCode.IncorrectAccount, "", DateTime.Now);
                    }
                    else if (data.ErrorCode == 94)
                    {
                        InvalidCredentials invalidCredentials = new InvalidCredentials(Enumeration.ErrorCode.InvalidCredentials, "", DateTime.Now);
                    }
                }

                // Save scraped data to the Repo
                log.LogMessage(Enumeration.LoggingPriority.Low, refNum, "Save scraped data to the Repo");
                ScrapeDataRepository     scrapeDataRepo = new ScrapeDataRepository();
                List <LoadManagerErrors> saveErrors     = scrapeDataRepo.SaveScrapeData(scrapeData);

                foreach (var saveError in saveErrors)
                {
                    // Process errors
                    if (saveError.ErrorCode == 91)
                    {
                        UnableToCheckDataIntegrity unableToCheckDataIntegrity = new UnableToCheckDataIntegrity(Enumeration.ErrorCode.UnableToCheckDataIntegrity, saveError.Message, DateTime.Now);
                    }
                }
            }
            catch (Exception ex)
            {
                // Process errors

                log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex);
            }
        }