Esempio n. 1
0
        private static void Test_UpdateCard()
        {
            Console.Write("[{0}] Testing update card on customer... ", Timestamp);
            var    stripe     = new StripeService(API_KEY);
            string newCity    = "Testing City";
            string newLineOne = "123 Address St";
            string newZip     = "78729";

            Card card = stripe.UpdateCardAsync(
                _testCustomerId,
                _testCardId,
                city: newCity,
                lineOne: newLineOne,
                zip: newZip).Result;

            if (card == null)
            {
                Console.WriteLine();
                if (!stripe.HasError)
                {
                    throw new TestFailedException("Update card failed for unknown reasons.");
                }

                throw new TestFailedException("Update card failed ({0}): {1} {2}",
                                              stripe.Error.Type,
                                              stripe.Error.Message,
                                              stripe.Error.Parameter);
            }

            if (card.AddressZip != newZip)
            {
                throw new TestFailedException("Update card failed: zip is not equal");
            }
            if (card.AddressCity != newCity)
            {
                throw new TestFailedException("Update card failed: city is not equal");
            }
            if (card.AddressLineOne != newLineOne)
            {
                throw new TestFailedException("Update card failed: line1 is not equal");
            }

            Console.WriteLine("pass");
        }