Пример #1
0
        }         // CheckEkm

        private void CheckHmrc(LoadCustomerMarketplaceSecurityData.ResultRow hmrc)
        {
            AccountModel oSecInfo;

            try {
                oSecInfo = Serialized.Deserialize <AccountModel>(Encrypted.Decrypt(hmrc.SecurityData));
            }
            catch (Exception e) {
                Log.Alert(
                    e,
                    "Failed to de-serialise security data for HMRC marketplace {0} ({1}).",
                    hmrc.DisplayName,
                    hmrc.CustomerMarketplaceID
                    );

                return;
            }             // try

            if ((oSecInfo.login == m_oCustomerData.Mail) && (oSecInfo.password == VendorInfo.TopSecret))
            {
                if (hmrc.UpdatingStart.HasValue && hmrc.UpdatingStart.Value.AddDays(1) < DateTime.UtcNow)
                {
                    Result.HasUploadedHmrc = true;
                }
                return;
            }

            try {
                var ctr = new Connector(oSecInfo.Fill(), Log, m_oCustomerData.Id, m_oCustomerData.Mail);

                if (ctr.Init())
                {
                    ctr.Run(true);
                    ctr.Done();
                }                 // if
            }
            catch (InvalidCredentialsException) {
                Log.Debug("Invalid credentials detected for linked HMRC account {0} ({1}).", hmrc.CustomerMarketplaceID, oSecInfo.login);
                Result.LinkedHmrc.Add(oSecInfo.login);
            }
            catch (Exception e) {
                Log.Warn(e, "Failed to validate credentials for linked HMRC account {0} ({1}).", hmrc.CustomerMarketplaceID, oSecInfo.login);
            }     // try
        }         // CheckHmrc
Пример #2
0
        private void CheckEkm(LoadCustomerMarketplaceSecurityData.ResultRow ekm)
        {
            string sPassword;

            try {
                sPassword = Encrypted.Decrypt(ekm.SecurityData);
            }
            catch (Exception e) {
                Log.Warn(e, "Failed to parse EKM password for marketplace with id {0}.", ekm.CustomerMarketplaceID);
                Result.Ekms[ekm.DisplayName] = "Invalid password.";
                return;
            }             // try

            m_oEkmConnector = m_oEkmConnector ?? new EkmConnector();
            string sError;

            if (!m_oEkmConnector.Validate(ekm.DisplayName, sPassword, out sError))
            {
                Result.Ekms[ekm.DisplayName] = sError;
            }
        }         // CheckEkm