Ejemplo n.º 1
0
        public OrderPaymentStatus EvaluatePaymentStatus(Order o)
        {
            var s = new OrderPaymentSummary();

            s.Populate(o, this);
            return(EvaluatePaymentStatus(o, s));
        }
Ejemplo n.º 2
0
        private OrderPaymentStatus EvaluatePaymentStatus(Order o, OrderPaymentSummary s)
        {
            var result = OrderPaymentStatus.Unknown;

            if (s.AmountDue < 0 || s.TotalCredit > o.TotalGrand)
            {
                // Refund Due = Overpaid
                result = OrderPaymentStatus.Overpaid;
            }
            else
            {
                if (s.AmountDue == 0 && s.TotalCredit == o.TotalGrand)
                {
                    result = OrderPaymentStatus.Paid;
                }
                else
                {
                    // Amount Due = positive at this point
                    if (s.TotalCredit > 0)
                    {
                        result = OrderPaymentStatus.PartiallyPaid;
                    }
                    else
                    {
                        result = OrderPaymentStatus.Unpaid;
                    }
                }
            }

            o.PaymentStatus = result;
            return(result);
        }
Ejemplo n.º 3
0
        public OrderPaymentSummary PaymentSummary(Order o)
        {
            var result = new OrderPaymentSummary();

            result.Populate(o, this);
            o.PaymentStatus = EvaluatePaymentStatus(o, result);
            return(result);
        }