예제 #1
0
        private void cboChargeType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Data.ChargeType        clsCharge            = new Data.ChargeType();
            Data.ChargeTypeDetails clsChargeTypeDetails = clsCharge.Details(cboChargeType.SelectedItem.ToString());
            clsCharge.CommitAndDispose();

            //if (clsChargeTypeDetails.ChargeAmount == 0)
            //{
            //    mChargeType = ChargeTypes.NotApplicable;
            //    lblHeader.Text = "Not Applicable";
            //    lblChargeType.Visible = false;
            //}
            //else
            if (clsChargeTypeDetails.InPercent)
            {
                mChargeType           = ChargeTypes.Percentage;
                lblHeader.Text        = clsChargeTypeDetails.ChargeType + ": Percentage Charge";
                lblChargeType.Visible = true;
            }
            else
            {
                mChargeType           = ChargeTypes.FixedValue;
                lblHeader.Text        = clsChargeTypeDetails.ChargeType + ": Amount Charge";
                lblChargeType.Visible = false;
            }

            txtAmount.Text = clsChargeTypeDetails.ChargeAmount.ToString("#,##0.#0");
        }
예제 #2
0
 public Charge(string title, ChargeTypes type, int fine, int time)
 {
     Title = title;
     Type  = type;
     Fine  = fine;
     Time  = time;
 }
        private string GetChargeTypeEmail(int?chargeTypeId, string clientLanguageCode)
        {
            var chargeTypeKey = ChargeTypes.GetList()
                                .Where(x => x.Id == chargeTypeId)
                                .Select(x => x.Display)
                                .FirstOrDefault();

            return(_resources.Get(chargeTypeKey, clientLanguageCode));
        }
예제 #4
0
 private ChargeSlot GetChargeSlot(ChargeTypes chargeTypes)
 {
     foreach (ChargeSlot slot in chargeSlots)
     {
         if (slot.chargeTypes == chargeTypes)
         {
             return(slot);
         }
     }
     return(null);
 }
예제 #5
0
        public static string GetChargePrefabName(ChargeTypes type)
        {
            switch (type)
            {
            default:
                return("ElectricSlime");

            case ChargeTypes.Smart:
                return("SmartElectricSlime");

            case ChargeTypes.Smarter:
                return("SmarterElectricSlime");
            }
        }
예제 #6
0
        public void TestChargeTypeControllerUpdateModelIdLessThanZeroOrZeroReturnsBadResultObjectFail()
        {
            ChargeTypes chargeType = new ChargeTypes
            {
                ChargeType = "Percentage",
                IsDeleted  = false
            };

            ChargeTypeMock.Setup(x => x.UpdateEntity(chargeType)).Returns(Task.FromResult(new BaseResult <bool>()
            {
                Result = true, IsError = false
            }));

            var result = mockChargeTypeController.Update(chargeType).Result;

            Assert.That(result is BadRequestObjectResult);
        }
예제 #7
0
        public static ListItem[] GetPaymentsList(ListItem company)
        {
            if (company == null)
            {
                throw new ArgumentNullException("company");
            }
            if (company.Id == null)
            {
                throw new ArgumentException("company Id should not be null");
            }

            return(ChargeTypes.GetList().Select(x => new ListItem
            {
                Id = x.Id,
                Display = x.Display,
                Parent = company
            }).ToArray());
        }
예제 #8
0
        private bool isValuesAssigned()
        {
            try
            {
                mdecChargeAmount = Convert.ToDecimal(txtAmount.Text);
                if (mdecChargeAmount == 0)
                {
                    mChargeType = ChargeTypes.NotApplicable;
                }

                mChargeCode = cboChargeType.Text;
                mRemarks    = txtRemarks.Text;

                return(true);
            }
            catch
            {
                MessageBox.Show("Sorry you have entered an invalid amount for Charge." +
                                "Please type a valid Charge amount.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }
예제 #9
0
        public virtual bool CanChargeWith(Mobile m, Item item, out int cost, bool message)
        {
            cost = 0;

            if (m == null || m.Deleted || item == null || item.Deleted || !item.IsAccessibleTo(m))
            {
                return(false);
            }

            var t = item.GetType();

            if (ChargeTypes.ContainsKey(t))
            {
                cost = ChargeTypes[t];
                return(true);
            }

            if (message)
            {
                m.SendMessage("That item is not accepted for charging this codex.");
            }

            return(false);
        }
예제 #10
0
        public void UpdateItem(Int64 TransactionID, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, ChargeTypes ChargeType, SalesTransactionItemDetails SalesTransItemDetails)
		{
            UpdateSubTotal(TransactionID, ItemSold, QuantitySold, GrossSales, SubTotal, NetSales, ItemsDiscount, SNRItemsDiscount, PWDItemsDiscount, OtherItemsDiscount, Discount, SNRDiscount, PWDDiscount, OtherDiscount, TransDiscount, TransDiscountType, VAT, VATableAmount, ZeroRatedSales, NonVATableAmount, VATExempt, EVAT, EVATableAmount, NonEVATableAmount, LocalTax, DiscountCode, DiscountRemarks, Charge, ChargeAmount, ChargeCode, ChargeRemarks, ChargeType);

            SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(base.Connection, base.Transaction);
			clsSalesTransactionItems.Update(SalesTransItemDetails);
		}
예제 #11
0
        public Int64 AddItem(Int64 TransactionID, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, ChargeTypes ChargeType, SalesTransactionItemDetails SalesTransItemDetails)
		{
			try
			{
                UpdateSubTotal(TransactionID, ItemSold, QuantitySold, GrossSales, SubTotal, NetSales, ItemsDiscount, SNRItemsDiscount, PWDItemsDiscount, OtherItemsDiscount, Discount, SNRDiscount, PWDDiscount, OtherDiscount, TransDiscount, TransDiscountType, VAT, VATableAmount, ZeroRatedSales, NonVATableAmount, VATExempt, EVAT, EVATableAmount, NonEVATableAmount, LocalTax, DiscountCode, DiscountRemarks, Charge, ChargeAmount, ChargeCode, ChargeRemarks, ChargeType);

				SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(base.Connection, base.Transaction);
				Int64 TransactionItemID = clsSalesTransactionItems.Insert(SalesTransItemDetails);

				return TransactionItemID;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
예제 #12
0
        public void UpdateSubTotal(Int64 TransactionID, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, ChargeTypes ChargeType)
		{
            // Sep 4, 2014 : Added VATableAmount, ZeroRatedSales, NonVATableAmount, VATExempt as per requirement of BIR
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

			    string SQL = "UPDATE tblTransactions SET " +
							    "TransactionStatus	=	@TransactionStatus, " +
                                "ItemSold		    =	@ItemSold, " +
                                "QuantitySold	    =	@QuantitySold, " +
                                "GrossSales		    =	@GrossSales, " +
                                "SubTotal			=	@SubTotal, " +
                                "NetSales			=	@NetSales, " +
							    "ItemsDiscount		=	@ItemsDiscount, " +
                                "SNRItemsDiscount	=	@SNRItemsDiscount, " +
                                "PWDItemsDiscount	=	@PWDItemsDiscount, " +
                                "OtherItemsDiscount =	@OtherItemsDiscount, " +
							    "Discount			=	@Discount, " +
                                "SNRDiscount		=	@SNRDiscount, " +
                                "PWDDiscount		=	@PWDDiscount, " +
                                "OtherDiscount		=	@OtherDiscount, " +
							    "TransDiscount		=	@TransDiscount, " +
							    "TransDiscountType	=	@TransDiscType, " +
							    "VAT				=	@VAT, " +
							    "VATableAmount		=	@VATableAmount, " +
                                "ZeroRatedSales     =   @ZeroRatedSales, " +
                                "NonVATableAmount	=	@NonVATableAmount, " +
                                "VATExempt		    =	@VATExempt, " +
							    "EVAT				=	@EVAT, " +
							    "EVATableAmount		=	@EVATableAmount, " +
                                "NonEVATableAmount	=	@NonEVATableAmount, " +
							    "LocalTax			=	@LocalTax, " +
							    "DateClosed			=	NOW(), " +
							    "DiscountCode		=	@DiscCode,  " +
							    "DiscountRemarks	=	@DiscRemarks, " +
							    "Charge				=	@Charge, " +
							    "ChargeAmount		=	@ChargeAmount, " +
							    "ChargeCode			=	@ChargeCode, " +
							    "ChargeRemarks		=	@ChargeRemarks, " +
                                "ChargeType		    =	@ChargeType, " +
                                "LastModified		=	NOW() " +
						    "WHERE TransactionID	=	@TransactionID;";


                cmd.Parameters.AddWithValue("@ItemSold", ItemSold);
                cmd.Parameters.AddWithValue("@QuantitySold", QuantitySold);
                cmd.Parameters.AddWithValue("@GrossSales", GrossSales);
                cmd.Parameters.AddWithValue("@SubTotal", SubTotal);
                cmd.Parameters.AddWithValue("@NetSales", NetSales);
                cmd.Parameters.AddWithValue("@ItemsDiscount", ItemsDiscount);
                cmd.Parameters.AddWithValue("@SNRItemsDiscount", SNRItemsDiscount);
                cmd.Parameters.AddWithValue("@PWDItemsDiscount", PWDItemsDiscount);
                cmd.Parameters.AddWithValue("@OtherItemsDiscount", OtherItemsDiscount);
                cmd.Parameters.AddWithValue("@Discount", Discount);
                cmd.Parameters.AddWithValue("@SNRDiscount", SNRDiscount);
                cmd.Parameters.AddWithValue("@PWDDiscount", PWDDiscount);
                cmd.Parameters.AddWithValue("@OtherDiscount", OtherDiscount);
                cmd.Parameters.AddWithValue("@TransDiscount", TransDiscount);
                cmd.Parameters.AddWithValue("@TransDiscType", TransDiscountType.ToString("d"));
                cmd.Parameters.AddWithValue("@VAT", VAT);
                cmd.Parameters.AddWithValue("@VATableAmount", VATableAmount);
                cmd.Parameters.AddWithValue("@ZeroRatedSales", ZeroRatedSales);
                cmd.Parameters.AddWithValue("@NonVATableAmount", NonVATableAmount);
                cmd.Parameters.AddWithValue("@VATExempt", VATExempt);
                cmd.Parameters.AddWithValue("@EVAT", EVAT);
                cmd.Parameters.AddWithValue("@EVATableAmount", EVATableAmount);
                cmd.Parameters.AddWithValue("@NonEVATableAmount", NonEVATableAmount);
                cmd.Parameters.AddWithValue("@LocalTax", LocalTax);
                cmd.Parameters.AddWithValue("@TransactionStatus", TransactionStatus.SuspendedOpen.ToString("d"));
                cmd.Parameters.AddWithValue("@DiscCode", DiscountCode);
                cmd.Parameters.AddWithValue("@DiscRemarks", DiscountRemarks);
                cmd.Parameters.AddWithValue("@Charge", Charge);
                cmd.Parameters.AddWithValue("@ChargeAmount", ChargeAmount);
                cmd.Parameters.AddWithValue("@ChargeCode", ChargeCode);
                cmd.Parameters.AddWithValue("@ChargeRemarks", ChargeRemarks);
                cmd.Parameters.AddWithValue("@ChargeType", ChargeType);
                cmd.Parameters.AddWithValue("@TransactionID", TransactionID);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
		}
 private Charge_V01 GetCharge(ChargeList chargeList, ChargeTypes type)
 {
     return(chargeList.Find(delegate(Charge p) { return ((Charge_V01)p).ChargeType == type; }) as Charge_V01 ?? new Charge_V01(type, (decimal)0.0));
 }
예제 #14
0
        private void cboChargeType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Data.ChargeType clsCharge = new Data.ChargeType();
            Data.ChargeTypeDetails clsChargeTypeDetails = clsCharge.Details(cboChargeType.SelectedItem.ToString());
            clsCharge.CommitAndDispose();

            //if (clsChargeTypeDetails.ChargeAmount == 0)
            //{
            //    mChargeType = ChargeTypes.NotApplicable;
            //    lblHeader.Text = "Not Applicable";
            //    lblChargeType.Visible = false;
            //}
            //else 
            if (clsChargeTypeDetails.InPercent)
            {
                mChargeType = ChargeTypes.Percentage;
                lblHeader.Text = clsChargeTypeDetails.ChargeType + ": Percentage Charge";
                lblChargeType.Visible = true;
            }
            else
            {
                mChargeType = ChargeTypes.FixedValue;
                lblHeader.Text = clsChargeTypeDetails.ChargeType + ": Amount Charge";
                lblChargeType.Visible = false;
            }

            txtAmount.Text = clsChargeTypeDetails.ChargeAmount.ToString("#,##0.#0");
        }
예제 #15
0
		private bool isValuesAssigned()
		{
			try 
			{
				mdecChargeAmount = Convert.ToDecimal(txtAmount.Text);
				if (mdecChargeAmount ==  0)
				{	mChargeType = ChargeTypes.NotApplicable;	}

				mChargeCode = cboChargeType.Text;
				mRemarks = txtRemarks.Text;

				return true;
			}
			catch
			{
				MessageBox.Show("Sorry you have entered an invalid amount for Charge." +
					"Please type a valid Charge amount.","RetailPlus",MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return false;
			}
		}
예제 #16
0
        protected CreateOrder BuildCreateOrderCommand(CreateOrderRequest request, AccountDetail account, CreateReportOrder createReportOrder)
        {
            _logger.LogMessage("Create order request : " + request);

            if (request.Settings.Country == null || !request.Settings.Country.Code.HasValueTrimmed())
            {
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable,
                                     string.Format(_resources.Get("PhoneNumberCountryNotProvided", request.ClientLanguageCode)));
            }

            var countryCode = CountryCode.GetCountryCodeByIndex(CountryCode.GetCountryCodeIndexByCountryISOCode(request.Settings.Country));

            if (PhoneHelper.IsPossibleNumber(countryCode, request.Settings.Phone))
            {
                request.Settings.Phone = PhoneHelper.GetDigitsFromPhoneNumber(request.Settings.Phone);
            }
            else
            {
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable,
                                     string.Format(_resources.Get("PhoneNumberFormat", request.ClientLanguageCode), countryCode.GetPhoneExample()));
            }

            // TODO MKTAXI-3576: Find a better way to do this...
            var isFromWebApp = request.FromWebApp;

            if (!isFromWebApp)
            {
                ValidateAppVersion(request.ClientLanguageCode, createReportOrder);
            }

            // Find market
            var marketSettings = _taxiHailNetworkServiceClient.GetCompanyMarketSettings(request.PickupAddress.Latitude, request.PickupAddress.Longitude);
            var market         = marketSettings.Market.HasValue() ? marketSettings.Market : null;

            createReportOrder.Market = market;

            var isFutureBooking = IsFutureBooking(request.PickupDate, marketSettings);

            if (!marketSettings.EnableFutureBooking && isFutureBooking)
            {
                // future booking not allowed
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable, _resources.Get("CannotCreateOrder_FutureBookingNotAllowed", request.ClientLanguageCode));
            }

            BestAvailableCompany bestAvailableCompany;

            if (request.OrderCompanyKey.HasValue() || request.OrderFleetId.HasValue)
            {
                // For API user, it's possible to manually specify which company to dispatch to by using a fleet id
                bestAvailableCompany = _taxiHailNetworkHelper.FindSpecificCompany(market, createReportOrder, request.OrderCompanyKey, request.OrderFleetId, request.PickupAddress.Latitude, request.PickupAddress.Longitude);
            }
            else
            {
                bestAvailableCompany = _taxiHailNetworkHelper.FindBestAvailableCompany(marketSettings, request.PickupAddress.Latitude, request.PickupAddress.Longitude, isFutureBooking);
            }

            _logger.LogMessage("Best available company determined: {0}, in {1}",
                               bestAvailableCompany.CompanyKey.HasValue() ? bestAvailableCompany.CompanyKey : "local company",
                               market.HasValue() ? market : "local market");

            createReportOrder.CompanyKey  = bestAvailableCompany.CompanyKey;
            createReportOrder.CompanyName = bestAvailableCompany.CompanyName;

            if (market.HasValue())
            {
                if (!bestAvailableCompany.CompanyKey.HasValue())
                {
                    // No companies available that are desserving this region for the company
                    ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable, _resources.Get("CannotCreateOrder_NoCompanies", request.ClientLanguageCode));
                }

                _taxiHailNetworkHelper.UpdateVehicleTypeFromMarketData(request.Settings, bestAvailableCompany.CompanyKey);
                var isConfiguredForCmtPayment = _taxiHailNetworkHelper.FetchCompanyPaymentSettings(bestAvailableCompany.CompanyKey);

                if (!isConfiguredForCmtPayment)
                {
                    // Only companies configured for CMT payment can support CoF orders outside of home market
                    request.Settings.ChargeTypeId = ChargeTypes.PaymentInCar.Id;
                }

                if (marketSettings.DisableOutOfAppPayment && request.Settings.ChargeTypeId == ChargeTypes.PaymentInCar.Id)
                {
                    // No payment method available since we can't pay in car
                    ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_NoChargeType, _resources.Get("CannotCreateOrder_NoChargeType", request.ClientLanguageCode));
                }
            }

            var isPaypal    = request.Settings.ChargeTypeId == ChargeTypes.PayPal.Id;
            var isBraintree = (request.Settings.ChargeTypeId == ChargeTypes.CardOnFile.Id) && (_serverSettings.GetPaymentSettings().PaymentMode == PaymentMethod.Braintree);

            var isPrepaid = isFromWebApp && (isPaypal || isBraintree);

            createReportOrder.IsPrepaid = isPrepaid;

            account.IBSAccountId = CreateIbsAccountIfNeeded(account, bestAvailableCompany.CompanyKey);

            var pickupDate = request.PickupDate ?? GetCurrentOffsetedTime(bestAvailableCompany.CompanyKey);

            createReportOrder.PickupDate = pickupDate;

            // User can still create future order, but we allow only one active Book now order.
            if (!isFutureBooking)
            {
                var pendingOrderId = GetPendingOrder();

                // We don't allow order creation if there's already an order scheduled
                if (!_serverSettings.ServerData.AllowSimultaneousAppOrders &&
                    pendingOrderId != null &&
                    !isFromWebApp)
                {
                    ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_PendingOrder, pendingOrderId.ToString());
                }
            }

            var rule = _ruleCalculator.GetActiveDisableFor(
                isFutureBooking,
                pickupDate,
                () =>
                _ibsServiceProvider.StaticData(bestAvailableCompany.CompanyKey)
                .GetZoneByCoordinate(
                    request.Settings.ProviderId,
                    request.PickupAddress.Latitude,
                    request.PickupAddress.Longitude),
                () => request.DropOffAddress != null
                    ? _ibsServiceProvider.StaticData(bestAvailableCompany.CompanyKey)
                .GetZoneByCoordinate(
                    request.Settings.ProviderId,
                    request.DropOffAddress.Latitude,
                    request.DropOffAddress.Longitude)
                        : null,
                market, new Position(request.PickupAddress.Latitude, request.PickupAddress.Longitude));

            if (rule != null)
            {
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable, rule.Message);
            }

            // We need to validate the rules of the roaming market.
            if (market.HasValue())
            {
                // External market, query company site directly to validate their rules
                var orderServiceClient = new RoamingValidationServiceClient(bestAvailableCompany.CompanyKey, _serverSettings.ServerData.Target);

                _logger.LogMessage(string.Format("Validating rules for company in external market... Target: {0}, Server: {1}", _serverSettings.ServerData.Target, orderServiceClient.Url));

                var validationResult = orderServiceClient.ValidateOrder(request, true);
                if (validationResult.HasError)
                {
                    ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable, validationResult.Message);
                }
            }

            if (Params.Get(request.Settings.Name, request.Settings.Phone).Any(p => p.IsNullOrEmpty()))
            {
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_SettingsRequired);
            }

            var referenceData = (ReferenceData)_referenceDataService.Get(new ReferenceDataRequest {
                CompanyKey = bestAvailableCompany.CompanyKey
            });

            request.PickupDate = pickupDate;

            request.Settings.Passengers = request.Settings.Passengers <= 0
                ? 1
                : request.Settings.Passengers;

            if (_serverSettings.ServerData.Direction.NeedAValidTarif &&
                (!request.Estimate.Price.HasValue || request.Estimate.Price == 0))
            {
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_NoFareEstimateAvailable,
                                     GetCreateOrderServiceErrorMessage(ErrorCode.CreateOrder_NoFareEstimateAvailable, request.ClientLanguageCode));
            }

            // IBS provider validation
            ValidateProvider(request, referenceData, market.HasValue(), createReportOrder);

            // Map the command to obtain a OrderId (web doesn't prepopulate it in the request)
            var orderCommand = Mapper.Map <Commands.CreateOrder>(request);

            _logger.LogMessage("MarketSettings for order {0}: {1}", orderCommand.OrderId, marketSettings.ToJson());

            var marketFees = _feesDao.GetMarketFees(market);

            orderCommand.BookingFees          = marketFees != null ? marketFees.Booking : 0;
            createReportOrder.BookingFees     = orderCommand.BookingFees;
            createReportOrder.AssignVehicleId = orderCommand.AssignVehicleId;

            // Promo code validation
            var promotionId = ValidatePromotion(bestAvailableCompany.CompanyKey, request.PromoCode, request.Settings.ChargeTypeId, account.Id, pickupDate, isFutureBooking, request.ClientLanguageCode, createReportOrder);

            // Charge account validation
            var accountValidationResult = ValidateChargeAccountIfNecessary(bestAvailableCompany.CompanyKey, request, orderCommand.OrderId, account, isFutureBooking, isFromWebApp, orderCommand.BookingFees, createReportOrder);

            createReportOrder.IsChargeAccountPaymentWithCardOnFile = accountValidationResult.IsChargeAccountPaymentWithCardOnFile;

            // if ChargeAccount uses payment with card on file, payment validation was already done
            if (!accountValidationResult.IsChargeAccountPaymentWithCardOnFile)
            {
                // Payment method validation
                ValidatePayment(bestAvailableCompany.CompanyKey, request, orderCommand.OrderId, account, isFutureBooking, request.Estimate.Price, orderCommand.BookingFees, isPrepaid, createReportOrder);
            }

            var chargeTypeIbs   = string.Empty;
            var chargeTypeEmail = string.Empty;
            var chargeTypeKey   = ChargeTypes.GetList()
                                  .Where(x => x.Id == request.Settings.ChargeTypeId)
                                  .Select(x => x.Display)
                                  .FirstOrDefault();

            chargeTypeKey = accountValidationResult.ChargeTypeKeyOverride ?? chargeTypeKey;

            if (chargeTypeKey != null)
            {
                // this must be localized with the priceformat to be localized in the language of the company
                // because it is sent to the driver
                chargeTypeIbs = _resources.Get(chargeTypeKey, _serverSettings.ServerData.PriceFormat);

                chargeTypeEmail = _resources.Get(chargeTypeKey, request.ClientLanguageCode);
            }

            // Get Vehicle Type from reference data
            var vehicleType = referenceData.VehiclesList
                              .Where(x => x.Id == request.Settings.VehicleTypeId)
                              .Select(x => x.Display)
                              .FirstOrDefault();

            // Use address alias if present.
            var addressAlias = request.PickupAddress.FriendlyName.HasValueTrimmed()
                ? request.PickupAddress.FriendlyName
                : request.PickupAddress.BuildingName;

            var ibsInformationNote = IbsHelper.BuildNote(
                _serverSettings.ServerData.IBS.NoteTemplate,
                chargeTypeIbs,
                request.Note,
                addressAlias,
                request.Settings.LargeBags,
                _serverSettings.ServerData.IBS.HideChargeTypeInUserNote);

            var fare = FareHelper.GetFareFromEstimate(request.Estimate);

            orderCommand.AccountId     = account.Id;
            orderCommand.UserAgent     = Request.UserAgent;
            orderCommand.ClientVersion = Request.Headers.Get("ClientVersion");
            orderCommand.IsChargeAccountPaymentWithCardOnFile = accountValidationResult.IsChargeAccountPaymentWithCardOnFile;
            orderCommand.CompanyKey               = bestAvailableCompany.CompanyKey;
            orderCommand.CompanyName              = bestAvailableCompany.CompanyName;
            orderCommand.CompanyFleetId           = bestAvailableCompany.FleetId;
            orderCommand.Market                   = market;
            orderCommand.IsPrepaid                = isPrepaid;
            orderCommand.Settings.ChargeType      = chargeTypeIbs;
            orderCommand.Settings.VehicleType     = vehicleType;
            orderCommand.IbsAccountId             = account.IBSAccountId.Value;
            orderCommand.ReferenceDataCompanyList = referenceData.CompaniesList.ToArray();
            orderCommand.IbsInformationNote       = ibsInformationNote;
            orderCommand.Fare                 = fare;
            orderCommand.Prompts              = accountValidationResult.Prompts;
            orderCommand.PromptsLength        = accountValidationResult.PromptsLength;
            orderCommand.PromotionId          = promotionId;
            orderCommand.ChargeTypeEmail      = chargeTypeEmail;
            orderCommand.OriginatingIpAddress = createReportOrder.OriginatingIpAddress = request.CustomerIpAddress;
            orderCommand.KountSessionId       = createReportOrder.OriginatingIpAddress = request.KountSessionId;
            orderCommand.IsFutureBooking      = createReportOrder.IsFutureBooking = isFutureBooking;
            orderCommand.AssignVehicleId      = createReportOrder.AssignVehicleId;

            Debug.Assert(request.PickupDate != null, "request.PickupDate != null");

            return(orderCommand);
        }
 public Charge_V01(ChargeTypes chargeType, decimal amount)
     : base()
 {
     ChargeType = chargeType;
     Amount     = amount;
 }
예제 #18
0
 public int GetCurrentCharge(ChargeTypes chargeTypes)
 {
     return(GetChargeSlot(chargeTypes).chargeAmt);
 }
예제 #19
0
        // If we ever had a more complicated type we might need to add some additional handling
        public string GetChargeTypeString()
        {
            ChargeTypes cType = (ChargeTypes)ChargeType;

            return(cType.ToString());
        }
예제 #20
0
 public void DepleteCharge(ChargeTypes chargeTypes)
 {
     GetChargeSlot(chargeTypes).chargeAmt--;
 }
예제 #21
0
 public void ReplenishCharge(ChargeTypes chargeTypes, int chargeAmt)
 {
     GetChargeSlot(chargeTypes).chargeAmt += chargeAmt;
 }