public string ViewAccountConnect(string username) { var existedCustomer = _customerRepository.Get(x => x.Username == username); if (existedCustomer == null) { return(ERROR_NOT_FOUND_CUSTOMER); } string linkResponse = null; try { StripeConfiguration.SetApiKey(SETTING.Value.SecretStripe); var service = new LoginLinkService(); var link = service.Create(existedCustomer.StripeConnectAccountId); linkResponse = link.Url; } catch (Exception ex) { return(ex.Message); } return(linkResponse); }
public async Task <string> GetStripeUrl(IAgencyOwner agencyOwner, bool isRecursive = false) { _logger.LogInformation(GetLogMessage("Getting Stripe Url for agency owner: {Customer}"), agencyOwner.CustomerId); var theClient = await _organizationCustomerRepository.Queryable() .Include(x => x.Organization) .ThenInclude(x => x.OrganizationFinancialAccount) .Where(x => x.OrganizationId == agencyOwner.OrganizationId && x.CustomerId == agencyOwner.CustomerId && x.Organization.OrganizationFinancialAccount != null) .FirstOrDefaultAsync(); if (theClient == null) { throw new ApplicationException("Please enable stripe account for this Organization"); } var result = new LoginLinkService().Create(theClient.Organization.OrganizationFinancialAccount.FinancialAccountId, new LoginLinkCreateOptions() { RedirectUrl = _appSettings.Urls.Flow }); _logger.LogDebug(GetLogMessage("{Url}"), result.Url); return(result.Url); }
public LoginLinkServiceTest() { this.service = new LoginLinkService(); this.createOptions = new LoginLinkCreateOptions() { RedirectUrl = "https://stripe.com/redirect?param=value" }; }
public LoginLinkServiceTest(MockHttpClientFixture mockHttpClientFixture) : base(mockHttpClientFixture) { this.service = new LoginLinkService(); this.createOptions = new LoginLinkCreateOptions { RedirectUrl = "https://stripe.com/redirect?param=value" }; }
private async Task <LoginLink> CreateLoginLinkAsync(string accountId, string redirectUrl) { var options = new LoginLinkCreateOptions { RedirectUrl = redirectUrl }; var service = new LoginLinkService(); return(await service.CreateAsync(accountId, options)); }
public async Task <string> GetStripeUrl(IOrganizationCustomer customer, bool isRecursive = false) { _logger.LogInformation(GetLogMessage("Getting Stripe Url for customer {Customer}"), customer); var theCustomer = await _organizationCustomerRepository.Queryable() .Include(x => x.Organization) .ThenInclude(x => x.OrganizationBuyerAccount) .Where(x => x.OrganizationId == customer.OrganizationId && x.CustomerId == customer.CustomerId && x.Organization.OrganizationBuyerAccount != null) .FirstOrDefaultAsync(); if (theCustomer == null) { _logger.LogDebug(GetLogMessage("Customer not found")); var customerResult = await PushCustomer(customer.OrganizationId, customer.CustomerId); if (customerResult > 0 && !isRecursive) { return(await GetStripeUrl(customer, true)); } throw new ApplicationException("Unable to create customer account"); } else { _logger.LogDebug(GetLogMessage("Customer Found: {0}"), theCustomer.CustomerId); } var result = new LoginLinkService().Create(theCustomer.Organization.OrganizationBuyerAccount.BuyerAccountId, new LoginLinkCreateOptions() { RedirectUrl = _appSettings.Urls.Flow }); _logger.LogDebug(GetLogMessage("{Url}"), result.Url); return(result.Url); }
public async Task <string> GetStripeUrl(IPerson person) { _logger.LogInformation(GetLogMessage("Getting Stripe Url for person {0}"), person.Id); var thePerson = await _personRepository .Queryable() .Include(x => x.IndividualFinancialAccount) .Where(x => x.Id == person.Id) .FirstOrDefaultAsync(); var financialAccountId = thePerson.IndividualFinancialAccount.FinancialAccountId; var result = new LoginLinkService().Create(financialAccountId, new LoginLinkCreateOptions() { RedirectUrl = _appSettings.Urls.Flow }); _logger.LogDebug(GetLogMessage("{Url}"), result.Url); return(result.Url); }
public JsonResult express_dashboard_link() { var account_id = HttpContext.Request.Query["account_id"][0]; //StripeConfiguration.ApiKey = _config.GetSection("Stripe_Secret_key").Value; StripeConfiguration.ApiKey = "sk_test_OqgRgzijpOeoqyZzh7TWFYuH00ic6FnP88"; var service = new LoginLinkService(); var options = new LoginLinkCreateOptions { RedirectUrl = "http://localhost" }; //var link = service.Create( // "acct_1GDAT2H4zF7BB8C0", options //); return(new JsonResult(new { //url = link.Url url = "https://connect.stripe.com/express/wOmIYmIcAcmq" })); }
public async Task <LoginLink> CreateLoginLinkAsync(string accountId) { var service = new LoginLinkService(); return(await service.CreateAsync(accountId)); }