public StripeAccountServiceTest()
        {
            this.service = new StripeAccountService();

            this.createOptions = new StripeAccountCreateOptions
            {
                Type = StripeAccountType.Custom,
                ExternalCardAccount = new StripeAccountCardOptions()
                {
                    TokenId = "tok_visa_debit"
                },
                LegalEntity = new StripeAccountLegalEntityOptions
                {
                    AdditionalOwners = new List <StripeAccountAdditionalOwner>
                    {
                        new StripeAccountAdditionalOwner
                        {
                            FirstName                = "John",
                            LastName                 = "Doe",
                            BirthDay                 = 1,
                            BirthMonth               = 1,
                            BirthYear                = 1980,
                            VerificationDocument     = "file_123",
                            VerificationDocumentBack = "file_234",
                        },
                        new StripeAccountAdditionalOwner
                        {
                            FirstName  = "Jenny",
                            LastName   = "Rosen",
                            State      = "CA",
                            CityOrTown = "City",
                            Line1      = "Line1",
                            Line2      = "Line2",
                            PostalCode = "90210",
                            Country    = "US",
                        }
                    },
                    VerificationDocumentFileId     = "file_abc",
                    VerificationDocumentFileBackId = "file_bcd",
                }
            };

            this.updateOptions = new StripeAccountUpdateOptions()
            {
                Metadata = new Dictionary <string, string>()
                {
                    { "key", "value" },
                },
            };

            this.rejectOptions = new StripeAccountRejectOptions
            {
                Reason = "terms_of_service"
            };

            this.listOptions = new StripeAccountListOptions()
            {
                Limit = 1,
            };
        }
        public virtual StripeAccount Update(string id, StripeAccountUpdateOptions updateOptions)
        {
            var url = this.ApplyAllParameters(updateOptions, string.Format(Urls.SpecificAccount, id), false);

            var response = Requestor.PostString(url, ApiKey);

            return Mapper<StripeAccount>.MapFromJson(response);
        }
        public virtual StripeAccount Update(string accountId, StripeAccountUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

            var url = string.Format("{0}/{1}", Urls.Accounts, accountId);
            url = this.ApplyAllParameters(updateOptions, url, false);

            var response = Requestor.PostString(url, requestOptions);

            return Mapper<StripeAccount>.MapFromJson(response);
        }
Esempio n. 4
0
        public virtual StripeAccount Update(string accountId, StripeAccountUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

            var url = string.Format("{0}/{1}", Urls.Accounts, accountId);

            url = this.ApplyAllParameters(updateOptions, url, false);

            var response = Requestor.PostString(url, requestOptions);

            return(Mapper <StripeAccount> .MapFromJson(response));
        }
Esempio n. 5
0
        public void AddBankAccount(string idStripeAccount, string token)
        {
            StripeAccountBankAccountOptions bankaccount = new StripeAccountBankAccountOptions();

            bankaccount.TokenId = token;
            var accountOptions = new StripeAccountUpdateOptions()
            {
                ExternalBankAccount = bankaccount
            };

            StripeAccount account = accountService.Update(idStripeAccount, accountOptions);
        }
Esempio n. 6
0
        // Not used for MVP because Stripe standard accounts cant be changed this way, but code left for reference.
        public bool ChangePayoutSettings(int customerId)
        {
            var domain = _customerEntityService.GetOrCreate(customerId);

            var updopts = new StripeAccountUpdateOptions();

            updopts.TransferScheduleDelayDays = "30";
            updopts.TransferScheduleInterval  = "daily";

            var postok = _stripeAccountService.Update(domain.StripeUserId, updopts);

            return(postok.PayoutSchedule.DelayDays == 30 && postok.PayoutSchedule.Interval == "daily");
        }
Esempio n. 7
0
        public AccountPayment UpdateAccountWithLegalEntity(IlevusUser user)
        {
            var accountLocal = Mapper.Map <AccountPayment>(user);
            var legalPayment = Mapper.Map <StripeAccountLegalEntityOptions>(accountLocal);

            var accountUpdateOptions = new StripeAccountUpdateOptions
            {
                TosAcceptanceDate = DateTime.Now,
                TosAcceptanceIp   = GetLocalIPAddress(),
                LegalEntity       = legalPayment
            };

            var account = accountService.Update(accountLocal.Id, accountUpdateOptions);

            return(Mapper.Map <AccountPayment>(account));
        }
Esempio n. 8
0
        public account_fixture()
        {
            // create a file to attach to the additional owner as a verification document
            var fileService = new StripeFileUploadService(Cache.ApiKey);
            var fileStream  = GetType().GetTypeInfo().Assembly.GetManifestResourceStream("Stripe.Tests.Xunit._resources.bumble.jpg");
            var file        = fileService.Create("bumble.jpg", fileStream, StripeFilePurpose.IdentityDocument);

            AccountCreateOptions = new StripeAccountCreateOptions
            {
                BusinessName              = "Subtracts",
                BusinessPrimaryColor      = "#" + new Random().Next(0, 6).ToString("D6"),
                BusinessUrl               = "http://subtracts.io",
                DebitNegativeBalances     = true,
                DeclineChargeOnAvsFailure = false,
                DeclineChargeOnCvcFailure = true,
                DefaultCurrency           = "usd",
                Email               = "*****@*****.**",
                Managed             = true,
                ExternalCardAccount = new StripeAccountCardOptions()
                {
                    AddressCountry     = "US",
                    AddressLine1       = "24 Main St",
                    AddressLine2       = "Apt 24",
                    AddressCity        = "Raleigh",
                    AddressState       = "NC",
                    AddressZip         = "27617",
                    Cvc                = "1223",
                    ExpirationMonth    = "10",
                    ExpirationYear     = "2021",
                    Name               = "Julius Turing",
                    Number             = "4000056655665556",
                    Currency           = "usd",
                    DefaultForCurrency = true
                },
                LegalEntity = new StripeAccountLegalEntityOptions
                {
                    AdditionalOwners = new List <StripeAccountAdditionalOwner>
                    {
                        new StripeAccountAdditionalOwner
                        {
                            FirstName            = "Bumble", LastName = "B",
                            BirthDay             = 29, BirthMonth = 8, BirthYear = 2013,
                            VerificationDocument = file.Id
                        },
                        new StripeAccountAdditionalOwner
                        {
                            FirstName = "Trouble", LastName = "China",
                            State     = "CA", CityOrTown = "RockAndWheat",
                            Line1     = "B", Line2 = "C", PostalCode = "27635",
                            Country   = "US"
                        }
                    }
                }
            };

            AccountUpdateOptions = new StripeAccountUpdateOptions
            {
                BusinessUrl = "https://subtracts.io"
            };

            var service = new StripeAccountService(Cache.ApiKey);

            Account          = service.Create(AccountCreateOptions);
            AccountUpdated   = service.Update(Account.Id, AccountUpdateOptions);
            AccountRetrieved = service.Get(Account.Id);
            AccountList      = service.List();
        }
Esempio n. 9
0
        public account_fixture()
        {
            // create a file to attach to the additional owner as a verification document
            var fileService = new StripeFileUploadService(Cache.ApiKey);
            var fileStream  = GetType().GetTypeInfo().Assembly.GetManifestResourceStream("Stripe.Tests.XUnit._resources.bumble.jpg");
            var file        = fileService.Create("bumble.jpg", fileStream, StripeFilePurpose.IdentityDocument);

            AccountCreateOptions = new StripeAccountCreateOptions
            {
                BusinessName              = "Subtracts",
                BusinessPrimaryColor      = "#" + new Random().Next(0, 6).ToString("D6"),
                BusinessUrl               = "http://subtracts.io",
                DebitNegativeBalances     = true,
                DeclineChargeOnAvsFailure = false,
                DeclineChargeOnCvcFailure = true,
                DefaultCurrency           = "usd",
                Email = "*****@*****.**",
                Type  = StripeAccountType.Custom,
                ExternalCardAccount = new StripeAccountCardOptions()
                {
                    TokenId = "tok_visa_debit"
                },
                LegalEntity = new StripeAccountLegalEntityOptions
                {
                    AdditionalOwners = new List <StripeAccountAdditionalOwner>
                    {
                        new StripeAccountAdditionalOwner
                        {
                            FirstName = "Bumble", LastName = "B",
                            // Ensure the owner is older than 18 to avoid API issues.
                            BirthDay             = 29, BirthMonth = 8, BirthYear = 1980,
                            VerificationDocument = file.Id
                        },
                        new StripeAccountAdditionalOwner
                        {
                            FirstName = "Trouble", LastName = "China",
                            State     = "CA", CityOrTown = "RockAndWheat",
                            Line1     = "B", Line2 = "C", PostalCode = "27635",
                            Country   = "US"
                        }
                    }
                }
            };

            AccountUpdateOptions = new StripeAccountUpdateOptions
            {
                BusinessUrl = "https://subtracts.io"
            };

            var _rejectOptions = new StripeAccountRejectOptions
            {
                Reason = "terms_of_service"
            };

            var service = new StripeAccountService(Cache.ApiKey);

            Account          = service.Create(AccountCreateOptions);
            AccountUpdated   = service.Update(Account.Id, AccountUpdateOptions);
            AccountRetrieved = service.Get(Account.Id);
            AccountList      = service.List();
            AccountRejected  = service.Reject(Account.Id, _rejectOptions);
        }