Exemplo n.º 1
0
        /// <summary>
        /// Added notifications to the rate object.
        /// </summary>
        /// <returns>The notifications.</returns>
        /// <param name="r">Fluent object.</param>
        /// <param name="recipientNotificationType">Recipient notification type.</param>
        /// <param name="email">Email.</param>
        /// <typeparam name="T">IRates concrete class.</typeparam>
        /// <typeparam name="S">ISpecialServices concrete class.</typeparam>
        /// <typeparam name="P">IParameter concrete class.</typeparam>
        public static RatesArrayFluent <T> Notifications <T, S, P>(
            this RatesArrayFluent <T> r,
            RecipientNotificationType recipientNotificationType,
            string email
            )
            where T : class, IRates, new()
            where S : class, ISpecialServices, new()
            where P : class, IParameter, new()
        {
            var s = new S
            {
                SpecialServiceId = SpecialServiceCodes.NOTIFICATIONS
            };
            var np = new P
            {
                Name  = NotificationType.RECIPIENT_NOTIFICATION_TYPE.ToString(),
                Value = recipientNotificationType.ToString()
            };

            s.AddParameter(np);
            var em = new P
            {
                Name  = NotificationType.RECIPIENT_NOTIFICATION_EMAIL.ToString(),
                Value = email
            };

            s.AddParameter(em);
            r.SpecialService(s);
            return(r);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Newgistics rates.
 /// </summary>
 /// <returns>The rates.</returns>
 /// <param name="f">The object</param>
 /// <param name="s">Service</param>
 /// <typeparam name="T">The 1st type parameter.</typeparam>
 public static RatesArrayFluent <T> NewgisticsRates <T>(
     this RatesArrayFluent <T> f,
     Services s
     ) where T : class, IRates, new()
 {
     f.Carrier(Carrier.NEWGISTICS)
     .Service(s)
     .ParcelType(ParcelType.PKG);
     return(f);
 }
 /// <summary>
 /// Set up the rates object for USPS priority mail service.
 /// </summary>
 /// <returns>this</returns>
 /// <param name="f">this</param>
 /// <typeparam name="T">Type of the IRates concrete class.</typeparam>
 /// <typeparam name="P">Type of the IParameter concreate class.</typeparam>
 public static RatesArrayFluent <T> USPSPriority <T, P>(this RatesArrayFluent <T> f)
     where T : class, IRates, new()
     where P : class, IParameter, new()
 {
     return(f.Add().Carrier(Carrier.USPS)
            .ParcelType(ParcelType.PKG)
            .Service(Services.PM)
            .SpecialService <SpecialServices>(SpecialServiceCodes.DelCon, 0M, new P {
         Name = "INPUT_VALUE", Value = "0"
     }));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Add special services without parameters
        /// </summary>
        /// <typeparam name="T">Rates type</typeparam>
        /// <typeparam name="S">Special Service Type</typeparam>
        /// <param name="ratesArray"></param>
        /// <param name="c"></param>
        /// <returns></returns>
        public static RatesArrayFluent <T> UPSService <T, S>(this RatesArrayFluent <T> ratesArray, SpecialServiceCodes c)
            where S : ISpecialServices, new()
            where T : class, IRates, new()
        {
            var s = new S()
            {
                SpecialServiceId = c
            };

            return(ratesArray);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Verbal confirmation of delivery
        /// </summary>
        /// <typeparam name="T">Rate type</typeparam>
        /// <typeparam name="S">Special Service Type</typeparam>
        /// <typeparam name="P">Parameter Type</typeparam>
        /// <param name="ratesArray">this</param>
        /// <param name="val">Phone number</param>
        /// <returns></returns>
        public static RatesArrayFluent <T> VerbalConfirmation <T, S, P>(this RatesArrayFluent <T> ratesArray, string val)
            where S : ISpecialServices, new()
            where T : class, IRates, new()
            where P : IParameter, new()
        {
            var p = new List <IParameter>(1)
            {
                new P()
                {
                    Name = "VERBAL_CONF_PHONE", Value = val
                }
            };
            var s = new S()
            {
                SpecialServiceId = SpecialServiceCodes.PRL, InputParameters = p
            };

            ratesArray.SpecialService <S>(s);
            return(ratesArray);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Print a return label
        /// </summary>
        /// <typeparam name="T">Rate type</typeparam>
        /// <typeparam name="S">Special Service Type</typeparam>
        /// <typeparam name="P">Parameter Type</typeparam>
        /// <param name="ratesArray">this</param>
        /// <param name="val">Description of returned itemse</param>
        /// <returns></returns>
        public static RatesArrayFluent <T> PrintReturnLabel <T, S, P>(this RatesArrayFluent <T> ratesArray, string val)
            where S : ISpecialServices, new()
            where T : class, IRates, new()
            where P : IParameter, new()
        {
            var p = new List <IParameter>(1)
            {
                new P()
                {
                    Name = "RETURN_PKG_DESCRIPTION", Value = val
                }
            };
            var s = new S()
            {
                SpecialServiceId = SpecialServiceCodes.PRL, InputParameters = p
            };

            ratesArray.SpecialService <S>(s);
            return(ratesArray);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Declared value for insurance
        /// </summary>
        /// <typeparam name="T">Rate type</typeparam>
        /// <typeparam name="S">Special Service Type</typeparam>
        /// <typeparam name="P">Parameter Type</typeparam>
        /// <param name="ratesArray">this</param>
        /// <param name="val">Decalred value</param>
        /// <returns></returns>
        public static RatesArrayFluent <T> DeclaredValue <T, S, P>(this RatesArrayFluent <T> ratesArray, decimal val)
            where S : ISpecialServices, new()
            where T : class, IRates, new()
            where P : IParameter, new()
        {
            var p = new List <IParameter>(1)
            {
                new P()
                {
                    Name = "INPUT_VALUE", Value = val.ToString()
                }
            };
            var s = new S()
            {
                SpecialServiceId = SpecialServiceCodes.INS, InputParameters = p
            };

            ratesArray.SpecialService <S>(s);
            return(ratesArray);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Cash on delivery paid by check.
        /// </summary>
        /// <typeparam name="T">Rate type</typeparam>
        /// <typeparam name="S">Special Service Type</typeparam>
        /// <typeparam name="P">Parameter Type</typeparam>
        /// <param name="ratesArray">this</param>
        /// <param name="currency">Currency</param>
        /// <param name="val">Amount</param>
        /// <returns></returns>
        public static RatesArrayFluent <T> CODCheck <T, S, P>(this RatesArrayFluent <T> ratesArray, string currency, decimal val)
            where S : ISpecialServices, new()
            where T : class, IRates, new()
            where P : IParameter, new()
        {
            var p = new List <IParameter>(2)
            {
                new P()
                {
                    Name = "CURRENCY", Value = currency
                }, new P()
                {
                    Name = "INPUT_VALUE", Value = val.ToString()
                }
            };
            var s = new S()
            {
                SpecialServiceId = SpecialServiceCodes.COD_CHECK, InputParameters = p
            };

            ratesArray.SpecialService <S>(s);
            return(ratesArray);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Dry Ice service
        /// </summary>
        /// <typeparam name="T">Rate type</typeparam>
        /// <typeparam name="S">Special Service Type</typeparam>
        /// <typeparam name="P">Parameter Type</typeparam>
        /// <param name="ratesArray">this</param>
        /// <param name="weightUOM">Unit of measure "OZS" for ounces</param>
        /// <param name="val">Weight</param>
        /// <returns></returns>
        public static RatesArrayFluent <T> DryIce <T, S, P>(this RatesArrayFluent <T> ratesArray, string weightUOM, decimal val)
            where S : ISpecialServices, new()
            where T : class, IRates, new()
            where P : IParameter, new()
        {
            var p = new List <IParameter>(2)
            {
                new P()
                {
                    Name = "WEIGHT_UOM", Value = weightUOM
                }, new P()
                {
                    Name = "WEIGHT", Value = val.ToString()
                }
            };
            var s = new S()
            {
                SpecialServiceId = SpecialServiceCodes.DRY_ICE, InputParameters = p
            };

            ratesArray.SpecialService <S>(s);
            return(ratesArray);
        }