/// <summary> /// Gift card payment related methods /// </summary> /// <param name="valid"></param> /// <param name="comment"></param> /// <param name="posTransaction"></param> /// <param name="cardInfo"></param> /// <param name="gcTenderInfo"></param> public void AuthorizeGiftCardPayment(ref bool valid, ref string comment, IPosTransaction posTransaction, ICardInfo cardInfo, ITender gcTenderInfo) { if (cardInfo == null) { throw new ArgumentNullException("cardInfo"); } LogMessage("Authorizing a gift card payment", LogTraceLevel.Trace); valid = false; GiftCardController controller = new GiftCardController(GiftCardController.ContextType.GiftCardPayment, (PosTransaction)posTransaction, (Tender)gcTenderInfo); controller.CardNumber = cardInfo.CardNumber; using (GiftCardForm giftCardForm = new GiftCardForm(controller)) { POSFormsManager.ShowPOSForm(giftCardForm); if (giftCardForm.DialogResult == DialogResult.OK) { valid = true; cardInfo.CardNumber = controller.CardNumber; cardInfo.Amount = controller.Amount; cardInfo.CurrencyCode = controller.Currency; } } }
public void AddToGiftCard(IRetailTransaction retailTransaction, ITender gcTenderInfo) { //Start: added on 16/07/2014 for customer selection is must RetailTransaction retailTrans = retailTransaction as RetailTransaction; if (retailTrans != null) { if (Convert.ToString(retailTrans.Customer.CustomerId) == string.Empty || string.IsNullOrEmpty(retailTrans.Customer.CustomerId)) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Add a customer to transaction before making a deposit", MessageBoxButtons.OK, MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } return; } } //End: added on 16/07/2014 for customer selection is must LogMessage("Adding money to gift card.", LSRetailPosis.LogTraceLevel.Trace, "GiftCard.AddToGiftCard"); GiftCardController controller = new GiftCardController(GiftCardController.ContextType.GiftCardAddTo, (PosTransaction)retailTransaction, (Tender)gcTenderInfo); using (GiftCardForm giftCardForm = new GiftCardForm(controller)) { POSFormsManager.ShowPOSForm(giftCardForm); if (giftCardForm.DialogResult == DialogResult.OK) { // Add the gift card to the transaction. GiftCertificateItem giftCardItem = (GiftCertificateItem)this.Application.BusinessLogic.Utility.CreateGiftCardLineItem( ApplicationSettings.Terminal.StoreCurrency, this.Application.Services.Rounding, retailTransaction); giftCardItem.SerialNumber = controller.CardNumber; giftCardItem.StoreId = retailTransaction.StoreId; giftCardItem.TerminalId = retailTransaction.TerminalId; giftCardItem.StaffId = retailTransaction.OperatorId; giftCardItem.TransactionId = retailTransaction.TransactionId; giftCardItem.ReceiptId = retailTransaction.ReceiptId; giftCardItem.Amount = controller.Amount; giftCardItem.Balance = controller.Balance; giftCardItem.Date = DateTime.Now; giftCardItem.AddTo = true; giftCardItem.Price = giftCardItem.Amount; giftCardItem.StandardRetailPrice = giftCardItem.Amount; giftCardItem.Quantity = 1; giftCardItem.TaxRatePct = 0; giftCardItem.Description = ApplicationLocalizer.Language.Translate(55000); // Add to Gift Card giftCardItem.Comment = controller.CardNumber; giftCardItem.NoDiscountAllowed = true; giftCardItem.Found = true; ((RetailTransaction)retailTransaction).Add(giftCardItem); } } }
/// <summary> /// Ctor /// </summary> /// <param name="context">Context of the gift card form</param> /// <param name="posTransaction">Transaction object.</param> /// <param name="tenderInfo">Tender information about GC (Required for Payment Context) </param> public GiftCardForm(GiftCardController giftCardController) { // Required for Windows Form Designer support InitializeComponent(); this.controller = giftCardController; // Initial field values. padGiftCardNumber.EnteredValue = this.controller.CardNumber; }
/// <summary> /// Handles Gift Card Balance operation. /// </summary> public void GiftCardBalance(IPosTransaction posTransaction) { LogMessage("Inquiring gift card balance.", LSRetailPosis.LogTraceLevel.Trace, "GiftCard.GiftCardBalance"); GiftCardController controller = new GiftCardController(GiftCardController.ContextType.GiftCardBalance, (PosTransaction)posTransaction); using (GiftCardForm giftCardForm = new GiftCardForm(controller)) { POSFormsManager.ShowPOSForm(giftCardForm); } }
public void IssueGiftCard(IPosTransaction posTransaction, ITender gcTenderInfo) { //Start: added on 16/07/2014 for customer selection is must RetailTransaction retailTrans = posTransaction as RetailTransaction; if (retailTrans != null) { if (Convert.ToString(retailTrans.Customer.CustomerId) == string.Empty || string.IsNullOrEmpty(retailTrans.Customer.CustomerId)) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Add a customer to transaction before making a deposit", MessageBoxButtons.OK, MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } return; } } //End :added on 16/07/2014 for customer selection is must LogMessage("Issuing a gift card", LSRetailPosis.LogTraceLevel.Trace, "GiftCard.IssueGiftCard"); if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled()) { //The operation should proceed after the fiscal printer handles IssueGiftCard FiscalPrinter.FiscalPrinter.Instance.IssueGiftCard(posTransaction, gcTenderInfo); } GiftCardController controller = new GiftCardController(GiftCardController.ContextType.GiftCardIssue, (PosTransaction)posTransaction, (Tender)gcTenderInfo); //controller.CardNumber = "111111"; testing for autogenerate no req sailendra da using (GiftCardForm giftCardForm = new GiftCardForm(controller)) { POSFormsManager.ShowPOSForm(giftCardForm); if (giftCardForm.DialogResult == DialogResult.OK) { // Add the gift card to the transaction. RetailTransaction retailTransaction = posTransaction as RetailTransaction; GiftCertificateItem giftCardItem = (GiftCertificateItem)this.Application.BusinessLogic.Utility.CreateGiftCardLineItem( ApplicationSettings.Terminal.StoreCurrency, this.Application.Services.Rounding, retailTransaction); giftCardItem.SerialNumber = controller.CardNumber; giftCardItem.StoreId = posTransaction.StoreId; giftCardItem.TerminalId = posTransaction.TerminalId; giftCardItem.StaffId = posTransaction.OperatorId; giftCardItem.TransactionId = posTransaction.TransactionId; giftCardItem.ReceiptId = posTransaction.ReceiptId; giftCardItem.Amount = controller.Amount; giftCardItem.Balance = controller.Balance; giftCardItem.Date = DateTime.Now; // Necessary property settings for the the gift certificate "item"... giftCardItem.Price = giftCardItem.Amount; giftCardItem.StandardRetailPrice = giftCardItem.Amount; giftCardItem.Quantity = 1; giftCardItem.TaxRatePct = 0; giftCardItem.Description = ApplicationLocalizer.Language.Translate(55001); // Gift Card giftCardItem.Comment = controller.CardNumber; giftCardItem.NoDiscountAllowed = true; giftCardItem.Found = true; retailTransaction.Add(giftCardItem); } } }