Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sendinblue/Brevo Marketing Automation error #7467

Open
wants to merge 2 commits into
base: 4.70-bug-fixes
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,13 @@ public async Task HandleOrderCompletedEventAsync(Order order)
ArgumentNullException.ThrowIfNull(order);

var customer = await _customerService.GetCustomerByIdAsync(order.CustomerId);
var shippingAddress = await _addressService.GetAddressByIdAsync(order.ShippingAddressId ?? 0);
var billingAddress = await _addressService.GetAddressByIdAsync(order.BillingAddressId);

try
{
//first, try to identify current customer
await _marketingAutomationHttpClient.RequestAsync(new IdentifyRequest { Email = customer.Email });
await _marketingAutomationHttpClient.RequestAsync(new IdentifyRequest { Email = customer.Email ?? billingAddress.Email });

//get URL helper
var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext);
Expand Down Expand Up @@ -296,9 +298,6 @@ public async Task HandleOrderCompletedEventAsync(Order order)
};
}).ToArrayAsync();

var shippingAddress = await _addressService.GetAddressByIdAsync(order.ShippingAddressId ?? 0);
var billingAddress = await _addressService.GetAddressByIdAsync(order.BillingAddressId);

var shippingAddressData = new
{
firstname = shippingAddress?.FirstName,
Expand Down Expand Up @@ -356,7 +355,7 @@ public async Task HandleOrderCompletedEventAsync(Order order)
//create track event object
var trackEvent = new TrackEventRequest
{
Email = customer.Email,
Email = customer.Email ?? billingAddress.Email,
EventName = BrevoDefaults.OrderCompletedEventName,
EventData = new { id = $"cart:{shoppingCartGuid}", data = cartData }
};
Expand Down