|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--webfunds.sox.Encodable
|
+--webfunds.sox.AbstractPayment
|
+--webfunds.sox.Payment
This class represents a signed payment. Payment objects are usually created using the createPayment method of an Account object, or re-constructed from a byte array which was created using the encode() method of a previous Payment object. Payments are encoded as a byte array for sending to third parties, and similarly, byte arrays are the form in which payments are received.
| Field Summary | |
protected boolean |
changekey
this boolean indicated wether the account has to rollover to a new key. |
protected byte[] |
sig
The signature of the other payment fields (made by the owner of the source account) |
protected AccountId |
source
The account from which the payment is drawn |
static int |
SUB_VERSION
The sub version of the original cheque payment. |
protected AccountId |
target
The account to which the payment is made out. |
static int |
TYPE
The type of payment of this class There is currently only one defined, but future payment types may include things such as bearer payments, coins, bank transfers and hash chain payments |
protected long |
validFrom
The date from which the payment is valid |
protected long |
validTill
The date to which the payment is valid |
| Fields inherited from class webfunds.sox.AbstractPayment |
desc,
item,
paymentId,
PF_VERSION,
qty,
SINGLETON_VERSION,
subversion,
type,
version |
| Constructor Summary | |
Payment(byte[] paymentData)
Construct a payment object from a byte array that was previously returned from the encode() method of a payment object. |
|
Payment(java.io.InputStream is)
Construct a payment object from data in an input stream, where the data was previously returned from the encode() method of a payment object. |
|
Payment(java.lang.String paymentId,
AccountId source,
AccountId target,
ItemId item,
long qty,
byte[] desc,
boolean changekey,
long validFrom,
long validTill)
Create an unsigned payment |
|
| Method Summary | |
protected static void |
cycle()
|
void |
decode(java.io.InputStream is)
Update this payment object with the values from a payment encoded as a byte array (such as previously returned from the encode() method of a payment object). |
void |
encode(java.io.OutputStream os)
Encode a payment as a byte array, suitable for sending to third parties for depositing. |
boolean |
equals(java.lang.Object obj)
|
static Payment |
example()
|
boolean |
getChangeKey()
|
byte[] |
getSignature()
Get the signature of the payment |
AccountId |
getSource()
Get the account from which the transaction is drawn |
AccountId |
getTarget()
Get the account to which the payment is made |
long |
getValidFrom()
Get the date from which the payment is valid |
long |
getValidTill()
Get the date to which the payment is valid |
protected static void |
input()
|
boolean |
isBearer()
|
boolean |
isSigned()
Check to see if this payment is signed NOTE: This does not check the validity of the signature, only that this payment has one. |
static void |
main(java.lang.String[] args)
|
protected static void |
output()
|
protected static void |
readWrite()
|
void |
setSignature(byte[] sig)
Define the signature for this payment |
java.lang.String |
toString()
|
boolean |
verify(java.security.PublicKey pk)
Verify the signature on the payment with the given public key |
| Methods inherited from class webfunds.sox.AbstractPayment |
getDesc,
getId,
getItem,
getQty,
getSubVersion,
getType,
getVersion,
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 TYPE
public static final int SUB_VERSION
protected AccountId source
protected AccountId target
protected long validFrom
protected long validTill
protected byte[] sig
protected boolean changekey
| Constructor Detail |
public Payment(java.lang.String paymentId,
AccountId source,
AccountId target,
ItemId item,
long qty,
byte[] desc,
boolean changekey,
long validFrom,
long validTill)
paymentId - the payment identifiersource - the source accounttarget - the target accountitem - the item for which the payment is fordesc - a description of what this payment is for (optional)qty - the number of items of which the payment is forvalidFrom - the Java time from which the payment is validvalidTill - the Java time till which the payment is validchangekey - boolean specifying if the account needs to be rolled over.
public Payment(byte[] paymentData)
throws SOXPacketException
paymentData - the previously encoded payment
public Payment(java.io.InputStream is)
throws SOXPacketException
is - the input stream from which to read the payment data| Method Detail |
public AccountId getSource()
public AccountId getTarget()
public boolean isBearer()
public long getValidFrom()
public long getValidTill()
public byte[] getSignature()
public boolean getChangeKey()
public boolean isSigned()
public void setSignature(byte[] sig)
sig - the signature to place on the payment,
or if null or empty, then the signature (if any) is removed.public boolean verify(java.security.PublicKey pk)
pk - The publickey to verify the signature with
public void decode(java.io.InputStream is)
throws java.io.IOException,
SOXPacketException
paymentData - the previosly encoded payment
public void encode(java.io.OutputStream os)
throws java.io.IOException
public java.lang.String toString()
public boolean equals(java.lang.Object obj)
public static Payment 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 | ||||||||