public adding_additional_owners() { var newAccount = new StripeAccountService(_stripe_api_key).Create( new StripeAccountCreateOptions { Email = $"*****@*****.**", Managed = true, LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List <StripeAccountAdditionalOwner> { new StripeAccountAdditionalOwner { FirstName = "Big", LastName = "Little", BirthDay = 25, BirthMonth = 12, BirthYear = 2000 }, new StripeAccountAdditionalOwner { FirstName = "Trouble", LastName = "China", State = "CA", CityOrTown = "A", Line1 = "B", Line2 = "C", PostalCode = "27635", Country = "US" } } } } ); RetrievedAccount = new StripeAccountService(_stripe_api_key).Get(newAccount.Id); }
public adding_additional_owner_verification_document() { // create a file var fileService = new StripeFileUploadService(_stripe_api_key); var fileStream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream("Stripe.Tests.Xunit._resources.bumble.jpg"); var file = fileService.Create("bumble.jpg", fileStream, StripeFilePurpose.IdentityDocument); // create the new account with the file as the verification document Account = new StripeAccountService(_stripe_api_key).Create( new StripeAccountCreateOptions { Email = $"*****@*****.**", Managed = true, LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List <StripeAccountAdditionalOwner> { new StripeAccountAdditionalOwner { FirstName = "Bumble", VerificationDocument = file.Id }, } } } ); }
public when_updating_legal_entity_additional_owners() { var newAccount = new StripeAccountService(_stripe_api_key).Create( new StripeAccountCreateOptions { Email = $"merry{ Guid.NewGuid() }@christmas.com", Managed = true, LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List<StripeAccountAdditionalOwner> { new StripeAccountAdditionalOwner { FirstName = "Big", LastName = "Little" }, new StripeAccountAdditionalOwner { FirstName = "Trouble", LastName = "China" } } } } ); RetrievedAccount = new StripeAccountService(_stripe_api_key).Get(newAccount.Id); new StripeAccountService(_stripe_api_key).Update(newAccount.Id, new StripeAccountUpdateOptions { LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List<StripeAccountAdditionalOwner> { new StripeAccountAdditionalOwner { FirstName = "BigUpdated", LastName = "Little" }, //new StripeAccountAdditionalOwner { BirthDay = 25, BirthMonth = 12, BirthYear = 2000 } } } } ); }
private void CreatePlanAndSubscription(RecurringGift gift, StripeAccount account, MinistryPlatformContext mpDB, StripeOnboardingContext stripeDB) { var plan = _paymentService.CreatePlan(MapToRecurringGiftDto(gift), MapToContactDonor(gift)); var subscription = _paymentService.CreateSubscription(plan.Id, account.StripeCustomer.CustomerId, GetStartDate(gift)); UpdateRecurringGiftAndDonorAccount(gift, account, subscription, mpDB, stripeDB); }
public adding_additional_owners() { var newAccount = new StripeAccountService(_stripe_api_key).Create( new StripeAccountCreateOptions { Email = $"*****@*****.**", Managed = true, LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List<StripeAccountAdditionalOwner> { new StripeAccountAdditionalOwner { FirstName = "Big", LastName = "Little", BirthDay = 25, BirthMonth = 12, BirthYear = 2000 }, new StripeAccountAdditionalOwner { FirstName = "Trouble", LastName = "China", State = "CA", CityOrTown = "A", Line1 ="B", Line2 = "C", PostalCode = "27635", Country = "US" } } } } ); RetrievedAccount = new StripeAccountService(_stripe_api_key).Get(newAccount.Id); }
public getting_external_accounts() { var newAccount = new StripeAccountService(_stripe_api_key).Create( 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 = "Joe Meatballs", Number = "4000056655665556", Currency = "usd", DefaultForCurrency = true } } ); RetrievedAccount = new StripeAccountService(_stripe_api_key).Get(newAccount.Id); }
private void UpdateRecurringGiftAndDonorAccount(RecurringGift gift, StripeAccount account, StripeSubscription subscription, MinistryPlatformContext mpDB, StripeOnboardingContext stripeDB) { gift.Subscription_ID = subscription.Id; gift.DonorAccount.Processor_Account_ID = account.NewCardId; gift.DonorAccount.Processor_ID = account.StripeCustomer.CustomerId; mpDB.SaveChanges(); account.StripeCustomer.Imported = true; stripeDB.SaveChanges(); }
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); }
public static StripeAccountDTO MapStripeAccountModelToStripeAccountDTO(StripeAccount stripeAccount) { if (stripeAccount == null) { throw new NullReferenceException("stripe account object is null"); } return(new StripeAccountDTO { Id = stripeAccount.Id, StripeAccountId = stripeAccount.StripeAccountId, UserEmail = stripeAccount.UserEmail, }); }
public when_creating_additional_owners_empty_list() { Account = new StripeAccountService(Cache.ApiKey).Create( new StripeAccountCreateOptions { Email = "*****@*****.**", Type = StripeAccountType.Custom, LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List <StripeAccountAdditionalOwner>() } } ); }
public ConfigureModel PrepareConfigurationModel(StripeAccount account) { var model = new ConfigureModel(); //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_BlJVOMfIvvIZirpsUMpS1IzZB3z4QuiC&scope=read_write&[email protected]("Test", "ConnectedAccount", null, this.Request.Url.Scheme) model.RedirectUri = "https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_BlJVOMfIvvIZirpsUMpS1IzZB3z4QuiC&scope=read_write&redirect_uri=" + _webHelper.GetStoreLocation(false) + "Plugins/PaymentStripe/StripeOAuth"; if (account != null) { model.AccountId = account.Id; model.PaymentsEnabled = account.PayoutsEnabled; } return(model); }
public when_additional_owners_is_empty_list() { Account = new StripeAccountService(_stripe_api_key).Create( new StripeAccountCreateOptions { Email = $"*****@*****.**", Managed = true, LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List <StripeAccountAdditionalOwner> { } } } ); }
private static void ImportAccount(string oldAccountId, StripeJsonAccount accountDetails, StripeCustomer customer) { var account = new StripeAccount { Type = accountDetails.Type, OldCardId = oldAccountId, NewCardId = accountDetails.NewAccountId, Fingerprint = accountDetails.Fingerprint, Last4 = accountDetails.Last4, ExpMonth = accountDetails.ExpMonth, ExpYear = accountDetails.ExpYear, Institution = accountDetails.Institution, }; customer.StripeAccounts.Add(account); }
public static StripeAccount GetCustomAccountWithBankAccount() { if (_customAccountWithBankAccount != null) { return(_customAccountWithBankAccount); } var options = test_data.stripe_account_create_options.ValidAccountWithBankAccount(); options.Country = "US"; options.Email = $"joe{ Guid.NewGuid() }@blahblah.com"; options.Type = StripeAccountType.Custom; CustomAccountWithBankAccountOptions = options; return(_customAccountWithBankAccount = new StripeAccountService().Create(options)); }
public static StripeAccount GetManagedAccount() { if (_managedAccount != null) { return(_managedAccount); } var options = test_data.stripe_account_create_options.ValidAccountWithCard(); options.Country = "US"; options.Email = $"joe{ Guid.NewGuid() }@blahblah.com"; options.Managed = true; options.TosAcceptanceDate = DateTime.UtcNow.Date; options.TosAcceptanceIp = "8.8.8.8"; options.TosAcceptanceUserAgent = "user-agent-7"; ManagedAccountOptions = options; return(_managedAccount = new StripeAccountService().Create(options)); }
public when_updating_legal_entity_additional_owners() { var newAccount = new StripeAccountService(_stripe_api_key).Create( new StripeAccountCreateOptions { Email = $"merry{ Guid.NewGuid() }@christmas.com", Managed = true, LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List <StripeAccountAdditionalOwner> { new StripeAccountAdditionalOwner { FirstName = "Big", LastName = "Little" }, new StripeAccountAdditionalOwner { FirstName = "Trouble", LastName = "China" } } } } ); RetrievedAccount = new StripeAccountService(_stripe_api_key).Get(newAccount.Id); new StripeAccountService(_stripe_api_key).Update(newAccount.Id, new StripeAccountUpdateOptions { LegalEntity = new StripeAccountLegalEntityOptions { AdditionalOwners = new List <StripeAccountAdditionalOwner> { new StripeAccountAdditionalOwner { FirstName = "BigUpdated", LastName = "Little" }, //new StripeAccountAdditionalOwner { BirthDay = 25, BirthMonth = 12, BirthYear = 2000 } } } } ); }
public async Task Register(Guid requestId, string code) { var request = await MeredithDbContext.StripeOAuthRequests.FirstOrDefaultAsync(s => s.Id == requestId); if (request == null) { throw new Exception("Invalid request ID"); } var oAuthTokenService = new OAuthTokenService(); var oAuthToken = await oAuthTokenService.CreateAsync(new OAuthTokenCreateOptions { ClientSecret = StripeOptions.ClientSecret, Code = code, GrantType = "authorization_code" }, GetRequestOptions()); var stripeAccount = await MeredithDbContext.StripeAccounts.FirstOrDefaultAsync(s => s.CompanyId == request.CompanyId); if (stripeAccount == null) { stripeAccount = new StripeAccount { CompanyId = request.CompanyId }; MeredithDbContext.StripeAccounts.Add(stripeAccount); } stripeAccount.AccessToken = oAuthToken.AccessToken; stripeAccount.LiveMode = oAuthToken.Livemode; stripeAccount.RefreshToken = oAuthToken.RefreshToken; stripeAccount.TokenType = oAuthToken.TokenType; stripeAccount.StripePublishableKey = oAuthToken.StripePublishableKey; stripeAccount.StripeUserId = oAuthToken.StripeUserId; stripeAccount.Scope = oAuthToken.Scope; MeredithDbContext.StripeOAuthRequests.Remove(request); await MeredithDbContext.SaveChangesAsync(); }
public AccountPayment CreateAccount(IlevusUser user) { var accountLocal = Mapper.Map <AccountPayment>(user); var legalPayment = Mapper.Map <StripeAccountLegalEntityOptions>(accountLocal); var accountOptions = new StripeAccountCreateOptions() { Email = accountLocal.Email, Type = StripeAccountType.Custom, Country = accountLocal.Country, DefaultCurrency = accountLocal.DefaultCurrency, TransferScheduleWeeklyAnchor = "monday", TransferScheduleInterval = "weekly", TosAcceptanceDate = DateTime.Now, TosAcceptanceIp = GetLocalIPAddress(), LegalEntity = legalPayment }; StripeAccount account = accountService.Create(accountOptions); user.Professional.AccountPayment = Mapper.Map <AccountPayment>(account); return(Mapper.Map <AccountPayment>(account)); }
public getting_external_accounts() { var newAccount = Cache.GetManagedAccount(); RetrievedAccount = new StripeAccountService(Cache.ApiKey).Get(newAccount.Id); }
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); }
public getting_an_account_with_no_accountid() { Account = new StripeAccountService(Cache.ApiKey).Get(); }
//private StripeAccount RetrievedAccountAsync { get; } public getting_an_account_with_no_accountid() { RetrievedAccount = new StripeAccountService(_stripe_api_key).Get(); //RetrievedAccountAsync = new StripeAccountService(_stripe_api_key).GetAsync().Result; }