Ejemplo n.º 1
0
        public void V2_34_00_Request_Ordering_Test1()
        {
            // Arrange
            var builder = TXLife_Type.CreateBuilder()
                .Version("2.34.00")
                .AddTXLifeRequest(new TXLifeRequest_Type { id = "3" })
                .AddUserAuthRequest(new UserAuthRequest_Type())
                .AddTXLifeRequest(new TXLifeRequest_Type { id = "1" })
                .AddTXLifeRequest(new TXLifeRequest_Type { id = "2" })
                .AddOLifEExtension(new OLifEExtension_Type() { VendorCode = "a" });

            var txLife = builder.Build();

            // Act
            string xmlString;
            txLife.Serialize(out xmlString);

            // Assert
            var authRequestIndex = xmlString.IndexOf("<UserAuthRequest>");
            var id3Index = xmlString.IndexOf("id=\"3\"");
            var id1Index = xmlString.IndexOf("id=\"1\"");
            var id2Index = xmlString.IndexOf("id=\"2\"");
            var oLifeIndex = xmlString.IndexOf("VendorCode=\"a\"");

            // Ensures the user auth appears first
            Assert.True(authRequestIndex < id3Index);

            // Ensures order is preserved of the requests
            Assert.True(id3Index < id1Index);
            Assert.True(id1Index < id2Index);

            // Ensures olife is present
            Assert.Contains("VendorCode=\"a\"", xmlString);
        }
Ejemplo n.º 2
0
        //private TXLifeBuilder(TXLife_Type baseEntity) : base(baseEntity) { }

        protected override void ValidateBaseObject(TXLife_Type baseEntity)
        {
            if (baseEntity.ShouldSerializeItems())
            {
                throw new ArgumentException("The TXLife_Type.Items collection should be empty. This builder will help handle the ACORD spec logic with setting this property.", "baseEntity");
            }
        }
Ejemplo n.º 3
0
        public void V2_35_00_Request_LoginName_Ordering_Test2()
        {
            // Arrange
            var builder1 = UserAuthRequest_Type.CreateBuilder()
                           .UserPswd(new UserPswd_Type {
                CryptType = "asdf"
            })
                           .UserLoginName("testname")
                           .UserDomain("workspace");

            var builder = TXLife_Type.CreateBuilder()
                          .Version("2.35.00")
                          .AddUserAuthRequest(builder1.Build());

            var txLife = builder.Build();

            // Act
            string xmlString;

            txLife.Serialize(out xmlString);

            // Assert
            var authRequestIndex = xmlString.IndexOf("<UserAuthRequest>");
            var loginIndex       = xmlString.IndexOf("<UserLoginName>testname</UserLoginName>");
            var pswdIndex        = xmlString.IndexOf("<UserPswd>");

            // Ensures the user login appears first
            Assert.True(loginIndex < pswdIndex);
        }
        public void V2_36_00_Request_LoginName_Ordering_Test1()
        {
            // Arrange
            var builder1 = UserAuthRequest_Type.CreateBuilder()
                           .UserAuthentication(new UserAuthentication_Type {
                id = "512"
            })
                           .UserLoginName("testname")
                           .UserDomain("workspace");

            var builder = TXLife_Type.CreateBuilder()
                          .Version("2.38.00")
                          .AddUserAuthRequest(builder1.Build());

            var txLife = builder.Build();

            // Act
            string xmlString;

            txLife.Serialize(out xmlString);

            // Assert
            var authRequestIndex = xmlString.IndexOf("<UserAuthRequest>");
            var loginIndex       = xmlString.IndexOf("<UserLoginName>testname</UserLoginName>");
            var authIndex        = xmlString.IndexOf("<UserAuthentication id=\"512\" />");

            // Ensures the user login appears first
            Assert.True(loginIndex < authIndex);
        }
Ejemplo n.º 5
0
        public void V2_38_00_UserAuthRequest_Builder_Test1()
        {
            // Arrange
            var builder = TXLife_Type.CreateBuilder()
                          .AddTXLifeRequest(new TXLifeRequest_Type {
                id = "1"
            })
                          .AddUserAuthRequest(UserAuthRequest_Type.CreateBuilder()
                                              .UserAuthentication(new UserAuthentication_Type()
            {
                id = "testauth"
            })
                                              .UserLoginName("john"))
                          .Version("2.38.00")
                          .AddOLifEExtension(new OLifEExtension_Type()
            {
                VendorCode = "a"
            });

            var txLife = builder.Build();

            // Act
            string xmlString;

            txLife.Serialize(out xmlString);

            // Assert
            Assert.Contains("<UserAuthentication id=\"testauth\" />", xmlString);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// The full receive method takes in a string txlife file, runs client conversion on it, based on the
        /// auth in the file and attempts to convert it from the fules located in the ConverterRules.xml file.  The object can
        /// then can be shipped off to another location for persistence.  Finally, a TXLifeResponse is returned.  This
        /// method is meant to be hooked up to a web controller, or other, wherein a string is received and a response is
        /// sent out.  Validation on the TXLife is not performed in here as, when receiving from many clients, one might
        /// need to convert a file into a properly validating file.
        /// </summary>
        /// <param name="txLifeRequest">A string of the TXLifeRequest file.</param>
        /// <returns>A string representation of the TXLifeResponse</returns>
        public string Receive(string txLifeRequest)
        {
            //clear out our existing errors.
            this.internalErrors.Clear();
            this.publicErrors.Clear();

            //process the conversion from the clientrules xml file.
            txLifeRequest = ProcessClientConverion(txLifeRequest);

            //setup our deserialization.
            TXLife_Type txr = null;

            try
            {
                //Create our txlife object from the incoming string.
                txr = TXLife_Type.NewFromString(txLifeRequest);
            }
            catch (Exception ex)
            {
                internalErrors.Add($"Error Reading TXLifeRequest Conversion Failed, the error was, \"{ex.Message}\".");
                publicErrors.Add($"Could not read the TXLife file.");
            }

            //setup the response object for sending back out.
            TXLife_Type         response = new TXLife_Type();
            TXLifeResponse_Type txrr     = new TXLifeResponse_Type();

            response.Items              = new object[] { txrr };
            txrr.TransRefGUID           = System.Guid.NewGuid().ToString();
            txrr.TransExeDate           = System.DateTime.Now;
            txrr.TransExeTime           = System.DateTime.Now;
            txrr.TransResult            = new TransResult_Type();
            txrr.TransResult.ResultCode = new RESULT_CODES();

            if (publicErrors.Count == 0)
            {
                txrr.TransResult.ResultCode.tc    = "1";
                txrr.TransResult.ResultCode.Value = "Success";
            }
            else
            {
                txrr.TransResult.ResultCode.tc    = "5";
                txrr.TransResult.ResultCode.Value = "Failure";

                //Log out the public errors.  We are hard coding the errors here at a severe, cannot be overridden.
                //There is a possibility to add in severity here.
                foreach (string ss in publicErrors)
                {
                    txrr.TransResult.ResultInfo = new ResultInfo_Type[] { new ResultInfo_Type {
                                                                              ResultInfoDesc = ss, ResultInfoSeverity = new OLI_LU_MSGSEVERITY {
                                                                                  tc = "5", Value = "The message is severe and cannot be overridden."
                                                                              }
                                                                          } };
                }
            }

            //return the TXLife Response
            return(response.ToString());
        }
Ejemplo n.º 7
0
        public override TXLife_Type Build(TXLife_Type baseEntity)
        {
            var resultEntity = base.Build(baseEntity);

            BuildItemsProperty(resultEntity);

            return(resultEntity);
        }
Ejemplo n.º 8
0
        public void ReceptionTest()
        {
            //Test to run through the complete reception method.
            string ss = System.IO.File.ReadAllText("Sample_121_Request.xml");

            Acord60Mins.IncomingRequest irr = new Acord60Mins.IncomingRequest();
            string output = irr.Receive(ss);

            TXLife_Type response = TXLife_Type.NewFromString(output);
        }
Ejemplo n.º 9
0
        public string Process(string txLife)
        {
            TXLife_Type txr = TXLife_Type.NewFromString(txLife);

            foreach (TXLifeRequest_Type txrr in txr.Items.Where(t => t.GetType() == typeof(TXLifeRequest_Type)))
            {
                txrr.TransTrackingID = "I Converted!";
            }

            return(txr.ToString());
        }
Ejemplo n.º 10
0
 private void BuildItemsProperty(TXLife_Type entity)
 {
     foreach (var type in _xmlSequenceOrder)
     {
         var currentNode = _buildActions[type].First;
         while (currentNode != null)
         {
             currentNode.Value(entity);
             currentNode = currentNode.Next;
         }
     }
 }
Ejemplo n.º 11
0
        internal static IEnumerable<string> AdvisorData(TXLife_Type response, Party_Type party)
        {
            List<string> errors = new List<string>();

            if (string.IsNullOrWhiteSpace(party.PartyTypeCode.tc)) { errors.Add("advisor partyTypeCode tc"); }
            if (party.Item == null) { errors.Add("advisor item"); }
            else
            {
                if (party.Item.GetType() != typeof(Person_Type)) { errors.Add("advisor item type"); return errors; }
                var person = party.Item as Person_Type;
                if (string.IsNullOrWhiteSpace(person.FirstName)) errors.Add("advisor firstname");
                if (string.IsNullOrWhiteSpace(person.LastName)) errors.Add("advisor lastname");
            }
            errors.AddRange(Email(party.EMailAddress, "Advisor"));

            return errors;
        }
Ejemplo n.º 12
0
        public void Create121()
        {
            //simple test to see if we can create and output a TXLife.

            TXLife_Type        txl = new TXLife_Type();
            TXLifeRequest_Type txr = new TXLifeRequest_Type();

            txl.Items = new TXLifeRequest_Type[] { txr };
            OLI_LU_TRANS_TYPE_CODES transCode = new OLI_LU_TRANS_TYPE_CODES();

            txr.TransType       = new OLI_LU_TRANS_TYPE_CODES();
            txr.TransType.tc    = "121";
            txr.TransType.Value = "General Requirement Order Request";

            string ss = txl.ToString();

            TXLife_Type final = TXLife_Type.NewFromString(ss);
        }
Ejemplo n.º 13
0
        public async Task RequestUpdatedContractors()
        {
            var client = new CITSService.CITSServiceClient();
            client.ClientCredentials.UserName.UserName = CLIENT_USERNAME;
            client.ClientCredentials.UserName.Password = CLIENT_PASSWORD;

            var requestMessage = new TXLife_Type()
            {
                Version = "2.35.00",
                Items = new object[] {
                    new TXLifeRequest_Type() {
                        TransRefGUID = Guid.NewGuid().ToString(),
                        StartDate = DateTime.Now.Date.AddDays(-6),
                        StartDateSpecified = true,
                        EndDate = DateTime.Now.Date.AddDays(1),
                        EndDateSpecified = true,
                        TransType = new OLI_LU_TRANS_TYPE_CODES() { tc = "228", Value = "Producer Inquiry" },
                        InquiryView = new InquiryView_Type() { InquiryViewCode = "ChangedProducerListing" },
                        TransExeDate = DateTime.Now.Date,
                        TransExeDateSpecified = true,
                        TransExeTime = new DateTime(DateTime.Now.TimeOfDay.Ticks),
                        TransExeTimeSpecified = true
                    }
                },
            };

            var responseMessage = await client.ProcessMessageAsync(new ProcessMessageRequest(requestMessage));

            // Feed errors
            var errorList = Validate.GetFeedErrors(responseMessage.TXLife);
            if (errorList.Count > 0)
            {
                Assert.Fail(Validate.DumpErrors(errorList));
            }

            /* Serialize */
            CITSHelper.SerializeMessage(requestMessage);
            CITSHelper.SerializeMessage(responseMessage);
        }
Ejemplo n.º 14
0
        internal static IEnumerable<string> Shareholder(TXLife_Type response, Party_Type party)
        {
            List<string> errors = new List<string>();

            if (LUObjNotValid(party.PartyTypeCode)) { errors.Add("Shareholder partyTypeCode"); }
            if (party.Item == null || !(party.Item is Person_Type)) { errors.Add("Shareholder item"); }
            if (string.IsNullOrWhiteSpace(party.FullName)) { errors.Add("Shareholder FullName"); }

            errors.AddRange(Email(party.EMailAddress, "Shareholder"));
            errors.AddRange(Relation(response.Items.OfType<Relation_Type>().Where(p => p.RelatedObjectID == party.id).FirstOrDefault(), "Shareholder"));

            return errors;
        }
Ejemplo n.º 15
0
        internal static IEnumerable<string> Appointments(TXLife_Type response, Party_Type contractor)
        {
            List<string> errors = new List<string>();
            foreach (var app in contractor.Producer.CarrierAppointment)
            {
                if (string.IsNullOrWhiteSpace(app.id)) { errors.Add("Appointment id"); }
                if (string.IsNullOrWhiteSpace(app.PartyID)) { errors.Add("Appointment PartyID"); }
                if (LUObjNotValid(app.CarrierApptStatus)) { errors.Add("Appointment CarrierApptStatus"); }
                if (string.IsNullOrWhiteSpace(app.CompanyProducerID)) { errors.Add("Appointment CompanyProducerID"); }
                foreach (var govId in app.GovtIDInfo)
                {
                    if (LUObjNotValid(govId)) { errors.Add("Appointment GovtIDInfo"); }
                }
                foreach (var assocInfo in app.AssocCarrierApptInfo)
                {
                    if (string.IsNullOrWhiteSpace(assocInfo.CompanyProducerID)) { errors.Add("Appointment CompanyProducerID"); }
                    if (LUObjNotValid(assocInfo.CarrierApptStatus)) { errors.Add("Appointment CarrierApptStatus"); }
                    if (string.IsNullOrWhiteSpace(assocInfo.CarrierAppointmentID)) { errors.Add("Appointment CarrierAppointmentID"); }
                    if (string.IsNullOrWhiteSpace(assocInfo.PartyID)) { errors.Add("Appointment PartyID"); }
                }

                // Referral
                foreach (var referral in app.ReferralInfo)
                {
                    if (!referral.PartyID.StartsWith("REF")) { errors.Add("Appointment referral PartyID"); }
                    var responseReferral = response.Items.OfType<Party_Type>().Where(p => p.id == referral.PartyID).FirstOrDefault();
                    if (responseReferral == null) { errors.Add("Appointment referral lifeItem"); }
                    else
                    {
                        if (LUObjNotValid(responseReferral.PartyTypeCode)) { errors.Add("Appointment referral PartyTypeCode"); }
                        if (responseReferral.Item == null || !(responseReferral.Item is Person_Type)) { errors.Add("Appointment referral Item"); }
                        if (string.IsNullOrWhiteSpace(responseReferral.FullName)) { errors.Add("Appointment referral FullName"); }
                    }
                }

                // Payment
                foreach (var distrib in app.DistributionAgreementInfo)
                {
                    if (distrib.BankingInfoID != null)
                    {
                        var holding = response.Items.OfType<Holding_Type>().Where(p => p.id == distrib.BankingInfoID).FirstOrDefault();
                        if (holding == null) { errors.Add("Appointment payment holding"); }
                        else
                        {
                            if (holding.Banking == null) { errors.Add("Appointment payment holding banking"); }
                            else
                            {
                                if (string.IsNullOrWhiteSpace(holding.Banking.AccountNumber)) { errors.Add("Appointment payment holding banking AccountNumber"); }
                                if (string.IsNullOrWhiteSpace(holding.Banking.TransitNumber)) { errors.Add("Appointment payment holding banking TransitNumber"); }
                                if (string.IsNullOrWhiteSpace(holding.Banking.InstitutionNumber)) { errors.Add("Appointment payment holding banking InstitutionNumber"); }
                            }
                            if (holding.Attachment == null) { errors.Add("Appointment payment holding Attachment"); }
                            else
                            {
                                foreach (var attachment in holding.Attachment)
                                {
                                    errors.AddRange(Attachment(attachment, "Appointment payment holding banking"));
                                }
                            }
                        }
                    }
                    if (distrib.CheckMailingID != null)
                    {
                        var address = response.Items.OfType<Address_Type>().Where(p => p.id == distrib.CheckMailingID).FirstOrDefault();
                        if (address == null) { errors.Add("Appointment payment address"); }
                        else { errors.AddRange(Address(address, "Appointment payment")); }
                    }
                    if (LUObjNotValid(distrib.PaymentForm)) { errors.Add("Appointment PaymentForm"); }
                }

                // Hierarchy
                foreach (var distribLevel in app.DistributionLevel)
                {
                    if (string.IsNullOrWhiteSpace(distribLevel.PartyID)) { errors.Add("Appointment hierarchy partyId"); }
                    if (string.IsNullOrWhiteSpace(distribLevel.DistributionLevelValue)) { errors.Add("Appointment hierarchy DistributionLevelValue"); }
                }

                // Consolidations
                foreach (var consolidation in app.ConsolidationInfo)
                {
                    if (string.IsNullOrWhiteSpace(consolidation.CarrierAppointmentID)) { errors.Add("Appointment consolidation CarrierAppointmentID"); }
                }

                // Transfers
                foreach (var transfer in app.TransferInfo)
                {
                    if (string.IsNullOrWhiteSpace(transfer.CarrierAppointmentID)) { errors.Add("Appointment transfer CarrierAppointmentID"); }
                }

                // Debts
                foreach (var debt in app.DebtInfo)
                {
                    errors.AddRange(Debt(response, response.Items.OfType<Holding_Type>().Where(p => p.id == debt.HoldingID).FirstOrDefault(), "Appointment"));
                }

                // Requirements
                var initialReq = response.Items.OfType<RequirementInfo_Type>().Where(p => p.ReqCode.tc == "936").FirstOrDefault();
                if (initialReq == null) { errors.Add("Appointment Requirements Initial Business"); }

                foreach (var req in app.RequirementInfo)
                {
                    if (string.IsNullOrWhiteSpace(req.FulfillerPartyID)) { errors.Add("Appointent Requirements FulfillerPartyID"); }
                    if (req.Attachment == null) { errors.Add("Appointment Requirements Attachment"); }
                    foreach (var attachment in req.Attachment)
                    {
                        errors.AddRange(Attachment(attachment, "Appointment Requirements"));

                        foreach (var signature in attachment.SignatureInfo)
                        {
                            if (string.IsNullOrWhiteSpace(signature.DelegatedSignerPartyID)) { errors.Add("Appointent Requirements attachment DelegatedSignerPartyID"); }
                            var signer = response.Items.OfType<Party_Type>().Where(p => p.id == signature.DelegatedSignerPartyID).FirstOrDefault();
                            if (signer == null) { errors.Add("Appointent Requirements attachment signer"); }
                            else
                            {
                                if (string.IsNullOrWhiteSpace(signer.id)) { errors.Add("Appointent Requirements attachment signer id"); }
                                if (string.IsNullOrWhiteSpace(signer.FullName)) { errors.Add("Appointent Requirements attachment signer FullName"); }
                                errors.AddRange(Email(signer.EMailAddress, "Appointment Requirements attachment signer"));
                                if (LUObjNotValid(signer.PartyTypeCode)) { errors.Add("Appointent Requirements attachment signer PartyTypeCode"); }
                                if (signer.Item == null) { errors.Add("Appointent Requirements attachment signer Item"); }
                            }
                        }
                    }
                }

                // CustomQuestions
                var formInstance = response.Items.OfType<FormInstance_Type>().Where(p => p.RelatedObjectID == app.id).FirstOrDefault();
                if (formInstance == null) { errors.Add("Appointent CustomQuestions formInstance"); }
                if (string.IsNullOrWhiteSpace(formInstance.id)) { errors.Add("Appointent CustomQuestions formInstance id"); }
                if (LUObjNotValid(formInstance.RelatedObjectType)) { errors.Add("Appointent CustomQuestions formInstance RelatedObjectType"); }
                if (formInstance.FormResponse == null) { errors.Add("Appointent CustomQuestions formInstance FormResponse"); }
                foreach (var formResponse in formInstance.FormResponse)
                {
                    if (string.IsNullOrWhiteSpace(formResponse.QuestionNumber)) { errors.Add("Appointent CustomQuestions formInstance FormResponse QuestionNumber"); }
                    if (string.IsNullOrWhiteSpace(formResponse.ResponseText)) { errors.Add("Appointent CustomQuestions formInstance FormResponse QuestionNumber"); }
                }
            }

            return errors;
        }
Ejemplo n.º 16
0
        internal static IEnumerable<string> OrganizationData(TXLife_Type response, Party_Type party)
        {
            List<string> errors = new List<string>();

            if (string.IsNullOrWhiteSpace(party.PartyTypeCode.tc)) { errors.Add("organization partyTypeCode tc"); }
            if (party.Item == null) { errors.Add("organization item"); }
            else
            {
                if (party.Item.GetType() != typeof(Organization_Type)) { errors.Add("organization item type"); return errors; }
                var org = party.Item as Organization_Type;
                if (string.IsNullOrWhiteSpace(party.FullName)) { errors.Add("organization fullname"); }
                if (string.IsNullOrWhiteSpace(party.id)) { errors.Add("organization id"); }
            }

            return errors;
        }
Ejemplo n.º 17
0
        internal static IEnumerable<string> Reference(TXLife_Type response)
        {
            List<string> errors = new List<string>();
            var references = response.Items.OfType<Relation_Type>().Where(p => p.RelationRoleCode.tc == "290");
            foreach (var reference in references)
            {
                var refParty = response.Items.OfType<Party_Type>().Where(p => p.id == reference.RelatedObjectID).FirstOrDefault();
                if (refParty == null) { errors.Add("Contractor reference relatedParty"); }
                else
                {
                    if (string.IsNullOrWhiteSpace(refParty.id)) { errors.Add("Contractor reference party id"); }
                    if (LUObjNotValid(refParty.PartyTypeCode)) { errors.Add("Contractor reference party PartyTypeCode"); }
                    if (refParty.Item == null || !(refParty.Item is Person_Type)) { errors.Add("contractor reference party Item"); }

                    errors.AddRange(Phones(refParty.Phone, "Contractor reference party"));
                    errors.AddRange(Email(refParty.EMailAddress, "Contractor reference party"));
                }

                errors.AddRange(Relation(reference, "Contractor reference"));
            }

            return errors;
        }
Ejemplo n.º 18
0
		public async Task RequestFullById()
		{
			var client = new CITSService.CITSServiceClient();
            client.ClientCredentials.UserName.UserName = CLIENT_USERNAME;
            client.ClientCredentials.UserName.Password = CLIENT_PASSWORD;
            var requestMessage = new TXLife_Type() {
				Version = "2.35.00",
				Items = new object[] {
					new TXLifeRequest_Type() {
                        TransRefGUID = Guid.NewGuid().ToString(),
                        TransType = new OLI_LU_TRANS_TYPE_CODES() { tc = "228", Value = "Producer Inquiry" },
                        InquiryView = new InquiryView_Type() { InquiryViewCode = "FullProducerWithAppointments" },
                        TransExeDate = DateTime.Now.Date,
                        TransExeDateSpecified = true,
                        TransExeTime = new DateTime(DateTime.Now.TimeOfDay.Ticks),
                        TransExeTimeSpecified = true,
                        OLifE = new OLifE_Type() {
                            Items = new object[] {
                                new Party_Type() {
                                    PartyKey = new PERSISTKEY() { Value = "6", Persist = "Session" } // Value must be producer's APEXA ID
                                }
                            }
                        },
                    }
				},
			};
            var responseMessage = await client.ProcessMessageAsync(new ProcessMessageRequest(requestMessage));

            // Feed errors
            var errorList = Validate.GetFeedErrors(responseMessage.TXLife);
            if (errorList.Count > 0)
            {
                Assert.Fail(Validate.DumpErrors(errorList));
            }

			/* Serialize */
			CITSHelper.SerializeMessage(requestMessage);
			CITSHelper.SerializeMessage(responseMessage);
		}
Ejemplo n.º 19
0
        internal static IEnumerable<string> Licence(TXLife_Type response, Party_Type contractor)
        {
            List<string> errors = new List<string>();

            if (contractor.Producer.License != null)
            {
                foreach (var licence in contractor.Producer.License)
                {
                    if (string.IsNullOrWhiteSpace(licence.AgencyAffiliationID)) { errors.Add("contractor licence AgencyAffiliationID"); }
                    else
                    {
                        var sponsor = response.Items.OfType<Party_Type>().FirstOrDefault(p => p.id == licence.AgencyAffiliationID);
                        if (sponsor == null) { errors.Add("contractor licence sponsor"); }
                        else
                        {
                            if (LUObjNotValid(sponsor.PartyTypeCode)) { errors.Add("contractor licence sponsor PartyTypeCode"); }
                            if (!(sponsor.Item is Organization_Type)) { errors.Add("contractor licence sponsor Item"); }
                            if (string.IsNullOrWhiteSpace(sponsor.FullName)) { errors.Add("contractor licence sponsor Item"); }
                        }
                    }
                    if (string.IsNullOrWhiteSpace(licence.LicenseNum)) { errors.Add("contractor licence LicenceNum"); }
                    if (LUObjNotValid(licence.LicenseType)) { errors.Add("contractor licence LicenceType"); }
                    if (LUObjNotValid(licence.LicenseState)) { errors.Add("contractor licence LicenceState"); }
                    if (string.IsNullOrWhiteSpace(licence.LevelDesc)) { errors.Add("contractor licence LevelDesc"); }
                }
            }

            return errors;
        }
Ejemplo n.º 20
0
 internal static IEnumerable<string> Debts(TXLife_Type response, Holding_Type[] debts, string module)
 {
     List<string> errors = new List<string>();
     foreach (var debt in debts)
     {
         errors.AddRange(Debt(response, debt, module));
     }
     return errors;
 }
Ejemplo n.º 21
0
        internal static IEnumerable<string> EOCoverage(TXLife_Type response, Party_Type contractor)
        {
            List<string> errors = new List<string>();
            var coverages = response.Items.OfType<Holding_Type>().Where(p => p.HoldingTypeCode.tc == "40");
            foreach (var coverage in coverages)
            {
                if (string.IsNullOrWhiteSpace(coverage.id)) { errors.Add("contractor coverage id"); }
                if (coverage.Policy == null) { errors.Add("contractor coverage policy"); }
                else
                {
                    if (string.IsNullOrWhiteSpace(coverage.Policy.CarrierPartyID)) { errors.Add("contractor coverage CarrierPartyID"); }
                    if (string.IsNullOrWhiteSpace(coverage.Policy.PolNumber)) { errors.Add("contractor coverage PolNumber"); }
                    if (LUObjNotValid(coverage.Policy.ProductType)) { errors.Add("contractor coverage productType"); }
                    if (coverage.Policy.PolicyValueSpecified && coverage.Policy.PolicyValue == 0) { errors.Add("contractor coverage PolicyValue"); }
                    if (LUObjNotValid(coverage.Policy.PolicyStatus)) { errors.Add("contractor coverage PolicyStatus"); }

                    var coverageHolder = response.Items.OfType<Party_Type>().FirstOrDefault(p => p.id == coverage.Policy.CarrierPartyID);
                    if (coverageHolder == null) { errors.Add("contractor coverage coverageHolder"); }
                    else
                    {
                        if (string.IsNullOrWhiteSpace(coverageHolder.id)) { errors.Add("contractor coverage coverageHolder id"); }
                        if (LUObjNotValid(coverageHolder.PartyTypeCode)) { errors.Add("contractor coverage coverageHolder partyTypeCode"); }
                        if (coverageHolder.Item == null || !(coverageHolder.Item is Organization_Type)) { errors.Add("contractor coverage coverageHolder Item"); }
                        if (string.IsNullOrWhiteSpace(coverageHolder.FullName)) { errors.Add("contractor coverage coverageHolder fullName"); }
                    }
                }

                if (coverage.Attachment == null) { errors.Add("contractor coverage attachment"); }
                else
                {
                    foreach (var attachment in coverage.Attachment)
                    {
                        errors.AddRange(Attachment(attachment, "Contractor coverage"));
                    }
                }

                var coverageInfo = contractor.Producer.EOCoverageInfo.Where(p => p.HoldingID == coverage.id).FirstOrDefault();
                if (coverageInfo == null) { errors.Add("contractor coverage producer coverageInfo"); }
            }

            return errors;
        }
Ejemplo n.º 22
0
        internal static IEnumerable<string> Debt(TXLife_Type response, Holding_Type debt, string module)
        {
            List<string> errors = new List<string>();
            if (string.IsNullOrWhiteSpace(debt.id)) { errors.Add(module + " debt id"); }
            foreach (var loan in debt.Loan)
            {
                if (string.IsNullOrWhiteSpace(loan.FinancialInstitutionPartyID)) { errors.Add(module + " debt loan FinancialInstitutionPartyID"); }
                if (loan.LoanAmtSpecified && loan.LoanAmt == 0) { errors.Add(module + " debt loan LoanAmt"); }
                if (LUObjNotValid(loan.LoanReason)) { errors.Add(module + " debt loan LoanReason"); }
                if (string.IsNullOrWhiteSpace(loan.LoanReasonDesc)) { errors.Add(module + " debt loan LoanReasonDesc"); }
            }

            long debtId;
            if (!long.TryParse(Regex.Match(debt.id, "DEBT([0-9]+)").Groups[1].Value, out debtId)) { errors.Add(module + " debt id"); }
            string debtHolderId = string.Format("DEBTHOLDER{0}", debtId);

            var debtholder = response.Items.OfType<Party_Type>().FirstOrDefault(p => p.id == debtHolderId);
            if (debtholder == null) { errors.Add(module + " debt debtholder"); }
            else
            {
                if (LUObjNotValid(debtholder.PartyTypeCode)) { errors.Add(module + " debt debtholder partyTypeCode"); }
                if (debtholder.Item == null || !(debtholder.Item is Organization_Type)) { errors.Add(module + " debt debtholder Item"); }
                if (string.IsNullOrWhiteSpace(debtholder.FullName)) { errors.Add(module + " debt debtholder fullName"); }

                var relation = response.Items.OfType<Relation_Type>().FirstOrDefault(p => p.OriginatingObjectID == debt.id);
                errors.AddRange(Relation(relation, module + " Debt Debtholder"));
            }
            return errors;
        }
Ejemplo n.º 23
0
        internal static IEnumerable<string> CLHIA(TXLife_Type response, Party_Type contractor)
        {
            List<string> errors = new List<string>();

            long contractorEntityId;
            if (!long.TryParse(Regex.Match(contractor.id, "C([0-9]+)").Groups[1].Value, out contractorEntityId)) { errors.Add("CLHIA contractorEntityId"); }
            else
            {
                if (contractor.Producer != null)
                {
                    if (contractor.Producer.NationApproval == null) { errors.Add("CLHIA producer nationalApproval"); }
                    else
                    {
                        foreach (var approval in contractor.Producer.NationApproval)
                        {
                            if (LUObjNotValid(approval.Nation)) { errors.Add("CLHIA producer nationalApproval"); }
                        }
                    }
                }
            }

            var formInstance = response.Items.OfType<FormInstance_Type>().FirstOrDefault();
            if (formInstance != null)
            {
                if (string.IsNullOrWhiteSpace(formInstance.id)) { errors.Add("CLHIA formInstance id"); }
                if (formInstance.FormResponse == null) { errors.Add("CLHIA formResponse"); }
                else
                {
                    foreach (var formResponse in formInstance.FormResponse)
                    {
                        if (string.IsNullOrWhiteSpace(formResponse.QuestionNumber)) { errors.Add("CLHIA formResponse questionNumber"); }
                        if (string.IsNullOrWhiteSpace(formResponse.ResponseCode)) { errors.Add("CLHIA formResponse ResponseCode"); }
                        if (string.IsNullOrWhiteSpace(formResponse.ResponseText)) { errors.Add("CLHIA formResponse ResponseText"); }
                        if (string.IsNullOrWhiteSpace(formResponse.ResponseData)) { errors.Add("CLHIA formResponse ResponseData"); }
                    }
                }
                var relation = response.Items.OfType<Relation_Type>().FirstOrDefault(p => p.OriginatingObjectID == contractor.id && p.RelatedObjectID == formInstance.id);
                errors.AddRange(Relation(relation, "CLHIA formInstance"));
            }

            return errors;
        }
Ejemplo n.º 24
0
 public void Load121()
 {
     //Simple test to see if we can load and deserialize a known good TXLife file.
     TXLife_Type tt = TXLife_Type.NewFromFile("Sample_121_Request.xml");
 }
Ejemplo n.º 25
0
        public void V2_38_00_Relationship_Test1()
        {
            var builder = TXLife_Type.CreateBuilder()
                          .Version("2.38.00")
                          .AddTXLifeRequest(new TXLifeRequest_Type
            {
                TransRefGUID  = "ACORD_001_Relation_Samples",
                TransType     = OLI_LU_TRANS_TYPE_CODES._1203,
                TransSubType  = TRANS_SUBTYPE_CODES._20300,
                TransExeDate  = DateTime.Parse("2006-09-28"),
                TransExeTime  = DateTime.Parse("12:35:02"),
                TransMode     = TRANS_MODE_CODES.OLI_TRANS_MODE_ORIGINAL,
                InquiryLevel  = INQUIRY_LEVEL_CODES._3,
                TestIndicator = OLI_LU_BOOLEAN.OLI_BOOL_TRUE,
                OLifE         = OLifE_Type
                                .CreateBuilder()
                                .AddHolding(new Holding_Type
                {
                    id = "Holding1",
                    HoldingTypeCode = OLI_LU_HOLDTYPE.OLI_HOLDTYPE_POLICY,
                    HoldingStatus   = OLI_LU_HOLDSTAT.OLI_HOLDSTAT_PROPOSED,
                    Policy          = Policy_Type
                                      .CreateBuilder(new Policy_Type()
                    {
                        CarrierPartyID = "CarrierParty",
                        ProductCode    = "SPTE",
                        CarrierCode    = "12345",
                        PlanName       = "Special Term",
                        PolicyStatus   = OLI_LU_POLSTAT.OLI_POLSTAT_ACTIVE,
                    })
                                      .WithLife(new Life_Type
                    {
                        FaceAmt  = 750000m,
                        Coverage =
                        {
                            new Coverage_Type
                            {
                                id              = "BaseCoverage",
                                PlanName        = "Special Term",
                                IndicatorCode   = OLI_LU_COVINDCODE.OLI_COVIND_BASE,
                                LifeParticipant =
                                {
                                    new LifeParticipant_Type
                                    {
                                        id      = "LifeParticipant1",
                                        PartyID = "PartyA",
                                        LifeParticipantRoleCode = OLI_LU_PARTICROLE.OLI_PARTICROLE_PRIMARY
                                    }
                                }
                            }
                        }
                    })
                                      .Build(),
                })
                                .AddParty(new Party_Type
                {
                    id            = "CarrierParty",
                    PartyTypeCode = OLI_LU_PARTY.OLI_PT_ORG,
                    FullName      = "ACME Life Insurance",
                    Carrier       = new Carrier_Type {
                        CarrierCode = "12345"
                    },
                    Item = new Organization_Type()
                })
                                .AddParty(
                    Party_Type
                    .CreateBuilder(new Party_Type
                {
                    id       = "PartyA",
                    GovtID   = "111111111",
                    GovtIDTC = OLI_LU_GOVTIDTC.OLI_GOVTID_SSN,
                })
                    .WithPerson(new Person_Type
                {
                    FirstName   = "Joseph",
                    LastName    = "Smith",
                    Gender      = OLI_LU_GENDER.OLI_GENDER_MALE,
                    BirthDate   = DateTime.Parse("1954-03-28"),
                    Citizenship = OLI_LU_NATION.OLI_NATION_USA
                })
                    )
                                .AddParty(
                    new Party_Type
                {
                    id            = "PartyB",
                    PartyTypeCode = OLI_LU_PARTY.OLI_PT_PERSON,
                    Item          = new Person_Type
                    {
                        FirstName = "Josephine",
                        LastName  = "Smith",
                        Gender    = OLI_LU_GENDER.OLI_GENDER_FEMALE
                    }
                }
                    )
                                .AddParty(
                    new Party_Type
                {
                    id            = "PartyC",
                    PartyTypeCode = OLI_LU_PARTY.OLI_PT_PERSON,
                    Item          = new Person_Type
                    {
                        FirstName = "Jill",
                        LastName  = "Smith",
                        Gender    = OLI_LU_GENDER.OLI_GENDER_FEMALE
                    }
                }
                    )
                                .BeginRelation("Relation_Estate")
                                .IsA(OLI_LU_REL.OLI_REL_TERTBENE)
                                .For("Holding1")
                                .EndRelation(new Relation_Type {
                    InterestPercent = 100.0d, BeneficiaryDesignation = OLI_LU_BENEDESIGNATION.OLI_BENEDES_ESTATE
                })
                                .BeginRelation("Relation1")
                                .Where("PartyA")
                                .IsA(OLI_LU_REL.OLI_REL_PARENT).WithDescription(OLI_LU_RELDESC.OLI_RELDESC_FATHER)
                                .Of("PartyB")
                                .EndRelation()
                                .BeginRelation("Relation2")
                                .Where("PartyB")
                                .IsA(OLI_LU_REL.OLI_REL_CHILD).WithDescription(OLI_LU_RELDESC.OLI_RELDESC_DAUGHTER)
                                .Of("PartyA")
                                .EndRelation()
                                .BeginRelation("Relation4")
                                .IsA(OLI_LU_REL.OLI_REL_INSURED)
                                .For("Holding1")
                                .EndRelation()
                                .BeginRelation("Relation5")
                                .IsA(OLI_LU_REL.OLI_REL_OWNER)
                                .For("Holding1")
                                .EndRelation()
                                .BeginRelation("Relation6")
                                .IsA(OLI_LU_REL.OLI_REL_BENEFICIARY)
                                .For("Holding1")
                                .EndRelation(new Relation_Type {
                    InterestPercent = 100.0d, BeneficiaryDesignation = OLI_LU_BENEDESIGNATION.OLI_BENEDES_NAMED
                })
                                .BeginRelation("Relation7")
                                .IsA(OLI_LU_REL.OLI_REL_CONTGNTBENE)
                                .For("Holding1")
                                .EndRelation(new Relation_Type {
                    InterestPercent = 100.0d, BeneficiaryDesignation = OLI_LU_BENEDESIGNATION.OLI_BENEDES_NAMED
                })
                                .BeginRelation("Relation8")
                                .Where("PartyC")
                                .IsA(OLI_LU_REL.OLI_REL_SPOUSE).WithDescription(OLI_LU_RELDESC.OLI_RELDESC_WIFE)
                                .Of("PartyA")
                                .EndRelation()
                                .BeginRelation("Relation9")
                                .Where("PartyA")
                                .IsA(OLI_LU_REL.OLI_REL_SPOUSE).WithDescription(OLI_LU_RELDESC.OLI_RELDESC_HUSBAND)
                                .Of("PartyC")
                                .EndRelation()
                                .Build() // End of olife
            });

            // Arrange
            var txLife = builder.Build();

            // Act
            string xmlString;

            txLife.Serialize(out xmlString);

            // Assert
            Assert.DoesNotContain("<HoldingKey", xmlString);
            Assert.Contains("id=\"Relation9\"", xmlString);
        }
Ejemplo n.º 26
0
		public async Task UnauthorizedRequest()
		{
			var client = new CITSService.CITSServiceClient();
			client.ClientCredentials.UserName.UserName = "******";
			client.ClientCredentials.UserName.Password = "******";

			var requestMessage = new TXLife_Type()
			{
				Version = "2.35.00",
				Items = new object[] {
					new TXLifeRequest_Type() {
						TransRefGUID = Guid.NewGuid().ToString(),
						StartDate = DateTime.Now.Date.AddDays(-7),
						StartDateSpecified = true,
						EndDate = DateTime.Now.Date,
						EndDateSpecified = true,
						TransType = new OLI_LU_TRANS_TYPE_CODES() { tc = "228", Value = "Producer Inquiry" },
                        InquiryView = new InquiryView_Type() { InquiryViewCode = "ChangedProducerListing" }
                    }
                },
			};

            try
			{
                var responseMessage = await client.ProcessMessageAsync(new ProcessMessageRequest(requestMessage));
                var result = responseMessage.TXLife;
				Assert.Fail("Should have failed with unauthorized.");
			}
			catch (SecurityAccessDeniedException ex)
			{
				Assert.IsTrue(String.Equals(ex.Message, "Access is denied."));
			}
		}