[AC-1693] Send InvoiceUpcoming Notification to Client Owners (#3319)
* Add Organization_ReadOwnerEmailAddresses SPROC
* Add IOrganizationRepository.GetOwnerEmailAddressesById
* Add SendInvoiceUpcoming overload for multiple emails
* Update InvoiceUpcoming handler to send multiple emails
* Cy's feedback
* Updates from testing
Hardened against missing entity IDs in Stripe events in the StripeEventService. Updated ValidateCloudRegion to not use a refresh/expansion for the customer because the invoice.upcoming event does not have an invoice.Id. Updated the StripeController's handling of invoice.upcoming to not use a refresh/expansion for the subscription because the invoice does not have an ID.
* Fix broken test
@ -46,6 +55,12 @@ public class StripeEventService : IStripeEventService
@@ -46,6 +55,12 @@ public class StripeEventService : IStripeEventService
returneventCustomer;
}
if(string.IsNullOrEmpty(eventCustomer.Id))
{
_logger.LogWarning("Cannot retrieve up-to-date Customer for Event with ID '{eventId}' because no Customer ID was included in the Event.",stripeEvent.Id);
@ -66,6 +81,12 @@ public class StripeEventService : IStripeEventService
@@ -66,6 +81,12 @@ public class StripeEventService : IStripeEventService
returneventInvoice;
}
if(string.IsNullOrEmpty(eventInvoice.Id))
{
_logger.LogWarning("Cannot retrieve up-to-date Invoice for Event with ID '{eventId}' because no Invoice ID was included in the Event.",stripeEvent.Id);
@ -86,6 +107,12 @@ public class StripeEventService : IStripeEventService
@@ -86,6 +107,12 @@ public class StripeEventService : IStripeEventService
returneventPaymentMethod;
}
if(string.IsNullOrEmpty(eventPaymentMethod.Id))
{
_logger.LogWarning("Cannot retrieve up-to-date Payment Method for Event with ID '{eventId}' because no Payment Method ID was included in the Event.",stripeEvent.Id);
@ -106,6 +133,12 @@ public class StripeEventService : IStripeEventService
@@ -106,6 +133,12 @@ public class StripeEventService : IStripeEventService
returneventSubscription;
}
if(string.IsNullOrEmpty(eventSubscription.Id))
{
_logger.LogWarning("Cannot retrieve up-to-date Subscription for Event with ID '{eventId}' because no Subscription ID was included in the Event.",stripeEvent.Id);
@ -224,4 +224,24 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
@@ -224,4 +224,24 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org