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(); }
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)); } }
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(); } }
internal static ReturnValue Sent(SendingStep step, IMessage message) { return new ReturnValue(step, message, null); }
internal static ReturnValue ProtectiveMarkCalculated(SendingStep step, IMessage message) { return new ReturnValue(step, message, null); }
internal static ReturnValue Error(SendingStep step, IMessage msg, string errorMsg) { return new ReturnValue(step, msg, errorMsg); }
internal static ReturnValue Error(SendingStep step, IMessage msg, string errorMsg) { return(new ReturnValue(step, msg, errorMsg)); }
internal static ReturnValue Sent(SendingStep step, IMessage message) { return(new ReturnValue(step, message, null)); }
internal static ReturnValue ProtectiveMarkCalculated(SendingStep step, IMessage message) { return(new ReturnValue(step, message, null)); }