public BankingController(ILogger <BankingController> logger, BankingService bankingService, IActionContextAccessor accessor, UserService userService, RecipientService recipientService) { _logger = logger; _bankingService = bankingService; _accessor = accessor; _userService = userService; _recipientService = recipientService; }
/// <summary> /// Use internal webservice to check if recipient exists and isreachable in FaR. /// </summary> public bool IsReachable(string recipient, string senderOrg) { var recipientHelper = new RecipientHelper(); var recipientNumber = recipientHelper.GetRecipientAdress(recipient); // Call FaR, ask if recipient is reachable var service = new RecipientService(); var isReachableResult = service.IsReachable(recipientNumber, senderOrg); return(isReachableResult.IsReachable); }
public async Task IfRecipientExistsAsyncShouldReturnTrue() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var ifExists = await recipientService.IfRecipientExistsAsync("0000 000 000"); Assert.True(ifExists); }
public async Task CreateRecipientAsyncShouldReturnId() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var expected = 1; var actual = returnId; Assert.Equal(expected, actual); }
public async Task DeleteRecipientAsyncShouldReturnTrue() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var isDeleted = await recipientService.DeleteRecipientAsync(new RecipientDeleteDtoModel { RecipientId = 1 }); Assert.True(isDeleted); }
public async Task GetRecipientParamsForUpdateAsyncShouldReturnFirstName() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var recipient = await recipientService.GetRecipientParamsForUpdateAsync(new RecipientUpdateOutputDtoModel { RecipientId = 1 }); var expected = "Test"; var actual = recipient.FirstName; Assert.Equal(expected, actual); }
static void Main(string[] args) { // Initialize recipient var serializer = new Serializer(); var recipient = new Recipient(); var exObj = new ExampleObject(); recipient.Register <IExampleObject>("obj1", exObj); // Start server var recipientService = new RecipientService(recipient); var server = new Server { Services = { Protos.RecipientService.BindService(recipientService) }, Ports = { new ServerPort("127.0.0.1", 6789, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Server started..."); var cts = new CancellationTokenSource(); Task.Run(() => { while (!cts.Token.IsCancellationRequested) { exObj.OnNotifyRequested(); try { Task.Delay(3000, cts.Token).Wait(cts.Token); } catch (OperationCanceledException) { } } }); Console.ReadLine(); cts.Cancel(); }
public async Task UpdateRecipientAsyncShouldReturnTrue() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var isUpdated = await recipientService.UpdateRecipientAsync(new RecipientUpdateInputDtoModel { RecipientId = 1, FirstName = "Test1", LastName = "Testov", RecipientTown = "TestTown", Address = "Test12", Phone = "0000 000 000" }); Assert.True(isUpdated); }
/// <summary> /// returns a object containing ServiceSupplier and if the recipient isReachable. /// </summary> /// <param name="recipient"></param> /// <returns></returns> public IsReachableResult IsReachableResult(string recipient, string senderOrg) { var isReachableResult = new IsReachableResult(); try { //Validate recipient var recipientHelper = new RecipientHelper(); var recipientService = new RecipientService(); // recipient = recipientHelper.GetRecipientAdress(recipient); //MG Not sure if we need this if (recipientHelper.ValidRecipient(recipient)) { isReachableResult = recipientService.IsReachable(recipient, senderOrg); } } catch (System.Exception e) { // LogManager.Log(new Log.Log() { EventId = EventId.GenerelizedException, Exception = e, Level = Level.Error, Message = "Something went wrong checking recipient against FaRService." }); return(null); } return(isReachableResult); }
/// <summary> /// Konstruktor modelu widoku odbiorców /// </summary> public RecipientsViewModel() { DataService = new RecipientService(); Recipients = new ObservableCollection <Recipient>(); }
public DistributionGroupController(RecipientService recipientService, IWebHostEnvironment environment) { _recipientService = recipientService; _environment = environment; }
public RecipientController(RecipientService recipientService, UserService userService, BankingService bankingService) { _recipentService = recipientService; _userService = userService; _bankingService = bankingService; }
public DistributionGroupController(RecipientService recipientService) { _recipientService = recipientService; }
private ReachabilityStatus[] IsUserReachableInFaR(string recipientNumber, Guid requestId, string senderOrg) { var recipientService = new RecipientService(); return(recipientService.IsUserReachableInFaRV3(recipientNumber, requestId, senderOrg)); }