| java.lang.Object com.sun.j2me.payment.PaymentAdapter
All known Subclasses: com.sun.j2me.payment.PPSMSAdapter,
PaymentAdapter | abstract public class PaymentAdapter implements TransactionProcessor(Code) | | This class represents an adapter which is responsible for handling of
transactions with an assigned provider. Each instance should be responsible
for some provider specific payment method (one instance of premium priced
SMS adapter for each PPSMS provider).
version: 1.3 |
Method Summary | |
abstract public String | getDisplayName() Returns a display name for this particular adapter. | public String | getPaymentQuestion(String provider, double price, String currency) Returns a question which is used for this adapter instance when the
user chooses between providers for the particular payment. | final protected void | preemptDisplay(SecurityToken token, Displayable nextDisplayable) Replaces the current Displayable with the new one if the
nextDisplayable is not null or it recovers
the previous Displayable if the nextDisplayable
is null . | public Transaction | process(Transaction transaction) Processes the given transaction, updates its state and returns the same
transaction instance or a new one (an instance of
a Transaction subclass), which is based on the old
transaction, but adds more (adapter specific) information to it.
The current implementation fails any transaction with the
Transaction.ASSIGNED state, so it has to be overriden to
work properly. | public void | validatePriceInfo(double price, String paySpecificPriceInfo) Validates the price information which are specified in the application
manifest file for the provider handled by this adapter. |
getDisplayName | abstract public String getDisplayName()(Code) | | Returns a display name for this particular adapter. It should represent
a payment method (premium priced sms, credit card...).
the display name |
getPaymentQuestion | public String getPaymentQuestion(String provider, double price, String currency)(Code) | | Returns a question which is used for this adapter instance when the
user chooses between providers for the particular payment.
Parameters: provider - the application supplied provider name Parameters: price - the price to pay when using the provider Parameters: currency - the currency of the payment the question to ask (Are you sure, you want to buy this feature...) |
preemptDisplay | final protected void preemptDisplay(SecurityToken token, Displayable nextDisplayable)(Code) | | Replaces the current Displayable with the new one if the
nextDisplayable is not null or it recovers
the previous Displayable if the nextDisplayable
is null .
Parameters: token - a security token, which allows preempting Parameters: nextDisplayable - the Displayable to show or null if the recovery of the old Displayable is requested |
process | public Transaction process(Transaction transaction)(Code) | | Processes the given transaction, updates its state and returns the same
transaction instance or a new one (an instance of
a Transaction subclass), which is based on the old
transaction, but adds more (adapter specific) information to it.
The current implementation fails any transaction with the
Transaction.ASSIGNED state, so it has to be overriden to
work properly. It also sets the transaction processor of the given
transaction to the payment module instance. It's recomended to call
this method from the overriden one for every unhandled transaction
(with the state, which can't be further processed in the adapter).
It ensures that the control over the transaction will return to the
payment module.
Parameters: transaction - the transaction to be processed the transaction after processing |
validatePriceInfo | public void validatePriceInfo(double price, String paySpecificPriceInfo) throws PaymentException(Code) | | Validates the price information which are specified in the application
manifest file for the provider handled by this adapter. It throws an
PaymentException if the parameters are incorrect.
Parameters: price - the price to pay when using this provider Parameters: paySpecificPriceInfo - the specific price information string from the manifest throws: PaymentException - if the provided information is correct |
|
|