public async void Test_CancelPayment() { var req = new SchedulePaymentReq { RequestId = Guid.NewGuid().ToString(), AccountId = Config.ACCOUNT_ID, Amount = 100, Currency = Config.CURRENCY, Reference = "Invoice payment #123", ScheduleFor = DateTime.Now.AddDays(2), Receiver = new CreatePaymentReq.ReceiverData { CounterpartyId = Config.COUNTERPARTY_ID, AccountId = Config.COUNTERPARTY_ACCOUNT_ID, } }; var transaction = await _paymentClient.SchedulePayment(req); Assert.NotNull(transaction); var resp = await _paymentClient.CancelPayment(transaction.Value.Id); Assert.True(resp); }
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); }