[Webfunds-commits] java/webfunds/sox PaymentFactory.java

Ian Grigg iang@cypherpunks.ai
Sun, 18 Mar 2001 19:18:31 -0400 (AST)


iang        01/03/18 19:18:30

  Modified:    webfunds/sox PaymentFactory.java
  Log:
  added example(), currently returns Token example or Payment example.

Revision  Changes    Path
1.9       +20 -2     java/webfunds/sox/PaymentFactory.java

Index: PaymentFactory.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/PaymentFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PaymentFactory.java	2000/12/18 04:21:18	1.8
+++ PaymentFactory.java	2001/03/18 23:18:30	1.9
@@ -1,6 +1,6 @@
-/* $Id: PaymentFactory.java,v 1.8 2000/12/18 04:21:18 iang Exp $
+/* $Id: PaymentFactory.java,v 1.9 2001/03/18 23:18:30 iang Exp $
  *
- * Copyright (c) Systemics Inc. 1995-2000 on behalf of
+ * Copyright (c) 1995-2001 Systemics Inc. on behalf of
  * The WebFunds Development Team. All Rights Reserved.
  */
 package webfunds.sox;
@@ -73,6 +73,24 @@
 //            e.printStackTrace();
 //            throw new SOXException("Payment Decode Error");
 //        }
+    }
+
+    public static AbstractPayment example()
+    {
+        
+        int sv = Utils.exampleByte() & 0x7F;
+        sv = 1 + (sv % 2);          // 1,2
+
+        if (sv == SOX_CHEQUE)
+            return Payment.example();
+        else if (sv == RANDOM_TOKEN)
+            return TokenPayment.example();
+        /*
+        else if (sv == WAGNER_TOKEN)
+            return TokenPayment.example();
+        */
+
+        throw new RuntimeException("Example did not catch " + sv);
     }
 
     /**