示例#1
0
        public static bool Validate(string email, string firstName, string lastName, User user)
        {
            GetVerifiedStatusResponse getVerifiedStatusResponse = null;

            if (HaveEmail(email))
            {
                throw new ValidationException("На данную электропочту PayPal уже зарегестирован на Д2 пользователь");
            }

            try
            {
                if (profile == null)
                {
                    profile = CreateProfile();
                }

                var getVerifiedStatusRequest = new GetVerifiedStatusRequest();

                getVerifiedStatusRequest.emailAddress  = email;
                getVerifiedStatusRequest.firstName     = firstName;
                getVerifiedStatusRequest.lastName      = lastName;
                getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none)
                var aa = new AdaptiveAccounts();
                aa.APIProfile             = profile;
                getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest);
            }
            catch (FATALException FATALEx)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx);
            }
            catch (Exception ex)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex);
            }

            if (getVerifiedStatusResponse == null)
            {
                return(false);
            }

            if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED")
            {
                DataService.PerThread.PayPalVerificationSet.AddObject(new PayPalVerification()
                {
                    Email            = email,
                    FirstName        = firstName,
                    LastName         = lastName,
                    VerificationDate = DateTime.Now,
                    User             = user
                });
                DataService.PerThread.SaveChanges();
                return(true);
            }

            return(false);
        }
        public static bool Validate(string email, string firstName, string lastName, User user)
        {
            GetVerifiedStatusResponse getVerifiedStatusResponse = null;

            if (HaveEmail(email))
                throw new ValidationException("На данную электропочту PayPal уже зарегестирован на Д2 пользователь");

            try
            {

                if (profile == null)
                    profile = CreateProfile();

                var getVerifiedStatusRequest = new GetVerifiedStatusRequest();

                getVerifiedStatusRequest.emailAddress = email;
                getVerifiedStatusRequest.firstName = firstName;
                getVerifiedStatusRequest.lastName = lastName;
                getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none)
                var aa = new AdaptiveAccounts();
                aa.APIProfile = profile;
                getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest);
            }
            catch (FATALException FATALEx)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx);
            }
            catch (Exception ex)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex);
            }

            if (getVerifiedStatusResponse == null)
                return false;

            if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED")
            {
                DataService.PerThread.PayPalVerificationSet.AddObject(new PayPalVerification()
                                                                          {
                                                                              Email = email,
                                                                              FirstName = firstName,
                                                                              LastName = lastName,
                                                                              VerificationDate = DateTime.Now,
                                                                              User = user
                                                                          });
                DataService.PerThread.SaveChanges();
                return true;
            }

            return false;
        }
示例#3
0
        public static bool ValidateTest(string email, string firstName, string lastName)
        {
            GetVerifiedStatusResponse getVerifiedStatusResponse = null;

            try
            {
                if (profile == null)
                {
                    profile = CreateProfile();
                }

                var getVerifiedStatusRequest = new GetVerifiedStatusRequest();

                getVerifiedStatusRequest.emailAddress  = email;
                getVerifiedStatusRequest.firstName     = firstName;
                getVerifiedStatusRequest.lastName      = lastName;
                getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none)
                var aa = new AdaptiveAccounts();
                aa.APIProfile             = profile;
                getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest);
            }
            catch (FATALException FATALEx)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx);
            }
            catch (Exception ex)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex);
            }

            if (getVerifiedStatusResponse == null)
            {
                return(false);
            }

            if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED")
            {
                return(true);
            }

            return(false);
        }
        public static bool ValidateTest(string email, string firstName, string lastName)
        {
            GetVerifiedStatusResponse getVerifiedStatusResponse = null;

            try
            {

                if (profile == null)
                    profile = CreateProfile();

                var getVerifiedStatusRequest = new GetVerifiedStatusRequest();

                getVerifiedStatusRequest.emailAddress = email;
                getVerifiedStatusRequest.firstName = firstName;
                getVerifiedStatusRequest.lastName = lastName;
                getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none)
                var aa = new AdaptiveAccounts();
                aa.APIProfile = profile;
                getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest);
            }
            catch (FATALException FATALEx)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx);
            }
            catch (Exception ex)
            {
                throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex);
            }

            if (getVerifiedStatusResponse == null)
                return false;

            if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED")
            {
                return true;
            }

            return false;
        }