예제 #1
0
        public virtual async Task <PriceCard> Process(CommerceContext commerceContext, PriceCard priceCard, PriceSnapshotComponent priceSnapshot, IEnumerable <CustomPriceTier> priceTiers)
        {
            PriceCard result = null;

            using (CommandActivity.Start(commerceContext, this))
            {
                var snapshot = await GetPriceSnapshot(commerceContext, priceCard, priceSnapshot.Id).ConfigureAwait(false);

                if (snapshot == null)
                {
                    return(null);
                }

                await PerformTransaction(commerceContext, async() =>
                {
                    foreach (CustomPriceTier priceTier in priceTiers)
                    {
                        result = await _removeCustomPriceTierPipeline.Run(new PriceCardSnapshotCustomTierArgument(priceCard, priceSnapshot, priceTier), commerceContext.GetPipelineContextOptions())
                                 .ConfigureAwait(false);

                        if (commerceContext.HasErrors())
                        {
                            break;
                        }
                    }
                }).ConfigureAwait(false);

                return(result);
            }
        }