Пример #1
0
        public static CardToken InitCardToken(string token, string consumerToken, string cv2, CardBase.CardType cardType, string expiryDate = null, string firstSix = null, string lastfour = null)
        {
            CardToken cd = new CardToken();

            cd.Token = token;
            cd.ConsumerToken = consumerToken;

            int cv2Number;

            if (!int.TryParse(cv2, out cv2Number))
            {
                throw new InvalidDataException("CV2");
            }

            cd.CardType = cardType;
            cd.ExpiryDate = expiryDate;
            cd.CardFirstSix = firstSix;
            cd.CardLastFour = lastfour;

            cd.IsValidCard();

            return cd;
        }
Пример #2
0
 internal static string GetExpiryAndValidationErrorMessage(CardBase.CardType cardType)
 {
     switch (cardType)
     {
         case CardBase.CardType.AMEX:
             return AMEX_EXPIRY_AND_VALIDATION_ERROR_MESSAGE;
         default:
             return REGULAR_EXPIRY_AND_VALIDATION_ERROR_MESSAGE;
     }
 }
Пример #3
0
 internal static string GetExpiryAndValidationHintFormat(CardBase.CardType cardType)
 {
     switch (cardType)
     {
         case CardBase.CardType.AMEX:
             return AMEX_EXPIRY_AND_VALIDATION_FORMAT_HINT;
         default:
             return REGULAR_EXPIRY_AND_VALIDATION_FORMAT_HINT;
     }
 }
Пример #4
0
 internal static string GetCardHintFormat(CardBase.CardType cardType)
 {
     switch (cardType)
     {
         case CardBase.CardType.AMEX:
             return AMEX_CARD_FORMAT_HINT;
         default:
             return REGULAR_CARD_FORMAT_HINT;
     }
 }
Пример #5
0
 internal static int GetCardResourceId(Context context, CardBase.CardType cardType, bool showFront)
 {
     if (showFront)
     {
         switch (cardType)
         {
             case CardBase.CardType.VISA:
                 return Resource.Drawable.ic_card_visa;
             case CardBase.CardType.MASTERCARD:
                 return Resource.Drawable.ic_card_mastercard;
             case CardBase.CardType.AMEX:
                 return Resource.Drawable.ic_card_amex;
             case CardBase.CardType.MASTRO:
                 return Resource.Drawable.ic_card_maestro;
             case CardBase.CardType.UNKNOWN:
             default:
                 return Resource.Drawable.ic_card_unknown;
         }
     }
     else
     {
         switch (cardType)
         {
             case CardBase.CardType.AMEX:
                 return Resource.Drawable.ic_card_cv2_amex;
             default:
                 return Resource.Drawable.ic_card_cv2;
         }
     }
 }
Пример #6
0
 public void SetCardType(CardBase.CardType cardType)
 {
     SetCardImageWithoutAnimation(JudoSDKManager.GetCardResourceId(Context, cardType, true));            
 }
Пример #7
0
 public void SetCardType(CardBase.CardType cardType)
 {
     cv2TextView.SetHintText(JudoSDKManager.GetExpiryAndValidationHintFormat(cardType));
     cv2TextView.SetInputFilter("/");
     cv2TextView.SetErrorText(JudoSDKManager.GetExpiryAndValidationErrorMessage(cardType));
     SetCardImageWithoutAnimation(JudoSDKManager.GetCardResourceId(Context, cardType, false));
 }