forked from Sitecore/Reference-Storefront
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added WishList capability to list, get, create and addToWishList
- Loading branch information
Administrator
authored and
Administrator
committed
Sep 8, 2016
1 parent
644985b
commit 7dadeb9
Showing
29 changed files
with
1,617 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#Visual Studio files | ||
*.[Oo]bj | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*.vssscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.[Cc]ache | ||
*.ilk | ||
*.log | ||
*.lib | ||
*.sbr | ||
*.sdf | ||
*.pyc | ||
ipch/ | ||
obj/ | ||
[Bb]in | ||
[Dd]ebug*/ | ||
[Rr]elease*/ | ||
/Storefront/packages/ |
50 changes: 50 additions & 0 deletions
50
...ront/CS/CSF/App_Config/Include/Reference.Storefront/Reference.Storefront.WishLists.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!-- | ||
// Copyright 2016 Sitecore Corporation A/S | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
// except in compliance with the License. You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
// either express or implied. See the License for the specific language governing permissions | ||
// and limitations under the License. | ||
--> | ||
|
||
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | ||
<sitecore> | ||
<pipelines> | ||
|
||
<commerce.wishLists.createWishList patch:source="Reference.Storefront.WishLists.config"> | ||
<processor type="Sitecore.Reference.Storefront.Connect.Pipelines.WishLists.CreateWishList, Sitecore.Reference.Storefront.Powered.by.CommerceServer" patch:before="processor[@type='Sitecore.Commerce.Pipelines.WishLists.CreateWishList.TriggerWishListCreatedPageEvent, Sitecore.Commerce']" /> | ||
<processor type="Sitecore.Commerce.Pipelines.WishLists.CreateWishList.AddVisitorToEaPlan, Sitecore.Commerce"> | ||
<patch:delete/> | ||
</processor> | ||
</commerce.wishLists.createWishList> | ||
|
||
<commerce.wishLists.addLinesToWishList patch:source="Reference.Storefront.WishLists.config"> | ||
<processor type="Sitecore.Reference.Storefront.Connect.Pipelines.WishLists.AddLinesToWishList, Sitecore.Reference.Storefront.Powered.by.CommerceServer" patch:before="processor[@type='Sitecore.Commerce.Pipelines.WishLists.AddLinesToWishList.TriggerLinesAddedToWishListPageEvent, Sitecore.Commerce']" /> | ||
</commerce.wishLists.addLinesToWishList> | ||
|
||
<commerce.wishLists.getWishLists> | ||
<processor type="Sitecore.Reference.Storefront.Connect.Pipelines.WishLists.GetWishLists, Sitecore.Reference.Storefront.Powered.by.CommerceServer" /> | ||
</commerce.wishLists.getWishLists> | ||
|
||
<commerce.wishLists.getWishList> | ||
<processor type="Sitecore.Reference.Storefront.Connect.Pipelines.WishLists.GetWishList, Sitecore.Reference.Storefront.Powered.by.CommerceServer" /> | ||
</commerce.wishLists.getWishList> | ||
|
||
<translate.ordergrouptowishlistheader> | ||
<processor type="Sitecore.Reference.Storefront.Connect.Pipelines.WishLists.TranslateOrderGroupToWishListHeader, Sitecore.Reference.Storefront.Powered.by.CommerceServer"> | ||
<param ref="entityFactory"/> | ||
</processor> | ||
</translate.ordergrouptowishlistheader> | ||
|
||
<translate.ordergrouptowishlist> | ||
<processor type="Sitecore.Reference.Storefront.Connect.Pipelines.WishLists.TranslateOrderGroupToWishList, Sitecore.Reference.Storefront.Powered.by.CommerceServer"> | ||
<param ref="entityFactory"/> | ||
</processor> | ||
</translate.ordergrouptowishlist> | ||
|
||
</pipelines> | ||
</sitecore> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
|
||
namespace Sitecore.Reference.Storefront.Connect.Pipelines | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public static class Constants | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public const string WishListNameBeginning = "WishList_"; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public const string TranslateOrderGroupToWishList = "translate.ordergrouptowishlist"; | ||
public const string TranslateOrderGroupToWishListHeader = "translate.ordergrouptowishlistheader"; | ||
|
||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
Storefront/CS/CSF/Connect/Pipelines/Utilities/OrderGroupUtility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using CommerceServer.Core.Runtime.Orders; | ||
using Sitecore.Commerce.Connect.CommerceServer.Pipelines; | ||
using Sitecore.Commerce.Services; | ||
using Sitecore.Globalization; | ||
using Sitecore.Reference.Storefront.Connect.Pipelines.WishLists; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
|
||
namespace Sitecore.Reference.Storefront.Connect.Pipelines.Utilities | ||
{ | ||
public static class OrderGroupUtility | ||
{ | ||
|
||
/// <summary> | ||
/// Executes vaidation of the wish list order group | ||
/// </summary> | ||
/// <param name="request"></param> | ||
/// <param name="result"></param> | ||
/// <returns></returns> | ||
public static bool ValidOrderGroupForWishList(TranslateOrderGroupRequest request, CommerceResult result) | ||
{ | ||
SystemMessage systemMessage = null; | ||
|
||
if (!(request.OrderGroup is Basket)) | ||
{ | ||
systemMessage = new SystemMessage() | ||
{ | ||
Message = Translate.Text("TranslateOrderGroupToEntity recieved an invalid OrderGroup type \"{0}\".", (object)request.OrderGroup.GetType().Name) | ||
}; | ||
} | ||
else if (request.OrderGroup.OrderForms != null && request.OrderGroup.OrderForms.Count > 1) | ||
{ | ||
systemMessage = new SystemMessage() | ||
{ | ||
Message = Translate.Text("TranslateOrderGroupToEntity recieved an invalid OrderGroup with more than one OrderForm \"{0}\".", request.OrderGroup.OrderForms.Count) | ||
}; | ||
} | ||
else | ||
{ | ||
return true; | ||
} | ||
|
||
result.SystemMessages.Add(systemMessage); | ||
return false; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Storefront/CS/CSF/Connect/Pipelines/Utilities/UserUtility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using CommerceServer.Core.Runtime.Profiles; | ||
using Sitecore.Commerce.Connect.CommerceServer; | ||
using Sitecore.Commerce.Connect.CommerceServer.Profiles.Pipelines; | ||
using Sitecore.Pipelines; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
|
||
namespace Sitecore.Reference.Storefront.Connect.Pipelines.Utilities | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public static class UserUtility | ||
{ | ||
/// <summary>Resolves the user identifier.</summary> | ||
/// <param name="givenUserId">The given user identifier.</param> | ||
/// <param name="csUserId">The cs user identifier.</param> | ||
/// <returns>true if the userId has been resolved; Otherwise false.</returns> | ||
public static bool ResolveUserId(string givenUserId, out Guid csUserId) | ||
{ | ||
bool flag = Guid.TryParse(givenUserId, out csUserId); | ||
if (!flag) | ||
{ | ||
GetProfileArgs getProfileArgs = new GetProfileArgs(); | ||
getProfileArgs.InputParameters.Name = "UserObject"; | ||
getProfileArgs.InputParameters.Id = givenUserId; | ||
getProfileArgs.InputParameters.Field = CommerceTypeLoader.ConfigurationProvider.CurrentConfiguration.Profiles.SitecoreLinkProperty; | ||
CorePipeline.Run("GetProfile", (PipelineArgs)getProfileArgs); | ||
Profile commerceProfile = getProfileArgs.OutputParameters.CommerceProfile; | ||
if (commerceProfile != null) | ||
{ | ||
csUserId = Guid.Parse(commerceProfile["GeneralInfo.user_id"].Value as string); | ||
flag = true; | ||
} | ||
} | ||
return flag; | ||
} | ||
} | ||
} |
Oops, something went wrong.