コード例 #1
0
        private void Init()
        {
            string url = isTestGateway ? "https://gatewaybeta.fedex.com:443/xml" : "https://gateway.fedex.com:443/xml";

            // FedEx uses the same URL for all types of requests
            _urls = new EzAccountServerUrls()
            {
                RateUrl  = url,
                ShipUrl  = url,
                TrackUrl = url,
            };

            string developerKey   = config.TryGetValueOrEmpty("apiKey");
            string meterNumber    = config.TryGetValueOrEmpty("meterNumber");
            string accountNumber  = config.TryGetValueOrEmpty("accountNumber");
            string password       = config.TryGetValueOrEmpty("apiPassword");
            string smartPostHub   = config.TryGetValueOrEmpty("smartPostHubId");
            string labelStockType = config.TryGetValueOrEmpty("labelStockType");
            string labelImageType = config.TryGetValueOrEmpty("labelImageType");

            ezrater.Account.DeveloperKey  = developerKey;
            ezrater.Account.MeterNumber   = meterNumber;
            ezrater.Account.AccountNumber = accountNumber;
            ezrater.Account.Password      = password;
            if (!string.IsNullOrEmpty(smartPostHub))
            {
                ezrater.Config("SmartPostHubId=" + smartPostHub);
                ezrater.Config("SmartPostIndicia=1");
                ezrater.Config("SmartPostAncillaryEndorsement=2");
            }

            ezship.Account.DeveloperKey  = developerKey;
            ezship.Account.MeterNumber   = meterNumber;
            ezship.Account.AccountNumber = accountNumber;
            ezship.Account.Password      = password;
            if (!string.IsNullOrEmpty(smartPostHub))
            {
                ezship.Config("SmartPostHubId=" + smartPostHub);
                ezship.Config("SmartPostIndicia=1");
                ezship.Config("SmartPostAncillaryEndorsement=2");
            }

            if (!string.IsNullOrEmpty(labelStockType))
            {
                ezship.Config("LabelStockType=" + labelStockType);
            }

            if (!string.IsNullOrEmpty(labelImageType))
            {
            }
        }
コード例 #2
0
        private void Init()
        {
            if (isTestGateway)
            {
                // UPS uses differents URLs depending on the service
                _urls = new EzAccountServerUrls()
                {
                    RateUrl  = "https://wwwcie.ups.com/ups.app/xml/Rate",
                    ShipUrl  = "https://wwwcie.ups.com/ups.app/xml/ShipConfirm",
                    TrackUrl = "https://wwwcie.ups.com/ups.app/xml/Track"
                };
            }
            else
            {
                _urls = new EzAccountServerUrls()
                {
                    RateUrl = "https://onlinetools.ups.com/ups.app/xml/Rate",
                    ShipUrl = "https://onlinetools.ups.com/ups.app/xml/ShipConfirm",
                    //ShipUrl = "https://onlinetools.ups.com/ups.app/xml/ShipAccept",
                    TrackUrl = "https://onlinetools.ups.com/ups.app/xml/Track"
                };
            }

            string accessKey     = config.TryGetValueOrEmpty("accessKey");
            string userId        = config.TryGetValueOrEmpty("userId");
            string password      = config.TryGetValueOrEmpty("password");
            string accountNumber = config.TryGetValueOrEmpty("accountNumber");

            ezrater.Account.AccessKey     = accessKey;
            ezrater.Account.UserId        = userId;
            ezrater.Account.Password      = password;
            ezrater.Account.AccountNumber = accountNumber;

            ezship.Account.AccessKey     = accessKey;
            ezship.Account.UserId        = userId;
            ezship.Account.Password      = password;
            ezship.Account.AccountNumber = accountNumber;
        }