/// <summary>
        /// Mock transactionlookup response depends on reference number
        /// </summary>
        /// <param name="referenceNumber"></param>
        /// <param name="purposeOfLookup"></param>
        /// <returns></returns>
        public TransactionLookupResponse MockTransactionLookupResponse(string referenceNumber, string purposeOfLookup)
        {
            SessionType sessionType = SessionType.AMD;

            Func <TrainingModeResponses, string> getFileName = null;

            TransactionLookupResponse response = null;

            switch (purposeOfLookup)
            {
            case PurposeOfLookup.Receive:
                sessionType = SessionType.RCV;
                getFileName = x => x.ReceiveTransactionLookup;
                break;

            case PurposeOfLookup.ReceiveCompletion:
                sessionType = SessionType.RCV;
                getFileName = x => x.StagedReceiveTransactionLookup;
                break;

            case PurposeOfLookup.SendCompletion:
                sessionType = SessionType.SEND;
                getFileName = x => x.StagedSendTransactionLookup;
                break;

            case PurposeOfLookup.BillPayCompletion:
                sessionType = SessionType.BP;
                getFileName = x => x.StagedBillPayTransactionLookup;
                break;

            case PurposeOfLookup.Amend:
                sessionType = SessionType.AMD;
                getFileName = x => x.AmendTransactionLookup;
                break;

            case PurposeOfLookup.SendReversal:
                sessionType = SessionType.SREV;
                getFileName = x => x.SendReversalTransactionLookup;
                break;

            case PurposeOfLookup.Status:
                response = TrainingModeConfiguration.GetTransactionLookupStatusResponse <TransactionLookupResponse>(referenceNumber, x => x.StatusTransactionLookup);
                break;
            }

            if (response == null)
            {
                response = TrainingModeConfiguration.GetResponse <TransactionLookupResponse>(sessionType.ToTrainingModeSessionType(), referenceNumber, getFileName);
            }

            var sendDate = response.Payload.CurrentValues.FirstOrDefault(x => x.InfoKey == "dateTimeSent");

            if (sendDate != null)
            {
                int.TryParse(sendDate.Value, out int daysAgo); //try to parse value from mock file. If it's int and parses it's added to current date. If parsing fails it is default of 0.
                sendDate.Value = DateTime.Now.AddDays(daysAgo).ToString("yyyy-MM-ddTHH:mm:ss.ffffzzz");
            }
            return(response);
        }
예제 #2
0
 private void Init()
 {
     ReceiveValidationResponses = new List <ReceiveValidationResponse>();
     ReceiveValidationRequests  = new List <ReceiveValidationRequest>();
     TransactionLookupRequest   = new TransactionLookupRequest();
     TransactionLookupResponse  = new TransactionLookupResponse();
     CompleteSessionRequest     = new CompleteSessionRequest();
     CompleteSessionResponse    = new CompleteSessionResponse();
 }
예제 #3
0
 public void Set(TransactionLookupResponse transactionLookupResponse)
 {
     TransactionLookupResponse = transactionLookupResponse;
     SetExecutionOrder(nameof(TransactionLookupResponse));
 }