public System.Collections.Generic.List <MerchantTribe.Web.Validation.RuleViolation> GetRuleViolations()
        {
            List <MerchantTribe.Web.Validation.RuleViolation> violations = new List <MerchantTribe.Web.Validation.RuleViolation>();

            // Card Number
            if (CardNumber.StartsWith("****-****-****-"))
            {
            }
            // Ignore for now
            //If paymentId.Trim.Length > 0 Then
            //End If
            //For i As Integer = 0 To thisOrder.Payments.Length - 1
            //    With thisOrder.Payments(i)
            //        If .PaymentType = BVSoftware.BVC.Interfaces.PaymentRecordType.Information Then
            //            If .PaymentMethod = BVSoftware.BVC.Interfaces.PaymentMethod.CreditCard Then
            //                testCardNumber = .CreditCardNumber
            //            End If
            //        End If
            //    End With
            //Next
            else
            {
                CardNumber = MerchantTribe.Payment.CardValidator.CleanCardNumber(CardNumber);
            }

            if ((!MerchantTribe.Payment.CardValidator.IsCardNumberValid(CardNumber)))
            {
                violations.Add(new RuleViolation("Credit Card Number", "", "Please enter a valid credit card number", "cccardnumber"));
            }


            MerchantTribe.Payment.CardType cardTypeCheck = MerchantTribe.Payment.CardValidator.GetCardTypeFromNumber(this.CardNumber);
            List <CardType> acceptedCards = MyPage.MTApp.CurrentStore.Settings.PaymentAcceptedCards;

            if (!acceptedCards.Contains(cardTypeCheck))
            {
                violations.Add(new RuleViolation("Card Type Not Accepted", "", "That card type is not accepted by this store. Please use a different card.", "cccardnumber"));
            }

            ValidationHelper.RequiredMinimum(1, "Card Expiration Year", ExpirationYear, violations, "ccexpyear");
            ValidationHelper.RequiredMinimum(1, "Card Expiration Month", ExpirationMonth, violations, "ccexpmonth");
            ValidationHelper.Required("Name on Card", CardHolderName, violations, "cccardholder");

            if (MyPage.MTApp.CurrentStore.Settings.PaymentCreditCardRequireCVV == true)
            {
                ValidationHelper.RequiredMinimum(3, "Card Security Code", SecurityCode.Length, violations, "ccsecuritycode");
            }

            SetErrorCss(violations);

            return(violations);
        }
 public void CopyToPayment(OrderTransaction ot)
 {
     ot.CreditCard.ExpirationMonth = ExpirationMonth;
     ot.CreditCard.ExpirationYear  = ExpirationYear;
     ot.CreditCard.CardHolderName  = CardHolderName;
     if (CardNumber.StartsWith("*") == false)
     {
         ot.CreditCard.CardNumber = CardNumber;
     }
     ot.CreditCard.SecurityCode = SecurityCode;
     //if (ccissuenumber.Text.Trim() != string.Empty) {
     //    ot.CustomPropertySet("bvsoftware", "issuenumber", ccissuenumber.Text);
     //}
 }
        public MerchantTribe.Payment.CardData GetCardData()
        {
            MerchantTribe.Payment.CardData result = new MerchantTribe.Payment.CardData();
            result.CardHolderName = CardHolderName;
            if (CardNumber.StartsWith("*"))
            {
                result.CardNumber = "";
            }
            else
            {
                result.CardNumber = CardNumber;
            }
            result.SecurityCode    = SecurityCode;
            result.ExpirationMonth = ExpirationMonth;
            result.ExpirationYear  = ExpirationYear;

            return(result);
        }
        public CardData GetCardData()
        {
            var result = new CardData();

            result.CardHolderName = CardHolderName;
            if (CardNumber.StartsWith("*"))
            {
                result.CardNumber = string.Empty;
            }
            else
            {
                result.CardNumber = CardNumber;
            }
            result.SecurityCode    = SecurityCode;
            result.ExpirationMonth = ExpirationMonth;
            result.ExpirationYear  = ExpirationYear;

            return(result);
        }
        public List <RuleViolation> GetRuleViolations()
        {
            var violations = new List <RuleViolation>();

            // Card Number
            if (!CardNumber.StartsWith("****-****-****-"))
            {
                CardNumber = CardValidator.CleanCardNumber(CardNumber);
            }

            if (!CardValidator.IsCardNumberValid(CardNumber))
            {
                violations.Add(new RuleViolation("Credit Card Number", string.Empty, "Please enter a valid credit card number",
                                                 "cccardnumber"));
            }

            var cardTypeCheck = CardValidator.GetCardTypeFromNumber(CardNumber);
            var acceptedCards = HccApp.CurrentStore.Settings.PaymentAcceptedCards;

            if (!acceptedCards.Contains(cardTypeCheck))
            {
                violations.Add(new RuleViolation("Card Type Not Accepted", string.Empty,
                                                 "That card type is not accepted by this store. Please use a different card.", "cccardnumber"));
            }

            ValidationHelper.RequiredMinimum(1, "Card Expiration Year is required", ExpirationYear, violations,
                                             "ccexpyear");
            ValidationHelper.RequiredMinimum(1, "Card Expiration Month is required", ExpirationMonth, violations,
                                             "ccexpmonth");
            ValidationHelper.Required("Name on Card is required", CardHolderName, violations, "cccardholder");

            if (HccApp.CurrentStore.Settings.PaymentCreditCardRequireCVV)
            {
                ValidationHelper.RequiredMinimum(3, "Card Security Code is required", SecurityCode.Length, violations,
                                                 "ccsecuritycode");
            }

            SetErrorCss(violations);

            return(violations);
        }
Example #6
0
        private void LoadCardIgnoreCardLength()
        {
            foreach (var brandData in CreditCardData.BrandsData)
            {
                // CardInfo from one brand.
                var cardInfo = brandData.Value;

                foreach (var rule in cardInfo.Rules)
                {
                    if (rule.Prefixes.Any(c => CardNumber.StartsWith(c)))
                    {
                        Brand     = brandData.Key;
                        BrandName = cardInfo.BrandName;
                        return;
                    }
                }
            }

            Brand     = CardIssuer.Unknown;
            BrandName = CardIssuer.Unknown.ToString();
        }
Example #7
0
 public string PaymentDetailCard()
 {
     if (CardNumber.StartsWith("34") || CardNumber.StartsWith("37"))
     {
         return("American Express");
     }
     else if (CardNumber.StartsWith("36"))
     {
         return("Diners Club - International");
     }
     else if (CardNumber.StartsWith("6011") || CardNumber.StartsWith("644") || CardNumber.StartsWith("645") || CardNumber.StartsWith("646") || CardNumber.StartsWith("647") || CardNumber.StartsWith("648") || CardNumber.StartsWith("649") || CardNumber.StartsWith("65") || CardNumber.StartsWith("622126") || CardNumber.StartsWith("622127") || CardNumber.StartsWith("622128") || CardNumber.StartsWith("622129") || CardNumber.StartsWith("62213") || CardNumber.StartsWith("62214") || CardNumber.StartsWith("62215") || CardNumber.StartsWith("62216") || CardNumber.StartsWith("62217") || CardNumber.StartsWith("62218") || CardNumber.StartsWith("62219") || CardNumber.StartsWith("6222") || CardNumber.StartsWith("6223") || CardNumber.StartsWith("6224") || CardNumber.StartsWith("6225") || CardNumber.StartsWith("6226") || CardNumber.StartsWith("6227") || CardNumber.StartsWith("6228") || CardNumber.StartsWith("62290") || CardNumber.StartsWith("62291") || CardNumber.StartsWith("622920") || CardNumber.StartsWith("622921") || CardNumber.StartsWith("622922") || CardNumber.StartsWith("622923") || CardNumber.StartsWith("622924") || CardNumber.StartsWith("622925"))
     {
         return("Discover");
     }
     else if (CardNumber.StartsWith("637") || CardNumber.StartsWith("638") || CardNumber.StartsWith("639"))
     {
         return("InstaPayment");
     }
     else if (CardNumber.StartsWith("5018") || CardNumber.StartsWith("5020") || CardNumber.StartsWith("5038") || CardNumber.StartsWith("5893") || CardNumber.StartsWith("6304") || CardNumber.StartsWith("6759") || CardNumber.StartsWith("6761") || CardNumber.StartsWith("6762") || CardNumber.StartsWith("6763"))
     {
         return("Maestro");
     }
     else if (CardNumber.StartsWith("51") || CardNumber.StartsWith("52") || CardNumber.StartsWith("53") || CardNumber.StartsWith("54") || CardNumber.StartsWith("55") || CardNumber.StartsWith("2221") || CardNumber.StartsWith("23") || CardNumber.StartsWith("24") || CardNumber.StartsWith("25") || CardNumber.StartsWith("26") || CardNumber.StartsWith("27") || CardNumber.StartsWith("2221") || CardNumber.StartsWith("2222") || CardNumber.StartsWith("2223") || CardNumber.StartsWith("2224") || CardNumber.StartsWith("2225") || CardNumber.StartsWith("2226") || CardNumber.StartsWith("2227") || CardNumber.StartsWith("2228") || CardNumber.StartsWith("2229") || CardNumber.StartsWith("223") || CardNumber.StartsWith("224") || CardNumber.StartsWith("225") || CardNumber.StartsWith("226") || CardNumber.StartsWith("227") || CardNumber.StartsWith("228") || CardNumber.StartsWith("229") || CardNumber.StartsWith("23") || CardNumber.StartsWith("24") || CardNumber.StartsWith("25") || CardNumber.StartsWith("26") || CardNumber.StartsWith("270") || CardNumber.StartsWith("271") || CardNumber.StartsWith("2720"))
     {
         return("MasterCard");
     }
     else if (CardNumber.StartsWith("4") && !CardNumber.StartsWith("4026") && CardNumber != "417500" && CardNumber != "4508" && CardNumber != "4844" && CardNumber != "4913" && CardNumber != "4917")
     {
         return("Visa");
     }
     else if (CardNumber.StartsWith("4026") || CardNumber.StartsWith("417500") || CardNumber.StartsWith("4508") || CardNumber.StartsWith("4844") || CardNumber.StartsWith("4913") || CardNumber.StartsWith("4917"))
     {
         return("Visa Electron");
     }
     else if (CardNumber.StartsWith("3528") || CardNumber.StartsWith("3529") || CardNumber.StartsWith("353") || CardNumber.StartsWith("354") || CardNumber.StartsWith("355") || CardNumber.StartsWith("356") || CardNumber.StartsWith("357") || CardNumber.StartsWith("358"))
     {
         return("JCB");
     }
     return("Sorry card is invalid");
 }
Example #8
0
        public List <RuleViolation> GetRuleViolations()
        {
            var violations = new List <RuleViolation>();

            // Card Number
            if (!CardNumber.StartsWith("****-****-****-"))
            {
                CardNumber = CardValidator.CleanCardNumber(CardNumber);
            }

            if (!CardValidator.IsCardNumberValid(CardNumber))
            {
                violations.Add(new RuleViolation(Localization.GetString("CreditCardNumber"), string.Empty, Localization.GetString("CreditCardMessage"),
                                                 "cccardnumber"));
            }

            var cardTypeCheck = CardValidator.GetCardTypeFromNumber(CardNumber);
            var acceptedCards = HccApp.CurrentStore.Settings.PaymentAcceptedCards;

            if (!acceptedCards.Contains(cardTypeCheck))
            {
                violations.Add(new RuleViolation(Localization.GetString("CardTypeInvalid"), string.Empty,
                                                 Localization.GetString("CardTypeMessage"), "cccardnumber"));
            }

            ValidationHelper.RequiredMinimum(1, Localization.GetString("CardYearRequired"), ExpirationYear, violations,
                                             "ccexpyear");
            ValidationHelper.RequiredMinimum(1, Localization.GetString("CardMonthRequired"), ExpirationMonth, violations,
                                             "ccexpmonth");
            ValidationHelper.Required(Localization.GetString("CardNameRequired"), CardHolderName, violations, "cccardholder");

            if (HccApp.CurrentStore.Settings.PaymentCreditCardRequireCVV)
            {
                ValidationHelper.RequiredMinimum(3, Localization.GetString("CardCodeRequired"), SecurityCode.Length, violations, "ccsecuritycode");
            }

            SetErrorCss(violations);

            return(violations);
        }
Example #9
0
        public async void PaymentDetailCard()
        {
            if (CardNumber.StartsWith("300") || CardNumber.StartsWith("301") || CardNumber.StartsWith("302") || CardNumber.StartsWith("303") || CardNumber.StartsWith("304") || CardNumber.StartsWith("305"))
            {
                ShowDialogBox("Diners Club - Carte Blanche");
            }
            else if (CardNumber.StartsWith("34") || CardNumber.StartsWith("37"))
            {
                ShowDialogBox("American Express");
            }
            else if (CardNumber.StartsWith("36"))
            {
                ShowDialogBox("Diners Club - International");
            }
            else if (CardNumber.StartsWith("54"))
            {
                ShowDialogBox("Diners Club - USA & Canada");
            }
            else if (CardNumber.StartsWith("6011") || CardNumber.StartsWith("644") || CardNumber.StartsWith("645") || CardNumber.StartsWith("646") || CardNumber.StartsWith("647") || CardNumber.StartsWith("648") || CardNumber.StartsWith("649") || CardNumber.StartsWith("65"))
            {
                ShowDialogBox("Discover");
            }
            else if (CardNumber.StartsWith("637") || CardNumber.StartsWith("638") || CardNumber.StartsWith("639"))
            {
                ShowDialogBox("InstaPayment");
            }
            else if (CardNumber.StartsWith(""))
            {
                ShowDialogBox("JCB");
            }
            else if (CardNumber.StartsWith("5018") || CardNumber.StartsWith("5020") || CardNumber.StartsWith("5038") || CardNumber.StartsWith("5893") || CardNumber.StartsWith("6304") || CardNumber.StartsWith("6759") || CardNumber.StartsWith("6761") || CardNumber.StartsWith("6762") || CardNumber.StartsWith("6763"))
            {
                ShowDialogBox("Maestro");
            }
            else if (CardNumber.StartsWith("51") || CardNumber.StartsWith("52") || CardNumber.StartsWith("53") || CardNumber.StartsWith("54") || CardNumber.StartsWith("55"))     // || (272099 <= Convert.ToInt32(CardNumber)  && Convert.ToInt32(CardNumber) <= 222100))
            {
                ShowDialogBox("MasterCard");
            }
            else if (CardNumber.StartsWith("4") && !CardNumber.StartsWith("4026") && CardNumber != "417500" && CardNumber != "4508" && CardNumber != "4844" && CardNumber != "4913" && CardNumber != "4917")
            {
                ShowDialogBox("Visa");
            }
            else if (CardNumber.StartsWith("4026") || CardNumber.StartsWith("417500") || CardNumber.StartsWith("4508") || CardNumber.StartsWith("4844") || CardNumber.StartsWith("4913") || CardNumber.StartsWith("4917"))
            {
                ShowDialogBox("Visa Electron");
            }



            ////if ((SecurityNumber.Length > 3 && SecurityNumber.Length < 4) && (CardNumber.Length == 13 || CardNumber.Length < 14 && CardNumber.Length > 17 || CardNumber.Length == 19))
            //// {
            ////     MsgBox("Payment Accepted");
            //// }



            int currentmonth = DateTime.Now.Month;
            int currentyear  = DateTime.Now.Year;

            if (currentmonth > ExpiryMonth && ExpiryYear > currentyear)
            {
                ShowDialogBox("Sorry. Card is invalid");
            }
        }