Exemple #1
0
        private void AssertTermination(TerminationMessage response, TerminationMessage request)
        {
            Assert.NotNull(response);

            Assert.Equal(request.Comment, response.Comment);

            Assert.Equal(request.Message.SessionId, response.Message.SessionId);
            Assert.Equal(request.MessageType, response.MessageType);
            Assert.Equal(request.Message.MessageCode, response.Message.MessageCode);
            Assert.Equal(request.Message.MessageId, response.Message.MessageId);

            AssertPlaceOfBirth(request.VASP.PlaceOfBirth, response.VASP.PlaceOfBirth);

            Assert.Equal(request.VASP.BIC, response.VASP.BIC);
            Assert.Equal(request.VASP.Name, response.VASP.Name);
            Assert.Equal(request.VASP.VaspPublickKey, response.VASP.VaspPublickKey);
            Assert.Equal(request.VASP.VaspIdentity, response.VASP.VaspIdentity);

            Assert.Equal(request.VASP.PostalAddress.StreetName, response.VASP.PostalAddress.StreetName);
            Assert.Equal(request.VASP.PostalAddress.AddressLine, response.VASP.PostalAddress.AddressLine);
            Assert.Equal(request.VASP.PostalAddress.BuildingNumber, response.VASP.PostalAddress.BuildingNumber);
            Assert.Equal(request.VASP.PostalAddress.Country, response.VASP.PostalAddress.Country);
            Assert.Equal(request.VASP.PostalAddress.PostCode, response.VASP.PostalAddress.PostCode);

            Assert.Equal(request.VASP.JuridicalPersonIds.Count(), response.VASP.JuridicalPersonIds.Count());

            AssertJuridicalPersonIds(request.VASP.JuridicalPersonIds, response.VASP.JuridicalPersonIds);

            Assert.Equal(request.VASP.NaturalPersonIds.Count(), response.VASP.NaturalPersonIds.Count());

            AssertNaturalPersonIds(request.VASP.NaturalPersonIds, response.VASP.NaturalPersonIds);
        }
        public static ProtoTerminationMessage MapToProto(TerminationMessage message)
        {
            var proto = new ProtoTerminationMessage()
            {
                Comment  = message.Comment,
                Message  = Mapper.MapMessageToProto(message.MessageType, message.Message),
                VaspInfo = Mapper.MapVaspInformationToProto(message.VASP)
            };

            return(proto);
        }
        public static TerminationMessage MapFromProto(ProtoTerminationMessage message)
        {
            var messageIn = new Message(
                message.Message.MessageId,
                message.Message.SessionId,
                message.Message.MessageCode);
            var vasp = Mapper.MapVaspInformationFromProto(message.VaspInfo);

            var obj = new TerminationMessage(messageIn, vasp)
            {
                Comment = message.Comment,
            };

            return(obj);
        }
        protected virtual async Task TerminateStrategyAsync(TerminationMessage.TerminationMessageCode terminationMessageCode)
        {
            var terminationMessage = new TerminationMessage(
                this.SessionId,
                terminationMessageCode,
                _vaspInfo);

            await _transportClient.SendAsync(new MessageEnvelope()
            {
                Topic          = this.CounterPartyTopic,
                SigningKey     = _privateSigningKey,
                EncryptionType = EncryptionType.Symmetric,
                EncryptionKey  = _sharedSymKeyId
            }, terminationMessage);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (msgCase_ == MsgOneofCase.SessionRequestMessage)
            {
                hash ^= SessionRequestMessage.GetHashCode();
            }
            if (msgCase_ == MsgOneofCase.SessionReplyMessage)
            {
                hash ^= SessionReplyMessage.GetHashCode();
            }
            if (msgCase_ == MsgOneofCase.TransferRequestMessage)
            {
                hash ^= TransferRequestMessage.GetHashCode();
            }
            if (msgCase_ == MsgOneofCase.TransferReplyMessage)
            {
                hash ^= TransferReplyMessage.GetHashCode();
            }
            if (msgCase_ == MsgOneofCase.TransferDispatchMessage)
            {
                hash ^= TransferDispatchMessage.GetHashCode();
            }
            if (msgCase_ == MsgOneofCase.TransaferConfirmationMessage)
            {
                hash ^= TransaferConfirmationMessage.GetHashCode();
            }
            if (msgCase_ == MsgOneofCase.TerminationMessage)
            {
                hash ^= TerminationMessage.GetHashCode();
            }
            if (msgCase_ == MsgOneofCase.ReservedField)
            {
                hash ^= ReservedField.GetHashCode();
            }
            if (Signature.Length != 0)
            {
                hash ^= Signature.GetHashCode();
            }
            hash ^= (int)msgCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #6
0
        private static TerminationMessage GetTerminationMessage()
        {
            //Should be a contract
            var vaspKey = EthECKey.GenerateKey();

            var message = new Message(
                Guid.NewGuid().ToByteArray().ToHex(prefix: false),
                Guid.NewGuid().ToByteArray().ToHex(prefix: false),
                "1");
            var postalAddress = new PostalAddress(
                "TestingStreet",
                61,
                "Test Address Line",
                "410000",
                "TownN",
                Country.List["DE"]
                );
            var placeOfBirth    = new PlaceOfBirth(DateTime.UtcNow, "TownN", Country.List["DE"]);
            var vaspInformation = new VaspInformation(
                "Test test",
                vaspKey.GetPublicAddress(),
                vaspKey.GetPubKey().ToHex(prefix: false),
                postalAddress,
                placeOfBirth,
                new NaturalPersonId[]
            {
                new NaturalPersonId("SomeId2", NaturalIdentificationType.AlienRegistrationNumber,
                                    Country.List["DE"]),
            },
                new JuridicalPersonId[]
            {
                new JuridicalPersonId("SomeId1", JuridicalIdentificationType.BankPartyIdentification,
                                      Country.List["DE"]),
            },
                "DEUTDEFF");

            var request = new TerminationMessage(message, vaspInformation)
            {
                Comment = "This is test message",
            };

            return(request);
        }
        public void MergeFrom(ProtoMessageWrapper other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Signature.Length != 0)
            {
                Signature = other.Signature;
            }
            switch (other.MsgCase)
            {
            case MsgOneofCase.SessionRequestMessage:
                if (SessionRequestMessage == null)
                {
                    SessionRequestMessage = new global::OpenVASP.ProtocolMessages.Messages.ProtoSessionRequestMessage();
                }
                SessionRequestMessage.MergeFrom(other.SessionRequestMessage);
                break;

            case MsgOneofCase.SessionReplyMessage:
                if (SessionReplyMessage == null)
                {
                    SessionReplyMessage = new global::OpenVASP.ProtocolMessages.Messages.ProtoSessionReplyMessage();
                }
                SessionReplyMessage.MergeFrom(other.SessionReplyMessage);
                break;

            case MsgOneofCase.TransferRequestMessage:
                if (TransferRequestMessage == null)
                {
                    TransferRequestMessage = new global::OpenVASP.ProtocolMessages.Messages.ProtoTransferRequestMessage();
                }
                TransferRequestMessage.MergeFrom(other.TransferRequestMessage);
                break;

            case MsgOneofCase.TransferReplyMessage:
                if (TransferReplyMessage == null)
                {
                    TransferReplyMessage = new global::OpenVASP.ProtocolMessages.Messages.ProtoTransferReplyMessage();
                }
                TransferReplyMessage.MergeFrom(other.TransferReplyMessage);
                break;

            case MsgOneofCase.TransferDispatchMessage:
                if (TransferDispatchMessage == null)
                {
                    TransferDispatchMessage = new global::OpenVASP.ProtocolMessages.Messages.ProtoTransferDispatchMessage();
                }
                TransferDispatchMessage.MergeFrom(other.TransferDispatchMessage);
                break;

            case MsgOneofCase.TransaferConfirmationMessage:
                if (TransaferConfirmationMessage == null)
                {
                    TransaferConfirmationMessage = new global::OpenVASP.ProtocolMessages.Messages.ProtoTransferConfirmationMessage();
                }
                TransaferConfirmationMessage.MergeFrom(other.TransaferConfirmationMessage);
                break;

            case MsgOneofCase.TerminationMessage:
                if (TerminationMessage == null)
                {
                    TerminationMessage = new global::OpenVASP.ProtocolMessages.Messages.ProtoTerminationMessage();
                }
                TerminationMessage.MergeFrom(other.TerminationMessage);
                break;

            case MsgOneofCase.ReservedField:
                ReservedField = other.ReservedField;
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }