コード例 #1
0
ファイル: Test.cs プロジェクト: mattschwartz/stripe.net
        private static void Test_FetchCustomer()
        {
            Console.Write("[{0}] Testing fetch customer... ", Timestamp);
            var stripe = new StripeService(API_KEY);

            Customer customer = stripe.GetCustomerAsync(_testCustomerId).Result;

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

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

            if (customer.Email != SAMPLE_CUSTOMER_EMAIL)
            {
                throw new TestFailedException("Fetched customer has different email.");
            }

            Console.WriteLine("pass");
        }