Add payment data export
This commit is contained in:
@ -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>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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: Добавить проверку пейлоада
|
||||
|
||||
@ -98,6 +98,7 @@
|
||||
<Compile Include="Client\Api\Request\Adapter\IGetStateResultMany.cs" />
|
||||
<Compile Include="Client\Api\Request\Adapter\IGetStateResultOne.cs" />
|
||||
<Compile Include="Client\Api\Request\Bills\BillsRequestBase.cs" />
|
||||
<Compile Include="Client\Api\Request\Bills\ExportPaymentDocumentDataRequest.cs" />
|
||||
<Compile Include="Client\Api\Request\Bills\ImportPaymentDocumentDataRequest.cs" />
|
||||
<Compile Include="Client\Api\Request\DeviceMetering\DeviceMeteringRequestBase.cs" />
|
||||
<Compile Include="Client\Api\Request\DeviceMetering\ExportMeteringDeviceHistoryRequest.cs" />
|
||||
|
||||
@ -45,6 +45,7 @@ namespace Hcs.TestApp
|
||||
var paymentsScenario = new PaymentsScenario(client);
|
||||
try
|
||||
{
|
||||
//billsScenario.ExportPaymentDocumentData();
|
||||
//billsScenario.ImportPaymentDocumentData();
|
||||
|
||||
//deviceMeteringScenario.ExportMeteringDeviceHistory();
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
using Hcs.Client.Api.Payload.Bills;
|
||||
using Hcs.Client.Api.Registry;
|
||||
using Hcs.Client.Api.Type;
|
||||
using Hcs.Service.Async.Bills;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Hcs.TestApp.Scenario
|
||||
{
|
||||
@ -11,6 +11,12 @@ namespace Hcs.TestApp.Scenario
|
||||
{
|
||||
private readonly UniClient client = client;
|
||||
|
||||
internal void ExportPaymentDocumentData()
|
||||
{
|
||||
var result = client.Bills.ExportPaymentDocumentDataAsync(2025, 8, "c48e5025-f77a-494f-8aab-f773da623a25", "019917a8-6eb6-74cc-99b7-58350127ac50").Result;
|
||||
Console.WriteLine("Scenario execution " + (result != null && result.Count() > 0 ? "succeeded" : "failed"));
|
||||
}
|
||||
|
||||
internal void ImportPaymentDocumentData()
|
||||
{
|
||||
var paymentInformation = new ImportPaymentDocumentDataPayload.PaymentInformation()
|
||||
|
||||
Reference in New Issue
Block a user