public SquareOrdersService(SquareConfig config, SquareMerchantCredentials credentials, ISquareLocationsService locationsService, ISquareItemsService itemsService) : base(config, credentials) { Condition.Requires(locationsService, "locationsService").IsNotNull(); Condition.Requires(itemsService, "itemsService").IsNotNull(); _locationsService = locationsService; _itemsService = itemsService; _ordersApi = new OrdersApi(base.ApiConfiguration); }
public void Init() { var locationsService = new SquareLocationsService(this.Config, this.Credentials); this._itemsService = new SquareItemsService(this.Config, this.Credentials, locationsService); var locations = locationsService.GetActiveLocationsAsync(CancellationToken.None, null).Result; this._defaultLocationId = locations.OrderBy(l => l.Name).First().Id; }