public bool StartPhysicalPrint(IPrintJob printJob, out CardData cardData, out string additionalInfo) { OnUiUpdate(CardPrintingLogicResource.BuildPrinterJobUi, false, true, EventArgs.Empty); cardData = null; additionalInfo = string.Empty; var cardPrintDetails = _printer.PrinterDetailFactory().Populate(printJob.ProductFields); int printJobSuccess; Device.IDeviceMagData magData = null; if (printJob.MustReturnCardData) { printJobSuccess = _printer.ReadAndPrint(printJob.ProductBin, cardPrintDetails, out magData); } else { printJobSuccess = _printer.Print(printJob.ProductBin, cardPrintDetails); } if (printJobSuccess == PrinterCodes.Success && magData != null) { var track2 = magData.TrackDataToString(2); var sepPos = track2.IndexOfAny(new char[] { '=', 'D' }); string ecryptedPAN = EncryptionManager.EncryptString(track2.Substring(0, sepPos), Veneka.Indigo.Common.Utilities.StaticFields.USE_HASHING_FOR_ENCRYPTION, Veneka.Indigo.Common.Utilities.StaticFields.EXTERNAL_SECURITY_KEY); cardData = new CardData { Track2 = track2, PAN = ecryptedPAN }; } ; if (printJobSuccess == PrinterCodes.ProductBinAndCardMismatch) { additionalInfo = "Card Product BIN does not match BIN on card used for printing"; } else if (printJobSuccess == PrinterCodes.PrintJobCancelled) { additionalInfo = "Card Jammed in Printer while printing."; } return(printJobSuccess.Equals(PrinterCodes.Success)); }
public AuthenticationResponse Login(string username, string password) { string message = String.Empty; try { string encryptedUsername = EncryptionManager.EncryptString(username, Veneka.Indigo.Common.Utilities.StaticFields.USE_HASHING_FOR_ENCRYPTION, Veneka.Indigo.Common.Utilities.StaticFields.EXTERNAL_SECURITY_KEY); string encryptedpwd = EncryptionManager.EncryptString(password, Veneka.Indigo.Common.Utilities.StaticFields.USE_HASHING_FOR_ENCRYPTION, Veneka.Indigo.Common.Utilities.StaticFields.EXTERNAL_SECURITY_KEY); string workstation = EncryptionManager.EncryptString("APILoginAttempt" + DateTime.Now.ToString(), Veneka.Indigo.Common.Utilities.StaticFields.USE_HASHING_FOR_ENCRYPTION, Veneka.Indigo.Common.Utilities.StaticFields.EXTERNAL_SECURITY_KEY); var responseObj = _userManContoller.LogIn(encryptedUsername, encryptedpwd, workstation); if (responseObj.ResponseType == ResponseType.SUCCESSFUL) { string SessionKey = EncryptionManager.DecryptString(responseObj.Value.encryptedSessionKey, Veneka.Indigo.Common.Utilities.StaticFields.USE_HASHING_FOR_ENCRYPTION, Veneka.Indigo.Common.Utilities.StaticFields.EXTERNAL_SECURITY_KEY); string UserId = EncryptionManager.DecryptString(responseObj.Value.encryptedUserId, Veneka.Indigo.Common.Utilities.StaticFields.USE_HASHING_FOR_ENCRYPTION, Veneka.Indigo.Common.Utilities.StaticFields.EXTERNAL_SECURITY_KEY); var token = BackOfficeAPIController.CreateToken(Guid.NewGuid(), SessionKey, int.Parse(UserId), bll.Action.PrintCard); return(new AuthenticationResponse() { ResponseCode = "00", ResponseMessage = "SUCCESSFUL", AuthToken = token }); } } catch (Exception ex) { message = ex.Message; _log.Error(ex); } return(new AuthenticationResponse() { ResponseCode = "01", ResponseMessage = "failed", AuthToken = null }); }