Skip to content

CommerceClaimTypes

// RB2 Core Connect
namespace CoreConnect.Commerce.Core;
public static class CommerceClaimTypes
{
public const string ResetPassword = "ResetPasswordToken";
public const string ConfirmAccount = "ConfirmAccountToken";
public const string CustomerId = "CustomerId";
public const string CompanyId = "CompanyId";
public const string CompanyInvoiceEmail = "CompanyInvoiceEmail";
public const string OrderId = "OrderId";
public const string ImpersonatedByCustomerId = "ImpersonatedByCustomerId";
public const string ImpersonatedByName = "ImpersonatedByName";
public const string ImpersonatedByEmail = "ImpersonatedByEmail";
public const string ImpersonatedByRole = "Role";
public const string CountryCode = "CountryCode";
public const string InvoiceId = "InvoiceId";
public const string InvoiceDate = "InvoiceDate";
public const string InvoicePdf = "InvoicePdf";
public const string CustomerType = "CustomerType";
public const string BusinessUnitKey = "BusinessUnitKey";
}
public static class Extensions
{
public static string CustomerId(this IRequestContext ctx)
{
return ctx.HttpContextAccessor?.HttpContext
?.User?.FindFirst(CommerceClaimTypes.CustomerId)?
.Value ?? string.Empty;
}
/// <summary>
/// Signin user company id.
/// </summary>
public static string UserCompanyId(this IRequestContext ctx) => ctx.HttpContextAccessor?.HttpContext
?.User?.FindFirst(CommerceClaimTypes.CompanyId)?
.Value ?? string.Empty;
/// <summary>
/// Sigin in commerce user type.
/// </summary>
public static string UserType(this IRequestContext ctx) => ctx.HttpContextAccessor?.HttpContext
?.User.FindFirst(CommerceClaimTypes.CustomerType)?
.Value ?? string.Empty;
/// <summary>
/// Singin user's specified or unique businessUnit key
/// </summary>
/// <param name="ctx"></param>
/// <returns></returns>
public static string BusinessUnitKey(this IRequestContext ctx) => ctx.HttpContextAccessor?.HttpContext
?.User?.FindFirst(CommerceClaimTypes.BusinessUnitKey)?
.Value ?? string.Empty;
}