internal CreateTransaction(AccountId accId, TransactionId id, TransactionLabel label, CreateAmount amount, string signature, TransactionDescription?description = null, TransactionMetadata?metadata = null) { AccountId = accId; Id = id; Label = label; Amount = amount; Metadata = metadata ?? new TransactionMetadata();; Description = description ?? new TransactionDescription(); Signature = signature; }
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 )); } }
private ITransactionAmount CreateToTransactionAmount(CreateAmount amount) => amount switch {