-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PT-8665: add Merged Prices Service (#180)
- Loading branch information
1 parent
8e9ae33
commit 6dc66da
Showing
14 changed files
with
416 additions
and
0 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,21 @@ | ||
using VirtoCommerce.Platform.Core.Common; | ||
|
||
namespace VirtoCommerce.PricingModule.Core.Model | ||
{ | ||
public class MergedPrice : Entity | ||
{ | ||
public string Currency { get; set; } | ||
|
||
public string PricelistId { get; set; } | ||
|
||
public string ProductId { get; set; } | ||
|
||
public decimal? Sale { get; set; } | ||
|
||
public decimal List { get; set; } | ||
|
||
public int MinQuantity { get; set; } | ||
|
||
public MergedPriceState State { get; set; } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/VirtoCommerce.PricingModule.Core/Model/MergedPriceGroup.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,23 @@ | ||
namespace VirtoCommerce.PricingModule.Core.Model | ||
{ | ||
public class MergedPriceGroup | ||
{ | ||
public string ProductId { get; set; } | ||
|
||
public string ProductName { get; set; } | ||
|
||
public string ProductCode { get; set; } | ||
|
||
public string ProductImgSrc { get; set; } | ||
|
||
public int GroupPricesCount { get; set; } | ||
|
||
public MergedPriceState GroupState { get; set; } | ||
|
||
public decimal? MinSalePrice { get; set; } | ||
public decimal? MaxSalePrice { get; set; } | ||
|
||
public decimal MinListPrice { get; set; } | ||
public decimal MaxListPrice { get; set; } | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/VirtoCommerce.PricingModule.Core/Model/MergedPriceState.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,9 @@ | ||
namespace VirtoCommerce.PricingModule.Core.Model | ||
{ | ||
public enum MergedPriceState | ||
{ | ||
Base = 0, | ||
New = 1, | ||
Updated = 2, | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/VirtoCommerce.PricingModule.Core/Model/Search/MergedPriceGroupSearchResult.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,8 @@ | ||
using VirtoCommerce.Platform.Core.Common; | ||
|
||
namespace VirtoCommerce.PricingModule.Core.Model.Search | ||
{ | ||
public class MergedPriceGroupSearchResult : GenericSearchResult<MergedPriceGroup> | ||
{ | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/VirtoCommerce.PricingModule.Core/Model/Search/MergedPriceSearchCriteria.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,16 @@ | ||
using System.Collections.Generic; | ||
using VirtoCommerce.Platform.Core.Common; | ||
|
||
namespace VirtoCommerce.PricingModule.Core.Model.Search | ||
{ | ||
public class MergedPriceSearchCriteria : SearchCriteriaBase | ||
{ | ||
public bool All { get; set; } | ||
|
||
public string BasePriceListId { get; set; } | ||
|
||
public string PriorityPriceListId { get; set; } | ||
|
||
public List<string> ProductIds { get; set; } | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/VirtoCommerce.PricingModule.Core/Model/Search/MergedPriceSearchResult.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,8 @@ | ||
using VirtoCommerce.Platform.Core.Common; | ||
|
||
namespace VirtoCommerce.PricingModule.Core.Model.Search | ||
{ | ||
public class MergedPriceSearchResult : GenericSearchResult<MergedPrice> | ||
{ | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/VirtoCommerce.PricingModule.Core/Services/IMergedPriceSearchService.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,12 @@ | ||
using System.Threading.Tasks; | ||
using VirtoCommerce.PricingModule.Core.Model.Search; | ||
|
||
namespace VirtoCommerce.PricingModule.Core.Services | ||
{ | ||
public interface IMergedPriceSearchService | ||
{ | ||
Task<MergedPriceSearchResult> SearchGroupPricesAsync(MergedPriceSearchCriteria criteria); | ||
|
||
Task<MergedPriceGroupSearchResult> SearchGroupsAsync(MergedPriceSearchCriteria criteria); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/VirtoCommerce.PricingModule.Data/Model/MergedPriceEntity.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,34 @@ | ||
using VirtoCommerce.Platform.Core.Common; | ||
using VirtoCommerce.PricingModule.Core.Model; | ||
|
||
namespace VirtoCommerce.PricingModule.Data.Model | ||
{ | ||
public class MergedPriceEntity : Entity | ||
{ | ||
public decimal? Sale { get; set; } | ||
|
||
public decimal List { get; set; } | ||
|
||
public string ProductId { get; set; } | ||
|
||
public decimal MinQuantity { get; set; } | ||
|
||
public string PricelistId { get; set; } | ||
|
||
public int State { get; set; } | ||
|
||
public MergedPrice ToModel(MergedPrice model) | ||
{ | ||
model.Id = Id; | ||
|
||
model.List = List; | ||
model.MinQuantity = (int)MinQuantity; | ||
model.PricelistId = PricelistId; | ||
model.ProductId = ProductId; | ||
model.Sale = Sale; | ||
model.State = (MergedPriceState)State; | ||
|
||
return model; | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/VirtoCommerce.PricingModule.Data/Model/MergedPriceGroupEntity.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,32 @@ | ||
using VirtoCommerce.PricingModule.Core.Model; | ||
|
||
namespace VirtoCommerce.PricingModule.Data.Model | ||
{ | ||
public class MergedPriceGroupEntity | ||
{ | ||
public string ProductId { get; set; } | ||
|
||
public int GroupPricesCount { get; set; } | ||
|
||
public int GroupState { get; set; } | ||
|
||
public decimal? MinSalePrice { get; set; } | ||
public decimal? MaxSalePrice { get; set; } | ||
|
||
public decimal MinListPrice { get; set; } | ||
public decimal MaxListPrice { get; set; } | ||
|
||
public MergedPriceGroup ToModel(MergedPriceGroup model) | ||
{ | ||
model.ProductId = ProductId; | ||
model.GroupPricesCount = GroupPricesCount; | ||
model.GroupState = (MergedPriceState)GroupState; | ||
model.MinSalePrice = MinSalePrice; | ||
model.MaxSalePrice = MaxSalePrice; | ||
model.MinListPrice = MinListPrice; | ||
model.MaxListPrice = MaxListPrice; | ||
|
||
return model; | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.