public async Task CanGetAccountTransactionsAsBinary() { AccountTransactionsRequest transactionsRequest = new AccountTransactionsRequest(account); transactionsRequest.Binary = true; var accountTransactions = await client.AccountTransactions(transactionsRequest); Assert.IsNotNull(accountTransactions); }
/// <summary> /// Gets merchant account transactions. /// Privatbank API reference: <https://api.privatbank.ua/#p24/orders>. /// </summary> /// <param name="password">Private merchant password.</param> /// <param name="merchantId">Merchant id.</param> /// <param name="cardNumber">Merchant assossiated card number.</param> /// <param name="from">Statement start date.</param> /// <param name="to">Statement end date.</param> /// <returns></returns> public async Task <PrivatbankAccountStatement> GetMerchantAccountStatementAsync( string password, string merchantId, string cardNumber, DateTime from, DateTime to) { AccountTransactionsRequest request = new AccountTransactionsRequest(password, merchantId, cardNumber, from, to); HttpResponseMessage response = await _privatbankClient.GetMerchantDataAsync("rest_fiz", request.Xml); string xml = await response.Content.ReadAsStringAsync(); AccountStatementParser parser = new AccountStatementParser(); PrivatbankAccountStatement statement = parser.Parse(xml); return(statement); }
public Task <AccountTransactions> AccountTransactions(AccountTransactionsRequest request) { var command = JsonConvert.SerializeObject(request, serializerSettings); TaskCompletionSource <AccountTransactions> task = new TaskCompletionSource <AccountTransactions>(); TaskInfo taskInfo = new TaskInfo(); taskInfo.TaskId = request.Id; taskInfo.TaskCompletionResult = task; taskInfo.Type = typeof(AccountTransactions); tasks.TryAdd(request.Id, taskInfo); client.SendMessage(command); return(task.Task); }
public ValidationResult Validate(AccountTransactionsRequest request) { var error = new List <string>(); if (request == null) { error.Add("Provide a valid request object"); return(new ValidationResult(error)); } if (string.IsNullOrWhiteSpace(request.BankName) || request.BankName.Length > 200) { error.Add("Provide a valid bank name. 1 - 200 digits"); } if (string.IsNullOrWhiteSpace(request.AccountNumber) || request.AccountNumber.Length != 8) { error.Add("Provide a valid account number. 8 digits"); } return(error.Any() ? new ValidationResult(error) : new ValidationResult()); }
public Task <AccountTransactions> AccountTransactions(string account) { AccountTransactionsRequest request = new AccountTransactionsRequest(account); return(AccountTransactions(request)); }