Ejemplo n.º 1
0
        public override Attempt <IShipmentRateQuote> QuoteShipment(IShipment shipment)
        {
            try
            {
                var visitor = new FoaShipmentLineItemVisitor()
                {
                    UseOnSalePriceIfOnSale = false
                };

                shipment.Items.Accept(visitor);

                if (visitor.TotalPrice >= _processorSettings.Amount)
                {
                    return(Attempt <IShipmentRateQuote> .Succeed(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 0 }));
                }

                // TODO shouldn't this just fail so that a different method is selected or have a configurable default rate.
                return(Attempt <IShipmentRateQuote> .Fail(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 0 }));
            }
            catch (Exception ex)
            {
                return(Attempt <IShipmentRateQuote> .Fail(
                           new Exception("An error occured during your request : " +
                                         ex.Message +
                                         " Please contact your administrator or try again.")));
            }
        }
        public override Attempt<IShipmentRateQuote> QuoteShipment(IShipment shipment)
        {
            try
            {
                var visitor = new FoaShipmentLineItemVisitor() { UseOnSalePriceIfOnSale = false };

                shipment.Items.Accept(visitor);

                if (visitor.TotalPrice >= _processorSettings.Amount)
                {
                    return Attempt<IShipmentRateQuote>.Succeed(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 0 });
                }
                else
                {
                    // TODO shouldn't this just fail so that a different method is selected or have a configurable default rate.
                    return Attempt<IShipmentRateQuote>.Succeed(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 100 });
                }
            }
            catch (Exception ex)
            {
                return Attempt<IShipmentRateQuote>.Fail(
                           new Exception("An error occured during your request : " +
                                                        ex.Message +
                                                        " Please contact your administrator or try again."));
            }
        }
Ejemplo n.º 3
0
        public override Attempt<IShipmentRateQuote> QuoteShipment(IShipment shipment)
        {
            try
            {
                var visitor = new FoaShipmentLineItemVisitor() { UseOnSalePriceIfOnSale = false };

                shipment.Items.Accept(visitor);

                if (visitor.TotalPrice >= _processorSettings.Amount)
                {
                    return Attempt<IShipmentRateQuote>.Succeed(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 0 });
                }
                else
                {
                    return Attempt<IShipmentRateQuote>.Succeed(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 100 });
                }
            }
            catch (Exception ex)
            {
                return Attempt<IShipmentRateQuote>.Fail(
                           new Exception("An error occured during your request : " +
                                                        ex.Message +
                                                        " Please contact your administrator or try again."));
            }
        }
        public override Attempt <IShipmentRateQuote> QuoteShipment(IShipment shipment)
        {
            try
            {
                var visitor = new FoaShipmentLineItemVisitor()
                {
                    UseOnSalePriceIfOnSale = false
                };

                shipment.Items.Accept(visitor);

                if (visitor.TotalPrice >= _processorSettings.Amount)
                {
                    return(Attempt <IShipmentRateQuote> .Succeed(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 0 }));
                }
                else
                {
                    return(Attempt <IShipmentRateQuote> .Succeed(new ShipmentRateQuote(shipment, ShipMethod) { Rate = 100 }));
                }
            }
            catch (Exception ex)
            {
                return(Attempt <IShipmentRateQuote> .Fail(
                           new Exception("An error occured during your request : " +
                                         ex.Message +
                                         " Please contact your administrator or try again.")));
            }
        }