Add payment document import
This commit is contained in:
23
Hcs.Client/Client/Api/BillsApi.cs
Normal file
23
Hcs.Client/Client/Api/BillsApi.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
55
Hcs.Client/Client/Api/Request/Bills/BillsRequestBase.cs
Normal file
55
Hcs.Client/Client/Api/Request/Bills/BillsRequestBase.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@ -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]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,8 @@ namespace Hcs.Client
|
||||
/// </summary>
|
||||
public class UniClient : ClientBase
|
||||
{
|
||||
public BillsApi Bills => new(this);
|
||||
|
||||
public DeviceMeteringApi DeviceMetering => new(this);
|
||||
|
||||
public HouseManagementApi HouseManagement => new(this);
|
||||
|
||||
Reference in New Issue
Block a user