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

            BankAccount bankAccount = stripe.AddBankAccountAsync(
                _testCustomerId,
                Guid.NewGuid().ToString(),
                AccountHolderType.Individual,
                "000123456789",
                "110000000").Result;

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

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

            _testBankAccountId = bankAccount.Id;

            Console.WriteLine("pass");
        }