mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 09:32:48 -05:00
organization status changed code changes (#5113)
* organization status changed code changes Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Add the push notification to subscriptionUpdated Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * send notification using the SendPayloadToUser Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Change the implementation to send userId * Added new implementation for orgstatus sync * refactor the code and remove private methods --------- Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
@ -25,6 +25,7 @@ public class PaymentSucceededHandler : IPaymentSucceededHandler
|
||||
private readonly ICurrentContext _currentContext;
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IStripeEventUtilityService _stripeEventUtilityService;
|
||||
private readonly IPushNotificationService _pushNotificationService;
|
||||
|
||||
public PaymentSucceededHandler(
|
||||
ILogger<PaymentSucceededHandler> logger,
|
||||
@ -37,7 +38,8 @@ public class PaymentSucceededHandler : IPaymentSucceededHandler
|
||||
IUserRepository userRepository,
|
||||
IStripeEventUtilityService stripeEventUtilityService,
|
||||
IUserService userService,
|
||||
IOrganizationService organizationService)
|
||||
IOrganizationService organizationService,
|
||||
IPushNotificationService pushNotificationService)
|
||||
{
|
||||
_logger = logger;
|
||||
_stripeEventService = stripeEventService;
|
||||
@ -50,6 +52,7 @@ public class PaymentSucceededHandler : IPaymentSucceededHandler
|
||||
_stripeEventUtilityService = stripeEventUtilityService;
|
||||
_userService = userService;
|
||||
_organizationService = organizationService;
|
||||
_pushNotificationService = pushNotificationService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -140,6 +143,7 @@ public class PaymentSucceededHandler : IPaymentSucceededHandler
|
||||
|
||||
await _organizationService.EnableAsync(organizationId.Value, subscription.CurrentPeriodEnd);
|
||||
var organization = await _organizationRepository.GetByIdAsync(organizationId.Value);
|
||||
await _pushNotificationService.PushSyncOrganizationStatusAsync(organization);
|
||||
|
||||
await _referenceEventService.RaiseEventAsync(
|
||||
new ReferenceEvent(ReferenceEventType.Rebilled, organization, _currentContext)
|
||||
|
Reference in New Issue
Block a user