|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--webfunds.sox.Encodable
|
+--webfunds.sox.Receipt
This class represents a signed receipt, such as received from an issuer in response to a deposit request. SOX clients usually only create receipts using data received from the issuer.
| Field Summary | |
protected java.io.PrintWriter |
debug
|
protected DepositRequest |
depositRequest
|
protected byte[] |
depositRequestData
|
protected java.lang.String |
did
|
protected AbstractPayment |
exPayment
The Exchange Payment is what is returned in case of a Withdrawal. |
protected byte[] |
exPaymentData
|
protected long |
flags
Some flags to indicate special conditions. |
protected ItemId |
item
|
protected java.lang.String |
pid
|
protected long |
qty
|
static int |
RECEIPT_LOCAL_VERS
The version of the encoded receipt. |
static int |
RECEIPT_not_used_yet
The version of the encoded receipt. |
static int |
RECEIPT_ORIGINAL
The version of the encoded receipt. |
static int |
RECEIPT_PROTO
The version of the encoded receipt. |
protected byte[] |
sig
|
protected AccountId |
src
|
protected AccountId |
tgt
|
protected long |
timestamp
|
protected int |
version
|
static long |
WITHDRAW_PROTO
|
protected java.lang.String |
xid
|
| Constructor Summary | |
Receipt(byte[] receiptData)
Construct a receipt object from a byte array that was previously returned from the encode() method of a receipt object. |
|
Receipt(java.io.InputStream is)
Construct a receipt object from data on an input stream that was previously returned from the encode() method of a receipt object. |
|
Receipt(ItemId item,
long qty,
long tim,
java.lang.String xid,
java.lang.String pid,
java.lang.String did,
AccountId tgt,
AccountId src,
DepositRequest req)
Create an unsigned receipt This constructor is not usually called by SOX clients. |
|
| Method Summary | |
protected static void |
cycle()
|
void |
decode(java.io.InputStream is)
Update this receipt object with the previously encoded receipt (such as output from the encode() method of a receipt object) read from an input stream. |
protected AccountId |
decodeAccountId(java.io.DataInputStream dis)
Get SOX2 Hash for an AccountId, which has an OpenPGP Message Digest Type in advance of it. |
protected ItemId |
decodeItemId(java.io.DataInputStream dis)
Get SOX2 Hash for an ItemId, which has an OpenPGP Message Digest Type in advance of it. |
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. |
void |
encodeId(Id id,
java.io.DataOutputStream dos)
Encode a SOX2 hash, with OpenPGP id as a byte before it. |
boolean |
equals(java.lang.Object object)
|
static Receipt |
example()
|
byte[] |
getDepositDesc()
Get the description on the deposit request. |
java.lang.String |
getDepositId()
Get the identifier on the deposit request, as created by the payee. |
DepositRequest |
getDepositRequest()
Get the DepositRequest object that was used to deposit the payment The DepositRequest is the signed object that the payee used to deposit the payment. |
AbstractPayment |
getExchangePayment()
Get the Exchange Payment if the original request was a WithdrawalRequest. |
protected byte[] |
getHashSig()
PRETEND Signature - the receipt is signed with a SHA1 MD, encoded as a message digest (type, data) within a string. |
ItemId |
getItem()
Get the type of item (or "currency") of the transaction. |
AbstractPayment |
getPay()
Get the Payment that was deposited. |
Payment |
getPayment()
Get the Payment that was deposited. |
byte[] |
getPaymentDesc()
Get the description on the payment. |
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. |
long |
getQty()
Get the quantity of the item for the transaction. |
AccountId |
getSource()
Get the account to which the payment was made. |
AccountId |
getTarget()
Get the account from which the transaction was drawn. |
long |
getTimestamp()
Get the time and date of the transaction. |
java.lang.String |
getTransactionId()
Get the identifier on the receipt (the transaction id), as created by the issuer. |
int |
getVersion()
|
protected static void |
input()
|
protected boolean |
isSet(long i)
|
boolean |
isSigned()
Check to see if this receipt is signed NOTE: This does not check the validity of the signature, only that this receipt has one. |
boolean |
isWithdrawalReceipt()
|
static void |
main(java.lang.String[] args)
|
protected static void |
output()
|
protected static void |
readWrite()
|
void |
setExchangePayment(AbstractPayment p)
|
void |
setExchangePayment(byte[] data)
|
void |
setSignature(byte[] sig)
Define the signature for this receipt |
void |
sign(java.security.PrivateKey key)
Sign this receipt |
java.lang.String |
toString()
Convert this object to a human readable string |
boolean |
verify(java.security.PublicKey key)
Verify this receipt |
java.lang.String |
vstring()
|
| 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 |
public static final int RECEIPT_ORIGINAL
public static final int RECEIPT_LOCAL_VERS
public static final int RECEIPT_PROTO
public static final int RECEIPT_not_used_yet
protected int version
protected DepositRequest depositRequest
protected byte[] depositRequestData
protected AbstractPayment exPayment
protected byte[] exPaymentData
protected ItemId item
protected long qty
protected long timestamp
protected byte[] sig
protected java.lang.String xid
protected java.lang.String pid
protected java.lang.String did
protected AccountId tgt
protected AccountId src
protected long flags
public static final long WITHDRAW_PROTO
protected java.io.PrintWriter debug
| Constructor Detail |
public Receipt(ItemId item,
long qty,
long tim,
java.lang.String xid,
java.lang.String pid,
java.lang.String did,
AccountId tgt,
AccountId src,
DepositRequest req)
throws SOXPacketException
depositRequest - the deposit request for which this is the receipttransactionId - the transaction identifierdate - the time of the transaction
public Receipt(byte[] receiptData)
throws SOXPacketException
receiptData - the previously encoded receipt
public Receipt(java.io.InputStream is)
throws SOXPacketException
is - the previously encoded receipt inputstream| Method Detail |
public int getVersion()
protected boolean isSet(long i)
public boolean isWithdrawalReceipt()
public Payment getPayment()
public AbstractPayment getPay()
public AbstractPayment getExchangePayment()
public void setExchangePayment(AbstractPayment p)
throws SOXPacketException
public void setExchangePayment(byte[] data)
throws SOXPacketException
public DepositRequest getDepositRequest()
public java.lang.String getPaymentId()
public java.lang.String getDepositId()
public java.lang.String getTransactionId()
public AccountId getTarget()
public AccountId getSource()
public ItemId getItem()
public long getQty()
public byte[] getPaymentDesc()
public byte[] getDepositDesc()
public long getTimestamp()
public boolean isSigned()
public void setSignature(byte[] sig)
sig - the signature to place on the receipt,
or if null, then the signature (if any) is removed.
public void sign(java.security.PrivateKey key)
throws java.security.KeyException
the - key to use to sign the receipt
public boolean verify(java.security.PublicKey key)
throws java.security.KeyException
the - public key of the signing key
public void decode(java.io.InputStream is)
throws java.io.IOException,
SOXPacketException
is - the stream containing the encoded receipt
protected ItemId decodeItemId(java.io.DataInputStream dis)
throws SOXPacketException,
java.io.IOException
protected AccountId decodeAccountId(java.io.DataInputStream dis)
throws SOXPacketException,
java.io.IOException
protected byte[] getHashSig()
throws java.io.IOException
public void encodeId(Id id,
java.io.DataOutputStream dos)
throws java.io.IOException
dos - the stream on which to send the output
public void encode(java.io.OutputStream os)
throws java.io.IOException
os - the stream on which to send the outputpublic boolean equals(java.lang.Object object)
public java.lang.String toString()
public java.lang.String vstring()
public static Receipt example()
public static void main(java.lang.String[] args)
protected static void cycle()
throws java.lang.Exception
protected static void output()
throws java.lang.Exception
protected static void readWrite()
throws java.lang.Exception
protected static void input()
throws java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||