Beispiel #1
0
        public Transaction To()
        {
            var descr = new TransactionDescription();

            foreach (var kv in Description)
            {
                descr.Add(kv.Key, kv.Value);
            }

            var metadata = new TransactionMetadata();

            foreach (var kv in Metadata)
            {
                metadata.Add(kv.Key, kv.Value);
            }

            var am = AmountFactory.New(AmountValue, AmountCurrency);
            ITransactionAmount amount = AmountType switch
            {
                _completedIncome => new AmountIncomeCompleted(am),
                _cancelledOutcome => new AmountOutcomeCancelled(am),
                _processingOutcome => new AmountOutcomeProcessing(am),
                _completedOutcome => new AmountOutcomeCompleted(am),
                _ => throw new InvalidOperationException("Invalid transaction status")
            };

            return(new Transaction(
                       new AccountId(new UniqId(AccountId)),
                       new TransactionId(new UniqId(Id)),
                       new TransactionLabel(Label),
                       amount,
                       metadata,
                       descr,
                       CreatedOn,
                       UpdateOn
                       ));
        }
        public CreateTransaction To()
        {
            Console.WriteLine("My Value {0} {1} {2}", CreateAmountValue, CreateAmountCurrency, CreateAmountType);
            var          am           = AmountFactory.New(CreateAmountValue, CreateAmountCurrency);
            CreateAmount createAmount = CreateAmountType switch
            {
                _processingOutcome => new CreateAmountProcessingOutcome(am),
                _completedIncome => new CreateAmountCompletedIncome(am),
                _ => throw new InvalidOperationException("Invalid create transaction status")
            };

            var descr = new TransactionDescription();

            foreach (var kv in Description)
            {
                descr.Add(kv.Key, kv.Value);
            }

            var metadata = new TransactionMetadata();

            foreach (var kv in Metadata)
            {
                metadata.Add(kv.Key, kv.Value);
            }

            return(new CreateTransaction(
                       new AccountId(new UniqId(AccountId)),
                       new TransactionId(new UniqId(Id)),
                       new TransactionLabel(Label),
                       createAmount,
                       Signature,
                       descr,
                       metadata
                       ));
        }
    }
        public UpdateTransaction To()
        {
            var descr = new TransactionDescription();

            foreach (var kv in Description)
            {
                descr.Add(kv.Key, kv.Value);
            }

            var metadata = new TransactionMetadata();

            foreach (var kv in Metadata)
            {
                metadata.Add(kv.Key, kv.Value);
            }

            return(new UpdateTransaction(
                       new TransactionId(new UniqId(Id)),
                       Status == StatusCompleted ? UpdateStatus.Complete : UpdateStatus.Cancel,
                       Signature,
                       descr,
                       metadata
                       ));
        }