public PostageLabel GetPostageLabel(PackageDetail packageDetail)
        {
            // create request object
            var requestObject = RequestHelper.CreateLabelRequest(packageDetail);

            // send the request to change the passphrase
            var response = SoapHelper.ProcessRequest <LabelRequestResponse>(requestObject);

            if (response.Status != 0)
            {
                return new PostageLabel {
                           ErrorMessage = response.ErrorMessage
                }
            }
            ;

            return(new PostageLabel
            {
                Base64LabelImage = response.Base64LabelImage,
                TrackingNumber = response.TrackingNumber,
                TransactionId = response.TransactionID,
                TransactionDateTime = response.TransactionDateTime,
                PostmarkDate = response.PostmarkDate,
                PostageBalance = response.PostageBalance,
                PostageTotalPrice = response.PostagePrice.TotalAmount
            });
        }
    }
        public ChangePassPhraseRequestResponse ChangePassPhrase(string newPassPhrase)
        {
            // create request object
            var requestObject = RequestHelper.CreateChangePassPhraseRequest(newPassPhrase);

            // send the request to change the passphrase
            var response = SoapHelper.ProcessRequest <ChangePassPhraseRequestResponse>(requestObject);

            return(response);
        }
        public List <ShippingRate> GetShipmentRates(Shipment shipment)
        {
            System.Threading.Thread.Sleep(1500);
            return(new List <ShippingRate>()
            {
                new ShippingRate {
                    PackageType = "Package", MailClass = "Endicia Ground", MailService = "Parcel", Zone = "5", Pricing = "Retail", TotalAmount = 23.44m, DeliveryDate = new System.DateTime().AddDays(3)
                },
                new ShippingRate {
                    PackageType = "Package", MailClass = "Endicia Express", MailService = "Letter", Zone = "5", Pricing = "Retail", TotalAmount = 11.32m, DeliveryDate = new System.DateTime().AddDays(2)
                },
                new ShippingRate {
                    PackageType = "Package", MailClass = "Endicia Mail", MailService = "Enveloope", Zone = "5", Pricing = "Retail", TotalAmount = 12.25m, DeliveryDate = new System.DateTime().AddDays(5)
                },
            });

            // create request object
            var requestObject = RequestHelper.CreatePostageRatesRequest(shipment);

            // send the request to change the passphrase
            var response = SoapHelper.ProcessRequest <PostageRatesResponse>(requestObject);

            if (response.Status != 0)
            {
                throw new Exception(response.ErrorMessage);
            }

            var results = new List <ShippingRate>();

            foreach (var rate in response.PostagePrice)
            {
                results.Add(new ShippingRate
                {
                    TotalAmount = rate.TotalAmount,
                    MailClass   = rate.MailClass,
                    MailService = rate.Postage.MailService,
                    Pricing     = rate.Postage.Pricing,
                    Zone        = rate.Postage.Zone
                });
            }

            return(results);
        }