Пример #1
0
        public IBSSettingContainer GetSettingContainer(string companyKey)
        {
            if (!companyKey.HasValue())
            {
                return(_serverSettings.ServerData.IBS);
            }

            // Switched companies or external market
            if (!_ibsSettings.ContainsKey(companyKey))
            {
                // Get all fleets available to dispatch to company
                var networkFleet = _taxiHailNetworkService.GetNetworkFleet(_serverSettings.ServerData.TaxiHail.ApplicationKey);

                _ibsSettings.Clear();

                foreach (var networkFleetResponse in networkFleet)
                {
                    var settingContainer = new IBSSettingContainer
                    {
                        RestApiUrl          = networkFleetResponse.RestApiUrl,
                        RestApiUser         = networkFleetResponse.RestApiUser,
                        RestApiSecret       = networkFleetResponse.RestApiSecret,
                        WebServicesUrl      = networkFleetResponse.IbsUrl,
                        WebServicesPassword = networkFleetResponse.IbsPassword,
                        WebServicesUserName = networkFleetResponse.IbsUserName,
                        TimeDifference      = networkFleetResponse.IbsTimeDifference
                    };

                    _ibsSettings.Add(networkFleetResponse.CompanyKey, settingContainer);
                }
            }

            return(_ibsSettings[companyKey]);
        }
        public AccountWebServiceClient(IServerSettings serverSettings, IBSSettingContainer ibsSettings, ILogger logger)
            : base(ibsSettings, logger)
        {
            // for now, server settings is for the home server, so if one day we want a real roaming mode (not network),
            // this will need to be changed

            _serverSettings = serverSettings;
        }
Пример #3
0
        public static IbsOrderParams PrepareForIbsOrder(IBSSettingContainer ibsSettingsContainer, VehicleTypeDetail defaultVehicleType,
                                                        int?chargeTypeId, Address pickupAddress, Address dropOffAddress, string accountNumberString, string customerNumberString,
                                                        IList <ListItem> referenceDataCompanyList, string market, int?requestProviderId, string companyKey)
        {
            int?ibsChargeTypeId;

            if (chargeTypeId == ChargeTypes.CardOnFile.Id ||
                chargeTypeId == ChargeTypes.PayPal.Id)
            {
                ibsChargeTypeId = ibsSettingsContainer.PaymentTypeCardOnFileId;
            }
            else if (chargeTypeId == ChargeTypes.Account.Id)
            {
                ibsChargeTypeId = ibsSettingsContainer.PaymentTypeChargeAccountId;
            }
            else
            {
                ibsChargeTypeId = ibsSettingsContainer.PaymentTypePaymentInCarId;
            }

            var ibsPickupAddress  = Mapper.Map <IbsAddress>(pickupAddress);
            var ibsDropOffAddress = dropOffAddress != null && dropOffAddress.IsValid()
                ? Mapper.Map <IbsAddress>(dropOffAddress)
                : null;

            var customerNumber = GetCustomerNumber(accountNumberString, customerNumberString);

            var defaultVehicleTypeId = defaultVehicleType != null ? defaultVehicleType.ReferenceDataVehicleId : -1;

            var defaultCompany = referenceDataCompanyList.FirstOrDefault(x => x.IsDefault.HasValue && x.IsDefault.Value)
                                 ?? referenceDataCompanyList.FirstOrDefault();

            //if we are in external market or local market but in a different company
            var providerId = (market.HasValue() || companyKey.HasValue()) &&
                             referenceDataCompanyList.Any() && defaultCompany != null
                    ? defaultCompany.Id
                    : requestProviderId;

            return(new IbsOrderParams
            {
                CustomerNumber = customerNumber,
                DefaultVehicleTypeId = defaultVehicleTypeId,
                IbsChargeTypeId = ibsChargeTypeId,
                IbsPickupAddress = ibsPickupAddress,
                IbsDropOffAddress = ibsDropOffAddress,
                ProviderId = providerId
            });
        }
Пример #4
0
 public BaseService(IBSSettingContainer ibsSettings, ILogger logger)
 {
     Logger       = logger;
     _ibsSettings = ibsSettings;
 }
 public ChargeAccountWebServiceClient(IServerSettings serverSettings, IBSSettingContainer ibsSettings, ILogger logger)
     : base(ibsSettings, logger)
 {
 }
 public StaticDataWebServiceClient(IBSSettingContainer ibsSettings, ILogger logger)
     : base(ibsSettings, logger)
 {
 }
Пример #7
0
 protected BaseServiceClient(IBSSettingContainer ibsSettings, ILogger logger)
 {
     Logger      = logger;
     IbsSettings = ibsSettings;
     SetupClient();
 }