private static Order CreateCompletedOrder()
        {
            var orderId = Scenarios.Buy1ItemMultipleQuantity.Run(_context);

            orderId.Should().NotBeNullOrEmpty();

            var order = Orders.GetOrder(_context.ShopsContainer(), orderId);

            order.Should().NotBeNull();
            order.Lines.Should().NotBeEmpty();
            order.Lines.FirstOrDefault().Should().NotBeNull();

            var lineId = order.Lines.FirstOrDefault()?.Id;

            lineId.Should().NotBeNullOrEmpty();

            var paymentId = order.Components.OfType <Sitecore.Commerce.Plugin.Payments.PaymentComponent>().FirstOrDefault()?.Id;

            paymentId.Should().NotBeNullOrEmpty();

            Orders.RunPendingOrdersMinion(_context);
            Orders.RunReleasedOrdersMinion(_context);

            return(order);
        }
Example #2
0
        private static Order CreateDigitalCompletedOrder()
        {
            var orderId = BuyWarranty.Run(_context, 2);

            orderId.Should().NotBeNullOrEmpty();

            var order = Orders.GetOrder(_context.ShopsContainer(), orderId);

            order.Should().NotBeNull();

            Orders.RunPendingOrdersMinion(_context);
            Orders.RunReleasedOrdersMinion(_context);

            return(order);
        }
Example #3
0
        private static Order CreateDigitalCompletedOrder()
        {
            var orderId = Scenarios.BuyWarranty.Run(_context, 2).Result;

            orderId.Should().NotBeNullOrEmpty();

            var order = Orders.GetOrder(_context.ShopsContainer(), orderId);

            order.Should().NotBeNull();

            Orders.RunPendingOrdersMinion(_context);
            Orders.RunSettleSalesActivitiesMinion(_context);
            Orders.RunReleasedOrdersMinion(_context);

            return(order);
        }
Example #4
0
        private static void RefundPayment_Federated()
        {
            using (new SampleMethodScope())
            {
                var context   = new AnonymousCustomerBob().Context;
                var container = context.ShopsContainer();
                var orderid   = SimplePhysical2Items.Run(new AnonymousCustomerBob().Context);
                var order     = Orders.GetOrder(container, orderid);
                var paymentId = order.Components.OfType <FederatedPaymentComponent>()
                                .FirstOrDefault()
                                ?.Id;

                Orders.RunPendingOrdersMinion(context);
                Orders.RunReleasedOrdersMinion(context);
                var view = Proxy.GetValue(
                    ShopsContainer.GetEntityView(orderid, "RefundPayment", "RefundPayment", paymentId));

                var result = Proxy.DoCommand(ShopsContainer.DoAction(view));

                result.Should().NotBeNull();
                result.Messages.Should().NotContainErrors();

                var updatedOrderView = Proxy.GetValue(
                    ShopsContainer.GetEntityView(orderid, "Master", string.Empty, string.Empty));

                var salesActivities =
                    updatedOrderView.ChildViews.FirstOrDefault(p => p.Name.Equals("SalesActivities")) as EntityView;
                salesActivities.Should().NotBeNull();

                //There should be 2 Sales Activities now. The original one and the one for the refund.
                salesActivities?.ChildViews.Count.Should().Be(2);

                // Get the OrderPayments View and validate that the payment is now gone
                var paymentsView = Proxy.GetValue(
                    ShopsContainer.GetEntityView(orderid, "OrderPayments", string.Empty, string.Empty));
                paymentsView.ChildViews.Count().Should().Be(0);
            }
        }
 private static void RunMinions(ShopperContext context)
 {
     Orders.RunPendingOrdersMinion(context);
     Orders.RunReleasedOrdersMinion(context);
 }
Example #6
0
 private static void RunMinions(ShopperContext context)
 {
     Orders.RunPendingOrdersMinion(context);
     Orders.RunSettleSalesActivitiesMinion(context);
     Orders.RunReleasedOrdersMinion(context);
 }