Пример #1
0
        private static void Test_UpdateBankAccount()
        {
            Console.Write("[{0}] Testing update bank account from customer... ", Timestamp);
            var    stripe = new StripeService(API_KEY);
            string newAccountHolderName = Guid.NewGuid().ToString();

            BankAccount bankAccount = stripe.UpdateBankAccountAsync(
                _testCustomerId,
                _testBankAccountId,
                newAccountHolderName,
                AccountHolderType.Company).Result;

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

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

            if (bankAccount.AccountHolderName != newAccountHolderName)
            {
                Console.WriteLine();
                throw new TestFailedException("Update bank account failed: account holder names differ");
            }
            if (bankAccount.AccountHolderType != AccountHolderType.Company)
            {
                Console.WriteLine();
                throw new TestFailedException("Update bank account failed: account holder types differ");
            }

            Console.WriteLine("pass");
        }