anon.pay.xml
Class XMLPaymentOption

java.lang.Object
  extended by anon.pay.xml.XMLPaymentOption
All Implemented Interfaces:
IXMLEncodable

public class XMLPaymentOption
extends java.lang.Object
implements IXMLEncodable

This class represents a payment option sent by the Payment Instance.

Author:
Tobias Bayer, Elmar Schraml

Field Summary
private static java.lang.String EXCEPTION_WRONG_XML_STRUCTURE
           
static java.lang.String EXTRA_LINK
           
static java.lang.String EXTRA_PHONE
           
static java.lang.String EXTRA_TEXT
           
private  java.util.Vector m_detailedInfos
          Same explanation as m_headings
private  java.util.Vector m_extraInfos
          This vector takes String[3] arrays.
private  boolean m_generic
          Generic option? should be true, unless you plan to have JAP provide a special input form for this option
private  java.util.Vector m_headings
          This vector takes String[2] arrays while the first element is the heading and the second element is the language identifier.
private  java.lang.String m_imageLink
          A link to an image
private  java.util.Vector m_inputFields
          This vector takes input fields.
private static java.util.Vector m_languages
           
private  int m_markup
          percentage of a user's payment that we have to pay to the payment option's provider
private  java.lang.String m_minJapVersion
          JAP version since when the option does work (for non-generic options)
private  java.lang.String m_name
          Option name
private  java.util.Vector m_paymentDelays
          Content: String[2], [0] is a message telling the user about the delay until his account is credited after payment, [1] the language identifier, e.g.
private  java.util.Hashtable m_ranks
          key: language, value: rank as Integer > 0, lower number for rank means higher priority
private  java.lang.String m_type
          Option type (active|passive)
static int MAX_CLICKS_UNLIMITED
           
static java.lang.String OPTION_ACTIVE
           
static java.lang.String OPTION_MIXED
           
static java.lang.String OPTION_PASSIVE
           
private static java.lang.String XML_ATTR_MAXCLICKS
           
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
XMLPaymentOption()
           
XMLPaymentOption(org.w3c.dom.Document document)
           
XMLPaymentOption(org.w3c.dom.Element xml)
           
XMLPaymentOption(java.lang.String xml)
           
XMLPaymentOption(java.lang.String a_name, java.lang.String a_type)
           
XMLPaymentOption(java.lang.String a_name, java.lang.String a_type, boolean a_generic)
           
XMLPaymentOption(java.lang.String a_name, java.lang.String a_type, boolean a_generic, java.lang.String a_japVersion)
           
XMLPaymentOption(java.lang.String a_name, java.lang.String a_type, boolean a_generic, java.lang.String a_japVersion, int a_markup)
           
 
Method Summary
 void addDetailedInfo(java.lang.String a_info, java.lang.String a_language)
           
 void addExtraInfo(java.lang.String a_info, java.lang.String a_type, java.lang.String a_language)
           
 void addHeading(java.lang.String a_heading, java.lang.String a_language)
           
 void addInputField(java.lang.String a_reference, java.lang.String a_label, java.lang.String a_language)
           
private static void addLanguage(java.lang.String lang)
           
 void addPaymentDelay(java.lang.String a_delayString, java.lang.String a_language)
           
 void addRank(int a_rank, java.lang.String a_language)
           
 java.lang.String getDetailedInfo(java.lang.String a_langShort)
           
 java.lang.String getExtraInfo(java.lang.String a_langShort)
           
 java.util.Vector getExtraInfos()
          getExtraInfos
 java.lang.String getExtraInfoType(java.lang.String a_langShort)
           
 java.lang.String getHeading(java.lang.String a_langShort)
          getHeading
 java.util.Vector getInputFields()
           
 java.util.Vector getLanguages()
           
 java.util.Vector getLocalizedExtraInfoText(java.lang.String language)
          getLocalizedExtraInfoText like getExtraInfos(), except: - only returns "info", without type (so you can get Strings from the Vector directly instead of an Array) - only in the given language (so you don't have to iterate over the Vector to get one language's strings) (after Jap version 0.08.101, will fall back to english if no extra infos at all were found for the given language) Warning: extraInfos that do not exist for the given language will not be returned at all (ideally, we'd fall back to english, but the data structures used don't allow figuring out which extraInfos are equivalents in different languages)
 int getMarkup()
           
 java.lang.String getMinJapVersion()
           
 java.lang.String getName()
           
 java.lang.String getPaymentDelay(java.lang.String a_langShort)
           
 java.lang.Integer getRank(java.lang.String a_langShort)
           
 java.lang.String getType()
           
 boolean isGeneric()
           
 boolean isNewer(XMLPaymentOption a_paymentOption)
           
 void setImageLink(java.lang.String a_link)
           
 void setType(java.lang.String a_type)
           
protected  void setValues(org.w3c.dom.Element elemRoot)
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 boolean worksWithJapVersion(java.lang.String a_version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CLICKS_UNLIMITED

public static final int MAX_CLICKS_UNLIMITED
See Also:
Constant Field Values

OPTION_ACTIVE

public static final java.lang.String OPTION_ACTIVE
See Also:
Constant Field Values

OPTION_PASSIVE

public static final java.lang.String OPTION_PASSIVE
See Also:
Constant Field Values

OPTION_MIXED

public static final java.lang.String OPTION_MIXED
See Also:
Constant Field Values

EXTRA_TEXT

public static final java.lang.String EXTRA_TEXT
See Also:
Constant Field Values

EXTRA_LINK

public static final java.lang.String EXTRA_LINK
See Also:
Constant Field Values

EXTRA_PHONE

public static final java.lang.String EXTRA_PHONE
See Also:
Constant Field Values

XML_ATTR_MAXCLICKS

private static final java.lang.String XML_ATTR_MAXCLICKS
See Also:
Constant Field Values

EXCEPTION_WRONG_XML_STRUCTURE

private static final java.lang.String EXCEPTION_WRONG_XML_STRUCTURE
See Also:
Constant Field Values

m_languages

private static java.util.Vector m_languages

m_name

private java.lang.String m_name
Option name


m_type

private java.lang.String m_type
Option type (active|passive)


m_markup

private int m_markup
percentage of a user's payment that we have to pay to the payment option's provider


m_generic

private boolean m_generic
Generic option? should be true, unless you plan to have JAP provide a special input form for this option


m_headings

private java.util.Vector m_headings
This vector takes String[2] arrays while the first element is the heading and the second element is the language identifier. E.g.: {"Money Transfer", "en"}


m_detailedInfos

private java.util.Vector m_detailedInfos
Same explanation as m_headings


m_ranks

private java.util.Hashtable m_ranks
key: language, value: rank as Integer > 0, lower number for rank means higher priority


m_paymentDelays

private java.util.Vector m_paymentDelays
Content: String[2], [0] is a message telling the user about the delay until his account is credited after payment, [1] the language identifier, e.g. {"2-3 business days", "en"}


m_extraInfos

private java.util.Vector m_extraInfos
This vector takes String[3] arrays. First element: Extra payment info like account number. Second element: type. Third element: Language.


m_inputFields

private java.util.Vector m_inputFields
This vector takes input fields. First element: reference, second element: label, third element: language


m_imageLink

private java.lang.String m_imageLink
A link to an image


m_minJapVersion

private java.lang.String m_minJapVersion
JAP version since when the option does work (for non-generic options)

Constructor Detail

XMLPaymentOption

public XMLPaymentOption(java.lang.String xml)
                 throws java.lang.Exception
Throws:
java.lang.Exception

XMLPaymentOption

public XMLPaymentOption()

XMLPaymentOption

public XMLPaymentOption(java.lang.String a_name,
                        java.lang.String a_type,
                        boolean a_generic)

XMLPaymentOption

public XMLPaymentOption(java.lang.String a_name,
                        java.lang.String a_type,
                        boolean a_generic,
                        java.lang.String a_japVersion)

XMLPaymentOption

public XMLPaymentOption(java.lang.String a_name,
                        java.lang.String a_type,
                        boolean a_generic,
                        java.lang.String a_japVersion,
                        int a_markup)

XMLPaymentOption

public XMLPaymentOption(java.lang.String a_name,
                        java.lang.String a_type)

XMLPaymentOption

public XMLPaymentOption(org.w3c.dom.Element xml)
                 throws java.lang.Exception
Throws:
java.lang.Exception

XMLPaymentOption

public XMLPaymentOption(org.w3c.dom.Document document)
                 throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

addHeading

public void addHeading(java.lang.String a_heading,
                       java.lang.String a_language)

addDetailedInfo

public void addDetailedInfo(java.lang.String a_info,
                            java.lang.String a_language)

addRank

public void addRank(int a_rank,
                    java.lang.String a_language)

addPaymentDelay

public void addPaymentDelay(java.lang.String a_delayString,
                            java.lang.String a_language)

addExtraInfo

public void addExtraInfo(java.lang.String a_info,
                         java.lang.String a_type,
                         java.lang.String a_language)

addInputField

public void addInputField(java.lang.String a_reference,
                          java.lang.String a_label,
                          java.lang.String a_language)

setImageLink

public void setImageLink(java.lang.String a_link)

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Description copied from interface: IXMLEncodable
Return an element that can be appended to the document. This Method must not change the document in any way!

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the interface as xml element

setValues

protected void setValues(org.w3c.dom.Element elemRoot)
                  throws java.lang.Exception
Throws:
java.lang.Exception

setType

public void setType(java.lang.String a_type)

getHeading

public java.lang.String getHeading(java.lang.String a_langShort)
getHeading

Parameters:
a_langShort - String
Returns:
String: heading int the specified language (if not found: returns English heading)

getDetailedInfo

public java.lang.String getDetailedInfo(java.lang.String a_langShort)

getRank

public java.lang.Integer getRank(java.lang.String a_langShort)
Parameters:
a_langShort - String
Returns:
int: the option's rank for the given language, or NULL if not set (does NOT fall back to the rank for english, or default values - if no rank is set for this language, we want the comparator to notice, so it won't compare one option's proper rank to the second's option rank for English) special case: no rank set for english -> will return Integer.MAX_VALUE

getPaymentDelay

public java.lang.String getPaymentDelay(java.lang.String a_langShort)

getExtraInfo

public java.lang.String getExtraInfo(java.lang.String a_langShort)

getExtraInfos

public java.util.Vector getExtraInfos()
getExtraInfos

Returns:
Vector: all Extrainfos, elements of the Vector are String[3] = { "info", "type", "lang"}

getLocalizedExtraInfoText

public java.util.Vector getLocalizedExtraInfoText(java.lang.String language)
getLocalizedExtraInfoText like getExtraInfos(), except: - only returns "info", without type (so you can get Strings from the Vector directly instead of an Array) - only in the given language (so you don't have to iterate over the Vector to get one language's strings) (after Jap version 0.08.101, will fall back to english if no extra infos at all were found for the given language) Warning: extraInfos that do not exist for the given language will not be returned at all (ideally, we'd fall back to english, but the data structures used don't allow figuring out which extraInfos are equivalents in different languages)

Parameters:
language - 2-letter code for the expected language
Returns:
Vector: all Extrainfos for given language as String (empty Vector if nothing set for the given language)

getType

public java.lang.String getType()

getName

public java.lang.String getName()

getExtraInfoType

public java.lang.String getExtraInfoType(java.lang.String a_langShort)

getInputFields

public java.util.Vector getInputFields()

getLanguages

public java.util.Vector getLanguages()

isGeneric

public boolean isGeneric()

getMarkup

public int getMarkup()

getMinJapVersion

public java.lang.String getMinJapVersion()

isNewer

public boolean isNewer(XMLPaymentOption a_paymentOption)

worksWithJapVersion

public boolean worksWithJapVersion(java.lang.String a_version)

addLanguage

private static void addLanguage(java.lang.String lang)