Exemplo n.º 1
0
        public override BaseResult AddCard(LmsPerson lmsPerson, out string cardNumber)
        {
            var result = AddCardBehavior.AddCard(lmsPerson);

            cardNumber = AddCardBehavior.MessageResponse?.CardNumber;

            return(result);
        }
Exemplo n.º 2
0
        public void AddCard_GivenAPersonThatHasAnAccountInCCM_ShouldBeAbleToCreateAPlasticCard()
        {
            // ARRANGE
            var applicant = GetApplicant();
            var lmsPerson = new LmsPerson()
            {
                Applicant = applicant
            };

            var credentials = new Credentials()
            {
                BaseUrl  = "https://some.bank.or.cu/api",
                Username = "******",
                Password = "******",
                Facility = "validFacility"
            };

            var credentialsHeader = GetCredentialsHeader(credentials);

            var messageXml = _card.Message?.SerializeToXmlString();

            messageXml = HostValueTranslator.UpdateRequestWithHostValues(
                messageXml,
                applicant.HostValues.Where(hv => hv.Field1.StartsWith("AddCard.")).ToList(),
                _card.Message?.HostValueParentNode
                );

            var processMessageNodeRequest = new ProcessMessageNodeRequest()
            {
                CredentialsHeader = credentialsHeader,
                request           = GetXmlNode(messageXml)
            };

            var stubServiceRepo = Substitute.For <ISoapRepository>();

            stubServiceRepo.GetProcessMessageNodeRequest(credentialsHeader, messageXml).Returns(processMessageNodeRequest);

            _messageResponse = GetMessageResponseSuccess();

            stubServiceRepo.AddCard(_card, _app, lmsPerson).Returns(_messageResponse);

            var stubLmsRepo = Substitute.For <ILmsRepository>();

            var mockBehavior = new AddCardBehavior(_app, _userToken, stubServiceRepo, stubLmsRepo);

            mockBehavior.Card = _card;

            // ACT
            var result     = mockBehavior.AddCard(lmsPerson);
            var cardNumber = mockBehavior.MessageResponse?.CardNumber;

            // ASSERT
            Assert.AreEqual(0, result.Messages.Count(m => m.Type == MessageType.Error));
            Assert.IsTrue(result.Result);
            Assert.AreEqual("Success", mockBehavior.MessageResponse.ResponseCode);
            Assert.AreEqual("4398790000000001", cardNumber);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Makes a call to create cards for the Primary
        /// </summary>
        /// <param name="person"></param>
        /// <param name="cardNumber"></param>
        /// <returns></returns>
        public virtual BaseResult AddCard(LmsPerson lmsPerson, out string cardNumber)
        {
            cardNumber = string.Empty;

            return(AddCardBehavior.AddCard(lmsPerson));
        }