Example #1
0
        /// <summary>
        /// Maps from a domain model representation to a XML representation of an AS4 receipt.
        /// </summary>
        /// <param name="model">The domain model to convert.</param>
        internal static Xml.SignalMessage Convert(Receipt model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            return(new Xml.SignalMessage
            {
                MessageInfo = new MessageInfo
                {
                    MessageId = model.MessageId,
                    RefToMessageId = model.RefToMessageId,
                    Timestamp = model.Timestamp.LocalDateTime
                },
                Receipt = new Xml.Receipt
                {
                    UserMessage =
                        model.UserMessage != null
                            ? UserMessageMap.Convert(model.UserMessage)
                            : null,
                    NonRepudiationInformation =
                        model.NonRepudiationInformation != null
                            ? MapNonRepudiationInformation(model.NonRepudiationInformation)
                            : null
                }
            });
        }
Example #2
0
        private static Maybe <UserMessage> GetUserMessageFromXml(Xml.Receipt r)
        {
            if (r.UserMessage == null)
            {
                return(Maybe.Nothing <UserMessage>());
            }

            return(Maybe.Just(UserMessageMap.Convert(r.UserMessage)));
        }