public TransferEvent(MachineId account, Transfer transfer) : base() { this.Account = account; this.Transfer = transfer; }
void DoTransfer() { var fromAccount = (this.ReceivedEvent as Account.TransferEvent).Account; var transfer = (this.ReceivedEvent as Account.TransferEvent).Transfer; if (this.IsLocked) { this.Send(transfer, new FailureResponse("Destination account is locked.")); return; } if (this.TransferTransaction != null) { this.Send(transfer, new FailureResponse("Transaction cannot be completed at this time.")); return; } this.TransferTransaction = transfer; var wTrans = new Transaction(this.Id, typeof(TransferComplete), new Integer(0), transfer.GetAmount(), transfer.GetPin(), 0, 0.0); this.Send(fromAccount, new Account.WithdrawEvent(wTrans, new Boolean(false))); }
void DoTransferComplete() { var response = (this.ReceivedEvent as Account.TransferComplete).Response; if (response is SuccessResponse) { this.Cents = this.Cents + this.TransferTransaction.GetAmount(); this.Send(this.TransferTransaction, new SuccessResponse("Transfer succeeded!")); } else { this.Send(this.TransferTransaction, new FailureResponse("Withdraw during transfer failed.")); } this.TransferTransaction = null; }
public TransferEvent(Transfer transfer) : base() { this.Transfer = transfer; }