public ActionResult <Device> RegisterDevice(RegisterDevice registerDevice) { if (registerDevice == null || string.IsNullOrWhiteSpace(registerDevice.FirmwareVersion) || string.IsNullOrWhiteSpace(registerDevice.SerialNumber)) { return(BadRequest(new BadRequestObjectResult(ModelState) { Value = "Must provide device SerialNumber and FirmwareVersion" })); } var existingDevice = _deviceService.GetBySerial(registerDevice.SerialNumber); if (existingDevice != null) { return(BadRequest(new BadRequestObjectResult(ModelState) { Value = "Device already registered." })); } var device = new Device() { SerialNumber = registerDevice.SerialNumber, FirmwareVersion = registerDevice.FirmwareVersion, RegistrationDate = System.DateTime.Now }; _deviceService.Create(device); return(CreatedAtRoute("GetDevice", new { id = device.Id.ToString() }, device)); }
public void TryCreateDeviceUnderOtherNetworkTest() { var environmentFactory = EnvironmentFactoryFactory.Create(); var authenticationContext = Substitute.For <IAuthenticationContext>(); var messagingService = Substitute.For <IMessagingServiceClient>(); var userOperations = environmentFactory.ManagementEnvironment.MgmtUserOperations; var companyOperations = environmentFactory.ManagementEnvironment.MgmtCompanyOperations; var settingProvider = new SettingProvider(environmentFactory.ManagementEnvironment.MgmtSettingOperations); var userService = new UserService(userOperations, authenticationContext, settingProvider, null); var userId1 = userService.Register(new RegisterDto() { Name = "user", Email = EmailHelper.Generate(), Password = "******" }, null); var companyService = new CompanyService(companyOperations, authenticationContext, null, new CapabilityProvider(settingProvider)); authenticationContext.GetContextUser().Returns(userId1); var companyId1 = companyService.Create("new company1"); var serviceOperations = environmentFactory.ManagementEnvironment.MgmtServiceOperations; var serviceService = new ServiceService(serviceOperations, companyOperations, authenticationContext, null, new CapabilityProvider(settingProvider)); var serviceId1 = serviceService.Create(new ServiceDto() { CompanyId = companyId1, Name = "svc" }); var companyId2 = companyService.Create("new company2"); var serviceId2 = serviceService.Create(new ServiceDto() { CompanyId = companyId2, Name = "svc" }); var networkOperations = environmentFactory.ManagementEnvironment.MgmtNetworkOperations; var networkService = new NetworkService(networkOperations, serviceOperations, companyOperations, authenticationContext, null); var deviceOperations = environmentFactory.ManagementEnvironment.MgmtDeviceOperations; var deviceService = new DeviceService(deviceOperations, networkOperations, serviceOperations, companyOperations, authenticationContext, messagingService); var networkId2 = networkService.Create(new NetworkDto() { ServiceId = serviceId2, CompanyId = companyId2, Name = "svc" }); var device = new DeviceDto() { NetworkId = networkId2, CompanyId = companyId1, ServiceId = serviceId1, Name = "test" }; deviceService.Create(device); }
static void Main(string[] args) { IDeviceInterface device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.HSIP_ISC250, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.130", Port = "12345", Timeout = 30000 }); try { device.OpenLane(); Console.WriteLine("Please swipe the card Shane."); var transaction = device.CreditSale(1, 32m) .WithAllowDuplicates(true) .WithSignatureCapture(true) .Execute(); if (transaction.ResponseCode == "00" || transaction.ResponseCode == "10") { PrintReceipt(transaction); AnyKeyToContinue(); } else { Console.WriteLine("{0} - {1}", transaction.ResponseCode, transaction.ResponseText); Console.WriteLine("{0} - {1}", transaction.DeviceResponseCode, transaction.DeviceResponseText); AnyKeyToContinue(); } } catch (BuilderException exc) { // validation errors Console.WriteLine(exc.Message); AnyKeyToContinue(); } catch (MessageException exc) { // trouble talking to the device Console.WriteLine(exc.Message); AnyKeyToContinue(); } catch (GatewayException exc) { // trouble talking to the gateway Console.WriteLine(exc.Message); Console.WriteLine(exc.ResponseCode, exc.ResponseMessage); AnyKeyToContinue(); } catch (ApiException exc) { // every exception ever!!! Console.WriteLine(exc.Message); AnyKeyToContinue(); } finally { device.Reset(); device.CloseLane(); device.Dispose(); } }
public void ListDevicesTest() { var networkId = _networkService.Create(new NetworkDto() { ServiceId = _serviceId, CompanyId = _companyId, Name = "new network1" }); var environmentFactory = EnvironmentFactoryFactory.Create(); var device1 = new DeviceDto() { NetworkId = networkId, ServiceId = _serviceId, CompanyId = _companyId, Name = "new device1" }; var device2 = new DeviceDto() { NetworkId = networkId, ServiceId = _serviceId, CompanyId = _companyId, Name = "new device2" }; var device3 = new DeviceDto() { NetworkId = networkId, ServiceId = _serviceId, CompanyId = _companyId, Name = "new device3" }; _deviceService.Create(device1); var device2Id = _deviceService.Create(device2); _deviceService.Create(device3); var pltNetworkOperations = environmentFactory.ManagementEnvironment.ObjNetworkOperations; var ds = pltNetworkOperations.ListDevices(networkId); Assert.AreEqual(3, ds.Count()); Assert.IsTrue(ds.Any(d => d.Id == device2Id && d.Name == device2.Name)); }
public PaxLevel2Tests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.HTTP, IpAddress = "10.12.220.172", Port = "10009", RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); }
public PaxAdminTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.HTTP, IpAddress = "10.12.220.172", Port = "10009" }); Assert.IsNotNull(_device); }
public HsipAdminTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.HSIP_ISC250, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.130", Port = "12345" }); Assert.IsNotNull(_device); }
public PaxMessageTests() { device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.HTTP, IpAddress = "10.12.220.172", Port = "10009", Timeout = 30000 }); Assert.IsNotNull(device); }
public HpaMessageTests() { device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.HPA_ISC250, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.39", Port = "12345", Timeout = 30000 }); Assert.IsNotNull(device); }
public PaxDebitTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.HTTP, IpAddress = "192.168.0.31", Port = "10009", RequestIdProvider = (IRequestIdProvider) new RandomIdProvider() }); Assert.IsNotNull(_device); }
public UpaEbtTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.NUCLEUS_SATURN_1000, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "192.168.1.6", Port = "8081", RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); }
public TerminalManagementTest() { _device = DeviceService.Create(new ConnectionConfig() { DeviceType = Entities.DeviceType.Ingenico_EPOS_Desk5000, ConnectionMode = ConnectionModes.TCP_IP_SERVER, Port = "18101", Timeout = 5 * 1000 }); Assert.IsNotNull(_device); }
public HpaVerificationTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.HPA_ISC250, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.39", Port = "12345", RequestIdProvider = (Api.Terminals.IRequestIdProvider) new RandomIdProvider() }); Assert.IsNotNull(_device); _device.OpenLane(); }
public static void Initialize(TestContext context) { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.NUCLEUS_SATURN_1000, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "192.168.0.114", Port = "8081", Timeout = 30000, RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); }
public TransactionTest() { _device = DeviceService.Create(new ConnectionConfig() { DeviceType = DeviceType.Ingenico_EPOS_Lane3000, ConnectionMode = ConnectionModes.TCP_IP_SERVER, Port = "18101", Timeout = 60000, RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); }
public PaxMessageTests() { device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.HTTP, IpAddress = "192.168.0.31", Port = "10009", Timeout = 30000, RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(device); }
public HpaEndOfDayTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.HPA_ISC250, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.39", Port = "12345", Timeout = 20000, RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); }
public async Task <IActionResult> RegisterDevice([FromBody] DeviceRegistrationDto deviceRegistration) { Device device = Mapper.Map <Device>(deviceRegistration); Device newDevice = deviceService.Create(device, device.SiteId); if (newDevice == null) { return(StatusCode((int)HttpStatusCode.NotFound, new { Message = $"No site found with Id {device.SiteId}" })); } return(Ok(Mapper.Map <DeviceOverviewDto>(newDevice))); }
public HsipGiftTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.HSIP_ISC250, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.130", Port = "12345", Timeout = 30000 }); Assert.IsNotNull(_device); _device.OpenLane(); }
public PaxAdminTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_PX7, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.172", //IpAddress = "192.168.0.31", Port = "10009", RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); }
public PaxCreditTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.TCP_IP, //IpAddress = "10.12.220.172", //Port = "10009", IpAddress = "192.168.000.31", Port = "80", Timeout = 30000 }); Assert.IsNotNull(_device); }
public HpaCreditTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.HPA_ISC250, ConnectionMode = ConnectionModes.TCP_IP, //IpAddress = "10.12.220.39", IpAddress = "192.168.0.94", Port = "12345", Timeout = 30000, RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); _device.OpenLane(); }
public PayAtTableRequestTests() { _device = DeviceService.Create(new ConnectionConfig() { DeviceType = DeviceType.Ingenico_EPOS_Desk5000, ConnectionMode = ConnectionModes.PAY_AT_TABLE, Port = "18101", Timeout = 10 * 1000 }); Assert.IsNotNull(_device); _device.OnPayAtTableRequest += _device_OnPayAtTableRequest; }
public PaxGiftTests() { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.HTTP, IpAddress = "10.12.220.172", Port = "10009", RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); card = new GiftCard { Number = "5022440000000000098" }; }
public IngenicoTransactionTests() { _device = DeviceService.Create(new ConnectionConfig() { DeviceType = Entities.DeviceType.Ingenico_EPOS_Desk5000, ConnectionMode = ConnectionModes.TCP_IP_SERVER, Port = "18101", //BaudRate = BaudRate.r9600, //Parity = System.IO.Ports.Parity.Even, //DataBits = DataBits.Seven, //Handshake = System.IO.Ports.Handshake.None, //StopBits = System.IO.Ports.StopBits.One, Timeout = 10 * 1000 }); Assert.IsNotNull(_device); }
public PaymentTransactionManagement() { _device = DeviceService.Create(new ConnectionConfig() { DeviceType = DeviceType.Ingenico_EPOS_Lane3000, ConnectionMode = ConnectionModes.SERIAL, Port = "7", BaudRate = BaudRate.r9600, Parity = System.IO.Ports.Parity.Even, StopBits = System.IO.Ports.StopBits.One, DataBits = DataBits.Seven, Timeout = 65000 }); Assert.IsNotNull(_device); }
public void TestCreate() { Device device = new Device(); device.ID = _deviceID; device.AppID = _confAppID; device.Fix = 3; device.GPSTime = DateTime.Now; device.Lat = 51.321; device.Long = 0.49875; device.Pin = "12345"; device.Sat = 3; device.Status = EnumDeviceStatus.ACTIVE; device.Token = Guid.NewGuid(); device.User = "******"; _service.Create(device); }
public static void Initialize(TestContext context) { _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.PAX_S300, ConnectionMode = ConnectionModes.TCP_IP, IpAddress = "10.12.220.172", //IpAddress = "192.168.0.31", Port = "10009", Timeout = 30000, RequestIdProvider = new RandomIdProvider() }); Assert.IsNotNull(_device); _device.OnMessageSent += (message) => { Assert.IsTrue(message.Contains(searchText), message); }; var card = new CreditCardData { Number = "4005554444444460", ExpMonth = 12, ExpYear = 20, Cvn = "123" }; var address = new Address { StreetAddress1 = "1 Heartland Way", PostalCode = "95124" }; var response = _device.Sale(11m) .WithAllowDuplicates(true) .WithPaymentMethod(card) .WithAddress(address) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); authCode = response.AuthorizationCode; transactionNumber = response.TerminalRefNumber; referenceNumber = response.ReferenceNumber; }
public async void Create() { var mock = new ServiceMockFacade <IDeviceRepository>(); var model = new ApiDeviceRequestModel(); mock.RepositoryMock.Setup(x => x.Create(It.IsAny <Device>())).Returns(Task.FromResult(new Device())); var service = new DeviceService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.DeviceModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLDeviceMapperMock, mock.DALMapperMockFactory.DALDeviceMapperMock, mock.BOLMapperMockFactory.BOLDeviceActionMapperMock, mock.DALMapperMockFactory.DALDeviceActionMapperMock); CreateResponse <ApiDeviceResponseModel> response = await service.Create(model); response.Should().NotBeNull(); mock.ModelValidatorMockFactory.DeviceModelValidatorMock.Verify(x => x.ValidateCreateAsync(It.IsAny <ApiDeviceRequestModel>())); mock.RepositoryMock.Verify(x => x.Create(It.IsAny <Device>())); }
public GeniusCreditTests() { _requestidProvider = new RandomIdProvider(); _device = DeviceService.Create(new ConnectionConfig { DeviceType = DeviceType.GENIUS, ConnectionMode = ConnectionModes.HTTP, IpAddress = "10.12.220.209", Port = "8080", Timeout = 30000, GatewayConfig = new GeniusConfig { MerchantName = "Test Shane Logsdon", MerchantSiteId = "BKHV2T68", MerchantKey = "AT6AN-ALYJE-YF3AW-3M5NN-UQDG1", RegisterNumber = "35", TerminalId = "3", DBA = "GP ECOM" } }); Assert.IsNotNull(_device); }