Ejemplo n.º 1
0
        public static Models.OrderForm ConvertToOrderForm(this OrderForm orderForm)
        {
            return(new Models.OrderForm
            {
                ReturnComment = orderForm.ReturnComment,
                ReturnType = orderForm.ReturnType,
                ReturnAuthCode = orderForm.ReturnAuthCode,
                Name = orderForm.Name,
                BillingAddressId = orderForm.BillingAddressId,
                ShippingTotal = orderForm.ShippingTotal,
                HandlingTotal = orderForm.HandlingTotal,
                TaxTotal = orderForm.TaxTotal,
                DiscountAmount = orderForm.DiscountAmount,
                SubTotal = orderForm.SubTotal,
                Total = orderForm.Total,
                Status = orderForm.Status,
                RmaNumber = orderForm.RMANumber,
                AuthorizedPaymentTotal = orderForm.AuthorizedPaymentTotal,
                CapturedPaymentTotal = orderForm.CapturedPaymentTotal,

                Shipments = orderForm.Shipments.Select(ConvertToShipment).ToArray(),
                LineItems = orderForm.LineItems.Select(ConvertToLineItem).ToArray(),
                Discounts = orderForm.Discounts.Select(ConvertToDiscount).ToArray(),

                OrderFormId = orderForm.OrderFormId,
                Properties = orderForm.ToPropertyList()
            });
        }
Ejemplo n.º 2
0
 private static void MapShipments(Models.OrderForm orderFormDto, OrderForm orderForm)
 {
     orderForm.Shipments.Clear();
     foreach (var shipmentDto in orderFormDto.Shipments)
     {
         var shipment = orderForm.Shipments.AddNew();
         shipmentDto.ConvertToShipment(shipment, orderForm);
     }
 }
        public bool PostProcess(Mediachase.Commerce.Orders.OrderForm orderForm)
        {
            if (orderForm == null)
            {
                throw new ArgumentNullException("form");
            }

            var payment = orderForm.Payments.ToArray().FirstOrDefault(x => x.PaymentMethodId == this.PaymentMethodId);

            if (payment == null)
            {
                return(false);
            }

            payment.Status = PaymentStatus.Processed.ToString();
            payment.AcceptChanges();

            return(true);
        }
        public Mediachase.Commerce.Orders.Payment PreProcess(Mediachase.Commerce.Orders.OrderForm form)
        {
            if (form == null)
            {
                throw new ArgumentNullException("form");
            }

            var payment = new OtherPayment
            {
                PaymentMethodId   = PaymentMethodId,
                PaymentMethodName = "DemoPaymentMethod",
                OrderFormId       = form.OrderFormId,
                OrderGroupId      = form.OrderGroupId,
                Amount            = form.Total,
                Status            = PaymentStatus.Pending.ToString(),
                TransactionType   = TransactionType.Authorization.ToString()
            };

            return(payment);
        }
Ejemplo n.º 5
0
        public static OrderForm ConvertToOrderForm(
            this Models.OrderForm orderFormDto, OrderForm orderForm)
        {
            orderForm.ReturnComment          = orderFormDto.ReturnComment;
            orderForm.ReturnType             = orderFormDto.ReturnType;
            orderForm.ReturnAuthCode         = orderFormDto.ReturnAuthCode;
            orderForm.Name                   = orderFormDto.Name;
            orderForm.BillingAddressId       = orderFormDto.BillingAddressId;
            orderForm.ShippingTotal          = orderFormDto.ShippingTotal;
            orderForm.HandlingTotal          = orderFormDto.HandlingTotal;
            orderForm.TaxTotal               = orderFormDto.TaxTotal;
            orderForm.DiscountAmount         = orderFormDto.DiscountAmount;
            orderForm.SubTotal               = orderFormDto.SubTotal;
            orderForm.Total                  = orderFormDto.Total;
            orderForm.Status                 = orderFormDto.Status;
            orderForm.RMANumber              = orderFormDto.RmaNumber;
            orderForm.AuthorizedPaymentTotal = orderFormDto.AuthorizedPaymentTotal;
            orderForm.CapturedPaymentTotal   = orderFormDto.CapturedPaymentTotal;

            orderFormDto.MapPropertiesToModel(orderForm);
            MapShipments(orderFormDto, orderForm);

            return(orderForm);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the parent.
 /// </summary>
 /// <param name="Parent">The parent.</param>
 public override void SetParent(object Parent)
 {
     _Parent = (OrderForm)Parent;
     Discounts.SetParent(this);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShipmentCollection"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public ShipmentCollection(OrderForm parent)
 {
     _Parent = parent;
 }