public string ValidateNlIdentity(CreateOrderBuilder order)
        {
            string errors = "";

            //Individual
            if (!order.GetIsCompanyIdentity())
            {
                if (order.GetIndividualCustomer().GetInitials() == null)
                {
                    errors +=
                        "MISSING VALUE - Initials is required for individual customers when countrycode is NL. Use SetInitials().\n";
                }
                if (order.GetIndividualCustomer().GetBirthDate() == null)
                {
                    errors +=
                        "MISSING VALUE - Birth date is required for individual customers when countrycode is NL. Use SetBirthDate().\n";
                }
                if (order.GetIndividualCustomer().GetFirstName() == null ||
                    order.GetIndividualCustomer().GetLastName() == null)
                {
                    errors +=
                        "MISSING VALUE - Name is required for individual customers when countrycode is NL. Use SetName().\n";
                }
            }

            //Company
            if (order.GetIsCompanyIdentity())
            {
                if (order.GetCompanyCustomer().GetVatNumber() == null)
                {
                    errors +=
                        "MISSING VALUE - Vat number is required for company customers when countrycode is NL. Use SetVatNumber().\n";
                }
                if (order.GetCompanyCustomer().GetCompanyName() == null)
                {
                    errors +=
                        "MISSING VALUE - Company name is required for individual customers when countrycode is NL. Use SetName().\n";
                }
            }

            //Individual and Company
            if (order.GetCustomerIdentity().Street == null || order.GetCustomerIdentity().HouseNumber == null)
            {
                errors +=
                    "MISSING VALUE - Street address and house number is required for all customers when countrycode is NL. Use SetStreetAddress().\n";
            }
            if (order.GetCustomerIdentity().Locality == null)
            {
                errors +=
                    "MISSING VALUE - Locality is required for all customers when countrycode is NL. Use SetLocality().\n";
            }
            if (order.GetCustomerIdentity().ZipCode == null)
            {
                errors +=
                    "MISSING VALUE - Zip code is required for all customers when countrycode is NL. Use SetZipCode().\n";
            }

            return(errors);
        }
        public string ValidateNlIdentity(CreateOrderBuilder order)
        {
            string errors = "";
            //Individual
            if (!order.GetIsCompanyIdentity())
            {
                if (order.GetIndividualCustomer().GetInitials() == null)
                {
                    errors +=
                        "MISSING VALUE - Initials is required for individual customers when countrycode is NL. Use SetInitials().\n";
                }
                if (order.GetIndividualCustomer().GetBirthDate() == null)
                {
                    errors +=
                        "MISSING VALUE - Birth date is required for individual customers when countrycode is NL. Use SetBirthDate().\n";
                }
                if (order.GetIndividualCustomer().GetFirstName() == null ||
                    order.GetIndividualCustomer().GetLastName() == null)
                {
                    errors +=
                        "MISSING VALUE - Name is required for individual customers when countrycode is NL. Use SetName().\n";
                }
            }

            //Company
            if (order.GetIsCompanyIdentity())
            {
                if (order.GetCompanyCustomer().GetVatNumber() == null)
                {
                    errors +=
                        "MISSING VALUE - Vat number is required for company customers when countrycode is NL. Use SetVatNumber().\n";
                }
                if (order.GetCompanyCustomer().GetCompanyName() == null)
                {
                    errors +=
                        "MISSING VALUE - Company name is required for individual customers when countrycode is NL. Use SetName().\n";
                }
            }

            //Individual and Company
            if (order.GetCustomerIdentity().Street == null || order.GetCustomerIdentity().HouseNumber == null)
            {
                errors +=
                    "MISSING VALUE - Street address and house number is required for all customers when countrycode is NL. Use SetStreetAddress().\n";
            }
            if (order.GetCustomerIdentity().Locality == null)
            {
                errors +=
                    "MISSING VALUE - Locality is required for all customers when countrycode is NL. Use SetLocality().\n";
            }
            if (order.GetCustomerIdentity().ZipCode == null)
            {
                errors +=
                    "MISSING VALUE - Zip code is required for all customers when countrycode is NL. Use SetZipCode().\n";
            }

            return errors;
        }
        public string ValidateNordicIdentity(CreateOrderBuilder order)
        {
            //check Company identity
            if (order.GetCustomerIdentity().NationalIdNumber == null)
            {
                return(order.GetIsCompanyIdentity()
                           ? "MISSING VALUE - Organisation number is required for company customers when countrycode is SE, NO, DK or FI. Use SetNationalIdNumber(...).\n"
                           : "MISSING VALUE - National number(ssn) is required for individual customers when countrycode is SE, NO, DK or FI. Use SetNationalIdNumber(...).\n");
            }

            return("");
        }
Esempio n. 4
0
        private static string ValidatePeppolId(CreateOrderBuilder order)
        {
            string validation = ValidatePeppolIdString(order.GetPeppolId());

            if (validation != "")
            {
                return(validation);
            }

            if (order.GetIsCompanyIdentity() == false)
            {
                return("NOT VALID - CustomerType must be a company when using PeppolId.");
            }

            return("");
        }
Esempio n. 5
0
        private void SerializeCustomer(CreateOrderBuilder order, XmlWriter xmlw)
        {
            if (order.GetCustomerIdentity() == null)
            {
                return;
            }

            CustomerIdentity        customer;
            Action <string, string> doWriteSimple = (name, value) => WriteSimpleElement(name, value, xmlw);

            if (order.GetIsCompanyIdentity())
            {
                customer = order.GetCompanyCustomer();
            }
            else
            {
                customer = order.GetIndividualCustomer();
            }

            xmlw.WriteStartElement("customer");

            if (customer.NationalIdNumber != null) //nordic country individual customer type
            {
                doWriteSimple("ssn", customer.NationalIdNumber);
            }
            else if (!order.GetIsCompanyIdentity()) //euro country individual
            {
                doWriteSimple("ssn", customer.IndividualIdentity.BirthDate);
            }
            else if (order.GetIsCompanyIdentity() && order.GetCountryCode() != CountryCode.SE)
            //euro country, Company customer and nationalId not set
            {
                doWriteSimple("ssn", customer.CompanyIdentity.CompanyVatNumber);
            }

            //Individual customer
            if (!order.GetIsCompanyIdentity())
            {
                var individualIdentity = customer.IndividualIdentity;
                if (individualIdentity != null)
                {
                    doWriteSimple("firstname", individualIdentity.FirstName);
                    doWriteSimple("lastname", individualIdentity.LastName);
                    doWriteSimple("initials", individualIdentity.Initials);
                }
            }
            else //Company customer
            {
                doWriteSimple("firstname", customer.FullName);
            }

            //Address
            doWriteSimple("phone", customer.PhoneNumber);
            doWriteSimple("email", customer.Email);
            doWriteSimple("address", customer.Street);
            doWriteSimple("housenumber", customer.HouseNumber);
            doWriteSimple("address2", customer.CoAddress);
            doWriteSimple("zip", customer.ZipCode);
            doWriteSimple("city", customer.Locality);

            if (order.GetCountryCode() != CountryCode.NONE)
            {
                doWriteSimple("country", order.GetCountryCode().ToString().ToUpper());
            }

            xmlw.WriteEndElement();

            doWriteSimple("ipaddress",
                          order.GetIsCompanyIdentity()
                              ? order.GetCompanyCustomer().GetIpAddress()
                              : order.GetIndividualCustomer().GetIpAddress());
        }
        private void SerializeCustomer(CreateOrderBuilder order, XmlWriter xmlw)
        {
            if (order.GetCustomerIdentity() == null)
            {
                return;
            }

            CustomerIdentity customer;
            Action<string, string> doWriteSimple = (name, value) => WriteSimpleElement(name, value, xmlw);

            if (order.GetIsCompanyIdentity())
            {
                customer = order.GetCompanyCustomer();
            }
            else
            {
                customer = order.GetIndividualCustomer();
            }

            xmlw.WriteStartElement("customer");

            if (customer.NationalIdNumber != null) //nordic country individual customer type
            {
                doWriteSimple("ssn", customer.NationalIdNumber);
            }
            else if (!order.GetIsCompanyIdentity()) //euro country individual
            {
                doWriteSimple("ssn", customer.IndividualIdentity.BirthDate);
            }
            else if (order.GetIsCompanyIdentity() && order.GetCountryCode() != CountryCode.SE)
                //euro country, Company customer and nationalId not set
            {
                doWriteSimple("ssn", customer.CompanyIdentity.CompanyVatNumber);
            }

            //Individual customer
            if (!order.GetIsCompanyIdentity())
            {
                var individualIdentity = customer.IndividualIdentity;
                if (individualIdentity != null)
                {
                    doWriteSimple("firstname", individualIdentity.FirstName);
                    doWriteSimple("lastname", individualIdentity.LastName);
                    doWriteSimple("initials", individualIdentity.Initials);
                }
            }
            else //Company customer
            {
                doWriteSimple("firstname", customer.FullName);
            }

            //Address
            doWriteSimple("phone", customer.PhoneNumber);
            doWriteSimple("email", customer.Email);
            doWriteSimple("address", customer.Street);
            doWriteSimple("housenumber", customer.HouseNumber);
            doWriteSimple("address2", customer.CoAddress);
            doWriteSimple("zip", customer.ZipCode);
            doWriteSimple("city", customer.Locality);

            if (order.GetCountryCode() != CountryCode.NONE)
            {
                doWriteSimple("country", order.GetCountryCode().ToString().ToUpper());
            }

            xmlw.WriteEndElement();

            doWriteSimple("ipaddress",
                          order.GetIsCompanyIdentity()
                              ? order.GetCompanyCustomer().GetIpAddress()
                              : order.GetIndividualCustomer().GetIpAddress());
        }
        public string ValidateNordicIdentity(CreateOrderBuilder order)
        {
            //check Company identity
            if (order.GetCustomerIdentity().NationalIdNumber == null)
            {
                return order.GetIsCompanyIdentity()
                           ? "MISSING VALUE - Organisation number is required for company customers when countrycode is SE, NO, DK or FI. Use SetNationalIdNumber(...).\n"
                           : "MISSING VALUE - National number(ssn) is required for individual customers when countrycode is SE, NO, DK or FI. Use SetNationalIdNumber(...).\n";
            }

            return "";
        }