public ActionResult <IEnumerable <string> > Get()
        {
            FraudCheck.Check();
            var currentTime = DateTime.Now;

            return(new string[] { currentTime.ToLongDateString(), currentTime.ToLongTimeString() });
        }
Example #2
0
        public void PurchaseWithFraudCheckShouldBeSuccessful()
        {
            FraudCheck fc = new FraudCheck();

            fc.DeviceID                  = "04003hQUMXGB0poNf94lis1ztjiCqvcbsN56bsuwsjuElyNu8BhUMCZzxJu5KaKrVRoPks+Sl5kZMVA4D1yzhjUZHdETNKeMs9+YWgT+Kx4Epa0/yoVIBnjain3l6hbzqbSTjyylda8tv/p+hOVDTbnr7BCIp0wtRbmoh0ylJGfM1m5dSDvFsQ9SoXAEKkoBeycPTld6LUiJXX9c8V1ZIWK++ykzCGBlggcGImwI4pTgqhbiV4XFveMqjhKePA1UZdKAZDwic+y5/r+SkyAbziDM7k8xAXTS4l7D1erHMnjL6riE+V79BTuQujkd6ANXzYbYiVcAZxPGQ1+WMCVbBcdxP6GA3q0kDinWcD6T1dGUjL/YgLUkuWAapecJ9jsJ+bfNdWTfYwpMVz5nPnl/jsrGjhHT5S5MgyzBqMl2d7573o/ED3HepEpuM5tlG61Ntm9z3eln9a65pRCiBordUO6M2UtezWwdrLOsKoxk0tBb1QXpA0h4C+tFNeowfmZjGrzuOZ8GLqXVxfWKXTaqUhFUi4FfJwjCz3bq72B5V9rdDiApQs/EGzmZL5HExNzY4wQ1n6+4nxW5nei2EMlMtbRnNwQxSxzPuRtycb0H5IjHkCcKSs4KVYKB4vaBnQE/NFveVlaPFRfz06FHDo0vYYDC35oMiutO9ehTdLDs+1JC1RF/uL27xMe3hVD7Hdts8ZIqU94iY2v9RU9XqLz+1vlqUAr9dE2jcfl0IKh8cj1oeYoZWyHUZkZv+34xaHrehirS7kJJzwHUCrewYC25B8PQHIGOUwWaBg2/x+KhHWTEUmltckvXNHlyG7akelk6fL+pVJndmh+e2629zvoSVjNwtsnaE4Ix/18X51W+7h4F0BmjrhSkvcPj8TfvG/6ipNVHqrN0PLhIf+CPI9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mXGhDvUpU3ztcmp8d3l/I1O3LPgQiChrVlaxMD3sFKEHiAjzCeLr/JKgoXy16eGlPDmAXrXEYZfU="; // Will be generated by the deviceID JS library
            fc.Customer.ID               = "ABD123";
            fc.Customer.FirstName        = "James";
            fc.Customer.LastName         = "Smith";
            fc.Customer.Email            = "*****@*****.**";
            fc.Customer.DOB              = null;
            fc.Customer.AddressLine1     = "23 Smith Road";
            fc.Customer.City             = "Canberra";
            fc.Customer.PostCode         = "2600";
            fc.Customer.Country          = "AUS";
            fc.Customer.HomePhone        = "0421858999";
            fc.Customer.ExistingCustomer = true;
            fc.Customer.CreatedAt        = DateTime.Now;

            fc.ShippingAddress.FirstName    = "James";
            fc.ShippingAddress.LastName     = "Smith";
            fc.ShippingAddress.Email        = "*****@*****.**";
            fc.ShippingAddress.AddressLine1 = "23 Smith Road";
            fc.ShippingAddress.City         = "Canberra";
            fc.ShippingAddress.PostCode     = "2600";
            fc.ShippingAddress.Country      = "AUS";
            fc.ShippingAddress.HomePhone    = "0421858999";
            fc.ShippingAddress.ShipMethod   = ShippingMethod.Express;

            var item = new OrderItem();

            item.ProductCode = "9999-A";
            item.SKU         = "9999";
            item.Description = "Widgets";
            item.ItemCost    = 23.30f;
            item.LineTotal   = 23.30f;
            item.Quantity    = 1;

            fc.OrderItems.Add(item);

            var recip = new Recipient();

            recip.FirstName    = "James";
            recip.LastName     = "Smith";
            recip.Email        = "*****@*****.**";
            recip.AddressLine1 = "1 Fairfield Road";
            recip.City         = "Austin";
            recip.State        = "TX";
            recip.PostCode     = "55555-1234";
            recip.Country      = "USA";
            recip.PhoneNumber  = "555-555-55555";

            fc.Recipients.Add(recip);
            fc.Website = "http://www.website.com";

            var response = Purchase.Create(120, "M Smith", "5123456789012346", DateTime.Now.AddYears(1), "123", Guid.NewGuid().ToString(), "123.0.0.1", "AUD", fc);

            Assert.IsTrue(response.Successful);
            Assert.IsTrue(response.Result.Successful);
            Assert.IsNotNull(response.Result.ID);
            Assert.AreEqual(response.Errors.Count, 0);
            Assert.AreEqual(response.Result.Amount, 120);

            Assert.AreEqual(response.Result.DecimalAmount, 1.20);

            Assert.AreEqual(response.Result.CardType, "MasterCard");
            Assert.AreEqual(response.Result.FraudCheckResult, FraudResult.Accept);
        }