Exemplo n.º 1
0
 static string FormatCode(TransactionModel transaction, long? bankOperationId)
 {
     const string pattern = "TRAN_{0}";
     var prefix = bankOperationId != null ? "OP_" : string.Empty;
     var code = string.Format(prefix + pattern, transaction.Code).ToUpperInvariant();
     return code;
 }
Exemplo n.º 2
0
 static string FormatDescription(TransactionModel transaction, long? bankOperationId)
 {
     const string operationalPattern = "Transaction #{0}({1})[OP-{2}] is in progress.";
     const string pattern = "Transaction #{0}({1}) was changed.";
     var description = bankOperationId == null
         ? string.Format(pattern, transaction.Id, transaction.Description)
         : string.Format(operationalPattern, transaction.Id, transaction.Description, bankOperationId);
     return description;
 }
Exemplo n.º 3
0
        public TransactionProgressEvent(Guid operationId, TransactionModel transaction, long? bankOperationId = null)
        {
            Argument.NotNull(transaction, "transaction");
            Argument.Satisfies(operationId, x => x != Guid.Empty);
            OperationId = operationId;
            TransactionId = transaction.Id;
            BankOperationId = bankOperationId;

            Data = JsonConvert.SerializeObject(transaction);
            Code = FormatCode(transaction, bankOperationId);
            Description = FormatDescription(transaction, bankOperationId);
        }
 public TransactionProcessingResult(TransactionModel transaction, IEnumerable <IEvent> transactionalEvents) : base(transactionalEvents)
 {
     Argument.NotNull(transaction, "transaction");
     _transaction = transaction;
 }
Exemplo n.º 5
0
 public TransactionProcessingResult(TransactionModel transaction, IEnumerable<IEvent> transactionalEvents)
     : base(transactionalEvents)
 {
     Argument.NotNull(transaction, "transaction");
     _transaction = transaction;
 }
Exemplo n.º 6
0
 static string FormatDescription(TransactionModel transaction, long? bankOperationId)
 {
     const string operationalPattern = "Transaction #{0}({1})[OP-{2}] is {3}.";
     const string pattern = "Transaction #{0}({1}) is {2}.";
     var status = transaction.Status == ProcessStatusModel.Failed ? "failed" : "completed";
     var description = bankOperationId == null
         ? string.Format(pattern, transaction.Id, transaction.Description, status)
         : string.Format(operationalPattern, transaction.Id, transaction.Description, bankOperationId, status);
     return description;
 }