예제 #1
0
        private bool TokenizeData(string cardNumber, out TokenizedCard token)
        {
            bool tokenized = false;

            token = new TokenizedCard(string.Empty);

            var proxy = new TokenizationServiceProxy();

            try
            {
                proxy.Open();
                Herbalife.HPS.Tokenization.TokenizedCard card = proxy.Tokenize(cardNumber);
                token.Token         = card.Token;
                token.FailureReason = card.FailureReason;
                tokenized           = true;
            }
            catch (Exception ex)
            {
                //Whatever
                string s = ex.Message;
            }
            finally
            {
                proxy.Close();
            }

            return(tokenized);
        }
예제 #2
0
        public TokenizedCard Tokenize(TokenizeRequest request)
        {
            var    tokenizedCard = new TokenizedCard(string.Empty);
            string cardNumber    = request.CardNumber.Trim();
            string token         = string.Empty;

            TokenizeData(cardNumber, out tokenizedCard);

            return(tokenizedCard);
        }
예제 #3
0
 public TokenizedCard Tokenize(TokenizeRequest request)
 {
     try
     {
         return(_underlyingService.Tokenize(request));
     }
     catch (Exception ex)
     {
         var result = new TokenizedCard(string.Empty);
         result.FailureReason = ex.Message;
         return(result);
     }
 }
예제 #4
0
        public TokenizedCard Tokenize(TokenizeRequest request)
        {
            TokenizedCard tokenized = null;
            string        result    = string.Empty;

            if (null != request)
            {
                //var provider = Membership.Provider as MyHlMembershipProvider;
                //if (provider != null &&
                //    !string.IsNullOrEmpty(provider.ValidateToken(request.AuthToken.ToString(), true)))
                {
                    if (string.IsNullOrEmpty(request.CardNumber))
                    {
                        tokenized = new TokenizedCard(string.Empty)
                        {
                            FailureReason = "Null CardNumber Passed"
                        };
                    }
                    else
                    {
                        if (request.CardNumber[1] > 57)
                        {
                            tokenized = new TokenizedCard(request.CardNumber)
                            {
                                FailureReason = "Not a valid Card Number"
                            };
                        }
                        else
                        {
                            tokenized = Service.Tokenize(request);
                        }
                    }
                }
            }
            else
            {
                tokenized = new TokenizedCard(string.Empty)
                {
                    FailureReason = "Null Request"
                };
            }
            return(tokenized);
        }