public async Task TestDeleteCounterparty_Success()
        {
            var    phone = "+4412345678908";
            string counterpartyId;

            var counterparties = await _counterpartiesApiClient.GetCounterparties();

            Assert.NotNull(counterparties);

            await Task.Delay(2000);

            counterpartyId = counterparties?.FirstOrDefault(x => x.Phone == phone)?.Id;
            if (counterpartyId == null)
            {
                var req = new AddCounterpartyReq
                {
                    ProfileType = ProfileType.Personal,
                    Name        = "John Smith",
                    Phone       = phone
                };

                var counterparty = await _counterpartiesApiClient.CreateCounterparty(req);

                Assert.NotNull(counterparty);
                counterpartyId = counterparty.Value.Id;
            }

            await Task.Delay(2000);

            var resp = await _counterpartiesApiClient.DeleteCounterparty(counterpartyId);

            Assert.True(resp);
        }
Exemplo n.º 2
0
        public async Task Test_CancelPayment()
        {
            var currency = "GBP";
            var accounts = await _accountApiClient.GetAccounts();

            var accountId = accounts.First(i => i.Currency == currency);

            await Task.Delay(200);

            var contrerparties = await _counterpartyApiClient.GetCounterparties();

            var counterParty = contrerparties.FirstOrDefault(i => i.Accounts.Any(a => a.Currency == currency));

            if (counterParty == null)
            {
                throw new NullReferenceException($"{nameof(counterParty)} cannot be null.");
            }

            await Task.Delay(200);

            var req = new SchedulePaymentReq
            {
                RequestId   = Guid.NewGuid().ToString(),
                AccountId   = accountId.Id,
                Amount      = 100,
                Currency    = currency,
                Reference   = "Invoice payment #123",
                ScheduleFor = DateTime.Now.AddDays(2),
                Receiver    = new ReceiverData
                {
                    CounterpartyId = counterParty.Id,
                    AccountId      = counterParty.Accounts.First(i => i.Currency == currency).Id
                }
            };

            var transaction = await _paymentClient.SchedulePayment(req);

            Assert.NotNull(transaction);

            await Task.Delay(200);

            var resp = await _paymentClient.CancelPayment(transaction.Value.Id);

            Assert.True(resp);
        }
Exemplo n.º 3
0
        public async void TestGetCounterparties_Success()
        {
            List <GetCounterpartyResp> resp = await _counterpartiesApiClient.GetCounterparties();

            Assert.NotNull(resp);
        }