public class PayAccount extends java.lang.Object implements IXMLEncodable
toXmlElement()
method is provided. It is recommended to encrypt the output of this method
before storing it to disk, because it includes the secret private key.
The XML structure is as follows:
Modifier and Type | Field and Description |
---|---|
static long |
ACCOUNT_MAX_UPDATE_INTERVAL_MS |
static long |
ACCOUNT_MIN_UPDATE_INTERVAL_MS |
static int |
MAX_KBYTES_COUNTING_AS_EMPTY |
static java.lang.String |
XML_ELEMENT_NAME |
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
Constructor and Description |
---|
PayAccount(org.w3c.dom.Element elemRoot,
IMiscPasswordReader a_passwordReader) |
PayAccount(XMLAccountCertificate certificate,
IMyPrivateKey privateKey,
PaymentInstanceDBEntry theBI,
XMLGenericText terms,
boolean a_bLock)
Creates a
PayAccount Object from the account certificate and the
private key. |
Modifier and Type | Method and Description |
---|---|
void |
addAccountListener(IAccountListener listener) |
long |
addCostConfirmation(XMLEasyCC cc,
boolean a_bForcedAdd) |
void |
addMessageListener(IMessageListener listener) |
void |
addTransCert(XMLTransCert cert) |
static boolean |
canDoMonthlyOverusage(PayAccount a_account,
java.sql.Timestamp a_tNow) |
boolean |
canDoMonthlyOverusage(java.sql.Timestamp a_tNow) |
XMLTransCert |
charge(XMLGenericStrings a_parameters)
Request a transfer certificate from the BI
|
static java.lang.String |
checkCouponCode(java.lang.String a_code) |
void |
decryptPrivateKey(IMiscPasswordReader a_passwordReader) |
boolean |
equals(java.lang.Object a_account) |
XMLAccountInfo |
fetchAccountInfo(boolean a_bForce)
Requests an AccountInfo XML structure from the BI.
|
XMLAccountInfo |
fetchAccountInfo(boolean a_bForce,
int a_connectionTimeout) |
void |
fireChangeEvent() |
XMLAccountCertificate |
getAccountCertificate() |
XMLAccountInfo |
getAccountInfo() |
long |
getAccountNumber()
Returns the account's accountnumber
|
java.lang.String |
getAffiliate() |
long |
getBackupTime() |
XMLBalance |
getBalance()
getBalance
|
java.sql.Timestamp |
getBalanceValidTime()
liefert zurueck, wann das Guthaben ungueltig wird (bei flatrate modellen)
|
PaymentInstanceDBEntry |
getBI() |
java.sql.Timestamp |
getCreationTime()
Liefert das Erstellungsdatum des Kontos.
|
long |
getCurrentBytes()
The bytes that have been transferred over the current service.
|
long |
getCurrentCredit()
Returns the current credit (i. e. deposit - spent) as counted by the Jap
itself.
|
long |
getCurrentCreditCalculated() |
long |
getCurrentCreditCalculatedAlsoNegative() |
long |
getCurrentCreditFromBalance() |
double |
getCurrentOverusageFactor(java.sql.Timestamp a_tNow) |
long |
getCurrentSpent()
returns totalBytes - getCurrentCredit() in BYTES or 0 if no accountInfo is given.
|
long |
getDeposit()
Returns the initial amount of the account (i. e. the sum of all incoming
payment)
|
java.lang.String |
getPIID() |
IMyPrivateKey |
getPrivateKey()
Returns the private key or null if the account is encrypted and not usable.
|
IMyPublicKey |
getPublicKey() |
XMLGenericText |
getTerms() |
java.util.Calendar |
getTermsDate() |
Transaction |
getTransaction() |
java.util.Vector |
getTransCerts()
Returns a vector with all transfer certificates
|
long |
getVolumeBytesMonthly() |
boolean |
hasAccountInfo()
Returns true when an accountInfo object exists.
|
boolean |
hasExpired() |
boolean |
hasExpired(java.sql.Timestamp a_time) |
int |
hashCode() |
boolean |
isAccountInfoUpdated()
Returns true if the account info/balance has been updated at least once at runtime.
|
boolean |
isBackupDone() |
boolean |
isBlocked() |
boolean |
isCharged() |
boolean |
isCharged(java.sql.Timestamp a_time)
Returns true if this account currently has a positive and usable balance.
|
boolean |
isLocked() |
boolean |
isSamePaymentInstance(java.lang.String a_PIID) |
boolean |
isStatusUnknown() |
boolean |
isTransactionExpired() |
boolean |
isUsed() |
boolean |
isWaitingForTransaction() |
void |
removeMessageListener(IMessageListener listener) |
XMLAccountInfo |
requestMonthlyOverusage() |
void |
resetCurrentBytes() |
void |
setBackupDone(long a_backupTime) |
void |
setBlocked(boolean a_bBlock) |
void |
setTerms(XMLGenericText xmlTerms) |
boolean |
shouldUpdateAccountInfo() |
java.lang.String |
toString() |
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc)
Returns the xml representation of the account
|
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc,
java.lang.String a_password,
boolean a_bDoNotDeactivate) |
void |
unlock() |
long |
updateCurrentBytes(PacketCounter a_packetCounter)
Asks the PacketCounter for the current number of transferred bytes and
updates the internal value.
|
void |
updated()
Marks the account as updated so a ChangeEvent gets fired
|
public static final java.lang.String XML_ELEMENT_NAME
public static final long ACCOUNT_MIN_UPDATE_INTERVAL_MS
public static final long ACCOUNT_MAX_UPDATE_INTERVAL_MS
public static final int MAX_KBYTES_COUNTING_AS_EMPTY
public PayAccount(org.w3c.dom.Element elemRoot, IMiscPasswordReader a_passwordReader) throws java.lang.Exception
java.lang.Exception
public PayAccount(XMLAccountCertificate certificate, IMyPrivateKey privateKey, PaymentInstanceDBEntry theBI, XMLGenericText terms, boolean a_bLock)
PayAccount
Object from the account certificate and the
private key.certificate
- account certificate issued by the BIprivateKey
- the private keypublic boolean isWaitingForTransaction()
public boolean isTransactionExpired()
public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
toXmlElement
in interface IXMLEncodable
a_doc
- a documentpublic org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc, java.lang.String a_password, boolean a_bDoNotDeactivate)
public void addTransCert(XMLTransCert cert) throws java.lang.Exception
java.lang.Exception
public boolean equals(java.lang.Object a_account)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public long getAccountNumber()
public boolean hasExpired()
public boolean hasExpired(java.sql.Timestamp a_time)
public boolean isCharged()
public boolean isCharged(java.sql.Timestamp a_time)
public boolean isSamePaymentInstance(java.lang.String a_PIID)
public boolean isBackupDone()
public long getBackupTime()
public void setBackupDone(long a_backupTime)
public boolean isStatusUnknown()
public boolean hasAccountInfo()
public XMLAccountCertificate getAccountCertificate()
public java.sql.Timestamp getCreationTime()
public java.sql.Timestamp getBalanceValidTime()
public IMyPrivateKey getPrivateKey()
public IMyPublicKey getPublicKey()
public long getDeposit()
public Transaction getTransaction()
public long getCurrentCreditCalculated()
public boolean isUsed()
public long getCurrentCreditCalculatedAlsoNegative()
public long getCurrentCreditFromBalance()
public java.lang.String toString()
toString
in class java.lang.Object
public void unlock()
public boolean isLocked()
public boolean isBlocked()
public void setBlocked(boolean a_bBlock)
public long getCurrentCredit()
updateCurrentBytes()
first.public long getCurrentSpent()
public XMLAccountInfo getAccountInfo()
public XMLGenericText getTerms()
public void setTerms(XMLGenericText xmlTerms)
public java.util.Calendar getTermsDate()
public java.util.Vector getTransCerts()
XMLTransCert
public long updateCurrentBytes(PacketCounter a_packetCounter) throws java.lang.Exception
java.lang.Exception
public void resetCurrentBytes()
public long getCurrentBytes()
public long addCostConfirmation(XMLEasyCC cc, boolean a_bForcedAdd) throws java.lang.Exception
java.lang.Exception
public void addAccountListener(IAccountListener listener)
public void addMessageListener(IMessageListener listener)
public void removeMessageListener(IMessageListener listener)
public void fireChangeEvent()
public java.lang.String getAffiliate()
public XMLBalance getBalance()
public XMLAccountInfo fetchAccountInfo(boolean a_bForce) throws java.lang.SecurityException, java.lang.Exception
a_bForce
- if the update is forced; if not, it might be prevented by
PayAccountsFile.isBalanceAutoUpdateEnabled()java.lang.Exception
java.lang.SecurityException
- if the account is encrypted and therefore not usablepublic XMLAccountInfo fetchAccountInfo(boolean a_bForce, int a_connectionTimeout) throws java.lang.SecurityException, java.lang.Exception
java.lang.SecurityException
java.lang.Exception
public static boolean canDoMonthlyOverusage(PayAccount a_account, java.sql.Timestamp a_tNow)
public long getVolumeBytesMonthly()
public double getCurrentOverusageFactor(java.sql.Timestamp a_tNow)
public boolean canDoMonthlyOverusage(java.sql.Timestamp a_tNow)
public boolean isAccountInfoUpdated()
public boolean shouldUpdateAccountInfo()
public XMLTransCert charge(XMLGenericStrings a_parameters) throws java.lang.SecurityException, java.lang.Exception
accountNumber
- account numberjava.lang.Exception
java.lang.SecurityException
- if the account is encrypted an not usablepublic void updated()
public java.lang.String getPIID()
public PaymentInstanceDBEntry getBI()
public XMLAccountInfo requestMonthlyOverusage() throws java.lang.Exception
java.lang.Exception
public static java.lang.String checkCouponCode(java.lang.String a_code)
public void decryptPrivateKey(IMiscPasswordReader a_passwordReader) throws java.lang.Exception
java.lang.Exception
Copyright © 2023. All rights reserved.