Interface ITransactionProcessor
The main transaction processor for handling the core financial services engine processing of transactions within the system
See https://help.lemonedge.com/transactions/ for more information
This processor is responsible for calculating transaction, allocations, and gl entries according to the rules of the ITransactionCode and responding to UI eventsInherited Members
Namespace: LemonEdge.API.Processors.Transactional
Assembly: API.dll
Syntax
public interface ITransactionProcessor : IBaseDataSetProcessorWithDBSave, IBaseDataSetProcessor, IProcessor, IDisposable, ILockable
Remarks
At its top level a transaction processor always deals with a root transaction entity.
Header transactions are top level transactions that all point to the root transaction (a header transaction itself)
Sub transactions are child transactions of a header transaction that contain detail at different entity levels along a path for the header transaction itselfAll transactions, whether root, header or sub, are valid and can simply aggregated and reported on however they are required
Lastly a processor works with a root transaction, that stands alone by itself, or is part of a set with a (ParentItemID)Properties
DefaultRounding
The default rounding level to use with a Rounder
Declaration
RoundingLevel DefaultRounding { get; }
Property Value
Type | Description |
---|---|
RoundingLevel |
ExchangeRateRetriever
A retriever for acquiring the valid exchange rate for a requested from/to currency and associated date
Declaration
ExchangeRateRetriever ExchangeRateRetriever { get; }
Property Value
Type | Description |
---|---|
ExchangeRateRetriever |
FinancialDateCalculator
A calculator for providing a valid financial date against an entity taking into account the IEntityPeriodClosing against it and the requested transaction date
Declaration
FinancialDateCalculator FinancialDateCalculator { get; }
Property Value
Type | Description |
---|---|
FinancialDateCalculator |
GetAllTransactions
Returns all transaction records (the root transaction, header transactions and sub-transactions) within this processor
Declaration
IEnumerable<ITransaction> GetAllTransactions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITransaction> |
HeaderTransactions
An enumeration of all header transactions in this processor.
Header transactions are all individually processed unless working together using a TransactionProcessorExtender
Declaration
IEnumerable<ITransaction> HeaderTransactions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITransaction> |
Helper
A helper class for dealing with transaction operations and ensuring values are updated consistently
Declaration
TransactionsHelper Helper { get; }
Property Value
Type | Description |
---|---|
TransactionsHelper |
RootTransaction
The parent root transaction this processor is responsible for calculating.
All other header and sub transactions pointing to this root are part of the set and will be processed by this algorithm too
Declaration
ITransaction RootTransaction { get; }
Property Value
Type | Description |
---|---|
ITransaction |
Methods
AddCodeVaue(ITransaction, Guid)
Adds the specified transaction type value to be recorded against the specified transaction (and all its sub-transactions) itself
Declaration
void AddCodeVaue(ITransaction transaction, Guid tranTypeValueID)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction (and all associated sub-transactions) to add the specified transaction type value to |
System.Guid | tranTypeValueID | The transaction type value to add to the transaction |
CreateGLPosting(ITransaction, ITransactionCodeGLEntry)
Creates a gl posting record for the specified parent
transaction and registers it
Declaration
Task<IGLPosting> CreateGLPosting(ITransaction parent, ITransactionCodeGLEntry glEntry)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | parent | The transaction that is the parent of this gl posting |
ITransactionCodeGLEntry | glEntry | The optional transaction code gl entry this gl posting is being created for. Can be null if manually being created |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IGLPosting> | A gl posting record for the specified |
CreateGLPostingAllocated(IGLPosting)
Creates a gl posting allocation record for the specified parent
gl posting and registers it
Declaration
Task<IGLPostingAllocated> CreateGLPostingAllocated(IGLPosting parent)
Parameters
Type | Name | Description |
---|---|---|
IGLPosting | parent | The gl posting record that is a parent to this allocation |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IGLPostingAllocated> | A gl posting allocation record for the specified |
CreateTransaction(ITransaction)
Creates a sub-transaction where the ParentTransactionID is set to the specified parent
and registers it
Declaration
Task<ITransaction> CreateTransaction(ITransaction parent)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | parent | The header transaction that is the parent of this created transaction |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ITransaction> | A sub-transaction where the ParentTransactionID is set to the specified |
CreateTransactionAllocated(ITransaction)
Creates a transaction allocation record for the specified parent
transaction and registers it
Declaration
Task<ITransactionAllocated> CreateTransactionAllocated(ITransaction parent)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | parent | The transaction that is the parent of the created transaction allocation |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ITransactionAllocated> | A transaction allocation record for the specified |
DeleteGLPosting(IGLPosting, Boolean)
Removes the specified gl posting from the processor, and stops listening to any changes against the record
This cascades to all gl posting allocations
Declaration
void DeleteGLPosting(IGLPosting posting, bool updateLog)
Parameters
Type | Name | Description |
---|---|---|
IGLPosting | posting | The gl posting to remove from the processor, and all associated gl posting allocations |
System.Boolean | updateLog | Indicates if the posting should also be removed from the IEntityUpdater context and marked for deletion. If not then it will update affected net amounts for other records, otherwise it assumes the caller will take care of it as it already marked the record for deletion too. |
DeleteGLPostingAllocated(IGLPostingAllocated, Boolean)
Removes the specified gl posting allocation from the processor, and stops listening to any changes against the record
Declaration
void DeleteGLPostingAllocated(IGLPostingAllocated allocated, bool updateLog)
Parameters
Type | Name | Description |
---|---|---|
IGLPostingAllocated | allocated | The gl posting allocation to remove from the processor |
System.Boolean | updateLog | Indicates if the posting allocation should also be removed from the IEntityUpdater context and marked for deletion. If not then it will update affected net amounts for other records, otherwise it assumes the caller will take care of it as it already marked the record for deletion too. |
DeleteTransaction(ITransaction, Boolean)
Removes the specified transaction from the processor, and stops listening to any changes against the record
This cascades to all sub-transactions, transaction allocations, gl postings, and gl posting allocations
If this transaction is the root transaction, the processor will be empty if there are no other transactions, or it will promote the next header transaction to become rootDeclaration
void DeleteTransaction(ITransaction transaction, bool updateLog)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction to remove from the processor, and all associated sub-transactions |
System.Boolean | updateLog | Indicates if the transaction should also be removed from the IEntityUpdater context and marked for deletion |
DeleteTransactionAllocated(ITransactionAllocated, Boolean)
Removes the specified transaction allocation from the processor, and stops listening to any changes against the record
This cascades to all gl posting allocations
Declaration
void DeleteTransactionAllocated(ITransactionAllocated transaction, bool updateLog)
Parameters
Type | Name | Description |
---|---|---|
ITransactionAllocated | transaction | The transaction allocation to remove from the processor |
System.Boolean | updateLog | Indicates if the transaction allocation should also be removed from the IEntityUpdater context and marked for deletion. If not then it will update affected net amounts for other records, otherwise it assumes the caller will take care of it as it already marked the record for deletion too. |
ExecuteFormula<T>(String, IBaseEntity)
Executes the specified formula with the specified context item
Declaration
Task<T> ExecuteFormula<T>(string formula, IBaseEntity contextItem)
Parameters
Type | Name | Description |
---|---|---|
System.String | formula | The c# formula/script to dynamically execute |
IBaseEntity | contextItem | A context item that is provided as a FormulaFunctionsWithContext which can be referenced by the formula |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | A task holding the result of the formula being executed |
Type Parameters
Name | Description |
---|---|
T | The type of result expected from executing the formula |
GetAllocateToValues(ITransaction)
Returns all the transaction allocation rules for creating a new transaction automatically to entities that are allocated to as part of a chain mapping
Declaration
IEnumerable<(ITransactionCodeAllocateToTransaction, IEnumerable<ITransactionCodeAllocateToTransactionValue>)> GetAllocateToValues(ITransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction to retrieve all automatica transactions for |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.ValueTuple<ITransactionCodeAllocateToTransaction, System.Collections.Generic.IEnumerable<ITransactionCodeAllocateToTransactionValue>>> | All the transaction allocation rules for creating a new transaction automatically to entities that are allocated to as part of a chain mapping |
GetAllTransactionValuesAllocated(ITransaction)
Returns all allocated transaction values against the specified owningTransaction
and all its sub-transactions (obtained from GetTransactionValues(ITransaction))
Declaration
IEnumerable<ITransactionAllocated> GetAllTransactionValuesAllocated(ITransaction owningTransaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | owningTransaction | The owning header transaction to return all transaction allocations for (including those from any sub-transactions too) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITransactionAllocated> | All allocated transaction values against the specified |
GetCode(ITransaction)
Returns the actual transaction code for the specified owningTransaction
Declaration
ITransactionCode GetCode(ITransaction owningTransaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | owningTransaction | The transaction to return the associated transaction code for its TransactionCodeID |
Returns
Type | Description |
---|---|
ITransactionCode | The actual transaction code for the specified |
GetCodeGLEntries(ITransaction)
Returns the transaction code gl entry settings for the specified transaction
This indicates which gl postings should automatically be created against the transaction
Declaration
IEnumerable<ITransactionCodeGLEntry> GetCodeGLEntries(ITransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction to return the automatic gl entry settings for |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITransactionCodeGLEntry> | The transaction code gl entry settings for the specified |
GetCodeValues(ITransaction)
Returns all the values being stored against the specified transaction
(and thus its sub-transactions too)
Transactions are configured to stored different values against them according to the transaction code.
This returns a list of transaction code settings and associated transaction valuesDeclaration
IEnumerable<(ITransactionCodeValue CodeValue, ITransactionTypeValue ValueDef)> GetCodeValues(ITransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction to return the values being stored against it |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.ValueTuple<ITransactionCodeValue, ITransactionTypeValue>> | All the values being stored against the specified |
GetGLValues(ITransaction)
Returns all gl posting records directly associated with the specified owningTransaction
and its sub-transactions
Declaration
IEnumerable<IGLPosting> GetGLValues(ITransaction owningTransaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | owningTransaction | The owning header transaction to return all gl postings for (including those from any sub-transactions too) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IGLPosting> | All gl posting records directly associated with the specified |
GetGLValuesAllocated(IGLPosting)
Returns all allocated gl posting values directly against the specified owningPosting
only.
Declaration
IEnumerable<IGLPostingAllocated> GetGLValuesAllocated(IGLPosting owningPosting)
Parameters
Type | Name | Description |
---|---|---|
IGLPosting | owningPosting | The gl posting to return all direct allocated gl postings for (those with GLPostingID set to this) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IGLPostingAllocated> | All allocated gl posting values directly against the specified |
GetPath(Guid)
Returns the loaded path from the specified pathID
Declaration
IEnumerable<IPathInfo> GetPath(Guid pathID)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | pathID | The id of the path to return |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IPathInfo> | The loaded path from the specified |
GetRounder(ITransaction)
A calculator for rounding a given number to a specified level
Declaration
Rounder GetRounder(ITransaction tran)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | tran | The transaction the rounder is required for |
Returns
Type | Description |
---|---|
Rounder | A calculator for rounding a given number to a specified level |
GetTransaction(Guid)
Returns the transaction within this processor identified by the specified globally unique id
Declaration
ITransaction GetTransaction(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The id of a transaction within this processor |
Returns
Type | Description |
---|---|
ITransaction | The transaction within this processor identified by the specified globally unique id |
GetTransactionSet(ITransaction)
Returns all transactions in a set that the specified transaction
is a member of
A set defines a header transaction and sub-transactions that have their ParentTransactionID set to the header transaction
Providing the header transaction or a sub-transaction will return the header and all sub-transactionsDeclaration
IEnumerable<ITransaction> GetTransactionSet(ITransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | A transaction in the set (either header or sub-transaction) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITransaction> | All transactions in a set that the specified |
GetTransactionSetting(ITransaction)
Retrieves a loaded associated transaction setting entity against the specified transaction
Transaction settings are linked to through SettingsID and implement IHasTransactionSetting
Declaration
IBaseEntity GetTransactionSetting(ITransaction tran)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | tran | The transaction to retrieve its associated settings entity from |
Returns
Type | Description |
---|---|
IBaseEntity | The already loaded transaction setting entity for this transaction |
GetTransactionValues(ITransaction)
Returns all sub-transactions that have the specified owningTransaction
as their ParentTransactionID along with the owning transaction itself
Declaration
IEnumerable<ITransaction> GetTransactionValues(ITransaction owningTransaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | owningTransaction | The owning header transaction to return all sub-transactions of |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITransaction> | All sub-transactions that have the specified |
GetTransactionValuesAllocated(ITransaction)
Returns all allocated transaction values against the specified owningTransaction
only.
Declaration
IEnumerable<ITransactionAllocated> GetTransactionValuesAllocated(ITransaction owningTransaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | owningTransaction | The transaction to return all direct allocated transactions for (those with ParentTransactionID set to this) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITransactionAllocated> | All allocated transaction values against the specified |
LoadPathInfo(ITransaction, Boolean)
Loads the allocation path information for the specified transaction according to the configuration of the associated transaction code
If dynamically allocating values out, the system will allocate the values across the path and create appropriate transaction allocation records for the breakdown (along with sub transactions and allocations if needed along the path)
Declaration
Task LoadPathInfo(ITransaction tran, bool force)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | tran | The transaction to load the path allocation information for |
System.Boolean | force | Indicates the path should be reloaded even if it is already cached as dependant values may have changed such as the date |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |
OnChanged(TransactionProcessorEventArgs)
Raises the OnTransactionChanged event with the specified arguments
Declaration
void OnChanged(TransactionProcessorEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
TransactionProcessorEventArgs | args | The arguments for the OnTransactionChanged event |
OnLoadTransactionCodeInfo(ITransaction, Boolean)
Loads all the associated transaction code configuration for the specified transaction
Declaration
Task OnLoadTransactionCodeInfo(ITransaction transaction, bool changed)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction to load its associated transaction code configuration for, including any TransactionProcessorExtender required too |
System.Boolean | changed | Indicates the code has been changed, and thus all current values need to be reset to 0 |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |
ProcessExtender(ITransaction, String)
Executes all extenders (TransactionProcessorExtender) configured against the ITransactionCode for the specified tran
Each extender is passed the name of the property that has changed so it can determine what, if any, processes need to be run
Declaration
Task ProcessExtender(ITransaction tran, string propertyChangedName)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | tran | The transaction that has a property changed and needs all extenders to respond to it |
System.String | propertyChangedName | The name of the property that has changed |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |
RegisterNewGLPosting(IGLPosting, ITransaction, ITransactionCodeGLEntry)
Registers a newly created Gl Posting record with the processor so it is correctly loaded, and so the processor can react to changes in the records values
Declaration
Task RegisterNewGLPosting(IGLPosting posting, ITransaction owningTransaction, ITransactionCodeGLEntry glEntry)
Parameters
Type | Name | Description |
---|---|---|
IGLPosting | posting | The gl posting to register with this processor |
ITransaction | owningTransaction | |
ITransactionCodeGLEntry | glEntry |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
RegisterTransaction(ITransaction)
Registers a newly created Transaction record with the processor so it is correctly loaded, and so the processor can react to changes in the records values
Declaration
void RegisterTransaction(ITransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction to register with this processor |
RegsterNewGLPostingAllocated(IGLPostingAllocated)
Registers a newly created Gl Posting Allocation record with the processor so it is correctly loaded, and so the processor can react to changes in the records values
Declaration
void RegsterNewGLPostingAllocated(IGLPostingAllocated alloc)
Parameters
Type | Name | Description |
---|---|---|
IGLPostingAllocated | alloc | The gl posting allocation to register with this processor |
RegsterNewTransactionAllocated(ITransactionAllocated)
Registers a newly created Transaction Allocation record with the processor so it is correctly loaded, and so the processor can react to changes in the records values
Declaration
void RegsterNewTransactionAllocated(ITransactionAllocated alloc)
Parameters
Type | Name | Description |
---|---|---|
ITransactionAllocated | alloc | The transaction allocation to register with this processor |
RemoveCodeValue(ITransaction, Guid)
Removes the specified transaction type value from the transaction. Possible if the transaction code allows manual alteration of the values stored against a transaction
Declaration
Task RemoveCodeValue(ITransaction transaction, Guid tranTypeValueID)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction (and all associated sub-transactions) to remove the specified transaction type value from |
System.Guid | tranTypeValueID | The transaction type value to remove from the transaction |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operaion |
UpdateRounders(ITransaction)
Updates the stored rounders in the processors for the specified transaction and all its sub-transactions
Declaration
Task UpdateRounders(ITransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
ITransaction | transaction | The transaction (and its sub-transactions) to update all the rounders for |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |
Events
OnTransactionChanged
An event indicating the processor has changed the specified value against records within the processor
Declaration
event TransactionProcessorEventHandler OnTransactionChanged
Event Type
Type | Description |
---|---|
TransactionProcessorEventHandler |