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

            Card card = stripe.AddCardAsync(
                _testCustomerId,
                7,
                DateTime.Now.AddYears(3).Year,
                123,
                "424242424242s242",
                "123 Address St",
                null,
                "Austin",
                "78729",
                "TX").Result;

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

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

            _testCardId = card.Id;

            Console.WriteLine("pass");
        }
コード例 #2
0
ファイル: Test.cs プロジェクト: mattschwartz/stripe.net
        public static void Main(string[] args)
        {
            try {
                var  stripe = new StripeService(API_KEY);
                Card card   = stripe.AddCardAsync(
                    "cus_9uJl7IpB8QLBYi",
                    7,
                    DateTime.Now.AddYears(3).Year,
                    123,
                    "4242424242424242",
                    "123 Address St",
                    null,
                    "Austin",
                    "78729",
                    "TXASFWQERWQE").Result;
                //Test_CreateCustomer();
                //Test_CreateDuplicateCustomer();
                //Test_FetchCustomer();

                //Test_AddCardToCustomer();
                //Test_FetchCard();
                //Test_UpdateCard();

                //Test_AddBankAccountToCustomer();
                //Test_FetchBankAccount();
                //Test_UpdateBankAccount();

                //Test_CreateCharge();

                //Test_DeleteCard();
                //Test_DeleteBankAccount();
            } catch (TestFailedException ex) {
                Console.WriteLine("[{0}]: {1}", Timestamp, ex.Message);
            } catch (Exception ex) {
                Console.WriteLine("[{0}] Unexpected exception: {1}\nInner Message: {2}\nStack Trace: {3}",
                                  Timestamp,
                                  ex.Message,
                                  ex.InnerException?.Message ?? "None",
                                  ex.StackTrace);
            }

            Console.WriteLine("Done...");
            Console.ReadLine();
        }