Esempio n. 1
0
        public static ProtoVaspInfo MapVaspInformationToProto(VaspInformation vaspInfo)
        {
            var proto = new ProtoVaspInfo()
            {
                Name          = vaspInfo.Name,
                PlaceOfBirth  = MapPlaceOfBirthToProto(vaspInfo.PlaceOfBirth),
                PostalAddress = MapPostalAddressToProto(vaspInfo.PostalAddress),
                VaspIdentity  = vaspInfo.VaspIdentity,
                VaspPubkey    = vaspInfo.VaspPublickKey,
                Bic           = vaspInfo.BIC ?? ""
            };

            var juridicalPeronsIds = vaspInfo
                                     .JuridicalPersonIds?.Select <JuridicalPersonId, ProtoJuridicalPersonId>(x =>
                                                                                                             MapJuridicalPersonIdToProto(x));

            var naturalPersonsIds =
                vaspInfo.NaturalPersonIds?.Select <NaturalPersonId, ProtoNaturalPersonId>(x =>
                                                                                          MapNaturalPersonIdToProto(x));

            if (juridicalPeronsIds != null)
            {
                proto.JuridicalPersonId.Add(juridicalPeronsIds);
            }

            if (naturalPersonsIds != null)
            {
                proto.NaturalPersonId.Add(naturalPersonsIds);
            }

            return(proto);
        }
Esempio n. 2
0
        public static VaspInformation MapVaspInformationFromProto(ProtoVaspInfo vaspInfo)
        {
            var proto = new VaspInformation(
                vaspInfo.Name,
                vaspInfo.VaspIdentity,
                vaspInfo.VaspPubkey,
                MapPostalAddressFromProto(vaspInfo.PostalAddress),
                MapPlaceOfBirthFromProto(vaspInfo.PlaceOfBirth),
                vaspInfo.NaturalPersonId?.Select <ProtoNaturalPersonId, NaturalPersonId>(x => MapNaturalPersonIdFromProto(x)).ToArray(),
                vaspInfo.JuridicalPersonId?.Select <ProtoJuridicalPersonId, JuridicalPersonId>(x => MapJuridicalPersonIdFromProto(x)).ToArray(),
                string.IsNullOrEmpty(vaspInfo.Bic) ? null : vaspInfo.Bic);

            return(proto);
        }