diff options
Diffstat (limited to 'DesignPatterns/src/app/DesignPatterns.State/PinEnteredState.cs')
| -rw-r--r-- | DesignPatterns/src/app/DesignPatterns.State/PinEnteredState.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/DesignPatterns/src/app/DesignPatterns.State/PinEnteredState.cs b/DesignPatterns/src/app/DesignPatterns.State/PinEnteredState.cs new file mode 100644 index 0000000..809186a --- /dev/null +++ b/DesignPatterns/src/app/DesignPatterns.State/PinEnteredState.cs @@ -0,0 +1,31 @@ +using System;
+
+namespace DesignPatterns.State {
+ public class PinEnteredState : IState {
+ public PinEnteredState( IPosTerminal terminal ) {
+ _terminal = terminal;
+ }
+
+ public void SwipeCard( string cardNumber ) {
+ Console.Out.WriteLine( "You've already swiped a card." );
+ }
+
+ public void EnterAmount( double amount ) {
+ Console.Out.WriteLine( "You've already entered an amount." );
+ }
+
+ public void EnterPin( string pin ) {
+ Console.Out.WriteLine( "You've already entered a pin." );
+ }
+
+ public void ProcessTransaction( ) {
+ _terminal.CurrentState = new ProcessingTransactionState( _terminal );
+ }
+
+ public void PrintReceipt( ) {
+ Console.Out.WriteLine( "The transaction needs to be authorized first" );
+ }
+
+ private IPosTerminal _terminal;
+ }
+}
\ No newline at end of file |
