Example #1
0
 public void SetupTest()
 {
     _driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
     _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(ConfigurationService.Instance.GetWebSettings().Chrome.PageLoadTimeout);
     _driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(ConfigurationService.Instance.GetWebSettings().Chrome.ScriptTimeout);
     _shoppingCartFactory = new ShoppingCartFactory(_driver);
 }
Example #2
0
        public void SaveToStoredValueCard(string cardNo, decimal amount, decimal balance)
        {
            string key         = KeyFactory.MachineKeyFactory(CompanyId, StoreId, MachineSN, DeviceSn);
            var    machineInfo = Salesclerk.onlineCache.Get(key);

            if (machineInfo == null)
            {
                throw new PosException("未能找到收银员信息,请重新登陆!");
            }
            var shoppingCart = ShoppingCartFactory.Factory(StoreId, MachineSN, CompanyId, DeviceSn);
            var cardinfo     = MembershipCardService.CurrentRepository.Entities.FirstOrDefault(o => o.CardSN == cardNo && o.CompanyId == CompanyId);

            if (cardinfo != null)
            {
                cardinfo.Balance = balance;
                MembershipCardService.CurrentRepository.Update(cardinfo, false);
                Pharos.Logic.BLL.BaseGeneralService <Pharos.Logic.Entity.StoredValueCardPayRecord, Pharos.Logic.DAL.EFDbContext> .CurrentRepository.Add(new StoredValueCardPayRecord()
                {
                    Amount    = amount,
                    CardNo    = cardNo,
                    CompanyId = CompanyId,
                    CreateDT  = DateTime.Now,
                    OrderSn   = shoppingCart.OrderSN,
                    StoreId   = StoreId,
                    CreateUID = machineInfo.CashierUid,
                    Balance   = balance
                });
            }
            else
            {
                throw new PosException(string.Format("未找到储值卡{0}!", cardNo));
            }
        }
Example #3
0
        public MemberInfo SetMember(SetMemberRequest requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            var memnerInfo   = shoppingcart.SetMember(requestParams.CardNo, requestParams.Phone, requestParams.To);

            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(memnerInfo);
        }
Example #4
0
        public object SetActivityId(SetActivityRequest requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            shoppingcart.SetActivityId(requestParams.ActivityId);
            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(null);
        }
Example #5
0
        public SuspendList RemoveHandBill([FromBody] HandBillRequest requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            var result       = SaleSuspend.Remove(shoppingcart, requestParams.OrderSn);

            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(result);
        }
        public ShoppingCart CreateEmptyShoppingCart()
        {
            var originalCart = ShoppingCartFactory.CreateCart(SiteID);

            ShoppingCartInfoProvider.SetShoppingCartInfo(originalCart);

            return(new ShoppingCart(originalCart, new EcommerceActivitiesLoggerFake(), null, null));
        }
Example #7
0
        public static DateTime RefundAll(string storeId, string machineSn, int companyId, int reason, string paySn, decimal amount, string deviceSn, IPay pay, DateTime createdt)
        {
            var customOrderSn = new Pharos.Infrastructure.Data.Normalize.PaySn(companyId, storeId, machineSn);
            var dataAdapter   = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var shoppingcart  = ShoppingCartFactory.Factory(storeId, machineSn, companyId, deviceSn);
            var uid           = shoppingcart.MachineInformation.CashierUid;
            var datetime      = dataAdapter.RefundAll(reason, paySn, amount, uid, pay.ApiCodes, pay.PayDetails.PaySn, customOrderSn.ToString(), createdt);

            customOrderSn.NextSerialNumber();
            return(datetime);
        }
        public ShoppingCart GetCart(Guid customerId)
        {
            var cart = this.RS.Where(item => item.CustomerId == customerId).FirstOrDefault();

            if (cart == null)
            {
                cart = ShoppingCartFactory.Create(customerId);
                this.RS.Add(cart);
            }
            return(cart);
        }
Example #9
0
        public ShoppingCart CreateCartWithCustomerInfo(CustomerInfo customer, AddressInfo address = null, ICurrentContactProvider currentContactProvider = null)
        {
            var cartInfo = ShoppingCartFactory.CreateCart(SiteID);

            cartInfo.ShoppingCartCurrencyID = Factory.MainCurrency.CurrencyID;
            cartInfo.Customer = customer;
            cartInfo.ShoppingCartBillingAddress = address;

            ShoppingCartInfoProvider.SetShoppingCartInfo(cartInfo);

            return(new ShoppingCart(cartInfo, new EcommerceActivitiesLoggerFake(), currentContactProvider));
        }
Example #10
0
        public DateTime SaveRecord(string storeId, string machineSn, int companyId, int reason, decimal amount, decimal receive, IPay pay, string deviceSn)
        {
            var      dataAdapter  = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var      shoppingcart = ShoppingCartFactory.Factory(storeId, machineSn, companyId, deviceSn);
            var      uid          = shoppingcart.MachineInformation.CashierUid;
            string   apiCodes     = pay != null ? pay.ApiCodes : "-1";
            DateTime saveTime     = pay != null ? pay.PayDetails.CreateDt : DateTime.Now;
            var      orderTime    = dataAdapter.ChangeOrRefund(this, reason, shoppingcart.MachineInformation, this.CustomOrderSn, amount, receive, uid, apiCodes, saveTime, this.SaleMan, this.OldOrderSn);

            new Pharos.Infrastructure.Data.Normalize.PaySn(companyId, storeId, machineSn).NextSerialNumber();
            return(orderTime);
        }
Example #11
0
        /// <summary>
        /// 验证用户登录
        /// </summary>
        /// <param name="userParams">登录参数</param>
        /// <returns></returns>
        public static LoginResult Login(LoginParams userParams, string deviceSn, bool inTestMode = false, bool isLock = false)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, userParams.StoreId, userParams.MachineSn, userParams.CompanyId, deviceSn);
            var userInfo    = dataAdapter.GetUser(userParams.Account);

            if (userInfo == null)
            {
                throw new LoginExecption("401", "账号错误!");
            }
            if (userInfo.LoginPwd != MD5.MD5Encrypt(userParams.Password))
            {
                throw new LoginExecption("401", "密码错误!");
            }
            //本店角色(1:店长、2:营业员、3:收银员、4:数据维护),格式:门店ID,角色ID|门店ID,角色ID
            if (!inTestMode && !(VerfyOperateAuth(userInfo, dataAdapter.StoreId, StoreOperateAuth.Cashier) || VerfyOperateAuth(userInfo, dataAdapter.StoreId, StoreOperateAuth.DataManager)))
            {
                throw new LoginExecption("402", "非销售员或数据维护员不允许登录销售!");
            }
            var key         = KeyFactory.MachineKeyFactory(userParams.CompanyId, userParams.StoreId, userParams.MachineSn, deviceSn);
            var machineInfo = new MachineInformation()
            {
                CashierName        = userInfo.FullName,
                CashierOperateAuth = userInfo.OperateAuth,
                CashierUid         = userInfo.UID,
                CashierUserCode    = userInfo.UserCode,
                StoreName          = userInfo.StoreName,
                StoreId            = userParams.StoreId,
                MachineSn          = userParams.MachineSn,
                CompanyId          = userParams.CompanyId,
                InTestMode         = inTestMode,
                DeviceSn           = deviceSn
            };

            onlineCache.Set(key, machineInfo);
#if (Local != true)
            RedisManager.Publish("SyncOnlineCache", JsonConvert.SerializeObject(machineInfo));
#endif
#if (Local)
            StoreManager.PubEvent("SyncOnlineCache", JsonConvert.SerializeObject(machineInfo));
#endif
            if (!isLock)
            {
                ShoppingCartFactory.Factory(userParams.StoreId, userParams.MachineSn, userParams.CompanyId, deviceSn, true);
            }
            return(new LoginResult()
            {
                FullName = userInfo.FullName,
                OperateAuth = userInfo.OperateAuth,
                UserCode = userInfo.UserCode,
                StoreName = userInfo.StoreName
            });
        }
Example #12
0
        public OrdersDetails SaleOrderEnableMarketing([FromBody] SaleEnableMarketingRequest requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            shoppingcart.EnableRangeMarketings = requestParams.EnableRangeMarketings;
            var result = new OrdersDetails()
            {
                BuyList    = shoppingcart.GetBuyList(),
                Gifts      = new List <GiftResult>(),
                Statistics = shoppingcart.GetSaleStatistics()
            };

            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(result);
        }
Example #13
0
        public OrdersDetails ClearOrder([FromBody] MachineInfo requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            shoppingcart.Clear();
            var result = new OrdersDetails()
            {
                BuyList    = shoppingcart.GetBuyList(),
                Gifts      = new List <GiftResult>(),
                Statistics = shoppingcart.GetSaleStatistics()
            };

            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(result);
        }
Example #14
0
        public OrdersDetails ReadHandBill([FromBody] HandBillRequest requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            var barcodes     = SaleSuspend.Read(shoppingcart, requestParams.OrderSn);

            shoppingcart.RunMarketings();
            var result = new OrdersDetails()
            {
                BuyList    = shoppingcart.GetBuyList(),
                Gifts      = new List <GiftResult>(),
                Statistics = shoppingcart.GetSaleStatistics()
            };

            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(result);
        }
Example #15
0
        public OrdersDetails SaleOrderRemove([FromBody] SaleRemoveRequest requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            shoppingcart.Remove(requestParams.Barcode, requestParams.Status, requestParams.HasEditPrice, requestParams.RecordId);
            shoppingcart.RunMarketings();
            var result = new OrdersDetails()
            {
                BuyList    = shoppingcart.GetBuyList(),
                Gifts      = new List <GiftResult>(),
                Statistics = shoppingcart.GetSaleStatistics()
            };

            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(result);
        }
Example #16
0
        // a step towards soundness. not precise. trust level matters: medium|low

        public void Run()
        {
            string input = FlowBlot.Model.Framework.Source();

            IShoppingCart cart = ShoppingCartFactory.FetchCart();

            IItem milk = ItemFactory.FetchMilk();

            milk.SetName(input);

            cart.PutItem(milk);

            IItem anItem = cart.FetchItem(0);

            /*FLOW:Flow_00073 - A more complex 3rd-party code taint propagation:codethreat.flowblot.benchmark:0+:FIND_ISSUE:1:
             * STEP_PATH:ABC
             */
            FlowBlot.Model.Framework.Sink(anItem.GetName());
        }
Example #17
0
        public OrdersDetails HandBill([FromBody] HandBillRequest requestParams)
        {
            var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            if (shoppingcart.RecordCount == 0)
            {
                throw new PosException("订单列表为空不能挂单!");
            }
            SaleSuspend.Suspend(shoppingcart);
            var result = new OrdersDetails()
            {
                BuyList    = shoppingcart.GetBuyList(),
                Gifts      = new List <GiftResult>(),
                Statistics = shoppingcart.GetSaleStatistics()
            };

            ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
            return(result);
        }
Example #18
0
    protected ShoppingCartInfo GetNewCart()
    {
        ShoppingCartInfo cart = null;
        var siteId            = SiteContext.CurrentSiteID;

        if (customerId > 0)
        {
            var customer = CustomerInfo.Provider.Get(customerId);
            if (customer != null)
            {
                cart = ShoppingCartFactory.CreateCart(siteId, customer.CustomerUser);
                cart.ShoppingCartCustomerID = customerId;
            }
        }

        cart = cart ?? ShoppingCartFactory.CreateCart(siteId);

        return(cart);
    }
Example #19
0
    /// <summary>
    /// Creates a new shopping cart record and corresponding shopping cart items records in the database
    /// as a copy of given shopping cart info.
    /// Currency is set according to the currency of the given cart.
    /// If a configuration of cart item is no longer available it is not cloned to new shopping cart.
    /// <see cref="AbstractUserControl.CurrentUser"/> is set as the new cart owner (only non-public user is set).
    /// </summary>
    /// <param name="originalCart">Original cart to clone.</param>
    /// <returns>Created shopping cart info.</returns>
    private ShoppingCartInfo CloneShoppingCartInfo(ShoppingCartInfo originalCart)
    {
        using (new CMSActionContext {
            UpdateTimeStamp = false
        })
        {
            var cartClone = ShoppingCartFactory.CreateCart(CurrentSite.SiteID, CurrentUser.IsPublic() ? null : CurrentUser);

            cartClone.ShoppingCartCurrencyID = originalCart.ShoppingCartCurrencyID;
            cartClone.ShoppingCartLastUpdate = originalCart.ShoppingCartLastUpdate;
            ShoppingCartInfoProvider.SetShoppingCartInfo(cartClone);

            ShoppingCartInfoProvider.CopyShoppingCartItems(originalCart, cartClone);

            // Set the shopping cart items into the database
            cartClone.CartItems.ForEach(i => i.Generalized.SetObject());

            return(cartClone);
        }
    }
Example #20
0
        public object RequestPay()
        {
            var shoppingCart = ShoppingCartFactory.Factory(StoreId, MachineSn, CompanyId, DeviceSn);

            lock (SwiftNumber.LockObject)
            {
                var ordersn = new PayOrderSn(CompanyId, StoreId);
                shoppingCart.PayOrderSn = ordersn.ToString();
                ShoppingCartFactory.ResetCache(shoppingCart, StoreId, MachineSn, CompanyId, DeviceSn);
            }
            var p = GetRongHeDynamicQRCodePayRequestParameter(CompanyId, StoreId, MachineSn, shoppingCart.PayOrderSn, PayDetails.Amount, PayDetails.CardNo);

            RequestPayDate = DateTime.Now;
            var RongHeDynamicQRCodePayUrl = Path.Combine(ConfigurationManager.AppSettings["RongHeDynamicQRCodePay"].ToString(), "api/pay/scanpay");

            if (string.IsNullOrEmpty(RongHeDynamicQRCodePayUrl))
            {
                throw new PosException("支付配置不完整,无法完成支付!");
            }
            return(PostPay(RongHeDynamicQRCodePayUrl, p));
        }
Example #21
0
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        var currentSite = SiteContext.CurrentSite;

        // If shopping cart is created -> create empty one
        if ((ShoppingCartInfoObj == null) && (currentSite != null))
        {
            var currentUser = MembershipContext.AuthenticatedUser;

            ShoppingCartInfoObj = ShoppingCartFactory.CreateCart(currentSite.SiteID, currentUser);
        }

        // Display / hide checkout process images
        plcCheckoutProcess.Visible = false;

        // Load current step data
        LoadCurrentStep();

        if (CurrentStepIndex == 0)
        {
            ShoppingCartInfoObj.PrivateDataCleared = false;
            btnBack.Enabled = false;
        }

        // If shopping cart information exist
        if (ShoppingCartInfoObj != null)
        {
            // Get order information
            var order = OrderInfo.Provider.Get(ShoppingCartInfoObj.OrderId);

            // If order is paid
            if ((order != null) && (order.OrderIsPaid))
            {
                // Disable specific controls
                btnNext.Enabled            = false;
                CurrentStepControl.Enabled = false;
            }
        }
    }
        public ThirdPartyPaymentStatus GetPayStatus()
        {
            var payConfig = BaseGeneralService <Pharos.Logic.Entity.PayConfiguration, EFDbContext> .Find(o => o.CompanyId == CompanyId && o.PayType == 25);

            var ordersn = ShoppingCartFactory.Factory(StoreId, MachineSn, CompanyId, DeviceSn).PayOrderSn;
            var storePaymentAuthorization = BaseGeneralService <Pharos.Logic.Entity.StorePaymentAuthorization, EFDbContext> .Find(o => o.CompanyId == CompanyId && o.PayType == 25 && o.StoreId == StoreId);

            var mic    = int.Parse(payConfig.PaymentMerchantNumber);
            var entity = PayNotifyResultService.Find(o => o.ApiCode == 25 && o.PaySN == ordersn && o.CompanyId == mic);

            if (entity == null)
            {
                return(ThirdPartyPaymentStatus.Unknown);
            }
            else if (entity.State == "PAYSUCCESS")
            {
                return(ThirdPartyPaymentStatus.Complete);
            }
            else
            {
                return(ThirdPartyPaymentStatus.Error);
            }
        }
    /// <summary>
    /// Creates a new shopping cart record and corresponding shopping cart items records in the database
    /// as a copy of given shopping cart info.
    /// Currency is set according to the currency of given cart.
    /// If a configuration of cart item is no longer available it is not cloned to new shopping cart.
    /// Correct user id for logged user is _not_ handled in this method, because it does not depend on
    /// abandoned cart's user id. It should be handled according to user's status (logged in/anonymous)
    /// in the browser where the cart is loaded:
    ///  - anonymous cart or user's cart opened in the browser where user is logged in - new cart userId should be set to logged user's id
    ///  - anonymous cart or user's cart opened in the browser where user is _not_ logged in - new cart userId should be empty (anonymous cart)
    /// </summary>
    /// <param name="originalCart">Original cart to clone.</param>
    /// <returns>Created shopping cart info.</returns>
    private ShoppingCartInfo CloneShoppingCartInfo(ShoppingCartInfo originalCart)
    {
        using (new CMSActionContext {
            UpdateTimeStamp = false
        })
        {
            ShoppingCartInfo cartClone = ShoppingCartFactory.CreateCart(CurrentSite.SiteID, originalCart.User);

            cartClone.ShoppingCartCurrencyID = originalCart.ShoppingCartCurrencyID;
            cartClone.ShoppingCartLastUpdate = originalCart.ShoppingCartLastUpdate;
            ShoppingCartInfoProvider.SetShoppingCartInfo(cartClone);

            ShoppingCartInfoProvider.CopyShoppingCartItems(originalCart, cartClone);

            // Set the shopping cart items into the database
            foreach (ShoppingCartItemInfo item in cartClone.CartItems)
            {
                ShoppingCartItemInfoProvider.SetShoppingCartItemInfo(item);
            }

            return(cartClone);
        }
    }
Example #24
0
        public SaleManInfo SetSaleMan([FromBody] SetSaleManRequest requestParams)
        {
            switch (requestParams.Source)
            {
            case 0:
            {
                var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
                var result       = shoppingcart.SetSaleMan(requestParams.SaleMan);
                ShoppingCartFactory.ResetCache(shoppingcart, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
                return(result);
            }

            case 1:
            case 2:
            {
                var orderChangeRefund = OrderChangeFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.Mode, requestParams.DeviceSn);
                var result            = orderChangeRefund.SetSaleMan(requestParams.SaleMan, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
                return(result);
            }

            default:
                throw new PosException("未能设置导购员,请重试!");
            }
        }
 public AccountController(IUserService userService, IOrderService orderService, ShoppingCartFactory factory)
 {
     UserService         = userService;
     OrderService        = orderService;
     shoppingCartFactory = factory;
 }
        //MusicStoreEntities storeDB = new MusicStoreEntities();

        public ShoppingCartController(ICartRepository carts, IAlbumsRepository albums, ShoppingCartFactory shoppingCartFactory)
        {
            _carts  = carts;
            _albums = albums;
            _shoppingCartFactory = shoppingCartFactory;
        }
Example #27
0
 public HomeController(IOrderService oService, IBookService bService, ShoppingCartFactory factory)
 {
     orderService        = oService;
     shoppingCartFactory = factory;
     bookService         = bService;
 }
 public void SetupTest()
 {
     _driver = new FirefoxDriver();
     _shoppingCartFactory = new ShoppingCartFactory(_driver);
 }
Example #29
0
        public object Pay([FromBody] PayRequest requestParams)
        {
            if (requestParams == null || requestParams.Payway == null || requestParams.Payway.Count() == 0)
            {
                throw new PosException("未知支付方式!");
            }
            string key = string.Format("{0}-{1}-{2}-{3}", requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            lock (lockobjforadd)
            {
                if (!lockobjs.ContainsKey(key))
                {
                    lockobjs = lockobjs.ToList().Concat(new List <KeyValuePair <string, object> >()
                    {
                        new KeyValuePair <string, object>(key, new object())
                    }).ToDictionary(o => o.Key, o => o.Value);
                }
            }
            var    dict    = lockobjs;//防止并发
            var    lockkv  = dict.First(o => o.Key == key);
            object lockobj = new object();

            if (!lockkv.Equals(default(KeyValuePair <string, object>)) && lockkv.Value != null)
            {
                lockobj = lockkv.Value;
            }

            DateTime createDt = DateTime.Now;

            lock (lockobj)
            {
                switch (requestParams.Mode)
                {
                case PayAction.RefundAll:    //退单
                    return(DoPay(requestParams.CID, requestParams.StoreId, requestParams.MachineSn, requestParams.DeviceSn, Guid.NewGuid().ToString("N"), requestParams, createDt, (o) =>
                    {
                        OrderChangeRefundSale.RefundAll(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.Reason, requestParams.OldOrderSn, requestParams.OrderAmount, requestParams.DeviceSn, o, createDt);
                    }));

                case PayAction.Refund:    //退货
                    var orderRefund = OrderChangeFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, AfterSaleMode.Refunding, requestParams.DeviceSn);
                    return(DoPay(requestParams.CID, requestParams.StoreId, requestParams.MachineSn, requestParams.DeviceSn, orderRefund.PaySn, requestParams, createDt, (o) =>
                    {
                        orderRefund.SaveRecord(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.Reason, requestParams.OrderAmount, requestParams.Receivable, o, requestParams.DeviceSn);
                    }));

                case PayAction.Change:    //换货支付
                    var orderChange = OrderChangeFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, AfterSaleMode.Changing, requestParams.DeviceSn);
                    return(DoPay(requestParams.CID, requestParams.StoreId, requestParams.MachineSn, requestParams.DeviceSn, orderChange.PaySn, requestParams, createDt, (o) =>
                    {
                        orderChange.SaveRecord(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.Reason, requestParams.OrderAmount, requestParams.Receivable, o, requestParams.DeviceSn);
                    }));

                case PayAction.Sale:    //销售支付

                    var shoppingcart = ShoppingCartFactory.Factory(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
                    var orderList    = shoppingcart.GetOrdeList();
                    if (orderList == null || orderList.Count() == 0)
                    {
                        throw new PosException("该商品已结算,遇到网络异常,请手动按 Q 清空购物车!");
                    }
                    try
                    {
                        return(DoPay(requestParams.CID, requestParams.StoreId, requestParams.MachineSn, requestParams.DeviceSn, shoppingcart.OrderSN, requestParams, createDt, (o) =>
                        {
                            shoppingcart.Record(o.ApiCodes, requestParams.OrderAmount, requestParams.Receivable, requestParams.DeviceSn, createDt);
                        }));
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                }
            }
            return(createDt);
        }
Example #30
0
 public CheckoutController(IOrderService service, ShoppingCartFactory factory)
 {
     shoppingCartFactory = factory;
     orderSerivce        = service;
 }