Add payment data export

This commit is contained in:
2025-09-16 18:02:07 +09:00
parent aab8165c81
commit e4a107ad83
7 changed files with 61 additions and 5 deletions

View File

@ -1,5 +1,7 @@
using Hcs.Client.Api.Payload.Bills;
using Hcs.Client.Api.Request.Bills;
using Hcs.Service.Async.Bills;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -8,6 +10,21 @@ namespace Hcs.Client.Api
// http://open-gkh.ru/BillsServiceAsync/
public class BillsApi(ClientBase client) : ApiBase(client)
{
/// <summary>
/// Экспорт платежных документов
/// </summary>
/// <param name="year">Год</param>
/// <param name="month">Месяц</param>
/// <param name="fiasHouseGuid">Глобальный уникальный идентификатор дома по ФИАС</param>
/// <param name="accountGUID">Идентификатор ЛС в ГИС ЖКХ</param>
/// <param name="token">Токен отмены</param>
/// <returns>Платежные документы</returns>
public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataAsync(short year, int month, string fiasHouseGuid, string accountGUID, CancellationToken token = default)
{
var request = new ExportPaymentDocumentDataRequest(client);
return await request.ExecuteAsync(year, month, fiasHouseGuid, accountGUID, token);
}
/// <summary>
/// Импорт сведений о платежных документах
/// </summary>

View File

@ -46,9 +46,9 @@ namespace Hcs.Client.Api.Request.Bills
{
protected override EndPoint EndPoint => EndPoint.BillsAsync;
protected override bool EnableMinimalResponseWaitDelay => true;
protected override bool EnableMinimalResponseWaitDelay => false;
protected override bool CanBeRestarted => true;
protected override bool CanBeRestarted => false;
protected override int RestartTimeoutMinutes => 20;
}

View File

@ -0,0 +1,33 @@
using Hcs.Client.Internal;
using Hcs.Service.Async.Bills;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Hcs.Client.Api.Request.Bills
{
internal class ExportPaymentDocumentDataRequest(ClientBase client) : BillsRequestBase(client)
{
protected override bool CanBeRestarted => true;
internal async Task<IEnumerable<exportPaymentDocumentResultType>> ExecuteAsync(short year, int month, string fiasHouseGuid, string accountGUID, CancellationToken token)
{
var request = new exportPaymentDocumentRequest()
{
Id = Constants.SIGNED_XML_ELEMENT_ID,
version = "13.1.0.1",
Items = [year, month, fiasHouseGuid, accountGUID],
ItemsElementName = [ItemsChoiceType7.Year, ItemsChoiceType7.Month, ItemsChoiceType7.FIASHouseGuid, ItemsChoiceType7.AccountGUID]
};
var result = await SendAndWaitResultAsync(request, async asyncClient =>
{
var response = await asyncClient.exportPaymentDocumentDataAsync(CreateRequestHeader(), request);
return response.AckRequest.Ack;
}, token);
return result.Items.OfType<exportPaymentDocumentResultType>();
}
}
}

View File

@ -13,8 +13,6 @@ namespace Hcs.Client.Api.Request.Bills
{
internal class ImportPaymentDocumentDataRequest(ClientBase client) : BillsRequestBase(client)
{
protected override bool CanBeRestarted => false;
internal async Task<bool> ExecuteAsync(ImportPaymentDocumentDataPayload payload, CancellationToken token)
{
// TODO: Добавить проверку пейлоада