Example #1
0
 public TransactionServiceFactory(IProcessSettingsFactory settingsFactory, ITransactionDataConnector dataConnector, IAgentFactory agentFactory, IAlternateBranchFactory alternateBranchFactory,
                                  ITransactionFeeListFactory transactionFeeListFactory, ITransactionContextFactory transactionContextFactory, ICustomerFactory customerFactory, ITransactionDeficienciesFactory transactionDeficienciesFactory,
                                  IDocumentService documentService, ILogicEvaluatorTypeFactory evaluatorTypeFactory, IEvidenceService evidenceService, ILocationFactory locationFactory,
                                  IParameterSerializer parameterSerializer, IPlatformService platformService, IProcessStepFactory processStepFactory, IProcessStepTypeFactory processStepTypeFactory,
                                  IRequirementEvaluator requirementEvaluator, IRequirementFactory requirementFactory, ITransactionHistoryFactory transactionHistoryFactory,
                                  ITransactionProcessFactory transactionProcessFactory, IFeeList feeList)
 {
     this.SettingsFactory                = settingsFactory ?? throw new ArgumentNullException("settingsFactory");
     this.DataConnector                  = dataConnector ?? throw new ArgumentNullException("dataConnector");
     this.AgentFactory                   = agentFactory ?? throw new ArgumentNullException("agentFactory.");
     this.AlternateBranchFactory         = alternateBranchFactory ?? throw new ArgumentNullException("alternateBrachFactory");
     this.TransactionFeeListFactory      = transactionFeeListFactory ?? throw new ArgumentNullException("transactionFeeListFactory");
     this.TransactionContextFactory      = transactionContextFactory ?? throw new ArgumentNullException("transactionContextFactory");
     this.CustomerFactory                = customerFactory ?? throw new ArgumentNullException("customerFactory.");
     this.TransactionDeficienciesFactory = transactionDeficienciesFactory ?? throw new ArgumentNullException("transactionDeficienciesFactory");
     this.DocumentService                = documentService ?? throw new ArgumentNullException("documentService");
     this.EvaluatorTypeFactory           = evaluatorTypeFactory ?? throw new ArgumentNullException("evaluatorTypeFactory.");
     this.EvidenceService                = evidenceService ?? throw new ArgumentNullException("evidenceService");
     this.LocationFactory                = locationFactory ?? throw new ArgumentNullException("locationFactory.");
     this.PlatformService                = platformService ?? throw new ArgumentNullException("platformService.");
     this.ProcessStepFactory             = processStepFactory ?? throw new ArgumentNullException("processStepFactory.");
     this.ProcessStepTypeFactory         = processStepTypeFactory ?? throw new ArgumentNullException("processStepTypeFactory.");
     this.RequirementEvaluator           = requirementEvaluator ?? throw new ArgumentNullException("requirementEvaluator");
     this.RequirementFactory             = requirementFactory ?? throw new ArgumentNullException("requirementFactory.");
     this.TransactionHistoryFactory      = transactionHistoryFactory ?? throw new ArgumentNullException("transactionHistoryFactory");
     this.TransactionProcessFactory      = transactionProcessFactory ?? throw new ArgumentNullException("transactionProcessFactory.");
     this.ParameterSerializer            = parameterSerializer ?? throw new ArgumentNullException("parameterSerializer");
     this.FeeList = feeList ?? throw new ArgumentNullException("feeList");
 }
Example #2
0
        public Transaction(IProcessExecutionContext executionContext, IAgentFactory agentFactory, ITransactionFeeListFactory transactionFeeListFactory, ITransactionContextFactory transactionContextFactory,
                           ICustomerFactory customerFactory, ITransactionDeficienciesFactory transactionDeficienciesFactory, IDocumentService documentService, IEvidenceService evidenceService,
                           ILocationFactory locationFactory, IRequirementEvaluator requirementEvaluator, ITransactionHistoryFactory transactionHistoryFactory, ITransactionService transactionService,
                           ITransactionType transactionType, ITransactionRecord record)
            : base(record.RecordType, record.Id)
        {
            this.ExecutionContext = executionContext ?? throw new ArgumentNullException("executionContext");

            this.AgentFactory = agentFactory ?? throw new ArgumentNullException("agentFactory");
            this.TransactionFeeListFactory      = transactionFeeListFactory ?? throw new ArgumentNullException("transactionFeeListFactory");
            this.TransactionContextFactory      = transactionContextFactory ?? throw new ArgumentNullException("transactionContextFactory");
            this.CustomerFactory                = customerFactory ?? throw new ArgumentNullException("customerFactory");
            this.TransactionDeficienciesFactory = transactionDeficienciesFactory ?? throw new ArgumentNullException("transactionDeficienciesFactory");
            this.DocumentService                = documentService ?? throw new ArgumentNullException("documentService");
            this.EvidenceService                = evidenceService ?? throw new ArgumentNullException("evidenceService");
            this.LocationFactory                = locationFactory ?? throw new ArgumentNullException("locationFactory");
            this.RequirementEvaluator           = requirementEvaluator ?? throw new ArgumentNullException("requirementEvaluator");
            this.TransactionHistoryFactory      = transactionHistoryFactory ?? throw new ArgumentNullException("transactionHistoryFactory");
            this.TransactionService             = transactionService ?? throw new ArgumentNullException("transactionService");

            this.TransactionType = transactionType ?? throw new ArgumentNullException("transactionType");

            this.Name                 = record.Name;
            this.ReferenceNumber      = record.ReferenceNumber;
            this.PricingDate          = record.PricingDate ?? DateTime.Now.Date;
            this.InitiatingProcessId  = record.InitiatingProcessId ?? throw new ArgumentNullException("InitiatingProcessId");
            this.CurrentProcessId     = record.CurrentProcessId ?? throw new ArgumentNullException("CurrentProcessId");
            this.CurrentStepId        = record.CurrentStepId ?? throw new ArgumentNullException("CurrentStepId");
            this.ContextRecordId      = record.ContextRecordId ?? throw new ArgumentNullException("contextRecordId");
            this.CustomerId           = record.CustomerId ?? throw new ArgumentNullException("customerId");
            this.InitiatingAgentId    = record.InitiatingAgentId ?? throw new ArgumentNullException("initiatingAgentId");
            this.InitiatingLocationId = record.InitiatingLocationId ?? throw new ArgumentNullException("initiatingLocationId");
        }
        public IStepExecutionResult Execute(IProcessExecutionContext executionContext, IWorkSession session, ITransaction transaction, IRequirementEvaluator requirementEvaluator)
        {
            try
            {
                bool blockProgress = false;
                bool isValid       = true;

                Type.ValidateStepParameters(executionContext, Parameters);

                //complete any specific implementation for the step type
                Type.Execute(executionContext, session, transaction, Parameters);

                if (ValidationRequirements.Count > 0)
                {
                    var requirementPointers = ValidationRequirements.Select(r => r.RequirementId).ToList();
                    var deficiencies        = requirementEvaluator.Evaluate(executionContext, transaction, requirementPointers);

                    if (deficiencies.Count > 0)
                    {
                        isValid = false;

                        //if any validation requirement is configured to block progress and there is a deficiency for that requirement
                        //then the step is blocked.
                        foreach (var r in ValidationRequirements)
                        {
                            if (r.BlockProcessProgress && deficiencies.Where(d => d.Requirement.Id == r.RequirementId.Id).FirstOrDefault() != null)
                            {
                                blockProgress = true;
                            }
                        }
                    }
                }

                var nextStep = getNextStep(executionContext, transaction);

                return(new StepExecutionResult
                {
                    StepIsBlocked = blockProgress,
                    StepIsValid = isValid,
                    NextStep = nextStep
                });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
        protected internal TransactionService(ITransactionDataConnector dataConnector, IAgentFactory agentFactory, ITransactionFeeListFactory transactionFeeListFactory,
                                              ITransactionContextFactory transactionContextFactory, ICustomerFactory customerFactory, ITransactionDeficienciesFactory transactionDeficienciesFactory, IDocumentService documentService,
                                              IEvidenceService evidenceService, ILocationFactory locationFactory, IRequirementEvaluator requirementEvaluator, ITransactionHistoryFactory transactionHistoryFactory,
                                              IFeeList feeList, IList <ITransactionType> registeredTransactions)
        {
            this.DataConnector                  = dataConnector ?? throw new ArgumentNullException("dataConnector");
            this.AgentFactory                   = agentFactory ?? throw new ArgumentNullException("agentFactory");
            this.TransactionFeeListFactory      = transactionFeeListFactory ?? throw new ArgumentNullException("feeListFactory");
            this.TransactionContextFactory      = transactionContextFactory ?? throw new ArgumentNullException("transactionContextFactory");
            this.CustomerFactory                = customerFactory ?? throw new ArgumentNullException("customerFactory");
            this.TransactionDeficienciesFactory = transactionDeficienciesFactory ?? throw new ArgumentNullException("transactionDeficienciesFactory");
            this.DocumentService                = documentService ?? throw new ArgumentNullException("documentService");
            this.EvidenceService                = evidenceService ?? throw new ArgumentNullException("evidenceService");
            this.LocationFactory                = locationFactory ?? throw new ArgumentNullException("locationFactory");
            this.RequirementEvaluator           = requirementEvaluator ?? throw new ArgumentNullException("requirementEvaluator");
            this.TransactionHistoryFactory      = transactionHistoryFactory ?? throw new ArgumentNullException("transactionHistoryFactory");
            this.FeeList = feeList ?? throw new ArgumentNullException("feeList");

            if (registeredTransactions == null)
            {
                this.RegisteredTransactionTypes = new List <ITransactionType>();
            }
            else
            {
                this.RegisteredTransactionTypes = registeredTransactions.ToList();
            }
        }