Get Logged in Customer

#region Get Customer

                    var accountId = CommerceFrameworkBase.Context.AccountId;
                    var accountType = ShopContext.GetCurrent().ShopAccount.Type;

                    ICustomerProfile customer = null;
                    if (accountType == ShopAccountType.Contact)
                        customer = CommerceFrameworkBase.Customers.GetCustomerByContact(accountId);
                    else if (!String.IsNullOrEmpty(accountId) && ((accountType == ShopAccountType.Customer) || (accountType == ShopAccountType.SalesAgent && ShopContext.GetCurrent().IsImpersonating)))
                        customer = CommerceFrameworkBase.Customers.GetCustomer(accountId);
                    #endregion