Table of Contents

Class HmrcReferenceDataProviderFactory

Namespace
Payetools.ReferenceData
Assembly
Payetools.ReferenceData.dll

Factory class that is used to create new HMRC reference data providers that implement IHmrcReferenceDataProvider.

public class HmrcReferenceDataProviderFactory : IHmrcReferenceDataProviderFactory
Inheritance
HmrcReferenceDataProviderFactory
Implements
Inherited Members

Constructors

HmrcReferenceDataProviderFactory(ILogger<HmrcReferenceDataProviderFactory>?)

public HmrcReferenceDataProviderFactory(ILogger<HmrcReferenceDataProviderFactory>? logger)

Parameters

logger ILogger<HmrcReferenceDataProviderFactory>

Implementation of ILogger for logging.

Properties

Logger

Gets logger for logging. If not supplied in constructor (or null supplied), no logging is performed.

protected ILogger<HmrcReferenceDataProviderFactory>? Logger { get; }

Property Value

ILogger<HmrcReferenceDataProviderFactory>

Methods

CreateProviderAsync(Stream[])

Creates a new HMRC reference data that implements IHmrcReferenceDataProvider using reference data loaded from an array of streams.

public Task<IHmrcReferenceDataProvider> CreateProviderAsync(Stream[] referenceDataStreams)

Parameters

referenceDataStreams Stream[]

Array of data streams to load HMRC reference data from.

Returns

Task<IHmrcReferenceDataProvider>

An instance of a type that implements IHmrcReferenceDataProvider.

Remarks

If the method completes successfully, the Health property of the created IHmrcReferenceDataProvider provides human-readable information on the status of each tax year loaded.

Exceptions

InvalidReferenceDataException

Thrown if it was not possible to load reference data from the supplied set of streams.

DeserializeAsync<T>(Stream, string)

Deserialises the supplied JSON stream. Primarily used to deserialise into HmrcTaxYearReferenceDataSet but may be used to other types needed by derived classes of this factory.

protected static Task<T> DeserializeAsync<T>(Stream data, string source)

Parameters

data Stream

Stream to use as source.

source string

Source name.

Returns

Task<T>

Object of type T containing the deserialised data.

Type Parameters

T

Type of object to deserialise.

Exceptions

InvalidReferenceDataException

Thrown if the supplied stream cannot be deserialised.