Пример #1
0
        public BillPayData BillerSearchByCode(BillPayData billPayData)
        {
            billPayData.Set(BillPayBillerSearchRequestFactory.BillerSearchRequestByCodeForEP(billPayData.BillPayRequest.Biller.Code));
            billPayData.Set(_acIntegration.BillerSearch(billPayData.BillPayRequest.AgentId, billPayData.BillPayRequest.AgentPos, billPayData.BillerSearchRequest));

            return(billPayData);
        }
        public override ITransactionResult Transaction(object parameters)
        {
            var billPayParams = (BillPayParameters)parameters;

            TestConfig.TestSettings = new IntegrationTestSettingsModel {
                AcEnvironment = billPayParams.Environment
            };

            var amtRangeParsed = Enum.TryParse(billPayParams.AmtRange, true, out AmountRange amtRange);
            var billPayRequest = new BillPayOperationRequest
            {
                Biller = new TestBiller {
                    Code = billPayParams?.BillerCode, ValidAccountNumber = billPayParams?.BillerAccountNumber
                },
                AmtRange       = amtRangeParsed ? amtRange : AmountRange.CustomAmount,
                Amount         = (double)billPayParams.CustomAmount,
                AgentState     = billPayParams.GetAgentState(),
                ThirdPartyType = billPayParams.ThirdPartyType,
                AgentId        = billPayParams.AgentId,
                AgentPos       = billPayParams.AgentPos
            };

            billPayRequest.PopulateAgentData(billPayParams.AgentState);
            var billPayData = new BillPayData(billPayRequest);

            _billPayOperations.CompleteStagedSession(billPayData);

            return(new TransactionResult {
                Result = billPayData
            });
        }
Пример #3
0
        public BillPayData CompleteStagedSession(BillPayData billPayData)
        {
            try
            {
                BillerSearchByCode(billPayData);

                FeeLookup(billPayData);

                if (DataErrorHandler.CheckForNestedErrors(billPayData).Any())
                {
                    return(billPayData);
                }
                // Initial Validate
                _validationOperations.BillPayValidate(billPayData, billPayData.BillPayRequest.Biller, billPayData.BillPayRequest.ThirdPartyType, staging: true);
                // Final Validate(s)
                _validationOperations.BillPayValidateUntilReadyForCommit(billPayData, billPayData.BillPayRequest.Biller, true, billPayData.BillPayRequest.ThirdPartyType);

                CompleteStaged(billPayData);
            }
            catch (AgentConnectException acExp)
            {
                billPayData.Errors.Add(new BusinessError
                {
                    ErrorCategory = "AC Exception",
                    ErrorCode     = acExp.ErrorCode.ToString(),
                    Message       = acExp.Message
                });
            }
            return(billPayData);
        }
Пример #4
0
        public BillPayData ConsumerHistoryLookupForExistingCustomer(BillPayData billPayData)
        {
            billPayData.Set(ConsumerHistoryLookupRequestFactory.ConsumerHistoryLookupRequestExisting);
            billPayData.ConsumerHistoryLookupRequest.MgiSessionType = SessionType.BP;
            billPayData.Set(_acIntegration.ConsumerHistoryLookup(billPayData.BillPayRequest.AgentId, billPayData.BillPayRequest.AgentPos, true));

            return(billPayData);
        }
Пример #5
0
        public BillPayData SingleValidate(BillPayData billPayData)
        {
            BillerSearchByCode(billPayData);

            FeeLookup(billPayData);

            InitialValidation(billPayData);

            return(billPayData);
        }
Пример #6
0
        public BillPayData ConsumerHistoryLookupForNonExistingCustomer(BillPayData billPayData)
        {
            var consumerHistoryLookupRequest = ConsumerHistoryLookupRequestFactory.ConsumerHistoryLookupRequestNonExisting;

            consumerHistoryLookupRequest.AgentID       = billPayData.BillPayRequest.AgentId;
            consumerHistoryLookupRequest.AgentSequence = billPayData.BillPayRequest.AgentPos;
            billPayData.Set(consumerHistoryLookupRequest);
            billPayData.ConsumerHistoryLookupRequest.MgiSessionType = SessionType.BP;
            billPayData.Set(_acIntegration.ConsumerHistoryLookup(billPayData.ConsumerHistoryLookupRequest));

            return(billPayData);
        }
Пример #7
0
        private BillPayData FeeLookup(BillPayData billPayData)
        {
            var selectedBiller = billPayData.BillerSearchResponse.Payload.BillerInfo.First();
            var feeLookupReq   = BillPayFeeLookupRequestFactory.FeeLookupForEp(selectedBiller.ReceiveCode, selectedBiller.ReceiveAgentID, billPayData.BillPayRequest.AmtRange, billPayData.BillPayRequest.Amount);

            feeLookupReq.AgentID       = billPayData.BillPayRequest.AgentId;
            feeLookupReq.AgentSequence = billPayData.BillPayRequest.AgentPos;
            billPayData.FeeLookup.Set(feeLookupReq);
            billPayData.FeeLookup.Set(_acIntegration.FeeLookup(billPayData.FeeLookup.FeeLookupReq));

            return(billPayData);
        }
Пример #8
0
        private BillPayData CompleteStaged(BillPayData billPayData)
        {
            var mgiSessionId           = billPayData.BillPayValidationResponseList.Last().Payload.MgiSessionID;
            var completeSessionRequest = CompleteSessionRequestFactory.CompleteBillPayRequest(mgiSessionId);

            completeSessionRequest.AgentID       = billPayData.BillPayRequest.AgentId;
            completeSessionRequest.AgentSequence = billPayData.BillPayRequest.AgentPos;
            completeSessionRequest.Commit        = false;
            var completeSessionResponse = _acIntegration.CompleteSession(completeSessionRequest);

            billPayData.Set(completeSessionRequest);
            billPayData.Set(completeSessionResponse);

            return(billPayData);
        }
Пример #9
0
        public void BillPay_ConsumerHistoryLookup_ConsumerDoesNotExist()
        {
            var request = new BillPayOperationRequest
            {
                AgentState     = AgentLocation.MN,
                ThirdPartyType = TestThirdPartyType.None
            };

            request.PopulateAgentData(request.AgentState);

            var billPayData = new BillPayData(request);

            _billPayOperations.ConsumerHistoryLookupForNonExistingCustomer(billPayData);

            Assert.IsNull(billPayData.ConsumerHistoryLookupResponse.Payload.SenderInfos);
        }
Пример #10
0
        public void BillPay_BillerSearchByReceiveCode()
        {
            var request = new BillPayOperationRequest
            {
                AgentState     = AgentLocation.MN,
                Biller         = Billers.Ford,
                ThirdPartyType = TestThirdPartyType.None
            };

            request.PopulateAgentData(request.AgentState);

            var billPayData = new BillPayData(request);

            _billPayOperations.BillerSearchByCode(billPayData);

            Assert.IsTrue(billPayData.BillerSearchResponse.Payload.BillerInfo.Any());
        }
Пример #11
0
        [Ignore] //test dependent on AC and currently failing
        public void TrainingMode_BillPay_CompleteRequest()
        {
            var request = new BillPayOperationRequest
            {
                AgentState = AgentLocation.MN,
                Biller = Billers.HubbardAttorney,
                AmtRange = AmountRange.NoIdsNoThirdParty,
                ThirdPartyType = TestThirdPartyType.None
            };
            request.PopulateAgentData(request.AgentState, true);
            var billPayData = new BillPayData(request);
            _billPayOperations.CompleteSession(billPayData);

            var completeSessionResponse = billPayData.CompleteSessionResponse;

            Assert.IsFalse(string.IsNullOrEmpty(completeSessionResponse.Payload.ReferenceNumber));
        }
Пример #12
0
        public void BillPay_FeeLookup()
        {
            var request = new BillPayOperationRequest
            {
                AgentState     = AgentLocation.MN,
                Biller         = Billers.HubbardAttorney,
                AmtRange       = AmountRange.NoIdsNoThirdParty,
                ThirdPartyType = TestThirdPartyType.None
            };

            request.PopulateAgentData(request.AgentState);

            var billPayData = new BillPayData(request);

            _billPayOperations.FeeLookupForReceiveCode(billPayData);

            Assert.IsTrue(billPayData.FeeLookup.FeeLookupResp.Payload.FeeInfos.Any());
        }
Пример #13
0
        public void BillPay_ValidateShouldReturnFieldsToCollectWithNoIdsOrThirdParty()
        {
            var request = new BillPayOperationRequest
            {
                AgentState     = AgentLocation.MN,
                Biller         = Billers.HubbardAttorney,
                AmtRange       = AmountRange.NoIdsNoThirdParty,
                ThirdPartyType = TestThirdPartyType.None
            };

            request.PopulateAgentData(request.AgentState);
            var billPayData = new BillPayData(request);

            _billPayOperations.SingleValidate(billPayData);

            var validationResponse = billPayData.BillPayValidationResponseList.First();

            Assert.IsTrue(validationResponse.Payload.FieldsToCollect.Any());
        }
Пример #14
0
        public void BillPay_ValidationUntilReadyForCommit()
        {
            var request = new BillPayOperationRequest
            {
                AgentState     = AgentLocation.MN,
                Biller         = Billers.HubbardAttorney,
                AmtRange       = AmountRange.NoIdsNoThirdParty,
                ThirdPartyType = TestThirdPartyType.None
            };

            request.PopulateAgentData(request.AgentState);
            var billPayData = new BillPayData(request);

            _billPayOperations.ValidateUntilReadyForCommit(billPayData);

            var validationResponse = billPayData.BillPayValidationResponseList.Last();

            Assert.IsTrue(validationResponse.Payload.ReadyForCommit);
        }
Пример #15
0
        private BillPayData InitialValidation(BillPayData billPayData)
        {
            var feeInfo    = billPayData.FeeLookup.FeeLookupResp.Payload.FeeInfos.FirstOrDefault();
            var billerInfo = billPayData.BillerSearchResponse.Payload.BillerInfo.FirstOrDefault();

            var validationRequest = BillPayValidationRequestFactory.InitialValidationForEp(feeInfo, billerInfo);

            if (billPayData.BillPayRequest.Staging)
            {
                validationRequest.TransactionStaging = true;
            }
            validationRequest.AgentID       = billPayData.BillPayRequest.AgentId;
            validationRequest.AgentSequence = billPayData.BillPayRequest.AgentPos;
            var validationResponse = _acIntegration.BPValidation(validationRequest);

            billPayData.Set(validationRequest);
            billPayData.Set(validationResponse);

            return(billPayData);
        }
Пример #16
0
        public void StagingBillPay_TwoId()
        {
            var request = new BillPayOperationRequest
            {
                AgentState     = AgentLocation.MN,
                Biller         = Billers.HubbardAttorney,
                AmtRange       = AmountRange.TwoIds,
                ThirdPartyType = TestThirdPartyType.None
            };

            request.PopulateAgentData(request.AgentState);
            var billPayData = new BillPayData(request);

            _billPayOperations.CompleteStagedSession(billPayData);

            var completeSessionResponse = billPayData.CompleteSessionResponse;

            Assert.IsFalse(billPayData.BillPayValidationResponseList.First().Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{billPayData.BillPayValidationResponseList.First().Errors?.Log()}");
            Assert.IsFalse(completeSessionResponse.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{completeSessionResponse.Errors?.Log()}");
        }
Пример #17
0
        public void BillPay_ValidateShouldReturnFieldsToCollectWithThirdPartyType()
        {
            var request = new BillPayOperationRequest
            {
                AgentState     = AgentLocation.MN,
                Biller         = Billers.HubbardAttorney,
                AmtRange       = AmountRange.ThirdParty,
                ThirdPartyType = TestThirdPartyType.None
            };

            request.PopulateAgentData(request.AgentState);
            var billPayData = new BillPayData(request);

            _billPayOperations.SingleValidate(billPayData);

            var validationResponse = billPayData.BillPayValidationResponseList.First();

            var containsThirdPartyCategory = ContainsCategory(validationResponse.Payload.FieldsToCollect,
                                                              "billPayTPSenderInformationSet");

            Assert.IsTrue(containsThirdPartyCategory, "Ensure that profile editor limits for bill pay are configured properly in the current environment");
        }
Пример #18
0
        public BillPayData CompleteSession(BillPayData billPayData)
        {
            try
            {
                BillerSearchByCode(billPayData);

                FeeLookup(billPayData);

                if (DataErrorHandler.CheckForNestedErrors(billPayData).Any())
                {
                    return(billPayData);
                }
                // Initial Validate
                _validationOperations.BillPayValidate(billPayData, billPayData.BillPayRequest.Biller, billPayData.BillPayRequest.ThirdPartyType);
                // Final Validate(s)
                _validationOperations.BillPayValidateUntilReadyForCommit(billPayData, billPayData.BillPayRequest.Biller, billPayData.BillPayRequest.ThirdPartyType);

                var mgiSessionId           = billPayData.BillPayValidationResponseList.Last().Payload.MgiSessionID;
                var completeSessionRequest = CompleteSessionRequestFactory.CompleteBillPayRequest(mgiSessionId);
                completeSessionRequest.AgentID       = billPayData.BillPayRequest.AgentId;
                completeSessionRequest.AgentSequence = billPayData.BillPayRequest.AgentPos;
                var completeSessionResponse = _acIntegration.CompleteSession(completeSessionRequest);

                billPayData.Set(completeSessionRequest);
                billPayData.Set(completeSessionResponse);
            }
            catch (AgentConnectException acExp)
            {
                billPayData.Errors.Add(new BusinessError
                {
                    ErrorCategory = "AC Exception",
                    ErrorCode     = acExp.ErrorCode.ToString(),
                    Message       = acExp.Message
                });
            }
            return(billPayData);
        }
Пример #19
0
        public BillPayData FeeLookupForReceiveCode(BillPayData billPayData)
        {
            BillerSearchByCode(billPayData);

            return(FeeLookup(billPayData));
        }
Пример #20
0
        public BillPayData FeeLookupForBillerName(BillPayData billPayData)
        {
            BillerSearchByName(billPayData);

            return(FeeLookup(billPayData));
        }