public class BIConnection extends java.lang.Object implements ICaptchaSender
| Modifier and Type | Field and Description |
|---|---|
private boolean |
m_bFirstCaptcha |
private java.util.Vector |
m_biConnectionListeners |
private boolean |
m_bSendNewCaptcha |
private byte[] |
m_captchaSolution |
private HttpClient |
m_httpClient |
private java.net.Socket |
m_socket |
private PaymentInstanceDBEntry |
m_theBI |
private static int |
ms_connectionTimeout |
private static IMutableProxyInterface |
ms_proxyInterface
A proxy interface that is used for all connections and may change over time.
|
static int |
TIMEOUT_DEFAULT |
static int |
TIMEOUT_MAX |
static int |
TIMEOUT_MIN |
static java.lang.String |
XML_ATTR_CONNECTION_TIMEOUT |
| Constructor and Description |
|---|
BIConnection(PaymentInstanceDBEntry theBI)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionListener(IBIConnectionListener a_listener)
Adds an IBIConnectionListener
|
void |
authenticate(PayAccount a_account)
performs challenge-response authentication
|
XMLErrorMessage |
buyFlatrate(PayAccount a_account) |
XMLTransCert |
charge(XMLGenericStrings parameters)
Fetches a transfer certificate from the BI.
|
boolean |
checkCouponCode(java.lang.String couponCode,
PayAccount a_account) |
private void |
connect_internal(ImmutableProxyInterface a_proxy,
int a_connectionTimeout) |
void |
connect() |
void |
connect(int a_connectionTimeout)
Connects to the Payment Instance via TCP and inits the HttpClient.
|
void |
disconnect()
Closes the connection.
|
IXMLEncodable |
fetchPaymentData(java.lang.String transfernumber,
PayAccount a_account) |
XMLPaymentOptions |
fetchPaymentOptions()
Gets the payment options the PI provides.
|
XMLTransactionOverview |
fetchTransactionOverview(XMLTransactionOverview a_overview)
Asks the PI to fill an XMLTransactionOverview
|
private void |
fireGotCaptcha(IImageEncodedCaptcha a_captcha)
Signals a received captcha to all registered IBICOnnectionListeners.
|
private XMLAccountInfo |
getAccountInfo(org.w3c.dom.Document doc,
PayAccount a_account) |
XMLAccountInfo |
getAccountInfo(PayAccount a_account)
Fetches an account statement (balance cert. + costconfirmations)
from the BI.
|
XMLGenericText |
getCancellationPolicy(java.lang.String lang) |
static int |
getConnectionTimeout() |
void |
getNewCaptcha()
Notifies the CaptchaSender that it should send a new captcha
|
XMLPaymentOptions |
getPaymentOptions()
Fetches payment options.
|
XMLPaymentSettings |
getPaymentSettings() |
XMLGenericText |
getTerms(java.lang.String lang) |
XMLVolumePlans |
getVolumePlans() |
XMLAccountCertificate |
registerNewAccount(XMLJapPublicKey pubKey,
IMyPrivateKey a_privateKey)
Registers a new account using the specified keypair.
|
protected XMLAccountInfo |
requestMonthlyOverusage(double a_dOverusageFactor,
PayAccount a_account) |
boolean |
sendPassivePayment(XMLPassivePayment a_passivePayment,
PayAccount a_account)
Sends data the user has entered for a passive payment to the payment
instance.
|
void |
setCaptchaSolution(byte[] a_solution)
Sets the solution of a captcha for registering an account.
|
static void |
setConnectionTimeout(int a_timeout) |
static void |
setMutableProxyInterface(IMutableProxyInterface a_proxyInterface) |
public static final int TIMEOUT_DEFAULT
public static final int TIMEOUT_MAX
public static final int TIMEOUT_MIN
public static final java.lang.String XML_ATTR_CONNECTION_TIMEOUT
private static int ms_connectionTimeout
private PaymentInstanceDBEntry m_theBI
private java.net.Socket m_socket
private HttpClient m_httpClient
private java.util.Vector m_biConnectionListeners
private byte[] m_captchaSolution
private boolean m_bSendNewCaptcha
private boolean m_bFirstCaptcha
private static IMutableProxyInterface ms_proxyInterface
public BIConnection(PaymentInstanceDBEntry theBI)
BI - the BI to which we connectpublic static void setConnectionTimeout(int a_timeout)
public static int getConnectionTimeout()
public static void setMutableProxyInterface(IMutableProxyInterface a_proxyInterface)
public void connect()
throws java.io.IOException
java.io.IOExceptionpublic void connect(int a_connectionTimeout)
throws java.io.IOException
java.io.IOException - if an error occured while connectionHTTPClient.ForbiddenIOException - if it is assumed that the local provider forbids the connectionprivate void connect_internal(ImmutableProxyInterface a_proxy, int a_connectionTimeout) throws java.io.IOException
java.io.IOExceptionpublic void disconnect()
java.io.IOExceptionpublic XMLTransCert charge(XMLGenericStrings parameters) throws java.lang.Exception
java.lang.Exceptionpublic XMLErrorMessage buyFlatrate(PayAccount a_account) throws java.lang.Exception
java.lang.Exceptionpublic XMLAccountInfo getAccountInfo(PayAccount a_account) throws java.lang.Exception
java.io.IOExceptionjava.lang.Exceptionprivate XMLAccountInfo getAccountInfo(org.w3c.dom.Document doc, PayAccount a_account) throws java.lang.Exception
java.lang.Exceptionprotected XMLAccountInfo requestMonthlyOverusage(double a_dOverusageFactor, PayAccount a_account) throws java.lang.Exception
java.lang.Exceptionpublic XMLPaymentOptions getPaymentOptions() throws java.lang.Exception
java.lang.Exceptionpublic XMLVolumePlans getVolumePlans() throws java.lang.Exception
java.lang.Exceptionpublic XMLGenericText getTerms(java.lang.String lang) throws java.lang.Exception
java.lang.Exceptionpublic XMLGenericText getCancellationPolicy(java.lang.String lang) throws java.lang.Exception
java.lang.Exceptionpublic XMLPaymentSettings getPaymentSettings() throws java.lang.Exception
java.lang.Exceptionpublic void authenticate(PayAccount a_account) throws java.lang.Exception
java.lang.Exceptionpublic XMLAccountCertificate registerNewAccount(XMLJapPublicKey pubKey, IMyPrivateKey a_privateKey) throws java.lang.Exception
pubKey - public keyprivKey - private keyjava.lang.Exception - if an error occurs or the signature or public key is wrongpublic XMLPaymentOptions fetchPaymentOptions() throws java.lang.Exception
java.lang.Exceptionpublic IXMLEncodable fetchPaymentData(java.lang.String transfernumber, PayAccount a_account) throws java.lang.Exception
java.lang.Exceptionpublic XMLTransactionOverview fetchTransactionOverview(XMLTransactionOverview a_overview) throws java.lang.Exception
a_overview - XMLTransactionOverviewjava.lang.Exceptionpublic boolean sendPassivePayment(XMLPassivePayment a_passivePayment, PayAccount a_account)
a_passivePayment - XMLPassivePaymentjava.lang.Exceptionpublic boolean checkCouponCode(java.lang.String couponCode,
PayAccount a_account)
public void addConnectionListener(IBIConnectionListener a_listener)
a_listener - IBIConnectionListenerprivate void fireGotCaptcha(IImageEncodedCaptcha a_captcha)
a_captcha - IImageEncodedCaptchapublic void setCaptchaSolution(byte[] a_solution)
setCaptchaSolution in interface ICaptchaSendera_solution - byte[]public void getNewCaptcha()
ICaptchaSendergetNewCaptcha in interface ICaptchaSenderCopyright © 2023. All rights reserved.