using OneKhusa.SDK;
using OneKhusa.SDK.Models.Analytics;
using OneKhusa.SDK.Models.Constants.Analytics;
//code omitted for brevity
OneKhusaResponse<List<GetConnectorSummaryByCountResponse>> response = await client
.Merchants
.Analytics
.GetConnectorSummaryByCountAsync(new GetConnectorSummaryByCountRequest
{
MerchantAccountNumber = 12345678,
SummaryType = SummaryTypes.Collections,
FromDate = new DateTime(2026, 1, 1),
ToDate = new DateTime(2026, 1, 31)
});
if (response is { IsSuccess: true, Data: not null })
{
foreach (var connector in response.Data)
{
Console.WriteLine($"""
SummaryType: {connector.SummaryType};
ConnectorName: {connector.ConnectorName};
CurrencyCode: {connector.CurrencyCode};
SuccessfulTransactions: {connector.SuccessfulTransactions};
FailedTransactions: {connector.FailedTransactions};
TotalTransactions: {connector.TotalTransactions}
""");
}
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();
Analytics
Get Connector Summary By Count
This method retrieves merchant analytics on successful, reversed and failed disbursement and collection transactions per connector by transactions count. For payload explanations for both request and response, click here