Populate account id in the call context (if available) when getting the catalog.  This was preventing the product_name, product_type, product_category from being populated correctly when using the analytics plugin.
@@ -77,13 +77,23 @@ public class DefaultCatalogUserApi implements CatalogUserApi {
@Override
public Catalog getCatalog(final String catalogName, final TenantContext tenantContext) throws CatalogApiException {
- final InternalTenantContext internalTenantContext = internalCallContextFactory.createInternalTenantContextWithoutAccountRecordId(tenantContext);
+ final InternalTenantContext internalTenantContext;
+ if (tenantContext.getAccountId() != null) {
+ internalTenantContext = internalCallContextFactory.createInternalTenantContext(tenantContext.getAccountId(), tenantContext);
+ } else {
+ internalTenantContext = createInternalTenantContext(tenantContext);
+ }
return catalogService.getFullCatalog(true, true, internalTenantContext);
}
@Override
public StaticCatalog getCurrentCatalog(final String catalogName, final TenantContext tenantContext) throws CatalogApiException {
- final InternalTenantContext internalTenantContext = createInternalTenantContext(tenantContext);
+ final InternalTenantContext internalTenantContext;
+ if (tenantContext.getAccountId() != null) {
+ internalTenantContext = internalCallContextFactory.createInternalTenantContext(tenantContext.getAccountId(), tenantContext);
+ } else {
+ internalTenantContext = createInternalTenantContext(tenantContext);
+ }
return catalogService.getCurrentCatalog(true, true, internalTenantContext);
}
