Add payment document export with different parameters
This commit is contained in:
@ -10,6 +10,18 @@ namespace Hcs.Client.Api
|
||||
// http://open-gkh.ru/BillsServiceAsync/
|
||||
public class BillsApi(ClientBase client) : ApiBase(client)
|
||||
{
|
||||
/// <summary>
|
||||
/// Экспорт платежных документов
|
||||
/// </summary>
|
||||
/// <param name="paymentDocumentID">Идентификатор платежного документа</param>
|
||||
/// <param name="token">Токен отмены</param>
|
||||
/// <returns>Платежные документы</returns>
|
||||
public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataAsync(string paymentDocumentID, CancellationToken token = default)
|
||||
{
|
||||
var request = new ExportPaymentDocumentDataRequest(client);
|
||||
return await request.ExecuteAsync(paymentDocumentID, token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Экспорт платежных документов
|
||||
/// </summary>
|
||||
|
||||
@ -11,6 +11,25 @@ namespace Hcs.Client.Api.Request.Bills
|
||||
{
|
||||
protected override bool CanBeRestarted => true;
|
||||
|
||||
internal async Task<IEnumerable<exportPaymentDocumentResultType>> 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<exportPaymentDocumentResultType>();
|
||||
}
|
||||
|
||||
internal async Task<IEnumerable<exportPaymentDocumentResultType>> ExecuteAsync(short year, int month, string fiasHouseGuid, string accountGUID, CancellationToken token)
|
||||
{
|
||||
var request = new exportPaymentDocumentRequest()
|
||||
|
||||
@ -45,6 +45,7 @@ namespace Hcs.TestApp
|
||||
var paymentsScenario = new PaymentsScenario(client);
|
||||
try
|
||||
{
|
||||
//billsScenario.ExportPaymentDocumentDataById();
|
||||
//billsScenario.ExportPaymentDocumentData();
|
||||
//billsScenario.ImportPaymentDocumentData();
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user