[Webfunds-commits] java/webfunds/sox Id.java Receipt.java ValueAccount.java

Ian Grigg iang@cypherpunks.ai
Sun, 18 Jun 2000 17:57:18 -0400 (AST)


iang        00/06/18 17:57:18

  Modified:    .        .cvsignore
               sun/security/x509 CertAndKeyGen.java
               webfunds/client ReceiptTableModel.java
               webfunds/client/sox SOXWallet.java
               webfunds/sox Id.java Receipt.java ValueAccount.java
  Log:
  fixed Description display in payments browser;
  added fp() to (all) Id.java so that short id can be printed
  CHANGED makePurePayment() and createPayment() to include additional
  (optional==null?"") argument to set the PID.

Revision  Changes    Path
1.3       +1 -1      java/.cvsignore

Index: .cvsignore
===================================================================
RCS file: /home/webfunds/cvsroot/java/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore	2000/06/04 19:53:14	1.2
+++ .cvsignore	2000/06/18 21:57:16	1.3
@@ -1,3 +1,3 @@
 stderr
 stdout
-user
+user*



1.12      +1 -2      java/sun/security/x509/CertAndKeyGen.java

Index: CertAndKeyGen.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/sun/security/x509/CertAndKeyGen.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- CertAndKeyGen.java	2000/06/10 19:20:34	1.11
+++ CertAndKeyGen.java	2000/06/18 21:57:17	1.12
@@ -1,4 +1,4 @@
-/* $Id: CertAndKeyGen.java,v 1.11 2000/06/10 19:20:34 iang Exp $ */
+/* $Id: CertAndKeyGen.java,v 1.12 2000/06/18 21:57:17 iang Exp $ */
 
 package sun.security.x509;
 
@@ -224,7 +224,6 @@
         }
         catch(Exception e)
         {
-            e = null; // jikes
             e.printStackTrace();
             throw new CertException(8, " getSignedCert");
         }



1.13      +2 -2      java/webfunds/client/ReceiptTableModel.java

Index: ReceiptTableModel.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/ReceiptTableModel.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ReceiptTableModel.java	2000/04/13 02:35:29	1.12
+++ ReceiptTableModel.java	2000/06/18 21:57:17	1.13
@@ -1,5 +1,5 @@
 /*
- * $Id: ReceiptTableModel.java,v 1.12 2000/04/13 02:35:29 iang Exp $
+ * $Id: ReceiptTableModel.java,v 1.13 2000/06/18 21:57:17 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -137,7 +137,7 @@
         //   to plugin.
         //
         row[i++] = new Long(amount);
-        row[i++] = new String( trans.getDesc() );
+        row[i++] = new String( webfunds.utils.Hex.printable( trans.getDesc() ) );
         row[i++] = trans.getStringStatus();
         row[i++] = trans.getStringType();
         data.addElement(row);



1.122     +17 -5     java/webfunds/client/sox/SOXWallet.java

Index: SOXWallet.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/SOXWallet.java,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- SOXWallet.java	2000/06/18 21:07:26	1.121
+++ SOXWallet.java	2000/06/18 21:57:17	1.122
@@ -1,4 +1,4 @@
-/* $Id: SOXWallet.java,v 1.121 2000/06/18 21:07:26 iang Exp $
+/* $Id: SOXWallet.java,v 1.122 2000/06/18 21:57:17 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -427,7 +427,7 @@
         Payment pay;
         pay = makePurePayment(source, targetinfo,
                               contractid, amount,
-                              desc, from.getTime(), till.getTime());
+                              desc, from.getTime(), till.getTime(), null);
 
         if (pay == null)
             return null ;
@@ -461,11 +461,21 @@
      *  and delivers the pure payment back.
      *  As a principle, we deal in Units of Contract (underlying units)
      *  and not Units of Account (displayed units).
+     * @param target the target account, may be bearer
+     * @param source the source account where funds are written from
+     * @param contractid is the name of the contract
+     * @param amount the (contract) qty of items of which the payment is for
+     * @param desc a description of what this payment is for (optional)
+     * @param boolean whether or not the payment is a rollover payment
+     * @param from the time from which the payment is valid
+     * @param till the time at which the payment will expire
+     * @param pid a payment identifier, ignored if empty
      */
     public Payment makePurePayment(AccountInfo source, AccountInfo targetinfo,
                               ItemId contractid, long amount,
                               byte[] desc,
-                              long validFrom, long validTill)
+                              long from, long till,
+                              String pid)
     {
         //  Need a quiet non-GUI version (no AccountInfos) !
 
@@ -523,7 +533,9 @@
                 return null ;
             }
             pay = sub.createPayment(target, amount,
-                                    desc, false, validFrom, validTill);
+                                    desc, false,
+                                    from, till,
+                                    pid);
         } catch (SOXException ex) {
             ex.printStackTrace();
             error("Payment no good: " + ex);
@@ -1826,7 +1838,7 @@
             AccountInfo source = ab.getInfo(src);
             AccountInfo target = ab.getInfo(tgt);
             long amount = receipt.getQty();
-            byte[] desc = receipt.getDepositDesc();
+            byte[] desc = receipt.getPaymentDesc();
             Date date = new Date(receipt.getTimestamp());
             if (info.equals(source))
             {



1.5       +22 -1     java/webfunds/sox/Id.java

Index: Id.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Id.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Id.java	1999/11/21 01:53:26	1.4
+++ Id.java	2000/06/18 21:57:17	1.5
@@ -1,5 +1,5 @@
 /*
- * $Id: Id.java,v 1.4 1999/11/21 01:53:26 iang Exp $
+ * $Id: Id.java,v 1.5 2000/06/18 21:57:17 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -92,6 +92,27 @@
         if (id.length == 0)
             return "<empty>" ;
         return webfunds.utils.Hex.data2hex(id);
+    }
+
+    /**
+     *  fingerprint - a quick function for diags, long enough to
+     *  avoid collisions, but short enough to print out.
+     */
+    public String fp()
+    {
+        if (id == null)
+            return "<null id>" ;
+        if (id.length == 0)
+            return "<empty>" ;
+
+        if (id.length < 8)
+            return webfunds.utils.Hex.data2hex(id);
+       
+        byte[] bbb = new byte[8];
+        for (int j = 0; j < bbb.length; j++)
+            bbb[j] = id[j];
+
+        return webfunds.utils.Hex.data2hex(bbb) + "..";
     }
 
     protected boolean eq(Id other) 



1.39      +4 -3      java/webfunds/sox/Receipt.java

Index: Receipt.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Receipt.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- Receipt.java	2000/06/18 21:07:26	1.38
+++ Receipt.java	2000/06/18 21:57:17	1.39
@@ -1,5 +1,5 @@
 /*
- * $Id: Receipt.java,v 1.38 2000/06/18 21:07:26 iang Exp $
+ * $Id: Receipt.java,v 1.39 2000/06/18 21:57:17 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -571,8 +571,9 @@
 
         retval += "\titem: "+item+"\tqty: "+qty+ "\n";
         retval += "\txid: "+xid+"\tpid: "+pid+ "\tdid: "+did+ "\n";
-        retval += "\tTimestamp: "+timestamp+"\n";
-        retval += "\tsrc: "+src+"\ttgt: "+tgt+ "\n";
+        retval += "\ttime: "+timestamp+"\tDesc: "+
+                  webfunds.utils.Hex.printable(getPaymentDesc())+"\n";
+        retval += "\tsrc: "+src.fp()+"\ttgt: "+tgt.fp()+ "\n";
         if (sig != null)
             retval += "\tSignature: "+sig+"\n";
 



1.14      +21 -13    java/webfunds/sox/ValueAccount.java

Index: ValueAccount.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/ValueAccount.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ValueAccount.java	2000/06/05 00:54:43	1.13
+++ ValueAccount.java	2000/06/18 21:57:17	1.14
@@ -1,5 +1,5 @@
 /*
- * $Id: ValueAccount.java,v 1.13 2000/06/05 00:54:43 iang Exp $
+ * $Id: ValueAccount.java,v 1.14 2000/06/18 21:57:17 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -385,11 +385,11 @@
      * @param validity the time in seconds for which the payment is valid
      */
     public Payment createPayment(AccountId target, long qty, byte[] desc,
-                                 long validFrom, long validity)
+                                 long from, long validity)
         throws SOXSubAccountException
     {
-        long validTill = validFrom + validity*1000;
-        return createPayment(target, qty, desc, false, validFrom, validTill);
+        long validTill = from + validity*1000;
+        return createPayment(target, qty, desc, false, from, validTill, null);
     }
 
     /**
@@ -406,7 +406,7 @@
     {
         long now = System.currentTimeMillis();
         long validTill = now + validity*1000;
-        return createPayment(target, 0, desc, true, now, validTill);
+        return createPayment(target, 0, desc, true, now, validTill, null);
     }
 
     /**
@@ -416,20 +416,24 @@
      * @param qty the number of items of which the payment is for
      * @param desc a description of what this payment is for (optional)
      * @param boolean whether or not the payment is a rollover payment
-     * @param validFrom the time from which the payment is valid
-     * @param validTill the time till which the payment is valid
+     * @param from the time from which the payment is valid
+     * @param till the time at which the payment will expire
+     * @param pid a unique payment identifier, replaced if empty
      */
     public Payment createPayment(AccountId target, long qty, byte[] desc,
-                                 boolean changekey, Date from, Date till)
+                                 boolean changekey, Date from, Date till,
+                                 String pid)
         throws SOXSubAccountException
     {
         checkFrozen("createPayment Date");
 
-        String ref = "P" + System.currentTimeMillis();// +payNo++;
+        if (pid == null || pid.length() == 0)
+            pid = "P" + System.currentTimeMillis();
+
         Date validFrom = adjustTime(from, true);
         Date validTill = adjustTime(till, false);
 
-        Payment payment = new Payment(ref, acct.getId(), target, itemId, qty,
+        Payment payment = new Payment(pid, acct.getId(), target, itemId, qty,
                                       desc, changekey,
                                       validFrom.getTime(), validTill.getTime());
         byte[] paymentData = payment.encode();
@@ -457,18 +461,22 @@
      * @param boolean whether or not the payment is a rollover payment
      * @param from the time from which the payment is valid
      * @param till the time till which the payment is valid
+     * @param pid a unique payment identifier, replaced if empty
      */
     public Payment createPayment(AccountId target, long qty, byte[] desc,
-                                 boolean changekey, long from, long till)
+                                 boolean changekey, long from, long till,
+                                 String pid)
         throws SOXSubAccountException
     {
         checkFrozen("createPayment time");
+
+        if (pid == null || pid.length() == 0)
+            pid = "P" + System.currentTimeMillis();
 
-        String ref = "P" + System.currentTimeMillis();// +payNo++;
         long validFrom = adjustTime(from, true);
         long validTill = adjustTime(till, false);
 
-        Payment payment = new Payment(ref, acct.getId(), target, itemId, qty,
+        Payment payment = new Payment(pid, acct.getId(), target, itemId, qty,
                                       desc, changekey,
                                       validFrom, validTill);
         byte[] paymentData = payment.encode();