private OrderInfo placeOrderForDomain(ReqPlaceOrderForDomain req, ProductPriceTypes op) { if (req.DomainName.IsEmpty()) { throw new APIException("DomainName parameter cannot be empty"); } var extension = DomainUtility.GetZoneFromDomainName(req.DomainName); if (extension == null) { throw new APIException("We dont have such extension: " + DomainUtility.GetDomainExtension(req.DomainName)); } ProductPrice pp = Provider.Database.Read <ProductPrice>("ProductId = {0} AND ProductPriceType = {1} AND Amount = {2}", extension.Id, op.ToString(), req.Years); if (pp == null) { pp = Provider.Database.Read <ProductPrice>("ProductId = {0} AND ProductPriceType = {1}", extension.Id, op.ToString()); } if (pp == null) { throw new APIException("There is no ProductPrice for Product " + extension.Id + " and ProductPriceType " + op + " with amount of " + req.Years + " years"); } OrderItemInfo oi = new OrderItemInfo() { ProductPriceId = pp.Id, Amount = req.Years }; oi.DisplayName = req.DomainName; var basket = Order.GetMemberBasket(); basket.RemoveAllItems(); basket.AddItem(oi); if (basket.TotalPrice == 0) { throw new APIException("Order total price must be bigger than zero"); } var reseller = Provider.CurrentMember.GetAdminResellerMember(); if (reseller == null) { throw new APIException("Reseller undefined! (This Member's ClientId should have an AdminMemberId)"); } if (reseller.CreditBalance < basket.TotalPrice) { throw new APIException("Insufficient credits"); } var order = CreateOrderFromBasket(""); return(order); }