Add payment document import

This commit is contained in:
2025-09-13 10:15:35 +09:00
parent f3dcb17c22
commit 71217acea5
10 changed files with 693 additions and 0 deletions

View File

@ -0,0 +1,23 @@
using Hcs.Client.Api.Payload.Bills;
using Hcs.Client.Api.Request.Bills;
using System.Threading;
using System.Threading.Tasks;
namespace Hcs.Client.Api
{
// http://open-gkh.ru/BillsServiceAsync/
public class BillsApi(ClientBase client) : ApiBase(client)
{
/// <summary>
/// Импорт сведений о платежных документах
/// </summary>
/// <param name="payload">Пейлоад сведений о платежных документах</param>
/// <param name="token">Токен отмены</param>
/// <returns>true, если операция выполнена успешно, иначе - false</returns>
public async Task<bool> ImportPaymentDocumentAsync(ImportPaymentDocumentPayload payload, CancellationToken token = default)
{
var request = new ImportPaymentDocumentRequest(client);
return await request.ExecuteAsync(payload, token);
}
}
}

View File

@ -0,0 +1,229 @@
using Hcs.Client.Api.Registry;
using Hcs.Client.Api.Type;
using System;
using System.Collections.Generic;
namespace Hcs.Client.Api.Payload.Bills
{
// http://open-gkh.ru/Bills/importPaymentDocumentRequest.html
public class ImportPaymentDocumentPayload
{
// http://open-gkh.ru/Bills/importPaymentDocumentRequest/PaymentInformation.html
public class PaymentInformation
{
/// <summary>
/// БИК банка получателя
/// </summary>
public string bankBIK;
/// <summary>
/// Номер расчетного счета
/// </summary>
public string operatingAccountNumber;
}
/// <summary>
/// Начисление по услуге
/// </summary>
// http://open-gkh.ru/Bills/PaymentDocumentType/ChargeInfo.html
public interface IChargeInfo { }
/// <summary>
/// Главная коммунальная услуга
/// </summary>
// http://open-gkh.ru/Bills/PDServiceChargeType/MunicipalService.html
public class MunicipalService : IChargeInfo
{
/// <summary>
/// Необязательное. Перерасчеты, корректировки, руб.
/// </summary>
public decimal? moneyRecalculation;
/// <summary>
/// Необязательное. Льготы, субсидии, скидки, руб.
/// </summary>
public decimal? moneyDiscount;
/// <summary>
/// Необязательное. Норматив потребления коммунальных ресурсов в целях использования и содержания
/// общего имущества в многоквартирном доме.
/// </summary>
public decimal? houseOverallNeedsNorm;
/// <summary>
/// Необязательное. Норматив потребления коммунальных услуг.
/// </summary>
public decimal? individualConsumptionNorm;
/// <summary>
/// Необязательное. Текущие показания приборов учёта коммунальных ресурсов - индивидуальных
/// (квартирных).
/// </summary>
public decimal? individualConsumptionCurrentValue;
/// <summary>
/// Необязательное. Текущие показания приборов учёта коммунальных ресурсов - коллективных (общедомовых).
/// </summary>
public decimal? houseOverallNeedsCurrentValue;
/// <summary>
/// Необязательное. Суммарный объём коммунальных ресурсов в многоквартирном доме - в помещениях дома.
/// </summary>
public decimal? houseTotalIndividualConsumption;
/// <summary>
/// Необязательное. Суммарный объём коммунальных ресурсов в многоквартирном доме - в целях содержания
/// общего имущества в многоквартирном доме.
/// </summary>
public decimal? houseTotalHouseOverallNeeds;
/// <summary>
/// Необязательное. Способ определения объема коммунальных ресурсов при индивидуальном потреблении.
/// </summary>
public MunicipalServiceVolumeDeterminingMethod? individualConsumptionVolumeDeterminingMethod;
/// <summary>
/// Необязательное. Объем/площадь/кол-во коммунальных ресурсов при индивидуальном потреблении.
/// </summary>
public decimal? individualConsumptionVolumeValue;
/// <summary>
/// Необязательное. Способ определения объема коммунальных ресурсов при содержании общего имущества.
/// </summary>
public MunicipalServiceVolumeDeterminingMethod? overallConsumptionVolumeDeterminingMethod;
/// <summary>
/// Необязательное. Объем/площадь/кол-во коммунальных ресурсов при содержании общего имущества.
/// </summary>
public decimal? overallConsumptionVolumeValue;
/// <summary>
/// Необязательное. Размер повышающего коэффициента.
/// </summary>
public decimal? multiplyingFactorRatio;
/// <summary>
/// Необязательное. Размер превышения платы, рассчитанной с применением повышающего коэффициента над
/// размером платы, рассчитанной без учета повышающего коэффициента, руб.
/// </summary>
public decimal? amountOfExcessFees;
/// <summary>
/// К оплате за индивидуальное потребление коммунальной услуги, руб.
/// </summary>
public decimal? municipalServiceIndividualConsumptionPayable;
/// <summary>
/// К оплате за общедомовое потребление коммунальной услуги, руб.
/// </summary>
public decimal? municipalServiceCommunalConsumptionPayable;
/// <summary>
/// Необязательное. Размер платы за коммунальные услуги, индивидуальное потребление.
/// </summary>
public decimal? amountOfPaymentMunicipalServiceIndividualConsumption;
/// <summary>
/// Необязательное. Размер платы за коммунальные услуги, общедомовые нужды.
/// </summary>
public decimal? amountOfPaymentMunicipalServiceCommunalConsumption;
/// <summary>
/// Код услуги из справочника "Вид коммунальной услуги" НСИ 3
/// </summary>
public RegistryElement serviceType;
/// <summary>
/// Тариф/Размер платы на кв.м, руб./Размер взноса на кв.м, руб.
/// </summary>
public decimal rate;
/// <summary>
/// К оплате за расчетный период, руб.
/// </summary>
public decimal totalPayable;
/// <summary>
/// Необязательное. Начислено за расчетный период (без перерасчетов и льгот), руб.
/// </summary>
public decimal? accountingPeriodTotal;
}
// http://open-gkh.ru/Bills/importPaymentDocumentRequest/PaymentDocument.html
public class PaymentDocument
{
/// <summary>
/// Платежный реквизит
/// </summary>
public PaymentInformation paymentInformation;
/// <summary>
/// Идентификатор лицевого счета
/// </summary>
public string accountGuid;
/// <summary>
/// Необязательное. Номер платежного документа, по которому внесена плата, присвоенный такому
/// документу исполнителем в целях осуществления расчетов по внесению платы
/// </summary>
public string paymentDocumentNumber;
/// <summary>
/// Начисления по услугам
/// </summary>
public List<IChargeInfo> chargeInfo;
/// <summary>
/// Необязательное. Задолженность за предыдущие периоды, руб.
/// </summary>
public decimal? debtPreviousPeriods;
/// <summary>
/// Необязательное. Аванс на начало расчетного периода, руб.
/// </summary>
public decimal? advanceBllingPeriod;
/// <summary>
/// Необязательное. Итого к оплате за расчетный период c учетом задолженности/переплаты, руб.
/// (по всему платежному документу)
/// </summary>
public decimal? totalPayableByPDWithDebtAndAdvance;
/// <summary>
/// Необязательное. Сумма к оплате за расчетный период, руб. (по всему платежному документу).
/// </summary>
public decimal? totalPayableByPD;
/// <summary>
/// Необязательное. Оплачено денежных средств, руб.
/// </summary>
public decimal? paidCash;
/// <summary>
/// Необязательное. Дата последней поступившей оплаты
/// </summary>
public DateTime? dateOfLastReceivedPayment;
}
/// <summary>
/// Месяц расчетного периода платежного документа
/// </summary>
public int month;
/// <summary>
/// Год расчетного периода платежного документа
/// </summary>
public short year;
/// <summary>
/// Сведения о платежных реквизитах получателя платежа - бизнес-ключ поиска размещенных платежных
/// реквизитов в ГИС ЖКХ
/// </summary>
public PaymentInformation[] paymentInformation;
/// <summary>
/// Размещаемый платежный документ. Максимум 500.
/// </summary>
public PaymentDocument[] paymentDocument;
}
}

View File

@ -0,0 +1,55 @@
using Hcs.Client.Api.Request;
using Hcs.Client.Api.Request.Adapter;
using Hcs.Service.Async.Bills;
using System.Threading.Tasks;
namespace Hcs.Service.Async.Bills
{
#pragma warning disable IDE1006
public partial class getStateResult : IGetStateResultMany { }
#pragma warning restore IDE1006
public partial class BillsPortsTypeAsyncClient : IAsyncClient<RequestHeader>
{
public async Task<IGetStateResponse> GetStateAsync(RequestHeader header, IGetStateRequest request)
{
return await getStateAsync(header, (getStateRequest)request);
}
}
#pragma warning disable IDE1006
public partial class getStateResponse : IGetStateResponse
#pragma warning restore IDE1006
{
public IGetStateResult GetStateResult => getStateResult;
}
public partial class AckRequestAck : IAck { }
public partial class ErrorMessageType : IErrorMessage { }
#pragma warning disable IDE1006
public partial class getStateRequest : IGetStateRequest { }
#pragma warning restore IDE1006
}
namespace Hcs.Client.Api.Request.Bills
{
internal class BillsRequestBase(ClientBase client) :
RequestBase<getStateResult,
BillsPortsTypeAsyncClient,
BillsPortsTypeAsync,
RequestHeader,
AckRequestAck,
ErrorMessageType,
getStateRequest>(client)
{
protected override EndPoint EndPoint => EndPoint.BillsAsync;
protected override bool EnableMinimalResponseWaitDelay => true;
protected override bool CanBeRestarted => true;
protected override int RestartTimeoutMinutes => 20;
}
}

View File

@ -0,0 +1,274 @@
using Hcs.Client.Api.Payload.Bills;
using Hcs.Client.Api.Request.Exception;
using Hcs.Client.Api.Type;
using Hcs.Client.Internal;
using Hcs.Service.Async.Bills;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Hcs.Client.Api.Request.Bills
{
internal class ImportPaymentDocumentRequest(ClientBase client) : BillsRequestBase(client)
{
protected override bool CanBeRestarted => false;
internal async Task<bool> ExecuteAsync(ImportPaymentDocumentPayload payload, CancellationToken token)
{
// TODO: Добавить проверку пейлоада
var request = GetRequestFromPayload(payload);
var result = await SendAndWaitResultAsync(request, async asyncClient =>
{
var response = await asyncClient.importPaymentDocumentDataAsync(CreateRequestHeader(), request);
return response.AckRequest.Ack;
}, token);
result.Items.OfType<ErrorMessageType>().ToList().ForEach(error =>
{
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
});
result.Items.OfType<CommonResultType>().ToList().ForEach(commonResult =>
{
commonResult.Items.OfType<ErrorMessageType>().ToList().ForEach(error =>
{
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
});
});
return true;
}
private importPaymentDocumentRequest GetRequestFromPayload(ImportPaymentDocumentPayload payload)
{
var items = new List<object>
{
payload.month,
payload.year
};
var paymentInformations = new Dictionary<ImportPaymentDocumentPayload.PaymentInformation, importPaymentDocumentRequestPaymentInformation>();
foreach (var entry in payload.paymentInformation)
{
var paymentInformation = new importPaymentDocumentRequestPaymentInformation()
{
TransportGUID = Guid.NewGuid().ToString(),
BankBIK = entry.bankBIK,
operatingAccountNumber = entry.operatingAccountNumber
};
paymentInformations.Add(entry, paymentInformation);
items.Add(paymentInformation);
}
foreach (var entry in payload.paymentDocument)
{
var chargeInfo = new List<object>();
foreach (var subEntry in entry.chargeInfo)
{
if (subEntry is ImportPaymentDocumentPayload.MunicipalService municipalService)
{
var item = new PDServiceChargeTypeMunicipalService()
{
ServiceType = new nsiRef()
{
Code = municipalService.serviceType.Code,
GUID = municipalService.serviceType.GUID
},
Rate = municipalService.rate,
TotalPayable = municipalService.totalPayable
};
if (municipalService.moneyRecalculation.HasValue)
{
item.ServiceCharge = new ServiceChargeImportType()
{
MoneyRecalculation = municipalService.moneyRecalculation.Value,
MoneyRecalculationSpecified = true
};
}
if (municipalService.moneyDiscount.HasValue)
{
item.ServiceCharge ??= new ServiceChargeImportType();
item.ServiceCharge.MoneyDiscount = municipalService.moneyDiscount.Value;
item.ServiceCharge.MoneyDiscountSpecified = true;
}
if (municipalService.houseOverallNeedsNorm.HasValue)
{
item.ServiceInformation = new ServiceInformation()
{
houseOverallNeedsNorm = municipalService.houseOverallNeedsNorm.Value,
houseOverallNeedsNormSpecified = true
};
}
if (municipalService.individualConsumptionNorm.HasValue)
{
item.ServiceInformation ??= new ServiceInformation();
item.ServiceInformation.individualConsumptionNorm = municipalService.individualConsumptionNorm.Value;
item.ServiceInformation.individualConsumptionNormSpecified = true;
}
if (municipalService.individualConsumptionCurrentValue.HasValue)
{
item.ServiceInformation ??= new ServiceInformation();
item.ServiceInformation.individualConsumptionCurrentValue = municipalService.individualConsumptionCurrentValue.Value;
item.ServiceInformation.individualConsumptionCurrentValueSpecified = true;
}
if (municipalService.houseOverallNeedsCurrentValue.HasValue)
{
item.ServiceInformation ??= new ServiceInformation();
item.ServiceInformation.houseOverallNeedsCurrentValue = municipalService.houseOverallNeedsCurrentValue.Value;
item.ServiceInformation.houseOverallNeedsCurrentValueSpecified = true;
}
if (municipalService.houseTotalIndividualConsumption.HasValue)
{
item.ServiceInformation ??= new ServiceInformation();
item.ServiceInformation.houseTotalIndividualConsumption = municipalService.houseTotalIndividualConsumption.Value;
item.ServiceInformation.houseTotalIndividualConsumptionSpecified = true;
}
if (municipalService.houseTotalHouseOverallNeeds.HasValue)
{
item.ServiceInformation ??= new ServiceInformation();
item.ServiceInformation.houseTotalHouseOverallNeeds = municipalService.houseTotalHouseOverallNeeds.Value;
item.ServiceInformation.houseTotalHouseOverallNeedsSpecified = true;
}
var consumption = new List<PDServiceChargeTypeMunicipalServiceVolume>();
if (municipalService.individualConsumptionVolumeDeterminingMethod.HasValue)
{
consumption.Add(new PDServiceChargeTypeMunicipalServiceVolume()
{
determiningMethod = municipalService.individualConsumptionVolumeDeterminingMethod.Value.ToServiceType(),
determiningMethodSpecified = true,
type = PDServiceChargeTypeMunicipalServiceVolumeType.I,
typeSpecified = true,
Value = municipalService.individualConsumptionVolumeValue.Value
});
}
if (municipalService.overallConsumptionVolumeDeterminingMethod.HasValue)
{
consumption.Add(new PDServiceChargeTypeMunicipalServiceVolume()
{
determiningMethod = municipalService.overallConsumptionVolumeDeterminingMethod.Value.ToServiceType(),
determiningMethodSpecified = true,
type = PDServiceChargeTypeMunicipalServiceVolumeType.O,
typeSpecified = true,
Value = municipalService.overallConsumptionVolumeValue.Value
});
}
item.Consumption = [.. consumption];
if (municipalService.multiplyingFactorRatio.HasValue)
{
item.MultiplyingFactor = new PDServiceChargeTypeMunicipalServiceMultiplyingFactor()
{
Ratio = municipalService.multiplyingFactorRatio.Value
};
if (municipalService.amountOfExcessFees.HasValue)
{
item.MultiplyingFactor.AmountOfExcessFees = municipalService.amountOfExcessFees.Value;
item.MultiplyingFactor.AmountOfExcessFeesSpecified = true;
}
}
if (municipalService.municipalServiceIndividualConsumptionPayable.HasValue)
{
item.MunicipalServiceIndividualConsumptionPayable = municipalService.municipalServiceIndividualConsumptionPayable.Value;
item.MunicipalServiceIndividualConsumptionPayableSpecified = true;
}
if (municipalService.municipalServiceCommunalConsumptionPayable.HasValue)
{
item.MunicipalServiceCommunalConsumptionPayable = municipalService.municipalServiceCommunalConsumptionPayable.Value;
item.MunicipalServiceCommunalConsumptionPayableSpecified = true;
}
if (municipalService.amountOfPaymentMunicipalServiceIndividualConsumption.HasValue)
{
item.AmountOfPaymentMunicipalServiceIndividualConsumption = municipalService.amountOfPaymentMunicipalServiceIndividualConsumption.Value;
item.AmountOfPaymentMunicipalServiceIndividualConsumptionSpecified = true;
}
if (municipalService.amountOfPaymentMunicipalServiceCommunalConsumption.HasValue)
{
item.AmountOfPaymentMunicipalServiceCommunalConsumption = municipalService.amountOfPaymentMunicipalServiceCommunalConsumption.Value;
item.AmountOfPaymentMunicipalServiceCommunalConsumptionSpecified = true;
}
if (municipalService.accountingPeriodTotal.HasValue)
{
item.AccountingPeriodTotal = municipalService.accountingPeriodTotal.Value;
item.AccountingPeriodTotalSpecified = true;
}
chargeInfo.Add(new PaymentDocumentTypeChargeInfo()
{
Item = item
});
}
// TODO: Обработать ошибку
}
var paymentDocument = new importPaymentDocumentRequestPaymentDocument()
{
TransportGUID = Guid.NewGuid().ToString(),
Items1 = [paymentInformations[entry.paymentInformation].TransportGUID],
AccountGuid = entry.accountGuid,
PaymentDocumentNumber = entry.paymentDocumentNumber,
Items = [.. chargeInfo]
};
if (entry.debtPreviousPeriods.HasValue)
{
paymentDocument.DebtPreviousPeriods = entry.debtPreviousPeriods.Value;
paymentDocument.DebtPreviousPeriodsSpecified = true;
}
if (entry.advanceBllingPeriod.HasValue)
{
paymentDocument.AdvanceBllingPeriod = entry.advanceBllingPeriod.Value;
paymentDocument.AdvanceBllingPeriodSpecified = true;
}
if (entry.totalPayableByPDWithDebtAndAdvance.HasValue)
{
paymentDocument.TotalPayableByPDWithDebtAndAdvance = entry.totalPayableByPDWithDebtAndAdvance.Value;
paymentDocument.TotalPayableByPDWithDebtAndAdvanceSpecified = true;
}
if (entry.totalPayableByPD.HasValue)
{
paymentDocument.TotalPayableByPD = entry.totalPayableByPD.Value;
paymentDocument.TotalPayableByPDSpecified = true;
}
if (entry.paidCash.HasValue)
{
paymentDocument.PaidCash = entry.paidCash.Value;
paymentDocument.PaidCashSpecified = true;
}
if (entry.dateOfLastReceivedPayment.HasValue)
{
paymentDocument.DateOfLastReceivedPayment = entry.dateOfLastReceivedPayment.Value;
paymentDocument.DateOfLastReceivedPaymentSpecified = true;
}
items.Add(paymentDocument);
}
// http://open-gkh.ru/Bills/importPaymentDocumentRequest.html
return new importPaymentDocumentRequest
{
Id = Constants.SIGNED_XML_ELEMENT_ID,
version = "11.2.0.16",
Items = [.. items]
};
}
}
}

View File

@ -0,0 +1,33 @@
using Hcs.Service.Async.Bills;
using System;
namespace Hcs.Client.Api.Type
{
// http://open-gkh.ru/Bills/PDServiceChargeType/MunicipalService/Consumption/Volume/determiningMethod.html
public enum MunicipalServiceVolumeDeterminingMethod
{
Norm,
MeteringDevice,
Other
}
internal static class MunicipalServiceVolumeDeterminingMethodExtensions
{
internal static PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod ToServiceType(this MunicipalServiceVolumeDeterminingMethod type)
{
switch (type)
{
case MunicipalServiceVolumeDeterminingMethod.Norm:
return PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod.N;
case MunicipalServiceVolumeDeterminingMethod.MeteringDevice:
return PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod.M;
case MunicipalServiceVolumeDeterminingMethod.Other:
return PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod.O;
}
throw new NotImplementedException($"Cannot convert {type} to service type");
}
}
}

View File

@ -11,6 +11,8 @@ namespace Hcs.Client
/// </summary> /// </summary>
public class UniClient : ClientBase public class UniClient : ClientBase
{ {
public BillsApi Bills => new(this);
public DeviceMeteringApi DeviceMetering => new(this); public DeviceMeteringApi DeviceMetering => new(this);
public HouseManagementApi HouseManagement => new(this); public HouseManagementApi HouseManagement => new(this);

View File

@ -65,11 +65,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Client\Api\ApiBase.cs" /> <Compile Include="Client\Api\ApiBase.cs" />
<Compile Include="Client\Api\BillsApi.cs" />
<Compile Include="Client\Api\DeviceMeteringApi.cs" /> <Compile Include="Client\Api\DeviceMeteringApi.cs" />
<Compile Include="Client\Api\HouseManagementApi.cs" /> <Compile Include="Client\Api\HouseManagementApi.cs" />
<Compile Include="Client\Api\NsiApi.cs" /> <Compile Include="Client\Api\NsiApi.cs" />
<Compile Include="Client\Api\NsiCommonApi.cs" /> <Compile Include="Client\Api\NsiCommonApi.cs" />
<Compile Include="Client\Api\OrgRegistryCommonApi.cs" /> <Compile Include="Client\Api\OrgRegistryCommonApi.cs" />
<Compile Include="Client\Api\Payload\Bills\ImportPaymentDocumentPayload.cs" />
<Compile Include="Client\Api\Payload\DeviceMetering\ExportMeteringDeviceHistoryPayload.cs" /> <Compile Include="Client\Api\Payload\DeviceMetering\ExportMeteringDeviceHistoryPayload.cs" />
<Compile Include="Client\Api\Payload\HouseManagement\ImportAccountDataPayload.cs" /> <Compile Include="Client\Api\Payload\HouseManagement\ImportAccountDataPayload.cs" />
<Compile Include="Client\Api\Payload\HouseManagement\ImportContractDataPayload.cs" /> <Compile Include="Client\Api\Payload\HouseManagement\ImportContractDataPayload.cs" />
@ -90,6 +92,8 @@
<Compile Include="Client\Api\Request\Adapter\IGetStateResult.cs" /> <Compile Include="Client\Api\Request\Adapter\IGetStateResult.cs" />
<Compile Include="Client\Api\Request\Adapter\IGetStateResultMany.cs" /> <Compile Include="Client\Api\Request\Adapter\IGetStateResultMany.cs" />
<Compile Include="Client\Api\Request\Adapter\IGetStateResultOne.cs" /> <Compile Include="Client\Api\Request\Adapter\IGetStateResultOne.cs" />
<Compile Include="Client\Api\Request\Bills\BillsRequestBase.cs" />
<Compile Include="Client\Api\Request\Bills\ImportPaymentDocumentRequest.cs" />
<Compile Include="Client\Api\Request\DeviceMetering\DeviceMeteringRequestBase.cs" /> <Compile Include="Client\Api\Request\DeviceMetering\DeviceMeteringRequestBase.cs" />
<Compile Include="Client\Api\Request\DeviceMetering\ExportMeteringDeviceHistory.cs" /> <Compile Include="Client\Api\Request\DeviceMetering\ExportMeteringDeviceHistory.cs" />
<Compile Include="Client\Api\Request\DeviceMetering\ImportMeteringDeviceValuesRequest.cs" /> <Compile Include="Client\Api\Request\DeviceMetering\ImportMeteringDeviceValuesRequest.cs" />
@ -125,6 +129,7 @@
<Compile Include="Client\Api\Request\Exception\RestartTimeoutException.cs" /> <Compile Include="Client\Api\Request\Exception\RestartTimeoutException.cs" />
<Compile Include="Client\Api\Request\RequestHelper.cs" /> <Compile Include="Client\Api\Request\RequestHelper.cs" />
<Compile Include="Client\Api\Request\X509Tools.cs" /> <Compile Include="Client\Api\Request\X509Tools.cs" />
<Compile Include="Client\Api\Type\MunicipalServiceVolumeDeterminingMethod.cs" />
<Compile Include="Client\Internal\CertificateHelper.cs" /> <Compile Include="Client\Internal\CertificateHelper.cs" />
<Compile Include="Client\Logger\ActionLogger.cs" /> <Compile Include="Client\Logger\ActionLogger.cs" />
<Compile Include="Client\Logger\ConsoleLogger.cs" /> <Compile Include="Client\Logger\ConsoleLogger.cs" />
@ -1121,6 +1126,7 @@
<WCFMetadataStorage Include="Connected Services\Service.Async.Nsi\" /> <WCFMetadataStorage Include="Connected Services\Service.Async.Nsi\" />
<WCFMetadataStorage Include="Connected Services\Service.Async.OrgRegistryCommon\" /> <WCFMetadataStorage Include="Connected Services\Service.Async.OrgRegistryCommon\" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -70,6 +70,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestApp\Program.cs" /> <Compile Include="TestApp\Program.cs" />
<Compile Include="TestApp\Scenario\BillsScenario.cs" />
<Compile Include="TestApp\Scenario\DeviceMeteringScenario.cs" /> <Compile Include="TestApp\Scenario\DeviceMeteringScenario.cs" />
<Compile Include="TestApp\Scenario\HouseManagementScenario.cs" /> <Compile Include="TestApp\Scenario\HouseManagementScenario.cs" />
<Compile Include="TestApp\Scenario\NsiCommonScenario.cs" /> <Compile Include="TestApp\Scenario\NsiCommonScenario.cs" />

View File

@ -36,6 +36,7 @@ namespace Hcs.TestApp
client.SetSigningCertificate(cert); client.SetSigningCertificate(cert);
var billsScenario = new BillsScenario(client);
var deviceMeteringScenario = new DeviceMeteringScenario(client); var deviceMeteringScenario = new DeviceMeteringScenario(client);
var houseManagementScenario = new HouseManagementScenario(client); var houseManagementScenario = new HouseManagementScenario(client);
var nsiScenario = new NsiScenario(client); var nsiScenario = new NsiScenario(client);
@ -43,6 +44,8 @@ namespace Hcs.TestApp
var orgRegistryCommonScenario = new OrgRegistryCommonScenario(client); var orgRegistryCommonScenario = new OrgRegistryCommonScenario(client);
try try
{ {
//billsScenario.ImportPaymentDocument();
//deviceMeteringScenario.ExportMeteringDeviceHistory(); //deviceMeteringScenario.ExportMeteringDeviceHistory();
//deviceMeteringScenario.ImportMeteringDeviceValues(); //deviceMeteringScenario.ImportMeteringDeviceValues();

View File

@ -0,0 +1,67 @@
using Hcs.Client;
using Hcs.Client.Api.Payload.Bills;
using Hcs.Client.Api.Registry;
using Hcs.Client.Api.Type;
using System;
namespace Hcs.TestApp.Scenario
{
internal class BillsScenario(UniClient client)
{
private readonly UniClient client = client;
internal void ImportPaymentDocument()
{
var paymentInformation = new ImportPaymentDocumentPayload.PaymentInformation()
{
bankBIK = "049805609",
operatingAccountNumber = "40602810276000100228"
};
var payload = new ImportPaymentDocumentPayload()
{
month = 8,
year = 2025,
paymentInformation = [paymentInformation],
paymentDocument = [new ImportPaymentDocumentPayload.PaymentDocument()
{
paymentInformation = paymentInformation,
accountGuid = "019917a8-6eb6-74cc-99b7-58350127ac50",
paymentDocumentNumber = "23900701600162023",
chargeInfo =
[
new ImportPaymentDocumentPayload.MunicipalService()
{
moneyRecalculation = 0M,
moneyDiscount = 0M,
houseOverallNeedsNorm = 0M,
individualConsumptionNorm = 0.472M,
individualConsumptionCurrentValue = 0M,
houseOverallNeedsCurrentValue = 0M,
houseTotalIndividualConsumption = 19.678M,
houseTotalHouseOverallNeeds = 0M,
individualConsumptionVolumeDeterminingMethod = MunicipalServiceVolumeDeterminingMethod.Norm,
individualConsumptionVolumeValue = 1.006M,
municipalServiceIndividualConsumptionPayable = 1862.93M,
municipalServiceCommunalConsumptionPayable = 0M,
amountOfPaymentMunicipalServiceIndividualConsumption = 1862.93M,
amountOfPaymentMunicipalServiceCommunalConsumption = 0M,
serviceType = Registry3.Element6,
rate = 1851.82M,
totalPayable = 1862.93M,
accountingPeriodTotal = 1862.93M
}
],
debtPreviousPeriods = 3271.16M,
advanceBllingPeriod = 0M,
totalPayableByPDWithDebtAndAdvance = 3043.95M,
totalPayableByPD = 3442.24M,
paidCash = 3669.45M,
dateOfLastReceivedPayment = new DateTime(2025, 8, 30)
}]
};
var result = client.Bills.ImportPaymentDocumentAsync(payload).Result;
Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
}
}
}