summaryrefslogtreecommitdiff
path: root/DesignPatterns/src/app/DesignPatterns.State/IdleState.cs
blob: 52b2bc6ea8522c7e98213ff78015a556aef7e038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;

namespace DesignPatterns.State {
	public class IdleState : IState {
		public IdleState( IPosTerminal terminal ) {
			_terminal = terminal;

			Console.Out.WriteLine( "Mo's POS TERMINAL" );
			Console.Out.WriteLine( "Please swipe a card:" );
		}

		public void SwipeCard( string cardNumber ) {
			_terminal.Transaction = new PosTransaction( );
			_terminal.Transaction.Date = DateTime.Now;
			_terminal.Transaction.CardNumber = cardNumber;
			_terminal.CurrentState = new CardSwipedState( _terminal );
		}

		public void EnterAmount( double amount ) {
			Console.Out.WriteLine( "Please swipe a card first." );
		}

		public void EnterPin( string pin ) {
			Console.Out.WriteLine( "Please swipe a card first." );
		}

		public void ProcessTransaction( ) {
			Console.Out.WriteLine( "Please swipe a card first." );
		}

		public void PrintReceipt( ) {
			Console.Out.WriteLine( "Please swipe a card first." );
		}

		private IPosTerminal _terminal;
	}
}