public CreditCardInfo(CreditCardTypes creditCardType, string creditCardNumber, string cVV2Number, DateTime expirationDate)
 {
     Type = creditCardType;
     CreditCardNumber = creditCardNumber;
     Cvv2Number = cVV2Number;
     ExpirationDate = expirationDate;
 }
示例#2
0
        public CardTypeDetails(CreditCardTypes CreditCardType, bool WithGuarantor)
        {
            this.CardTypeID                     = 0;
            this.CardTypeCode                   = string.Empty;
            this.CardTypeName                   = string.Empty;
            this.CreditFinanceCharge            = 0;
            this.CreditLatePenaltyCharge        = 0;
            this.CreditMinimumAmountDue         = 0;
            this.CreditMinimumPercentageDue     = 0;
            this.CreditFinanceCharge15th        = 0;
            this.CreditLatePenaltyCharge15th    = 0;
            this.CreditMinimumAmountDue15th     = 0;
            this.CreditMinimumPercentageDue15th = 0;
            this.CreditPurcStartDateToProcess   = Constants.C_DATE_MIN_VALUE;
            this.CreditPurcEndDateToProcess     = Constants.C_DATE_MIN_VALUE;
            this.CreditCutOffDate               = Constants.C_DATE_MIN_VALUE;
            this.CreditCardType                 = CreditCardType;
            this.WithGuarantor                  = WithGuarantor;
            this.ExemptInTerminalCharge         = false;
            this.BillingDate                    = Constants.C_DATE_MIN_VALUE;
            this.CreatedOn    = DateTime.Now;
            this.LastModified = DateTime.Now;

            this.CheckGuarantor = true;
        }
示例#3
0
        public CardTypeDetails(CreditCardTypes CreditCardType, bool WithGuarantor)
        {
            this.CardTypeID = 0;
            this.CardTypeCode = string.Empty;
            this.CardTypeName = string.Empty;
            this.CreditFinanceCharge = 0;
            this.CreditLatePenaltyCharge = 0;
            this.CreditMinimumAmountDue = 0;
            this.CreditMinimumPercentageDue = 0;
            this.CreditFinanceCharge15th = 0;
            this.CreditLatePenaltyCharge15th = 0;
            this.CreditMinimumAmountDue15th = 0;
            this.CreditMinimumPercentageDue15th = 0;
            this.CreditPurcStartDateToProcess = Constants.C_DATE_MIN_VALUE;
            this.CreditPurcEndDateToProcess = Constants.C_DATE_MIN_VALUE;
            this.CreditCutOffDate = Constants.C_DATE_MIN_VALUE;
            this.CreditCardType = CreditCardType;
            this.WithGuarantor = WithGuarantor;
            this.ExemptInTerminalCharge = false;
            this.BillingDate = Constants.C_DATE_MIN_VALUE;
            this.CreatedOn = DateTime.Now;
            this.LastModified = DateTime.Now;

            this.CheckGuarantor = true;
        }
示例#4
0
 internal CreditCardType(CreditCardTypes type, string name, string shortName, string prefix, int length, string spacing)
 {
     Type           = type;
     Name           = name;
     ShortName      = shortName;
     Prefix         = prefix;
     Length         = length;
     SpacingPattern = spacing;
 }
 public CreditCardTypeAttribute(CreditCardTypes types = (CreditCardTypes) ~0)
 {
     this.types = types;
 }
示例#6
0
        public static bool GetTenderAndCardTypeFromOpCode(
            string opCode,
            out TenderTypes tType,
            out CreditCardTypes cType,
            out DebitCardTypes dType,
            out bool isInbound)
        {
            tType     = TenderTypes.CASHIN;
            cType     = CreditCardTypes.VISA;
            dType     = DebitCardTypes.VISA;
            isInbound = true;

            if (string.IsNullOrEmpty(opCode))
            {
                return(false);
            }

            if (opCode == "RDEBIT")
            {
                tType     = TenderTypes.CASHOUT;
                isInbound = false;
            }
            else if (opCode == "RCREDIT")
            {
                tType = TenderTypes.CASHIN;
            }
            else if (opCode == "PCOUT")
            {
                tType     = TenderTypes.CHECK;
                isInbound = false;
            }
            else if (opCode == "DCIN")
            {
                tType = TenderTypes.DEBITCARD;
                dType = DebitCardTypes.OTHER;
            }
            else if (opCode == "DCOUT")
            {
                tType     = TenderTypes.DEBITCARD;
                dType     = DebitCardTypes.OTHER;
                isInbound = false;
            }
            else if (opCode == "AMEXCCOUT")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.AMEX;
                isInbound = false;
            }
            else if (opCode == "VSCCOUT")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.VISA;
                isInbound = false;
            }
            else if (opCode == "MCCCOUT")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.MASTERCARD;
                isInbound = false;
            }
            else if (opCode == "DSCCOUT")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.DISCOVER;
                isInbound = false;
            }
            else if (opCode == "VSDCOUT")
            {
                tType     = TenderTypes.DEBITCARD;
                dType     = DebitCardTypes.VISA;
                isInbound = false;
            }
            else if (opCode == "MCDCOUT")
            {
                tType     = TenderTypes.DEBITCARD;
                dType     = DebitCardTypes.MASTERCARD;
                isInbound = false;
            }
            else if (opCode == "CDOUT")
            {
                tType     = TenderTypes.COUPON;
                isInbound = false;
            }
            else if (opCode == "PPOUT")
            {
                tType     = TenderTypes.PAYPAL;
                isInbound = false;
            }
            else if (opCode == "PCIN")
            {
                tType     = TenderTypes.CHECK;
                isInbound = true;
            }
            else if (opCode == "AMEXCCIN")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.AMEX;
                isInbound = true;
            }
            else if (opCode == "VSCCIN")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.VISA;
                isInbound = true;
            }
            else if (opCode == "MCCCIN")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.MASTERCARD;
                isInbound = true;
            }
            else if (opCode == "DSCCIN")
            {
                tType     = TenderTypes.CREDITCARD;
                cType     = CreditCardTypes.DISCOVER;
                isInbound = true;
            }
            else if (opCode == "VSDCIN")
            {
                tType     = TenderTypes.DEBITCARD;
                dType     = DebitCardTypes.VISA;
                isInbound = true;
            }
            else if (opCode == "MCDCIN")
            {
                tType     = TenderTypes.DEBITCARD;
                dType     = DebitCardTypes.MASTERCARD;
                isInbound = true;
            }
            else if (opCode == "CDIN")
            {
                tType     = TenderTypes.COUPON;
                isInbound = true;
            }
            else if (opCode == "PPIN")
            {
                tType     = TenderTypes.PAYPAL;
                isInbound = true;
            }
            else if (opCode == "SCIN")
            {
                tType     = TenderTypes.STORECREDIT;
                isInbound = false;
            }
            else if (opCode == "SCOUT")
            {
                tType     = TenderTypes.STORECREDIT;
                isInbound = true;
            }
            else
            {
                return(false);
            }

            return(true);
        }
        public static void EnsureSeedDataForContext(this EbuyContext context)
        {
            #region Products,Categories,Authors
            if (!context.Products.Any())
            {
                var bogo1 = new Bogo()
                {
                    BogoId = 1, BogoLevel = 1
                };
                var bogo2 = new Bogo()
                {
                    BogoId = 2, BogoLevel = 2
                };
                var bogo3 = new Bogo()
                {
                    BogoId = 3, BogoLevel = 3
                };
                var bogo4 = new Bogo()
                {
                    BogoId = 4, BogoLevel = 4
                };

                var p1 = new Product()
                {
                    Category = new Category()
                    {
                        CategoryId   = (int)CategoryType.Book,
                        CategoryType = CategoryType.Book
                    },
                    Title  = "Harry Potter and the Sorcerer's Stone",
                    Author = new Author()
                    {
                        AuthorId   = 12345,
                        AuthorName = "J K Rolling"
                    },
                    PublicationDate = new DateTime(1998, 7, 2),
                    ProductAbstract = "aa",
                    Price           = 200,
                    Bogo            = bogo1
                };

                var p2 = new Product()
                {
                    Category = new Category()
                    {
                        CategoryId   = (int)CategoryType.Book,
                        CategoryType = CategoryType.Book
                    },
                    Title  = "The Hunger Games",
                    Author = new Author()
                    {
                        AuthorId   = 3928,
                        AuthorName = "Suzanne Collins"
                    },
                    PublicationDate = new DateTime(2006, 6, 21),
                    ProductAbstract = "aa",
                    Price           = 150,
                    Bogo            = bogo2
                };

                var p3 = new Product()
                {
                    Category = new Category()
                    {
                        CategoryId   = (int)CategoryType.Book,
                        CategoryType = CategoryType.Book
                    },
                    Title  = "The Book Thief",
                    Author = new Author()
                    {
                        AuthorId   = 3948,
                        AuthorName = "Markus Zusak"
                    },
                    PublicationDate = new DateTime(1993, 12, 7),
                    ProductAbstract = "aa",
                    Price           = 170,
                    Bogo            = bogo3
                };

                var p4 = new Product()
                {
                    Category = new Category()
                    {
                        CategoryId   = (int)CategoryType.Article,
                        CategoryType = CategoryType.Article
                    },
                    Title  = "Twilight",
                    Author = new Author()
                    {
                        AuthorId   = 2938,
                        AuthorName = "Stephenie Meyer"
                    },
                    PublicationDate = new DateTime(2012, 6, 4),
                    ProductAbstract = "aa",
                    Price           = 210,
                    Bogo            = bogo4
                };
                var p5 = new Product()
                {
                    Category = new Category()
                    {
                        CategoryId   = (int)CategoryType.Book,
                        CategoryType = CategoryType.Book
                    },
                    Title  = "Harry Potter and the Chamber of Secrets",
                    Author = new Author()
                    {
                        AuthorId   = 12345,
                        AuthorName = "J K Rolling"
                    },
                    PublicationDate = new DateTime(1999, 7, 2),
                    ProductAbstract = "aa",
                    Price           = 200,
                    Bogo            = bogo1
                };

                var products = new List <Product>()
                {
                    p1, p2, p3, p4, p5
                };
                context.Products.AddRange(products);
                context.SaveChanges();
            }
            #endregion

            #region DeliveryModes
            if (!context.DeliveryModes.Any())
            {
                var deliveryMode1 = new DeliveryModes()
                {
                    ModeId = (int)DeliveryMode.electronically,
                    Mode   = DeliveryMode.electronically
                };
                var deliveryMode2 = new DeliveryModes()
                {
                    ModeId = (int)DeliveryMode.hard,
                    Mode   = DeliveryMode.hard
                };
                var deliverymodes = new List <DeliveryModes>()
                {
                    deliveryMode1, deliveryMode2
                };
                context.DeliveryModes.AddRange(deliverymodes);
                context.SaveChanges();
            }
            #endregion

            #region Areas, Countries

            if (!context.CountryAreas.Any())
            {
                var area1 = new ShipmentArea()
                {
                    ShipmentAreaId = 1,
                    Area           = "North America"
                };

                var area2 = new ShipmentArea()
                {
                    ShipmentAreaId = 2,
                    Area           = "Asia"
                };

                var area3 = new ShipmentArea()
                {
                    ShipmentAreaId = 3,
                    Area           = "Europe"
                };

                var area4 = new ShipmentArea()
                {
                    ShipmentAreaId = 4,
                    Area           = "Australia"
                };


                var country1 = new CountryArea()
                {
                    //CountryId = 1,
                    Country      = "USA",
                    ShipmentArea = area1
                };
                var country2 = new CountryArea()
                {
                    //CountryId = 2,
                    Country      = "Canada",
                    ShipmentArea = area1
                };
                var country3 = new CountryArea()
                {
                    //CountryId = 3,
                    Country      = "Israel",
                    ShipmentArea = area2
                };
                var country4 = new CountryArea()
                {
                    //CountryId = 4,
                    Country      = "Japan",
                    ShipmentArea = area2
                };
                var country5 = new CountryArea()
                {
                    //CountryId = 5,
                    Country      = "China",
                    ShipmentArea = area2
                };
                var country6 = new CountryArea()
                {
                    //CountryId = 6,
                    Country      = "Germany",
                    ShipmentArea = area3
                };
                var country7 = new CountryArea()
                {
                    //CountryId = 7,
                    Country      = "Italy",
                    ShipmentArea = area3
                };
                var country8 = new CountryArea()
                {
                    //CountryId = 8,
                    Country      = "Australia",
                    ShipmentArea = new ShipmentArea()
                    {
                        ShipmentAreaId = 4,
                        Area           = "Australia"
                    }
                };
                var _countryAreas = new List <CountryArea>()
                {
                    country1, country2, country3, country4, country5, country6, country7, country8
                };

                var company1 = new ShipmentCompany()
                {
                    ShipmentCompanyId = 1,
                    CompanyName       = "Fedex"
                };
                var company2 = new ShipmentCompany()
                {
                    ShipmentCompanyId = 2,
                    CompanyName       = "PickPack"
                };
                var company3 = new ShipmentCompany()
                {
                    ShipmentCompanyId = 3,
                    CompanyName       = "HFD"
                };
                var company4 = new ShipmentCompany()
                {
                    ShipmentCompanyId = 4,
                    CompanyName       = "DHL"
                };
                var companies = new List <ShipmentCompany>()
                {
                    company1, company2, company3, company4
                };

                var shipmentOption1 = new ShipmentOptions()
                {
                    ShipmentOptionId = (int)ShipmentOption.AirStandard,
                    ShipmentOption   = ShipmentOption.AirStandard
                };
                var shipmentOption2 = new ShipmentOptions()
                {
                    ShipmentOptionId = (int)ShipmentOption.AirExpress,
                    ShipmentOption   = ShipmentOption.AirExpress
                };
                var shipmentOption3 = new ShipmentOptions()
                {
                    ShipmentOptionId = (int)ShipmentOption.Boat,
                    ShipmentOption   = ShipmentOption.Boat
                };

                var _shipmentOptions = new List <ShipmentOptions>()
                {
                    shipmentOption1, shipmentOption2, shipmentOption3
                };

                var shipmentPrice1 = new ShipmentPrice()
                {
                    ShipmentArea     = area1,
                    ShipmentOption   = shipmentOption1,
                    ShipmentCompany  = company1,
                    BasicCharge      = 500,
                    ShipmentDuration = 7
                };
                var shipmentPrice2 = new ShipmentPrice()
                {
                    ShipmentArea     = area2,
                    ShipmentOption   = shipmentOption1,
                    ShipmentCompany  = company1,
                    BasicCharge      = 1500,
                    ShipmentDuration = 5
                };
                var shipmentPrice3 = new ShipmentPrice()
                {
                    ShipmentArea     = area2,
                    ShipmentOption   = shipmentOption2,
                    ShipmentCompany  = company2,
                    BasicCharge      = 2000,
                    ShipmentDuration = 2
                };
                var shipmentPrice4 = new ShipmentPrice()
                {
                    ShipmentArea     = area3,
                    ShipmentOption   = shipmentOption3,
                    ShipmentCompany  = company3,
                    BasicCharge      = 1700,
                    ShipmentDuration = 5
                };
                var shipmentPrice5 = new ShipmentPrice()
                {
                    ShipmentArea     = area4,
                    ShipmentOption   = shipmentOption3,
                    ShipmentCompany  = company3,
                    BasicCharge      = 1000,
                    ShipmentDuration = 6
                };
                var shipmentPrice6 = new ShipmentPrice()
                {
                    ShipmentArea     = area4,
                    ShipmentOption   = shipmentOption1,
                    ShipmentCompany  = company4,
                    BasicCharge      = 3000,
                    ShipmentDuration = 5
                };
                var _shipmentPrice = new List <ShipmentPrice>()
                {
                    shipmentPrice1, shipmentPrice2, shipmentPrice3, shipmentPrice4, shipmentPrice5, shipmentPrice6
                };
                var member = new ClubMember()
                {
                    City     = "Tel Aviv",
                    MemberId = 2009558205,
                    //Customer = new Customer()
                    //{
                    //	CustomerId = 2009558205,
                    //	IsClubMember = true
                    //},
                    //Country = new CountryArea()
                    //{
                    //	CountryId = 3,
                    //	Country = "Israel"
                    //},
                    Email             = "*****@*****.**",
                    LoginName         = "orrmorad",
                    Password          = "******",
                    FirstRegistration = new DateTime(),
                    HouseNumber       = 1,
                    Street            = "Habaron Hirsh",
                    Phone             = "0509815894"
                };
                country3.ClubMembers.Add(member);
                context.CountryAreas.AddRange(_countryAreas);
                context.ShipmentCompanies.AddRange(companies);
                context.ShipmentOptions.AddRange(_shipmentOptions);
                context.ShipmentPrices.AddRange(_shipmentPrice);
                context.SaveChanges();
            }

            if (!context.CreditCardTypes.Any())
            {
                var card1 = new CreditCardTypes()
                {
                    Type   = CreditCardType.AmericanExpress,
                    Prefix = 1234
                };

                var card2 = new CreditCardTypes()
                {
                    Type   = CreditCardType.Mastercard,
                    Prefix = 5326
                };

                var card3 = new CreditCardTypes()
                {
                    Type   = CreditCardType.Visa,
                    Prefix = 5678
                };
                var cards = new List <CreditCardTypes>()
                {
                    card1, card2, card3
                };
                context.CreditCardTypes.AddRange(cards);
                context.SaveChanges();
            }

            #endregion
        }
示例#8
0
 /// <summary>
 /// Determines whether the specified credit card number is valid. Does not validate the check digit.
 /// </summary>
 /// <param name="creditCardNumber">The credit card number.</param>
 /// <param name="validTypes">The valid types.</param>
 /// <returns>
 ///     <c>true</c> if the specified credit card number is valid; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsValid(string creditCardNumber, CreditCardTypes validTypes)
 {
     return((GetType(creditCardNumber) & validTypes) != 0);
 }
示例#9
0
 /// <summary>
 /// Determines whether the specified credit card number is valid.
 /// </summary>
 /// <param name="creditCardNumber">The credit card number.</param>
 /// <param name="validTypes">The valid types.</param>
 /// <param name="validateCheckDigit">if set to <c>true</c> validate the check digit.</param>
 /// <returns>
 ///     <c>true</c> if the specified credit card number is valid; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsValid(string creditCardNumber, CreditCardTypes validTypes, bool validateCheckDigit)
 {
     return(IsValid(creditCardNumber, validTypes) && (validateCheckDigit || IsCheckDigitValid(creditCardNumber)));
 }
示例#10
0
 /// <summary>
 /// Determines whether the specified credit card number is valid. Does not validate the check digit.
 /// </summary>
 /// <param name="creditCardNumber">The credit card number.</param>
 /// <param name="validTypes">The valid types.</param>
 /// <returns>
 /// 	<c>true</c> if the specified credit card number is valid; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsValid(string creditCardNumber, CreditCardTypes validTypes)
 {
     return (GetType(creditCardNumber) & validTypes) != 0;
 }
示例#11
0
 /// <summary>
 /// Determines whether the specified credit card number is valid.
 /// </summary>
 /// <param name="creditCardNumber">The credit card number.</param>
 /// <param name="validTypes">The valid types.</param>
 /// <param name="validateCheckDigit">if set to <c>true</c> validate the check digit.</param>
 /// <returns>
 /// 	<c>true</c> if the specified credit card number is valid; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsValid(string creditCardNumber, CreditCardTypes validTypes, bool validateCheckDigit)
 {
     return IsValid(creditCardNumber, validTypes) && (validateCheckDigit || IsCheckDigitValid(creditCardNumber));
 }
示例#12
0
 internal CreditCard(Chance chance, CreditCardTypes types = (CreditCardTypes) ~0)
 {
     TypeInfo       = chance.CreditCardType(types);
     Number         = chance.CreditCardNumber(TypeInfo.Type);
     ExpirationDate = chance.ExpirationDate();
 }