Exemple #1
0
        private ReturnValue(SendingStep step, IMessage message, string errorMessage)
        {
            this.Step = step;

              if (message == null)
              {
            this.Success = false;
            this.ErrorMessage = errorMessage;
            this.MessageType = MessageType.Unknown;
            this.ErrorMessageSource = ErrorMessageSource.System;
            return;
              }

              this.MessageType = message.MessageType;
              this.originalMessage = message.Message;
              this.MessageSendToFurs = (step >= SendingStep.SoapEnvelopeGenerated) ? message.MessageSendToFurs : null;
              this.MessageReceivedFromFurs = (step >= SendingStep.MessageSend) ? message.MessageReceivedFromFurs : null;

              if (!string.IsNullOrEmpty(errorMessage))
              {
            this.Success = false;
            this.ErrorMessage = errorMessage;
            this.ErrorMessageSource = ErrorMessageSource.System;
            return;
              }

              this.Success = true;
              this.ErrorMessage = this.ProtectedID = this.UniqueInvoiceID = string.Empty;

              // only calculation is special case
              if (message.MessageAction == MessageAction.Calculate)
            this.processCalculate(message);
              else
            this.processSend();
        }
Exemple #2
0
        private ReturnValue execute(IMessage msg, bool send)
        {
            SendingStep step = SendingStep.MessageReceived;

            try
            {
                msg.Check();
                step = SendingStep.MessageChecked;

                if (msg.MessageAction == MessageAction.Calculate)
                {
                    return(ReturnValue.ProtectiveMarkCalculated(step, msg));
                }

                msg.SurroundWithSoap();
                step = SendingStep.SoapEnvelopeGenerated;

                msg.Sign();
                step = SendingStep.MessageSigned;

                msg.Validate();
                step = SendingStep.MessageValidated;

                msg.SendToFURS();
                step = SendingStep.MessageSend;

                return(ReturnValue.Sent(step, msg));
            }
            catch (System.Exception ex)
            {
                return(ReturnValue.Error(step, msg, ex.Message));
            }
        }
Exemple #3
0
        private ReturnValue(SendingStep step, IMessage message, string errorMessage)
        {
            this.Step = step;

            if (message == null)
            {
                this.Success            = false;
                this.ErrorMessage       = errorMessage;
                this.MessageType        = MessageType.Unknown;
                this.ErrorMessageSource = ErrorMessageSource.System;
                return;
            }

            this.MessageType             = message.MessageType;
            this.originalMessage         = message.Message;
            this.MessageSendToFurs       = (step >= SendingStep.SoapEnvelopeGenerated) ? message.MessageSendToFurs : null;
            this.MessageReceivedFromFurs = (step >= SendingStep.MessageSend) ? message.MessageReceivedFromFurs : null;

            if (!string.IsNullOrEmpty(errorMessage))
            {
                // Even in case of an error, we can still calculate ZOI and Barcode
                this.processCalculate(message);

                this.Success            = false;
                this.ErrorMessage       = errorMessage;
                this.ErrorMessageSource = ErrorMessageSource.System;
                return;
            }

            this.Success      = true;
            this.ErrorMessage = this.ProtectedID = this.UniqueInvoiceID = string.Empty;

            // only calculation is special case
            if (message.MessageAction == MessageAction.Calculate)
            {
                this.processCalculate(message);
            }
            else
            {
                this.processSend();
            }
        }
Exemple #4
0
 internal static ReturnValue Sent(SendingStep step, IMessage message)
 {
     return new ReturnValue(step, message, null);
 }
Exemple #5
0
 internal static ReturnValue ProtectiveMarkCalculated(SendingStep step, IMessage message)
 {
     return new ReturnValue(step, message, null);
 }
Exemple #6
0
 internal static ReturnValue Error(SendingStep step, IMessage msg, string errorMsg)
 {
     return new ReturnValue(step, msg, errorMsg);
 }
Exemple #7
0
 internal static ReturnValue Error(SendingStep step, IMessage msg, string errorMsg)
 {
     return(new ReturnValue(step, msg, errorMsg));
 }
Exemple #8
0
 internal static ReturnValue Sent(SendingStep step, IMessage message)
 {
     return(new ReturnValue(step, message, null));
 }
Exemple #9
0
 internal static ReturnValue ProtectiveMarkCalculated(SendingStep step, IMessage message)
 {
     return(new ReturnValue(step, message, null));
 }