Пример #1
0
        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);
                }
            }
        }
Пример #2
0
        public void GiftCertificateOrderItemTypeReturnsGiftCertificateItemOrderItemType()
        {
            const OrderItemType expectedOrderItemType = OrderItemType.GiftCertificateItem;
            var refundItem = new GiftCertificateItem();

            OrderItemType orderItemType = refundItem.OrderItemType;

            Assert.AreEqual(expectedOrderItemType, orderItemType, "RefundItem returned incorrect OrderItemType.");
        }
Пример #3
0
        public void RefundItemOrderItemIdGetsSetViaConstructorParameter()
        {
            const long expectedOrderItemId = 83;
            var        refundItem          = new GiftCertificateItem(expectedOrderItemId);

            long orderItemId = refundItem.Id;

            Assert.AreEqual(expectedOrderItemId, orderItemId, "RefundItem's OrderItemId was not set correctly.");
        }
Пример #4
0
        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);
                }
            }
        }
Пример #5
0
 /// <summary>
 /// Adds a gift certificate item to an existing basket.
 /// </summary>
 /// <param name="basketId">A String value containing the basket ID.</param>
 /// <param name="giftCertificateItem">A GiftCertificateItem document instance containing the git certificate item.</param>
 /// <returns>A Basket document instance containing the updated basket.</returns>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="basketId"/> is null or empty.</exception>
 /// <exception cref="ApiException">Thrown when a <see cref="Fault"/> document is returned.</exception>
 public Basket AddGiftCertificateItem(string basketId, GiftCertificateItem giftCertificateItem)
 {
     throw new NotImplementedException();
 }