Пример #1
0
        public void SendReferrals(string SenderUserId, ReferralCodeRequest model) //pass in the sender's userId and the request model
        {
            //Use GetCouponByUserIdAndType method
            CouponsDomain referralCoupon = _CouponService.GetCouponByUserIdAndType(SenderUserId, CouponType.referral);
            //referralCoupon now contains the information about the coupon, based on the UserId and the coupon emun referral

            //initially couponId is set to zero, but will get over-ridden as it goes in the if statement
            int couponId = 0;

            //If there is no referral coupon, generate a new referral coupon code for the sender.
            //If a new person registers, initially they will not have this code.
            //Therefore, this null check will check and they will have a code generated for them
            if (referralCoupon == null)
            {
                couponId = _CouponService.GenerateReferralCode(SenderUserId);
            }
            else //If the user already has a coupon code:
            {
                couponId = referralCoupon.Id;
            }

            //for each email, generate a token
            //token needs: couponId, friend's email address, and the userId of the current user
            //once generated, token emailed to new user via emailservice: either sendgrid or mandrill...depending on the unity.config

            //do a loop through model.emails... loop is required because user can send more than one referral email
            foreach (var email in model.InviteEmail)
            {
                //Checks the following:
                //Does invitation email exist in the token database? meaning have they already been sent an email?
                //Go through the database and see if there is an email that matches the var email ^^
                //if there is NO match (not a current user || invitee), bool = false and therefore send the invitation
                //if there IS a match (current user || already invited), bool = true, and therefore DO NOT send out the invitation
                {
                    bool checkUser = UserService.IsUser(email.Email);

                    //this var is null-checking if a invitation email already exists
                    ReferralTokenRequest alreadyInvited = TokenService.getAllEmailsByTokenType(TokenType.Invite, email.Email);

                    //if that email does NOT exist in the database,
                    //AND if that email has NOT been sent an invitation....send the referral email:
                    if (checkUser == false && alreadyInvited == null)
                    {
                        //new instance of the ReferralTokenRequest model to get token:
                        ReferralTokenRequest referralTokenModel = new ReferralTokenRequest();

                        referralTokenModel.Email    = email.Email;
                        referralTokenModel.CouponId = couponId;
                        referralTokenModel.UserId   = SenderUserId;

                        //Create a unique token for each valid email:
                        Guid CreateTokenForInvites = TokenService.InsertReferralToken(referralTokenModel);

                        //Finally, send out invitation email
                        _EmailService.ReferralEmail(CreateTokenForInvites, email.Email);
                    }
                }
            }
        }
Пример #2
0
        public static CouponsDomain GetReferralTokenByGuid(string tokenhash)
        {
            CouponsDomain c = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Coupons_SelectByTokenId"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@TokenHash", tokenhash);
            }, map : delegate(IDataReader reader, short set)
            {
                int startingIndex = 0;

                c = new CouponsDomain();

                c.Id = reader.GetSafeInt32(startingIndex++);
                c.CouponDateCreated    = reader.GetSafeDateTime(startingIndex++);
                c.CouponDateModified   = reader.GetSafeDateTime(startingIndex++);
                c.WebsiteId            = reader.GetSafeInt32(startingIndex++);
                c.CouponType           = reader.GetSafeInt32(startingIndex++);
                c.CouponCode           = reader.GetSafeString(startingIndex++);
                c.CouponValue          = reader.GetSafeDecimal(startingIndex++);
                c.CouponActiveDate     = reader.GetSafeDateTime(startingIndex++);
                c.CouponExpirationDate = reader.GetSafeDateTime(startingIndex++);
                c.CouponDescription    = reader.GetSafeString(startingIndex++);
                c.UserId = reader.GetSafeString(startingIndex++);

                Token t = new Token();

                t.Id          = reader.GetSafeInt32(startingIndex++);
                t.DateCreated = reader.GetSafeDateTime(startingIndex++);
                t.Used        = reader.GetSafeDateTimeNullable(startingIndex++);
                t.TokenHash   = reader.GetSafeGuid(startingIndex++);
                t.UserId      = reader.GetSafeString(startingIndex++);
                t.TokenType   = reader.GetSafeInt32(startingIndex++);
                t.CouponId    = reader.GetSafeInt32(startingIndex++);
                t.Email       = reader.GetSafeString(startingIndex++);

                c.Token = t;
            });
            return(c);
        }
        //Service ran for creating a new user - pass in users id and request model
        public void CreateUserProfile(string userId, CreateUserRequest model)
        {
            //Updated the create user so that it can take in the tokenHash param if there is one provided
            DataProvider.ExecuteNonQuery(GetConnection, "UserProfiles_Insert" // stored procedure
                                         , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {                                                                 //input fields
                paramCollection.AddWithValue("@UserId", userId);
                paramCollection.AddWithValue("@FirstName", model.FirstName);
                paramCollection.AddWithValue("@LastName", model.LastName);
                paramCollection.AddWithValue("@TokenHash", model.TokenHash);     //this is provided if they were referred by a current customer
            }
                                         );
            //referral coupon
            //if TokenHash referral is null, they're making a new account.
            //if TokenHash referral is NOT null, we want to give them (new user) a Coupon value and add it to their Credit.
            // we also want to give the original user (one who referred) the same Coupon value and add it to their Credit.
            if (model.TokenHash != null)
            {
                //retrieve coupon information + token information based on the token hash.
                CouponsDomain userCoupon = TokenService.GetReferralTokenByGuid(model.TokenHash);
                if (userCoupon.Token.Used == null)
                {
                    //send token to Credit service
                    UserCreditsRequest insertRefferalCredits = new UserCreditsRequest();
                    UserCreditsRequest insertFriendCredits   = new UserCreditsRequest();

                    //send credits to new User who was referred
                    insertRefferalCredits.Amount          = userCoupon.CouponValue;
                    insertRefferalCredits.TransactionType = "Add";
                    insertRefferalCredits.UserId          = userId;
                    _CreditsService.InsertUserCredits(insertRefferalCredits);
                }

                else
                {
                    //send error message that token has already been used.
                }
            }

            //Activity Services
            ActivityLogRequest Activity = new ActivityLogRequest();

            Activity.ActivityType = ActivityTypeId.NewAccount;
            _ActivityLogService.InsertActivityToLog(userId, Activity);

            //----------//create a new Website Id ---------updated the AddUserToWebsite using the updated domain with int[]
            //getting the websiteId via the website Slug
            Website w    = null;
            string  Slug = model.Slug;

            w = WebsiteService.GetWebsiteIdBySlug(Slug);

            int[] WebsiteIds = new int[1];
            WebsiteIds[0] = w.Id;
            //populating userwebsite object
            UserWebsite userWebsite = new UserWebsite();

            userWebsite.UserId     = userId;
            userWebsite.WebsiteIds = WebsiteIds;
            WebsiteService.AddUserToWebsite(userWebsite);

            //creae a new Customer role
            //set role as customer by default - change role by admin panel
            UserProfile aspUser = new UserProfile();

            aspUser.FirstName = model.FirstName;
            aspUser.LastName  = model.LastName;
            aspUser.RoleId    = ConfigService.CustomerRole;
            _AdminService.CreateUserRole(userId, aspUser);

            //create a new Braintree account using UserID
            //braintree used for handling credit card transactions
            CustomerPaymentRequest Payment = new CustomerPaymentRequest();

            Payment.FirstName = model.FirstName;
            Payment.LastName  = model.LastName;
            Payment.UserId    = userId;
            Payment.Phone     = model.Phone;

            //Send a confirmation Text Msg
            string UserSMSToken = TokenSMSService.TokenSMSInsert(userId);
            //send a text msg
            NotifySMSRequest NotifyCustomer = new NotifySMSRequest();

            NotifyCustomer.Phone    = model.Phone;
            NotifyCustomer.TokenSMS = UserSMSToken;

            try
            {
                NotifySMSService.SendConfirmText(NotifyCustomer);
            }
            catch (ArgumentException ex)
            {
                //if phone number is already registered will not send a registration check
                //should never get this far
                throw new System.ArgumentException(ex.Message);
            }

            //bringg create account
            RegisterBringgRequest bringgRequest = new RegisterBringgRequest();

            bringgRequest.Name   = model.FirstName + " " + model.LastName;
            bringgRequest.Phone  = model.Phone;
            bringgRequest.Email  = model.Email;
            bringgRequest.UserId = userId;
            this._CreateCustomerTask.Execute(bringgRequest);

            _CreateCustomerTask.Execute(bringgRequest);

            BrainTreeService brainTree = new BrainTreeService();

            brainTree.newCustomerInsert(Payment);

            ////generate a new token
            Guid userTokenGuid = TokenService.tokenInsert(userId);

            //send a confirmation email
            _EmailService.SendProfileEmail(userTokenGuid, model.Email);
        }
Пример #4
0
        public bool CompleteTransaction(Job job, ActivityLogAddRequest add)
        {
            bool success = false;

            List <ActivityLog> list = _ActivityLogService.GetByJobId(add.JobId);

            foreach (var activity in list)
            {
                int currentStatus = activity.TargetValue;

                if (currentStatus == (int)JobStatus.BringgOnTheWay)
                {
                    _timeCreated = activity.IdCreated;
                }
                if (currentStatus == (int)JobStatus.BringgDone)
                {
                    _timeCompleted = activity.IdCreated;
                }
            }
            TimeSpan timeDifference = _timeCompleted.Subtract(_timeCreated);
            double   toMinutes      = timeDifference.TotalMinutes;

            CreditCardService cardService      = new CreditCardService();
            PaymentRequest    payment          = new PaymentRequest();
            BrainTreeService  brainTreeService = new BrainTreeService();

            List <string> Slugs = new List <string>();

            Slugs.Add("base-price");
            Slugs.Add("price-per-minute");
            Slugs.Add("minimum-job-duration");
            Slugs.Add("website-pricing-model");

            Dictionary <string, WebsiteSettings> dict = WebsiteSettingsServices.getWebsiteSettingsDictionaryBySlug(job.WebsiteId, Slugs);

            WebsiteSettings pricingModel = (dict["website-pricing-model"]);
            WebsiteSettings basePrice    = (dict["base-price"]);
            WebsiteSettings pricePerMin  = (dict["price-per-minute"]);
            WebsiteSettings jobDuration  = (dict["minimum-job-duration"]);

            // - Switch statement to calculate service cost depending on the website's pricing model

            int pricingModelValue = Convert.ToInt32(pricingModel.SettingsValue);

            switch (pricingModelValue)
            {
            case 1:
                _basePrice  = Convert.ToDouble(basePrice.SettingsValue);
                _totalPrice = _basePrice;
                break;

            case 2:
                _webPrice       = Convert.ToDouble(pricePerMin.SettingsValue);
                _minJobDuration = Convert.ToDouble(jobDuration.SettingsValue);

                if (toMinutes <= _minJobDuration)
                {
                    _totalPrice = _webPrice * _minJobDuration;
                }
                else
                {
                    _totalPrice = _webPrice * toMinutes;
                }

                break;

            case 3:
                _webPrice   = Convert.ToDouble(pricePerMin.SettingsValue);
                _basePrice  = Convert.ToDouble(basePrice.SettingsValue);
                _totalPrice = _webPrice + _basePrice;
                break;
            }


            JobsService.UpdateJobPrice(add.JobId, _totalPrice);

            if (job.UserId != null)
            {
                payment.UserId = job.UserId;
            }
            else
            {
                payment.UserId = job.Phone;
            }


            payment.ExternalCardIdNonce = job.PaymentNonce;
            payment.ItemCost            = (decimal)_totalPrice;


            brainTreeService.AdminPaymentService(payment, job.Id);

            //This is where my contribution begins:


            //once the payment goes through, insert the referral code for user A. Existance of a TokenHash will determine if we need to award an userA.
            //NOTE: User A is the initial friend who referred User B.

            String TokenHash = _UserProfileService.GetTokenHashByUserId(job.UserId);
            //string TokenHash = "CED28811-C2DF-4629-8D2B-AE3C478A5A82"; --FOR TESTING PURPOSES
            Guid TokenGuid;

            Guid.TryParse(TokenHash, out TokenGuid);


            if (TokenHash != null)
            {
                bool TokenUsed = TokenService.isTokenUsedReferral(TokenHash);

                Token GetUserA = TokenService.userGetByGuid(TokenGuid);

                string    UserAId        = GetUserA.UserId;
                int       CouponReferral = GetUserA.TokenType;
                TokenType referral       = (TokenType)CouponReferral; //parsing the int into an enum

                if (UserAId != null && referral == TokenType.Invite && TokenUsed == false)
                {
                    //give User A a credit of 25 dollars
                    CouponsDomain userCoupon = TokenService.GetReferralTokenByGuid(TokenHash);

                    UserCreditsRequest insertUserACredits = new UserCreditsRequest();
                    insertUserACredits.Amount          = userCoupon.CouponValue;
                    insertUserACredits.TransactionType = "Add";
                    insertUserACredits.UserId          = UserAId;

                    int forTargetValue = _CreditsService.InsertUserCredits(insertUserACredits);


                    //then update the activity log for USER A to tell them that their friend completed their first order and that they were rewarded credits
                    ActivityLogAddRequest addCreditFriend = new ActivityLogAddRequest();

                    addCreditFriend.ActivityType = ActivityTypeId.CreditsFriend;
                    addCreditFriend.JobId        = job.Id;
                    addCreditFriend.TargetValue  = forTargetValue;
                    addCreditFriend.RawResponse  = Newtonsoft.Json.JsonConvert.SerializeObject(insertUserACredits);
                    _ActivityLogService.Insert(UserAId, addCreditFriend);

                    //update user B's activity log to show that they used the credits for their first payment
                    ActivityLogAddRequest addCredit = new ActivityLogAddRequest();

                    addCredit.ActivityType = ActivityTypeId.Credits;
                    addCredit.JobId        = job.Id;
                    addCredit.TargetValue  = forTargetValue;
                    addCredit.RawResponse  = Newtonsoft.Json.JsonConvert.SerializeObject(insertUserACredits);
                    _ActivityLogService.Insert(UserAId, addCredit);
                }
            }

            bool successpay = AdminPaymentService(payment, job.Id);

            if (successpay)
            {
                JobsService.UpdateJobStatus(JobStatus.Complete, job.ExternalJobId);

                ActivityLogAddRequest log = new ActivityLogAddRequest();
                log.JobId        = job.Id;
                log.TargetValue  = (int)JobStatus.Complete;
                log.ActivityType = ActivityTypeId.BringgTaskStatusUpdated;

                _ActivityLogService.Insert((job.UserId == null) ? job.Phone : job.UserId, log);
            }
            else
            {
                success = false;
            }

            return(success);
        }
Пример #5
0
        //Complete
        public bool CompleteTransaction(Job job, ActivityLogAddRequest add)
        {
            bool success = false;

            List <ActivityLog> list = _ActivityLogService.GetByJobId(add.JobId);

            foreach (var activity in list)
            {
                int currentStatus = activity.TargetValue;

                if (currentStatus == (int)JobStatus.BringgOnTheWay)
                {
                    _timeCreated = activity.IdCreated;
                }
                if (currentStatus == (int)JobStatus.BringgDone)
                {
                    _timeCompleted = activity.IdCreated;
                }
            }
            TimeSpan timeDifference = _timeCompleted.Subtract(_timeCreated);
            double   toMinutes      = timeDifference.TotalMinutes;

            CreditCardService cardService      = new CreditCardService();
            PaymentRequest    payment          = new PaymentRequest();
            BrainTreeService  brainTreeService = new BrainTreeService();

            List <string> Slugs = new List <string>();

            Slugs.Add("base-price");
            Slugs.Add("price-per-minute");
            Slugs.Add("minimum-job-duration");
            Slugs.Add("website-pricing-model");

            Dictionary <string, WebsiteSettings> dict = WebsiteSettingsServices.getWebsiteSettingsDictionaryBySlug(job.WebsiteId, Slugs);

            WebsiteSettings pricingModel = (dict["website-pricing-model"]);
            WebsiteSettings basePrice    = (dict["base-price"]);
            WebsiteSettings pricePerMin  = (dict["price-per-minute"]);
            WebsiteSettings jobDuration  = (dict["minimum-job-duration"]);

            // - Switch statement to calculate service cost depending on the website's pricing model

            int pricingModelValue = Convert.ToInt32(pricingModel.SettingsValue);

            switch (pricingModelValue)
            {
            case 1:
                _basePrice  = Convert.ToDouble(basePrice.SettingsValue);
                _totalPrice = _basePrice;
                break;

            case 2:
                _webPrice       = Convert.ToDouble(pricePerMin.SettingsValue);
                _minJobDuration = Convert.ToDouble(jobDuration.SettingsValue);

                if (toMinutes <= _minJobDuration)
                {
                    _totalPrice = _webPrice * _minJobDuration;
                }
                else
                {
                    _totalPrice = _webPrice * toMinutes;
                }

                break;

            case 3:
                _webPrice   = Convert.ToDouble(pricePerMin.SettingsValue);
                _basePrice  = Convert.ToDouble(basePrice.SettingsValue);
                _totalPrice = _webPrice + _basePrice;
                break;
            }


            JobsService.UpdateJobPrice(add.JobId, _totalPrice);

            if (job.UserId != null)
            {
                payment.UserId = job.UserId;
            }
            else
            {
                payment.UserId = job.Phone;
            }

            payment.ExternalCardIdNonce = job.PaymentNonce;
            payment.ItemCost            = (decimal)_totalPrice;

            String TokenHash = _UserProfileService.GetTokenHashByUserId(job.UserId);
            Guid   TokenGuid;

            Guid.TryParse(TokenHash, out TokenGuid);


            //This section was added by a team member
            if (TokenHash != null)
            {
                bool TokenUsed = TokenService.isTokenUsedReferral(TokenHash);

                //then find the user who referred userB
                //second service: get the userId of userA by using the tokenhash of userB
                //take User B's email and find the user id of the person who referred them (userA) and
                //use the [dbo].[Token_SelectByUserIdAndTokenType] and take UserId from the stored proc

                //[dbo].[Token_GetByGuid]

                //NOTE: User A is the initial friend who referred User B.

                Token GetUserA = TokenService.userGetByGuid(TokenGuid);

                string    UserAId        = GetUserA.UserId;
                int       CouponReferral = GetUserA.TokenType;
                TokenType referral       = (TokenType)CouponReferral;                      //parsing the int into an enum

                if (UserAId != null && referral == TokenType.Invite && TokenUsed == false) //if this user was referred from a friend && that referral coupon type  is 3 && if that coupon is not used, do the thing
                {
                    //give User A a credit of 25 dollars
                    CouponsDomain userCoupon = TokenService.GetReferralTokenByGuid(TokenHash);

                    UserCreditsRequest insertUserACredits = new UserCreditsRequest();
                    insertUserACredits.Amount          = userCoupon.CouponValue;
                    insertUserACredits.TransactionType = "Add";
                    insertUserACredits.UserId          = UserAId;
                    //_CreditsService.InsertUserCredits(insertUserACredits); // get int value for it and plug it ino the targetValue in activitylogrequest
                    int forTargetValue = _CreditsService.InsertUserCredits(insertUserACredits);


                    //then update the activity log for USER A to tell them that their friend completed their first order and that they were rewarded credits
                    ActivityLogAddRequest addCreditFriend = new ActivityLogAddRequest();

                    addCreditFriend.ActivityType = ActivityTypeId.CreditsFriend;
                    addCreditFriend.JobId        = job.Id;
                    addCreditFriend.TargetValue  = forTargetValue;
                    addCreditFriend.RawResponse  = Newtonsoft.Json.JsonConvert.SerializeObject(insertUserACredits);
                    _ActivityLogService.Insert(UserAId, addCreditFriend);

                    //update user B's activity log to show that they used the credits for their first payment
                    ActivityLogAddRequest addCredit = new ActivityLogAddRequest();

                    addCredit.ActivityType = ActivityTypeId.Credits;
                    addCredit.JobId        = job.Id;
                    addCredit.TargetValue  = forTargetValue;
                    addCredit.RawResponse  = Newtonsoft.Json.JsonConvert.SerializeObject(insertUserACredits);
                    _ActivityLogService.Insert(UserAId, addCredit);
                }
            }

            bool successpay = AdminPaymentService(payment, job.Id);

            if (successpay)
            {
                JobsService.UpdateJobStatus(JobStatus.Complete, job.ExternalJobId);

                ActivityLogAddRequest log = new ActivityLogAddRequest();
                log.JobId        = job.Id;
                log.TargetValue  = (int)JobStatus.Complete;
                log.ActivityType = ActivityTypeId.BringgTaskStatusUpdated;

                _ActivityLogService.Insert((job.UserId == null) ? job.Phone : job.UserId, log);
            }
            else
            {
                success = false;
            }

            return(success);
        }
Пример #6
0
        public void CreateUserProfile(string userId, CreateUserRequest model)
        {
            //Updated the create user so that it can take in the tokenHash param if there is one provided --Anna

            DataProvider.ExecuteNonQuery(GetConnection, "UserProfiles_Insert"
                                         , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@UserId", userId);
                paramCollection.AddWithValue("@FirstName", model.FirstName);
                paramCollection.AddWithValue("@LastName", model.LastName);
                paramCollection.AddWithValue("@TokenHash", model.TokenHash);     //this is provided if they were referred by a current customer
            }
                                         );

            //referral coupon
            //if TokenHash referral is null, they're making a new account.
            //if TokenHash referral is NOT null, give new user a Coupon value and add it to their Credit.
            // we also want to give the original user (one who referred) the same Coupon value and add it to their Credit.
            if (model.TokenHash != null)
            {
                //retrieve coupon information + token information based on the token hash.
                CouponsDomain userCoupon = TokenService.GetReferralTokenByGuid(model.TokenHash);
                if (userCoupon.Token.Used == null)
                {
                    //send token to Credit service
                    UserCreditsRequest insertRefferalCredits = new UserCreditsRequest();

                    //send credits to new User who was referred
                    insertRefferalCredits.Amount          = userCoupon.CouponValue;
                    insertRefferalCredits.TransactionType = "Add";
                    insertRefferalCredits.UserId          = userId;
                    _CreditsService.InsertUserCredits(insertRefferalCredits);

                    //send credits to Friend who referred new user BUT ONLY AFTER THE REFERRED FRIEND HAS COMPLETED THEIR FIRST ORDER----
                    //see BrainTreeService, Line 130
                }
            }

            //Activity Services - update the activity log
            ActivityLogRequest Activity = new ActivityLogRequest();

            Activity.ActivityType = ActivityTypeId.NewAccount;
            _ActivityLogService.InsertActivityToLog(userId, Activity);

            //Associating a User to website(s)
            Website w    = null;
            string  Slug = model.Slug;

            w = WebsiteService.GetWebsiteIdBySlug(Slug);

            int[] WebsiteIds = new int[1];
            WebsiteIds[0] = w.Id;

            UserWebsite userWebsite = new UserWebsite();

            userWebsite.UserId     = userId;
            userWebsite.WebsiteIds = WebsiteIds;
            WebsiteService.AddUserToWebsite(userWebsite);

            //creae a new Customer role
            UserProfile aspUser = new UserProfile();

            aspUser.FirstName = model.FirstName;
            aspUser.LastName  = model.LastName;
            aspUser.RoleId    = ConfigService.CustomerRole;

            _AdminService.CreateUserRole(userId, aspUser);

            //create a new Braintree account using UserID
            CustomerPaymentRequest Payment = new CustomerPaymentRequest();

            Payment.FirstName = model.FirstName;
            Payment.LastName  = model.LastName;
            Payment.UserId    = userId;
            Payment.Phone     = model.Phone;

            //Send a confirmation Text Msg
            string UserSMSToken = TokenSMSService.TokenSMSInsert(userId);
            //send a text msg
            NotifySMSRequest NotifyCustomer = new NotifySMSRequest();

            NotifyCustomer.Phone    = model.Phone;
            NotifyCustomer.TokenSMS = UserSMSToken;

            try
            {
                NotifySMSService.SendConfirmText(NotifyCustomer);
            }
            catch (ArgumentException /*ex*/)
            {
                DeleteUserProfileByUserId(userId);
                DeleteUserWebsiteByUserId(userId);
                DeleteAspNetUserByUserId(userId);

                throw new System.ArgumentException(ex.Message);
            }

            //send a confirmation email
            _EmailService.SendProfileEmail(userTokenGuid, model.Email);

            //bringg create account
            RegisterBringgRequest bringgRequest = new RegisterBringgRequest();

            bringgRequest.Name   = model.FirstName + " " + model.LastName;
            bringgRequest.Phone  = model.Phone;
            bringgRequest.Email  = model.Email;
            bringgRequest.UserId = userId;
            this._CreateCustomerTask.Execute(bringgRequest);



            _CreateCustomerTask.Execute(bringgRequest);

            BrainTreeService brainTree = new BrainTreeService();

            brainTree.newCustomerInsert(Payment);

            ////generate a new token
            Guid userTokenGuid = TokenService.tokenInsert(userId);

            //send a confirmation email

            _EmailService.SendProfileEmail(userTokenGuid, model.Email, model.Slug);
        }