diff --git a/Hcs.Client/Client/Api/BillsApi.cs b/Hcs.Client/Client/Api/BillsApi.cs index e43d587..42ed3a6 100644 --- a/Hcs.Client/Client/Api/BillsApi.cs +++ b/Hcs.Client/Client/Api/BillsApi.cs @@ -10,6 +10,18 @@ namespace Hcs.Client.Api // http://open-gkh.ru/BillsServiceAsync/ public class BillsApi(ClientBase client) : ApiBase(client) { + /// + /// Экспорт платежных документов + /// + /// Идентификатор платежного документа + /// Токен отмены + /// Платежные документы + public async Task> ExportPaymentDocumentDataAsync(string paymentDocumentID, CancellationToken token = default) + { + var request = new ExportPaymentDocumentDataRequest(client); + return await request.ExecuteAsync(paymentDocumentID, token); + } + /// /// Экспорт платежных документов /// diff --git a/Hcs.Client/Client/Api/Request/Bills/ExportPaymentDocumentDataRequest.cs b/Hcs.Client/Client/Api/Request/Bills/ExportPaymentDocumentDataRequest.cs index 451354c..8b9bdd8 100644 --- a/Hcs.Client/Client/Api/Request/Bills/ExportPaymentDocumentDataRequest.cs +++ b/Hcs.Client/Client/Api/Request/Bills/ExportPaymentDocumentDataRequest.cs @@ -11,6 +11,25 @@ namespace Hcs.Client.Api.Request.Bills { protected override bool CanBeRestarted => true; + internal async Task> ExecuteAsync(string paymentDocumentID, CancellationToken token) + { + var request = new exportPaymentDocumentRequest() + { + Id = Constants.SIGNED_XML_ELEMENT_ID, + version = "13.1.0.1", + Items = [paymentDocumentID], + ItemsElementName = [ItemsChoiceType7.PaymentDocumentID] + }; + + var result = await SendAndWaitResultAsync(request, async asyncClient => + { + var response = await asyncClient.exportPaymentDocumentDataAsync(CreateRequestHeader(), request); + return response.AckRequest.Ack; + }, token); + + return result.Items.OfType(); + } + internal async Task> ExecuteAsync(short year, int month, string fiasHouseGuid, string accountGUID, CancellationToken token) { var request = new exportPaymentDocumentRequest() diff --git a/Hcs.TestApp/TestApp/Program.cs b/Hcs.TestApp/TestApp/Program.cs index 3097cf1..8c8ed8a 100644 --- a/Hcs.TestApp/TestApp/Program.cs +++ b/Hcs.TestApp/TestApp/Program.cs @@ -45,6 +45,7 @@ namespace Hcs.TestApp var paymentsScenario = new PaymentsScenario(client); try { + //billsScenario.ExportPaymentDocumentDataById(); //billsScenario.ExportPaymentDocumentData(); //billsScenario.ImportPaymentDocumentData(); diff --git a/Hcs.TestApp/TestApp/Scenario/BillsScenario.cs b/Hcs.TestApp/TestApp/Scenario/BillsScenario.cs index ea8b808..e19dcf9 100644 --- a/Hcs.TestApp/TestApp/Scenario/BillsScenario.cs +++ b/Hcs.TestApp/TestApp/Scenario/BillsScenario.cs @@ -11,6 +11,12 @@ namespace Hcs.TestApp.Scenario { private readonly UniClient client = client; + internal void ExportPaymentDocumentDataById() + { + var result = client.Bills.ExportPaymentDocumentDataAsync("00АА095186-02-5081").Result; + Console.WriteLine("Scenario execution " + (result != null && result.Count() > 0 ? "succeeded" : "failed")); + } + internal void ExportPaymentDocumentData() { var result = client.Bills.ExportPaymentDocumentDataAsync(2025, 8, "c48e5025-f77a-494f-8aab-f773da623a25", "019917a8-6eb6-74cc-99b7-58350127ac50").Result;