public async void Test_Transfer() { string currency = "GBP"; var accounts = await _accountApiClient.GetAccounts(); GetAccountResp accountResp1 = null; GetAccountResp accountResp2 = null; try { accountResp1 = accounts.Where(x => x.Currency == currency).First(); accounts.Remove(accountResp1); accountResp2 = accounts.Where(x => x.Currency == currency).First(); } catch (InvalidOperationException ex) { throw new Exception($"Missing account with {currency} currency"); } TransferReq req = new TransferReq { RequestId = DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString(), SourceAccountId = accountResp1.Id, TargetAccountId = accountResp2.Id, Amount = 100, Currency = currency }; var resp = await _paymentClient.CreateTransfer(req); Assert.NotNull(resp); }
public async void Test_Transfer_InSameCurrencys() { var currency = "EUR"; var accounts = (await _accountApiClient.GetAccounts()).ToList(); GetAccountResp accountInCurrencyMain = null; GetAccountResp accounInCurrencySecondary = null; try { accountInCurrencyMain = accounts.FirstOrDefault(x => x.Currency == currency); if (accountInCurrencyMain == null) { throw new Exception($"Account in currency is missing, you need to create a new one"); } accounInCurrencySecondary = accounts.FirstOrDefault(x => x.Currency == currency && x.Id != accountInCurrencyMain.Id); if (accounInCurrencySecondary == null) { throw new Exception($"account Not InCurrency is missing, you need to create a new one"); } await Task.Delay(200); } catch (InvalidOperationException ex) { throw new Exception($"Missing account with {currency} currency - {ex.Message}"); } var req = new TransferReq { RequestId = DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString(), SourceAccountId = accountInCurrencyMain.Id, TargetAccountId = accounInCurrencySecondary.Id, Amount = 100, Currency = currency }; var resp = await _paymentClient.CreateTransfer(req); Assert.NotNull(resp); }