private static bool GetAdditionalInformation(CorporateCardTenderLineItem cardTenderLine, IApplication application) { ApplicationLog.Log("CorporateCard.GetAdditionalInformation", "Additional fleet card infomration", LogTraceLevel.Trace); bool result = false; using (frmInformation frmAddInfo = new frmInformation()) { application.ApplicationFramework.POSShowForm(frmAddInfo); if (frmAddInfo.DialogResult == DialogResult.OK) { cardTenderLine.DriverId = frmAddInfo.DriverId; cardTenderLine.VehicleId = frmAddInfo.VehicleId; cardTenderLine.OdometerReading = Convert.ToInt32(frmAddInfo.Odometer); result = true; } } return(result); }
private void AddCorporateCardTenderLine() { try { LogMessage("Adding the tender line to the transaction", LSRetailPosis.LogTraceLevel.Trace, "CorporateCard.AddCorporateCardTenderLine"); bool getAdditionalInfo = false; // Generate the tender line for the card CorporateCardTenderLineItem cardTenderLine = (CorporateCardTenderLineItem)this.Application.BusinessLogic.Utility.CreateCorporateCardTenderLineItem(); cardTenderLine.TenderTypeId = iCardInfo.TenderTypeId; cardTenderLine.CardName = iCardInfo.CardName; cardTenderLine.Description = LSRetailPosis.ApplicationLocalizer.Language.Translate(50150) + " " + iCardInfo.CardName; //Card payment cardTenderLine.Amount = this.amountValue; if (iCardInfo.CardEntryType == CardEntryTypes.MAGNETIC_STRIPE_READ) { // We have the track, from which we need to get the card number and exp date string track2Data = LSRetailPosis.Settings.HardwareProfiles.MSR.Track2Data(iCardInfo.Track2); cardTenderLine.CardNumber = track2Data.Substring(0, track2Data.IndexOf("-")); cardTenderLine.ExpiryDate = track2Data.Substring(track2Data.IndexOf("-") + 1, 4); } else { // We have the card number and the exp. date cardTenderLine.CardNumber = iCardInfo.CardNumber; cardTenderLine.ExpiryDate = iCardInfo.ExpDate; getAdditionalInfo = true; } // Get information about the tender... TenderData tenderData = new TenderData(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID); ITender tenderInfo = tenderData.GetTender(iCardInfo.TenderTypeId, ApplicationSettings.Terminal.StoreId); cardTenderLine.OpenDrawer = tenderInfo.OpenDrawer; cardTenderLine.ChangeTenderID = tenderInfo.ChangeTenderID; cardTenderLine.MinimumChangeAmount = tenderInfo.MinimumChangeAmount; cardTenderLine.AboveMinimumTenderId = tenderInfo.AboveMinimumTenderId; //Get additional information on corporate card if needed if (getAdditionalInfo && !GetAdditionalInformation(cardTenderLine, this.Application)) { return; } //convert from the store-currency to the company-currency... cardTenderLine.CompanyCurrencyAmount = this.Application.Services.Currency.CurrencyToCurrency( ApplicationSettings.Terminal.StoreCurrency, ApplicationSettings.Terminal.CompanyCurrency, this.amountValue); // the exchange rate between the store amount(not the paid amount) and the company currency cardTenderLine.ExchrateMST = this.Application.Services.Currency.ExchangeRate( ApplicationSettings.Terminal.StoreCurrency) * 100; cardTenderLine.SignatureData = LSRetailPosis.POSProcesses.TenderOperation.ProcessSignatureCapture(tenderInfo, cardTenderLine); retailTransaction.Add(cardTenderLine); ((IPosTransactionV2)retailTransaction).LastRunOperationIsValidPayment = true; } catch (Exception x) { LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), x); throw; } }