Copy
using OneKhusa.SDK;
using OneKhusa.SDK.Models.Transactions.BatchDisbursements;
//code omitted for brevity
OneKhusaResponse<List<GetBatchTransactionsResponse>> response = await client
.Transactions
.BatchDisbursements
.GetBatchTransactionsAsync(new GetBatchTransactionsRequest
{
MerchantAccountNumber = 12345678,
BatchNumber = 123456
});
if (response is { IsSuccess: true, Data: not null })
{
foreach (var batch in response.Data)
{
Console.WriteLine($"""
BatchNumber: {batch.BatchNumber};
TransactionReferenceNumber: {batch.TransactionReferenceNumber};
TransactionDescription: {batch.TransactionDescription};
ConnectorName: {batch.ConnectorName};
CurrencyCode: {batch.CurrencyCode};
TransactionAmount: {batch.TransactionAmount};
TransactionStatusCode: {batch.TransactionStatusCode};
TransactionStatusName: {batch.TransactionStatusName}
""");
}
Console.ReadLine();
return;
}
//it means an error has occurred: RFC7807 compliant error object
Console.WriteLine($"""
Type: {response.Error?.Type};
Title: {response.Error?.Title};
Detail: {response.Error?.Detail};
ErrorCode: {response.Error?.ErrorCode};
Status: {response.Error?.Status};
Instance: {response.Error?.Instance};
Errors: {string.Join(";", response.Error?.Errors ?? [])}
""");
Console.ReadLine();