Skip to content

Commit

Permalink
VCST-818: Delete Second cart after merge (#539)
Browse files Browse the repository at this point in the history
fix: The anonymous cart is not cleared after merge. After the fix, the mutation will delete second cart after merge by default. Added mutation option deleteAfterMerge: bool. By default, true.
  • Loading branch information
OlegoO committed Mar 18, 2024
1 parent 1bb7bbf commit e5cec9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public MergeCartCommand(string storeId, string cartType, string cartName, string
}

public string SecondCartId { get; set; }

public bool DeleteAfterMerge { get; set; } = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public override async Task<CartAggregate> Handle(MergeCartCommand request, Cance
{
cartAggr = await cartAggr.MergeWithCartAsync(secondCart);
await CartRepository.SaveAsync(cartAggr);
if (request.DeleteAfterMerge)
{
await CartRepository.RemoveCartAsync(secondCart.Id);
}
}

return cartAggr;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ public class InputMergeCartType : InputCartBaseType
{
public InputMergeCartType()
{
Field<NonNullGraphType<StringGraphType>>("secondCartId",
"Second cart Id");
Field<NonNullGraphType<StringGraphType>>("secondCartId", "Second cart Id");
Field<BooleanGraphType>("deleteAfterMerge", "Delete second cart after merge");
}
}
}

0 comments on commit e5cec9e

Please sign in to comment.