Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCST-1659: CartDiscount with PromotionName and PromotionDescription #19

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/VirtoCommerce.XCart.Core/CartAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ public virtual Task<CartAggregate> AddGiftItemsAsync(IReadOnlyCollection<string>
{
Coupon = availableGift.Coupon,
PromotionId = availableGift.Promotion.Id,
Name = availableGift.Promotion.Name,
Description = availableGift.Promotion.Description,
Currency = Cart.Currency,
});
giftItem.CatalogId ??= "";
Expand Down
12 changes: 8 additions & 4 deletions src/VirtoCommerce.XCart.Core/Extensions/RewardExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ public static void ApplyRewards(this LineItem lineItem, string currency, IEnumer
{
Coupon = reward.Coupon,
Currency = currency,
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
Name = reward.Promotion?.Name,
Description = reward.Promotion?.Description,
DiscountAmount = reward.GetRewardAmount(lineItem.ListPrice - lineItem.DiscountAmount, lineItem.Quantity),
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
};

// Pass invalid discounts
Expand Down Expand Up @@ -98,9 +99,10 @@ public static void ApplyRewards(this Shipment shipment, string currency, IEnumer
{
Coupon = reward.Coupon,
Currency = currency,
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
Name = reward.Promotion?.Name,
Description = reward.Promotion?.Description,
DiscountAmount = reward.GetRewardAmount(shipment.Price - shipment.DiscountAmount, 1),
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
};

// Pass invalid discounts
Expand Down Expand Up @@ -129,9 +131,10 @@ public static void ApplyRewards(this Payment payment, string currency, IEnumerab
{
Coupon = reward.Coupon,
Currency = currency,
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
Name = reward.Promotion?.Name,
Description = reward.Promotion?.Description,
DiscountAmount = reward.GetRewardAmount(payment.Price - payment.DiscountAmount, 1),
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
};

// Pass invalid discounts
Expand Down Expand Up @@ -211,9 +214,10 @@ private static void ApplyCartRewardsInternal(CartAggregate aggregate, ICollectio
{
Coupon = reward.Coupon,
Currency = shoppingCart.Currency,
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
Name = reward.Promotion?.Name,
Description = reward.Promotion?.Description,
DiscountAmount = reward.GetRewardAmount(subTotalExcludeDiscount, 1),
PromotionId = reward.PromotionId ?? reward.Promotion?.Id,
};

shoppingCart.Discounts ??= new List<Discount>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.Xapi.Core" Version="3.809.0" />
<PackageReference Include="VirtoCommerce.XCatalog.Core" Version="3.813.0" />
<PackageReference Include="VirtoCommerce.CartModule.Core" Version="3.813.0" />
<PackageReference Include="VirtoCommerce.CartModule.Core" Version="3.816.0-alpha.705-vcst-1659" />
<PackageReference Include="VirtoCommerce.PaymentModule.Core" Version="3.804.0" />
<PackageReference Include="VirtoCommerce.ShippingModule.Core" Version="3.802.0" />
<PackageReference Include="VirtoCommerce.InventoryModule.Core" Version="3.805.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.XCart.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<platformVersion>3.861.0</platformVersion>
<dependencies>
<dependency id="VirtoCommerce.Cart" version="3.813.0" />
<dependency id="VirtoCommerce.Cart" version="3.816.0" />
<dependency id="VirtoCommerce.Inventory" version="3.805.0" />
<dependency id="VirtoCommerce.Marketing" version="3.812.0" />
<dependency id="VirtoCommerce.Payment" version="3.804.0" />
Expand Down
Loading