webfunds.client.sox
Class StateReceipt

java.lang.Object
  |
  +--webfunds.sox.Encodable
        |
        +--webfunds.client.sox.StateReceipt

public class StateReceipt
extends Encodable

This class represents a payment issued and maybe settled. If pending, only pending information is included. If settled, the Receipt is included.

See Also:
Serialized Form

Field Summary
static int CANCELLED
           
static int CANCELLING
           
static int PENDING
           
protected  PendingReceipt pendingReceipt
           
protected  java.lang.String pid
           
protected  Receipt receipt
           
protected  int state
           
static int SUCCEEDED
           
protected static int VERSION
          The version of the encoded object.
 
Constructor Summary
StateReceipt(byte[] data)
          Construct the object from a byte array that was previously returned from the encode() method of the previous object.
StateReceipt(java.io.InputStream is)
          Construct the object from data on an input stream that was previously returned from the encode() method of the previous object.
StateReceipt(PendingReceipt pr)
          Create a new StateReceipt.
 
Method Summary
protected static void cycle()
           
 void decode(java.io.InputStream is)
          Update this object with the previously encoded object (such as output from the encode() method of a previous object) read from an input stream.
 void encode(java.io.OutputStream os)
          Encode a receipt, writing the data to an output stream, in a format suitable for sending to restoring using the decode() method to re-construct the object.
 boolean equals(java.lang.Object object)
           
static StateReceipt example()
          Return a usefully correct example of the object for testing.
 java.lang.String getPaymentId()
          Get the identifier on the payment, as originally created by the payer.
 PendingReceipt getPendingReceipt()
          Get the Pending if there.
 Receipt getReceipt()
          Get the Pending if there.
 int getState()
           
protected static void input()
           
 boolean isCancelled()
           
 boolean isCancelling()
           
 boolean isComplete()
           
 boolean isPending()
           
 boolean isSucceeded()
           
static void main(java.lang.String[] args)
           
protected static void output()
           
protected static void readWrite()
           
 void setCancelled(Receipt r)
           
 void setCancelling()
           
 void setReceipt(Receipt r)
           
 java.lang.String toString()
          Convert this object to a human readable string
 
Methods inherited from class webfunds.sox.Encodable
decode, encode, readByteArray, readCertificate, readProperties, readString, writeByteArray, writeCertificate, writeProperties, writeString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

protected static final int VERSION
The version of the encoded object.

PENDING

public static final int PENDING

CANCELLING

public static final int CANCELLING

CANCELLED

public static final int CANCELLED

SUCCEEDED

public static final int SUCCEEDED

state

protected int state

pendingReceipt

protected PendingReceipt pendingReceipt

receipt

protected Receipt receipt

pid

protected java.lang.String pid
Constructor Detail

StateReceipt

public StateReceipt(PendingReceipt pr)
Create a new StateReceipt. This constructor used when making a Payment committment.
Parameters:
pendingReceipt - the deposit request for which this is the receipt
transactionId - the transaction identifier
date - the time of the transaction

StateReceipt

public StateReceipt(byte[] data)
             throws SOXPacketException
Construct the object from a byte array that was previously returned from the encode() method of the previous object.
Parameters:
data - the previously encoded object

StateReceipt

public StateReceipt(java.io.InputStream is)
             throws SOXPacketException
Construct the object from data on an input stream that was previously returned from the encode() method of the previous object.
Parameters:
is - the previously encoded receipt inputstream
Method Detail

getState

public int getState()

isPending

public boolean isPending()

isCancelling

public boolean isCancelling()

isCancelled

public boolean isCancelled()

isSucceeded

public boolean isSucceeded()

isComplete

public boolean isComplete()

getPendingReceipt

public PendingReceipt getPendingReceipt()
Get the Pending if there.
Returns:
the PendingReceipt, else null if settled

getReceipt

public Receipt getReceipt()
Get the Pending if there.
Returns:
the Receipt, else null if not settled as yet

setReceipt

public void setReceipt(Receipt r)

setCancelled

public void setCancelled(Receipt r)

setCancelling

public void setCancelling()

getPaymentId

public java.lang.String getPaymentId()
Get the identifier on the payment, as originally created by the payer. Note: although a java String is used, this identifier should only contain 8-bit ascii characters.

decode

public void decode(java.io.InputStream is)
            throws java.io.IOException,
                   SOXPacketException
Update this object with the previously encoded object (such as output from the encode() method of a previous object) read from an input stream.
Overrides:
decode in class Encodable
Parameters:
is - the stream containing the encoded object

encode

public void encode(java.io.OutputStream os)
            throws java.io.IOException
Encode a receipt, writing the data to an output stream, in a format suitable for sending to restoring using the decode() method to re-construct the object.
Overrides:
encode in class Encodable
Parameters:
os - the stream on which to send the output
Returns:
byte[] the receipt in encoded form

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Convert this object to a human readable string
Overrides:
toString in class java.lang.Object

example

public static StateReceipt example()
Return a usefully correct example of the object for testing.

main

public static void main(java.lang.String[] args)

cycle

protected static void cycle()
                     throws java.lang.Exception

output

protected static void output()
                      throws java.lang.Exception

readWrite

protected static void readWrite()
                         throws java.lang.Exception

input

protected static void input()
                     throws java.lang.Exception