Example #1
0
        static void Main(string[] args)
        {
            ReturnOrder returnOrder = new ReturnOrder()
            {
                Action = ReturnAction.FaultyReturn,
                PayMentTransactionId = "20141113",
                PostageCost          = 10,
                PricePaid            = 110,
                ProductId            = 1
            };
            ReturnService returnService = new ReturnService();

            returnService.Process(returnOrder);
            Console.WriteLine("退款金额为:{0}", returnOrder.AmountToRefund);
            Console.Read();
        }
Example #2
0
        public void Process(ReturnOrder returnOrder)
        {
            ReturnProcessTemplate returnProcessTemplate = ReturnProcessFactory.Create(returnOrder.Action);

            returnProcessTemplate.Process(returnOrder);
        }
Example #3
0
 /// <summary>
 /// 缺陷商品需要返厂修理
 /// </summary>
 /// <param name="returnOrder"></param>
 protected override void GenerateReturnTransactionFor(ReturnOrder returnOrder)
 {
     Console.WriteLine("创建了一张返厂单");
 }
Example #4
0
 /// <summary>
 /// 计算退货费用
 /// </summary>
 /// <param name="returnOrder"></param>
 protected override void CalclateRefundFor(ReturnOrder returnOrder)
 {
     returnOrder.AmountToRefund = returnOrder.PricePaid + returnOrder.PostageCost;
 }
 /// <summary>
 /// 退货处理
 /// </summary>
 /// <param name="returnOrder"></param>
 public void Process(ReturnOrder returnOrder)
 {
     GenerateReturnTransactionFor(returnOrder);
     CalclateRefundFor(returnOrder);
 }
 /// <summary>
 /// 退货处理事务
 /// </summary>
 /// <param name="returnOrder"></param>
 protected abstract void GenerateReturnTransactionFor(ReturnOrder returnOrder);
 /// <summary>
 /// 计算退还费用
 /// </summary>
 /// <param name="returnOrder"></param>
 protected abstract void CalclateRefundFor(ReturnOrder returnOrder);