public DataResponse GetAllPromotions(PosProductRequest productRequest) { var promotions = _blackstonePosService.GetAllPromotions(productRequest.MerchantId); var merchantInfo = _blackstonePosService.FindMerchant(productRequest.MerchantId); var productsResponse = _blackstonePosService.GetProducts(productRequest.MerchantId, merchantInfo.MerchantTerminalID.ToString(), merchantInfo.MerchantPassword, merchantInfo.Name); var products = (productsResponse.Data as IEnumerable<ProductItem>); var promotionsProducts = promotions.Join(products, promo => promo.Code, product => product.Code, (a, b) => new Promotion() { Code = a.Code, ImageText = a.ImageText, ImageUrl = a.ImageUrl, MainCategory = b.MainCategory } ).ToList(); var promotionsResult = GetDistinctPromotions(promotionsProducts); return new DataResponse() { Data = promotionsResult, ErrorMessage = promotions != null ? string.Empty : "Could not retrieve Promotions at this moment", Status = promotions != null ? 200 : 201 }; }
public DataResponse GetAllProducts(PosProductRequest productRequest) { var cashierInfo = _blackstonePosService.FindMerchant(productRequest.MerchantId); const int mostPopularAmount = 150; var productsResponse = _blackstonePosService.GetProducts(productRequest.MerchantId, cashierInfo.MerchantTerminalID.Value.ToString(), cashierInfo.MerchantPassword, cashierInfo.Name, productRequest.Category, mostPopularAmount); return productsResponse; }
public DataResponse GetWirelessProductsByCarrier(PosProductRequest productRequest) { var wirelessProdsByCarrier = getWirelessProductsByCarrier(productRequest).ToList(); //Cable to help building the url in the client wirelessProdsByCarrier.ForEach(p => p.MainCategory = "wireless"); return new DataResponse { Data = wirelessProdsByCarrier, Status = wirelessProdsByCarrier != null ? 200 : 201, ErrorMessage = wirelessProdsByCarrier != null ? string.Empty : "Could not retrieve Wireless Products at this time." }; }
public DataResponse GetWirelessCountries(PosProductRequest productRequest) { var countriesResult = getWirelessCountries(productRequest.MerchantId); return new DataResponse { Data = countriesResult, Status = countriesResult != null ? 200 : 201, ErrorMessage = countriesResult != null ? string.Empty : "Could not retrieve Wireless countries at this time." }; }
public DataResponse GetWirelessCarriers(PosProductRequest productRequest) { var carriers = !string.IsNullOrEmpty(productRequest.CountryCode) ? _meteleService.GetWirelessCarriers(productRequest.CountryCode, productRequest.MerchantId) : GetWirelessCarriers(productRequest.MerchantId); var carriersResult = carriers.Select(c => new { ImageUrl = string.Format("http://mobile.blackstonepos.com/products/IMG_{0}.jpg", c.ImageName), Name = c.CarrierName, Id = c.CarrierId, c.PhoneCode }); return new DataResponse { Data = carriersResult, ErrorMessage = carriers != null ? string.Empty : "Could not retrieve Wireless Carriers", Status = carriers != null ? 200 : 201 }; }
public DataResponse GetWirelessCarrierInitials(PosProductRequest productRequest) { var carriers = !string.IsNullOrEmpty(productRequest.CountryCode) ? _meteleService.GetWirelessCarriers(productRequest.CountryCode, productRequest.MerchantId) : GetWirelessCarriers(productRequest.MerchantId); var initials = carriers.Select(carrier => carrier.CarrierName.Substring(0, 1)).GetInitials(); return new DataResponse { Data = initials, ErrorMessage = carriers != null ? string.Empty : "Could not retrieve Wireless Carrier Initials", Status = carriers != null ? 200 : 201 }; }
public DataResponse GetCountryDetailsByCategory(PosProductRequest productRequest) { var country = getCountryDetailsByCategory(productRequest.MerchantId, productRequest.Category, productRequest.CountryCode); return new DataResponse { Data = country, Status = country != null ? 200 : 201, ErrorMessage = country != null ? string.Empty : "Could not retrieve Long Distance country details at this time." }; }
private IEnumerable<ProductItem> getWirelessProductsByCarrier(PosProductRequest productRequest) { var wirelessProducts = _meteleService.GetWirelessPlans(productRequest.CarrierId.ToString(), "USA", productRequest.MerchantId); var merchantInfo = _blackstonePosService.FindMerchant(productRequest.MerchantId); var productsFromService = _blackstonePosService.GetProducts(productRequest.MerchantId, merchantInfo.MerchantTerminalID.ToString(), merchantInfo.MerchantPassword, merchantInfo.Name).Data as IEnumerable<ProductItem>; var productsJoined = productsFromService.Join(wirelessProducts, a => a.Code, b => b.PlanId, (a, b) => a).ToList(); var productsResult = productsJoined.Distinct(new ProductItemComparer()); return productsResult; }
public DataResponse GetProductInitialsByCategoryByCountry(PosProductRequest productRequest) { var productsByCategoryByCountryResponse = GetProductsByCategoryByCountry(productRequest); var productsByCategoryByCountry = productsByCategoryByCountryResponse.Data as IEnumerable<ProductItem>; var initials = productsByCategoryByCountry.Select(p => p.Name.Substring(0, 1)).GetInitials(); return new DataResponse { Data = initials, ErrorMessage = initials != null ? string.Empty : "Could not retrieve product initials at this time", Status = initials != null ? 200 : 201 }; }
public DataResponse GetProductInitialsByCategory(PosProductRequest productRequest) { var allProductsDataResponse = GetAllProducts(productRequest); var allProductsInitials = (allProductsDataResponse.Data as IEnumerable<ProductItem>).Select(p=> p.Name.Substring(0,1)).GetInitials().Distinct(new InitialComparer()); return new DataResponse { Data = allProductsInitials, ErrorMessage = allProductsInitials!= null? string.Empty: "Could not retrieve product initials.", Status = allProductsInitials!= null? 200: 201 }; }
public DataResponse GetMostSoldProducts(PosProductRequest productRequest) { var cashierInfo = _blackstonePosService.FindMerchant(productRequest.MerchantId); var mostSoldProductsResponse = _blackstonePosService.GetMostSoldProducts(productRequest.MerchantId, cashierInfo.MerchantTerminalID.ToString(), cashierInfo.MerchantPassword, cashierInfo.Name, productRequest.Category, productRequest.Amount); return mostSoldProductsResponse; }
public DataResponse GetLongDistanceCountryInitials(PosProductRequest productRequest) { var longDistanceCountries = _meteleService.GiveCountries(productRequest.MerchantId); var initials = longDistanceCountries.Select(country => country.CountryName.Substring(0, 1)).GetInitials(); return new DataResponse { Data = initials, Status = longDistanceCountries != null ? 200 : 201, ErrorMessage = longDistanceCountries != null ? string.Empty : "Could not retrieve Long Distance countries at this time." }; }
public DataResponse GetFullcargaAccessNumber(PosProductRequest posRequest) { var accessNumber = _blackstonePosService.FullcargaAccessNumberTest(posRequest.MerchantId, posRequest.ProductMainCode); return new DataResponse { Data = accessNumber, Status = 200, ErrorMessage = "OK" }; }
public DataResponse GetCountryInitialsByCategory(PosProductRequest productRequest) { var countriesByCategory = getCountriesByCategory(productRequest.MerchantId, productRequest.Category); var countriesInitials = countriesByCategory.Select(c => c.Name.Substring(0,1)).GetInitials(); return new DataResponse { Data = countriesInitials, ErrorMessage = countriesInitials != null ? string.Empty : "Could not retrieve countries initials at this time", Status = countriesInitials != null ? 200 : 201 }; }
public DataResponse GetWirelessProductsByCountry(PosProductRequest productRequest) { var longDistanceProducts = getWirelessProductsByCountry(productRequest).ToList(); //Cable to help building the url in the client longDistanceProducts.ForEach(p => p.MainCategory = "wireless"); return new DataResponse { Data = longDistanceProducts, Status = longDistanceProducts != null ? 200 : 201, ErrorMessage = longDistanceProducts != null ? string.Empty : "Could not retrieve Wireless products at this time." }; }
private IEnumerable<ProductItem> getLongDistanceProductsByCountry(PosProductRequest productRequest) { var countryName = GetLongDistanceCountryName(productRequest.MerchantId, productRequest.CountryCode); var longDistanceProducts = _meteleService.GetLongDistanceProductsByCountry(productRequest.MerchantId, countryName); var merchantInfo = _blackstonePosService.FindMerchant(productRequest.MerchantId); var productsFromService = _blackstonePosService.GetProducts(merchantInfo.MerchantId, merchantInfo.MerchantTerminalID.ToString(), merchantInfo.MerchantPassword, merchantInfo.Name).Data as IEnumerable<ProductItem>; var productsJoined = productsFromService.Join(longDistanceProducts, a => a.Code, b => b.ProductMainCode, (a, b) => a).ToList(); var productsResult = productsJoined.Distinct(new ProductItemComparer()); return productsResult; }
public DataResponse GetProductRates(PosProductRequest productRequest) { var merchantInfo = _blackstonePosService.FindMerchant(productRequest.MerchantId); var productRates = _blackstonePosService.GetProductRates(productRequest.MerchantId, merchantInfo.MerchantTerminalID.ToString(), merchantInfo.MerchantPassword, merchantInfo.Name, productRequest.ProductMainCode); return productRates; }
private IEnumerable<ProductItem> getWirelessProductsByCountry(PosProductRequest productRequest) { var wirelessPlans = GetAllWirelessPlansByCountry(productRequest.MerchantId, productRequest.CountryCode); var merchantInfo = _blackstonePosService.FindMerchant(productRequest.MerchantId); var productsFromService = _blackstonePosService.GetProducts(merchantInfo.MerchantId, merchantInfo.MerchantTerminalID.ToString(), merchantInfo.MerchantPassword, merchantInfo.Name).Data as IEnumerable<ProductItem>; var productsJoined = productsFromService.Join(wirelessPlans, a => a.Code, b => b.PlanId, (a, b) => a); return productsJoined; }
public DataResponse GetProductsByCategoryByCountry(PosProductRequest productRequest) { IEnumerable<ProductItem> products; switch (productRequest.Category) { case "international": { products = getWirelessProductsByCountry(productRequest); break; } case "longdistance": { products = getLongDistanceProductsByCountry(productRequest); break; } default: { products = null; break; } } return new DataResponse { Data = products, ErrorMessage = products!=null?string.Empty:"Could not retrieve products at this time", Status= products!= null? 200: 201 }; }
public DataResponse GetCountriesByCategory(PosProductRequest productRequest) { var countriesByCategory = getCountriesByCategory(productRequest.MerchantId, productRequest.Category); return new DataResponse { Data = countriesByCategory, ErrorMessage = countriesByCategory != null? string.Empty: "Could not retrieve countries at this time", Status = countriesByCategory != null ? 200: 201 }; }
public DataResponse GetWirelessCarrierDetails(PosProductRequest productRequest) { var carriers = GetWirelessCarriers(productRequest.MerchantId); var carriersResult = carriers.Select(c => new { ImageUrl = c.ImageName, Name = c.CarrierName, Id = c.CarrierId, c.PhoneCode }).FirstOrDefault(a=> a.Id == productRequest.CarrierId); return new DataResponse { Data = carriersResult, ErrorMessage = carriersResult != null ? string.Empty : "Could not retrieve Wireless Carrier Details", Status = carriersResult != null ? 200 : 201 }; }