Copy
using OneKhusa.SDK;
using OneKhusa.SDK.Models.Transactions.BatchDisbursements;
//code omitted for brevity
OneKhusaResponse<GetBatchResponse> response = await client
.Transactions
.BatchDisbursements
.GetBatchAsync(new GetBatchRequest
{
MerchantAccountNumber = 12345678,
BatchNumber = 123456
});
if (response is { IsSuccess: true, Data: not null })
{
Console.WriteLine($"""
MerchantAccountNumber: {response.Data.MerchantAccountNumber};
BatchNumber: {response.Data.BatchNumber};
ContentType: {response.Data.ContentType};
CurrencyCode: {response.Data.CurrencyCode};
BatchStatusCode: {response.Data.BatchStatusCode};
BatchStatusDescription: {response.Data.BatchStatusDescription};
IsBatchScheduled: {response.Data.IsBatchScheduled};
ScheduledDate: {response.Data.ScheduledDate};
DataSource: {response.Data.DataSource};
AuthorisationLevel: {response.Data.AuthorisationLevel};
ProcessDate: {response.Data.ProcessDate};
CapturedBy: {response.Data.CapturedBy};
DateCaptured: {response.Data.DateCaptured};
ReviewedBy: {response.Data.ReviewedBy};
DateReviewed: {response.Data.DateReviewed};
ApprovedBy: {response.Data.ApprovedBy};
DateApproved: {response.Data.DateApproved};
RejectionReason: {response.Data.RejectionReason};
ActionedBy: {response.Data.ActionedBy};
DateActioned: {response.Data.DateActioned};
ErrorMessage: {response.Data.ErrorMessage};
ErrorFileName: {response.Data.ErrorFileName};
NumberOfEntries: {response.Data.NumberOfEntries};
NumberOfFailedEntries: {response.Data.NumberOfFailedEntries};
NumberOfSuccessfulEntries: {response.Data.NumberOfSuccessfulEntries};
TotalAmountOfSuccessfulEntries: {response.Data.TotalAmountOfSuccessfulEntries}
""");
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();