|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--FIM.payment.AnonymousInvoice
An invoice for an anonymous recipient.
Constructor Summary | |
protected |
AnonymousInvoice()
Creates a new empty invoice. |
|
AnonymousInvoice(Element elem)
Create a new anonymous invoice from an XML element. |
|
AnonymousInvoice(String issuer,
Certificate issuerCert,
Date date,
String title,
InvoiceItem[] items)
Create a new anonymous invoice. |
Method Summary | |
void |
decodeXMLElement(Element elem)
Parse back the invoice from an XML element. |
Serializable |
getAsSerializable()
Retrieve the invoice as a serializable (just returns this as this object is directly serializable). |
Element |
getAsXMLElement(Document doc)
Retrieve the invoice as an XML element (name: AnonymousInvoice). |
Certificate |
getCertificate()
Retrieve the certificate passed in upon signing. |
Date |
getDate()
Retrieve the date of the invoice. |
byte[] |
getEncoded()
Retrieve the invoice in encoded form to be used for signing. |
String |
getIssuer()
Retrieve the issuer of the invoice as a string. |
Certificate |
getIssuerCertificate()
Retrieve the issuer of the invoice as a certificate (might be null ). |
InvoiceItem[] |
getItems()
Retrieve the items contained within the invoice (items or lines). |
String |
getTitle()
Retrieve the title of the invoice. |
Price |
getTotalPrice()
Retrieve the total value of all items in the invoice. |
boolean |
isSigned()
Check whether this invoice is signed or not. |
void |
sign(String signAlgorithm,
PrivateKey pk,
Certificate cert)
Sign the invoice. |
String |
toString()
Retrieve the invoice as a string, suitable for presenting to the user in a very simple form. |
void |
verifySignature(String provider)
Verify the signature of the invoice based on the certificate contained. |
void |
verifySignature(String provider,
PublicKey pk)
Verify the signature of the invoice based on the public key passed in. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public AnonymousInvoice(String issuer, Certificate issuerCert, Date date, String title, InvoiceItem[] items)
issuer
- the issuer of the invoiceissuerCert
- the certificate of the issuer of the invoicedata
- the date for the invoicetitle
- the title of the invoiceitem
- an array of items for the invoice. At least one requiredprotected AnonymousInvoice()
decodeXMLElement
.public AnonymousInvoice(Element elem)
elem
- the XML element containing the encoded formMethod Detail |
public String getIssuer()
getIssuer
in interface Invoice
public Certificate getIssuerCertificate()
null
).getIssuerCertificate
in interface Invoice
null
public Date getDate()
getDate
in interface Invoice
public Price getTotalPrice()
getTotalPrice
in interface Invoice
public String getTitle()
getTitle
in interface Invoice
public InvoiceItem[] getItems()
getItems
in interface Invoice
public boolean isSigned()
isSigned
in interface Invoice
true
if the invoice is signedpublic void sign(String signAlgorithm, PrivateKey pk, Certificate cert) throws InvalidKeyException, NoSuchAlgorithmException
sign
in interface Invoice
signAlgorithm
- the algorithm to be used for signingpk
- the private key to be used for signingcert
- the certificate of the public key associated with the private key (can be null
)InvalidKeyException
- if the private key is invalidNoSuchAlgorithmException
- if the algorithm is not supportedpublic Certificate getCertificate()
null
if non provided then.getCertificate
in interface Invoice
null
public void verifySignature(String provider) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verifySignature
in interface Invoice
provider
- the security provider to be used for checking. if null
, the standard provider is usedInvalidKeyException
- if the public key is invalidNoSuchAlgorithmException
- if the algorithm used for signing is not supportedInvalidKeyException
- if the key in the certificate is erroneousNoSuchProviderException
- if the security provider could not be foundSignatureException
- if the signature is invalidpublic void verifySignature(String provider, PublicKey pk) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verifySignature
in interface Invoice
provider
- the security provider to be used for checking. if null
, the standard provider is usedpk
- the public key to use for verification. If null
, the key from the certificate is used (if no certificate in this case, verification fails)NoSuchAlgorithmException
- if the algorithm used for signing is not supportedInvalidKeyException
- if the public key (or the key in the certificate) is invalidNoSuchProviderException
- if the security provider could not be foundSignatureException
- if the signature is invalidpublic byte[] getEncoded()
getEncoded
in interface Invoice
public String toString()
toString
in interface Invoice
toString
in class Object
public Serializable getAsSerializable()
this
as this object is directly serializable).getAsSerializable
in interface XMLEncodeable
public Element getAsXMLElement(Document doc)
getAsXMLElement
in interface XMLEncodeable
doc
- the document within which to create the elementpublic void decodeXMLElement(Element elem) throws IllegalArgumentException
decodeXMLElement
in interface XMLEncodeable
elem
- the element containing the price to parse backIllegalArgumentException
- if the element is incorrect (e. g. wrong tag name)
|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |