mirror of
https://github.com/bitwarden/server
synced 2026-01-04 17:43:53 +00:00
[PM-20452] - Offloading Stripe Update (#6034)
* Adding job to update stripe subscriptions and increment seat count when inviting a user. * Updating name * Added ef migrations * Fixing script * Fixing procedures. Added repo tests. * Fixed set stored procedure. Fixed parameter name. * Added tests for database calls and updated stored procedures * Fixed build for sql file. * fixing sproc * File is nullsafe * Adding view to select from instead of table. * Updating UpdateSubscriptionStatus to use a CTE and do all the updates in 1 statement. * Setting revision date when incrementing seat count * Added feature flag check for the background job. * Fixing nullable property. * Removing new table and just adding the column to org. Updating to query and command. Updated tests. * Adding migration script rename * Add SyncSeats to Org.sql def * Adding contraint name * Removing old table files. * Added tests * Upped the frequency to be at the top of every 3rd hour. * Updating error message. * Removing extension method * Changed to GuidIdArray * Added xml doc and switched class to record
This commit is contained in:
@@ -24,6 +24,7 @@ public interface IOrganizationRepository : IRepository<Organization, Guid>
|
||||
/// Gets the organizations that have a verified domain matching the user's email domain.
|
||||
/// </summary>
|
||||
Task<ICollection<Organization>> GetByVerifiedUserEmailDomainAsync(Guid userId);
|
||||
|
||||
Task<ICollection<Organization>> GetAddableToProviderByUserIdAsync(Guid userId, ProviderType providerType);
|
||||
Task<ICollection<Organization>> GetManyByIdsAsync(IEnumerable<Guid> ids);
|
||||
|
||||
@@ -36,4 +37,29 @@ public interface IOrganizationRepository : IRepository<Organization, Guid>
|
||||
/// <param name="organizationId">The ID of the organization to get the occupied seat count for.</param>
|
||||
/// <returns>The number of occupied seats for the organization.</returns>
|
||||
Task<OrganizationSeatCounts> GetOccupiedSeatCountByOrganizationIdAsync(Guid organizationId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all organizations that need to have their seat count updated to their Stripe subscription.
|
||||
/// </summary>
|
||||
/// <returns>Organizations to sync to Stripe</returns>
|
||||
Task<IEnumerable<Organization>> GetOrganizationsForSubscriptionSyncAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the organization SeatSync property to signify the organization's subscription has been updated in stripe
|
||||
/// to match the password manager seats for the organization.
|
||||
/// </summary>
|
||||
/// <param name="successfulOrganizations"></param>
|
||||
/// <param name="syncDate"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateSuccessfulOrganizationSyncStatusAsync(IEnumerable<Guid> successfulOrganizations, DateTime syncDate);
|
||||
|
||||
/// <summary>
|
||||
/// This increments the password manager seat count on the organization by the provided amount and sets SyncSeats to true.
|
||||
/// It also sets the revision date using the request date.
|
||||
/// </summary>
|
||||
/// <param name="organizationId">Organization to update</param>
|
||||
/// <param name="increaseAmount">Amount to increase password manager seats by</param>
|
||||
/// <param name="requestDate">When the action was performed</param>
|
||||
/// <returns></returns>
|
||||
Task IncrementSeatCountAsync(Guid organizationId, int increaseAmount, DateTime requestDate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user