private static async Task <DTOManager> GetAllowedContact(string phone) { List <DTOManager> managers; var credentials = DiscoveryFactory.GetDefaultCreditenals(); using (var client = new PaymentClient(ConfigurationContainer.Configuration["DiscoveryUrl"], credentials.ClientId, credentials.ClientSecret)) { managers = await client.GetAllowedManagers(); } return(managers.FirstOrDefault(x => x.Phone == phone)); }
public void Execute() { Console.Write("Bluetooth Low Energy device discovery in progress..."); var factory = new DiscoveryFactory().Create(); var discoveredDevices = factory.EnumerateDevicesAsync(DefaultTimeout).Result.ToList(); Console.WriteLine(); Console.WriteLine($"Discovered devices: ({discoveredDevices.Count})"); foreach (var device in discoveredDevices) { var blueDress = device.BluetoothAddress.ToBluetoothAddress(); Console.WriteLine($"Device: {device.Name}, Id: {device.Id}, Address={blueDress}"); } }
private static async Task <ReturnModel> SendPaymentIfValid(Tuple <DTOInsertPayment, string> content) { var manager = await GetAllowedContact(content.Item2); if (manager == null) { return(null); } var credentials = DiscoveryFactory.GetDefaultCreditenals(); using (var client = new PaymentClient(ConfigurationContainer.Configuration["DiscoveryUrl"], credentials.ClientId, credentials.ClientSecret)) { content.Item1.OperatorId = manager.Id; return(await client.AddPayment(content.Item1)); } }
public void Execute() { Console.WriteLine($"Polling device: {_deviceId}"); Console.Write(" - List resources ..."); var discovery = new DiscoveryFactory().Create(); var deviceResult = discovery.EnumerateResources(_deviceId); Console.WriteLine(); if (deviceResult.Status != ResourceEnumerationResult.EnumerationStatus.Success) { Console.WriteLine($"Operation has failed due to status: {deviceResult.Status}"); } else { PollAttributes(deviceResult.Device); } }
public void Execute() { Console.Write($"Listing resources of device Id: {_deviceId} ..."); var discovery = new DiscoveryFactory().Create(); var deviceResult = discovery.EnumerateResources(_deviceId); Console.WriteLine(); if (deviceResult.Status != ResourceEnumerationResult.EnumerationStatus.Success) { Console.WriteLine($"Operation has failed due to status: {deviceResult.Status}"); if (deviceResult.Device != null) { DumpDevice(deviceResult.Device); } } else { Dump(deviceResult.Device); } }