Exemple #1
0
        private static void GetAllCardsFromProfile()
        {
            Console.WriteLine("Get all Cards from Profile... ");

            ProfileResponse response = _bambora.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = _bambora.Profiles.GetProfile(response.Id);

            response = profile.AddCard(_bambora.Profiles, new Card {
                Name        = "Jane Doe",
                Number      = "4030000010001234",
                ExpiryMonth = "03",
                ExpiryYear  = "22",
                Cvd         = "123"
            });
            Console.WriteLine("Added card to profile");
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            // get all cards
            IList <Card> cards = profile.getCards(_bambora.Profiles);

            Assert.NotNull(cards);
            Assert.AreEqual(2, cards.Count);
            Assert.AreEqual(1, cards[0].Id);
            Assert.AreEqual(2, cards[1].Id);
            Console.WriteLine("Retrieved " + cards.Count + " cards from profile.");
            Console.WriteLine("Card 1 expiry year: " + cards[0].ExpiryYear);
            Console.WriteLine("Card 2 expiry year: " + cards[1].ExpiryYear);

            // delete it so when we create a profile again with the same card we won't get an error
            _bambora.Profiles.DeleteProfile(response.Id);
        }
Exemple #2
0
        private static void GetAllCardsFromProfile()
        {
            Console.WriteLine("Get all Cards from Profile... ");

            Gateway beanstream = new Gateway()
            {
                MerchantId      = 300200578,
                PaymentsApiKey  = "4BaD82D9197b4cc4b70a221911eE9f70",
                ReportingApiKey = "4e6Ff318bee64EA391609de89aD4CF5d",
                ProfilesApiKey  = "D97D3BE1EE964A6193D17A571D9FBC80",
                ApiVersion      = "1"
            };

            ProfileResponse response = beanstream.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = beanstream.Profiles.GetProfile(response.Id);

            response = profile.AddCard(beanstream.Profiles, new Card {
                Name        = "Jane Doe",
                Number      = "4030000010001234",
                ExpiryMonth = "03",
                ExpiryYear  = "22",
                Cvd         = "123"
            });
            Console.WriteLine("Added card to profile");
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            // get all cards
            IList <Card> cards = profile.getCards(beanstream.Profiles);

            Assert.NotNull(cards);
            Assert.AreEqual(2, cards.Count);
            Assert.AreEqual(1, cards[0].Id);
            Assert.AreEqual(2, cards[1].Id);
            Console.WriteLine("Retrieved " + cards.Count + " cards from profile.");
            Console.WriteLine("Card 1 expiry year: " + cards[0].ExpiryYear);
            Console.WriteLine("Card 2 expiry year: " + cards[1].ExpiryYear);

            // delete it so when we create a profile again with the same card we won't get an error
            beanstream.Profiles.DeleteProfile(response.Id);
        }