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); }
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); }
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); } }
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); }