public void SalesInvoicecmdProcessAccessCompute_ChargeIsAllowedForCustomer_Applicable()
        {
            var customer     = PaymentHelper.GetCustomer("LGBUI");
            var salesInvoice = PaymentHelper.CreateInvoiceWithDetail(customer, PaymentHelper.DefaultProduct, 1, 10).Invoice;

            Assert.IsFalse(IsHiddenAndNotApplicable(salesInvoice.accesscmdProcess));
        }
        public void SalesInvoicecmdProcessExecuted_HasAllowedRealPaymentType_NoMessage()
        {
            var warningMessage = new MessageId(typeof(SalesInvoiceBL), nameof(SalesInvoiceBL.SalesInvoice_cmdProcess_Executed));
            var salesInvoice   = PaymentHelper.CreateInvoiceWithDetail(PaymentHelper.GetCustomer("AMERET"), PaymentHelper.DefaultProduct, 10, 10).Invoice;

            salesInvoice.cmdProcess.Execute();
            Assert.IsFalse(warningMessage.Any(TestContext.Messages));
        }
        public void SalesInvoicecmdProcessAndOrPayExecuting_WhenThereAreSomeAllowedType_NoMessage()
        {
            var message  = new MessageId(this, nameof(SalesInvoice_cmdProcessAndOrPay_Executing));
            var customer = TestContext.GetEntity <Customer>("AMERET");
            var invoice  = PaymentHelper.CreateInvoiceWithDetail(PaymentHelper.GetCustomer("AMERET"), PaymentHelper.DefaultProduct, 1, 12).Invoice;

            invoice.cmdProcessAndOrPay.Execute();
            Assert.IsFalse(message.Any(TestContext.Messages));
        }
        public void SalesInvoicecmdProcessAndOrPayExecuting_ThereIsNotAnyAllowedType_DisplayMessage()
        {
            var message      = new MessageId(this, nameof(SalesInvoice_cmdProcessAndOrPay_Executing));
            var salesInvoice = PaymentHelper.CreateInvoiceWithDetail(PaymentHelper.GetCustomer("LGBUI"), PaymentHelper.DefaultProduct, 1, 12).Invoice;

            salesInvoice.BillingCustomer.AllowedPaymentTypeLinks.Clear();
            salesInvoice.cmdProcessAndOrPay.Execute();
            Assert.IsTrue(message.Any(TestContext.Messages));
        }
        public void SalesInvoicecmdProcessAccessCompute_ChargeIsTemporaryAllowed_Applicable()
        {
            var cashCustomer = PaymentHelper.GetCustomer("LGBUI");

            PaymentHelper.DisallowCharge(cashCustomer);
            var salesInvoice = PaymentHelper.CreateInvoiceWithDetail(cashCustomer, PaymentHelper.DefaultProduct, 1, 10).Invoice;

            salesInvoice.IsChargeTemporaryAllowed = true;
            Assert.IsFalse(IsHiddenAndNotApplicable(salesInvoice.accesscmdProcess));
        }
        public void SalesInvoicecmdProcessExecuted_NoAllowedPaymentType_DisplayMessage()
        {
            var warningMessage = new MessageId(typeof(SalesInvoiceBL), nameof(SalesInvoiceBL.SalesInvoice_cmdProcess_Executed));
            var customer       = PaymentHelper.GetCustomer("ZURMIK");
            var salesInvoice   = PaymentHelper.CreateInvoiceWithDetail(customer, PaymentHelper.DefaultProduct, 10, 10).Invoice;

            customer.AllowedPaymentTypes.Clear();
            salesInvoice.cmdProcess.Execute();
            Assert.IsTrue(warningMessage.Any(TestContext.Messages));
        }
        public void SalesInvoicecmdProcessAccessCompute_ChargeIsNotAllowedAndBalanceIsNegative_Applicable()
        {
            var cashCustomer = PaymentHelper.GetCustomer("LGBUI");

            PaymentHelper.DisallowCharge(cashCustomer);
            var salesInvoice = PaymentHelper.CreateInvoiceWithDetail(cashCustomer, PaymentHelper.DefaultProduct, 1, 10).Invoice;
            var payment      = PaymentHelper.CreatePayment(cashCustomer, salesInvoice.Balance + 10, salesInvoice).Payment;

            payment.cmdPay.TryExecute();
            Assert.IsFalse(IsHiddenAndNotApplicable(salesInvoice.accesscmdProcess));
        }