void Book(MakeTransfer transfer) => accounts.Get(transfer.DebitedAccountId) .Bind(account => account.Debit(transfer.Amount)) .ForEach(newState => { accounts.Save(transfer.DebitedAccountId, newState); swift.Wire(transfer, newState); });
MakeTransfer Normalize(MakeTransfer request) => request; // remove whitespace, toUpper, etc.
public void MakeTransfer(MakeTransfer transfer) => Some(transfer) .Map(Normalize) .Where(validator.IsValid) .ForEach(Book);