Methods Summary |
---|
protected abstract void | checkForPermission(int permission, java.lang.String name)Ensures that the MIDlet will have required privileges to do a protected
operation.
|
public void | deliverMissedTransactions()Makes the payment module to notify the listener about the MIDlet
transactions which the listener couldn't have been notified about before
(the MIDlet crashed or ended before the notification could take place).
if (listener == null) {
throw new TransactionListenerException();
}
TransactionRecord[] allMissed = getMissedTransactions();
if (allMissed != null) {
PaymentModule.getInstance().addTransactionsForNotification(
allMissed, this);
}
|
protected abstract int | getApplicationID()Returns the MIDlet payment ID that can be used to store transaction
records for the MIDlet initiated transactions into the transaction store.
|
final javax.microedition.payment.TransactionListener | getListener()Returns the transaction listener.
return listener;
|
public final javax.microedition.midlet.MIDlet | getMIDlet()Returns the MIDlet.
return midlet;
|
protected javax.microedition.payment.TransactionRecord[] | getMissedTransactions()Returns an array of the missed transactions associated with the MIDlet
suite.
int applicationID = getApplicationID();
TransactionStore transactionStore =
PaymentModule.getInstance().getTransactionStore();
TransactionRecord[] allMissed = null;
try {
allMissed = transactionStore.getMissedTransactions(applicationID);
} catch (IOException e) {
}
return allMissed;
|
protected javax.microedition.payment.TransactionRecord[] | getPassedTransactions()Returns an array of the passed transactions associated with the MIDlet
suite.
int applicationID = getApplicationID();
TransactionStore transactionStore =
PaymentModule.getInstance().getTransactionStore();
TransactionRecord[] allPassed = null;
try {
allPassed = transactionStore.getPassedTransactions(applicationID);
} catch (IOException e) {
}
return allPassed;
|
public final javax.microedition.payment.TransactionRecord[] | getPastTransactions(int max)Returns an array of TransactionRecord objects that
represent the past transactions, initiated by the MIDlet and about whose
final state the MIDlet has been already notified.
if (max == 0) {
return null;
}
TransactionRecord[] allPassed = getPassedTransactions();
if ((allPassed == null) || (allPassed.length <= max)) {
return allPassed;
}
TransactionRecord[] truncated = new TransactionRecord[max];
System.arraycopy(allPassed, 0, truncated, 0, max);
return truncated;
|
protected abstract PaymentInfo | getPaymentInfo()Returns the payment provisioning information associated with the MIDlet.
|
public final int | process(int featureID, java.lang.String featureTitle, java.lang.String featureDescription, byte[] payload)Initiates a new payment transaction from the given input values.
// check for the javax.microedition.payment.process permission
try {
checkForPermission(Permissions.PAYMENT, null);
} catch (InterruptedException e) {
throw new SecurityException();
}
// null featureTitle or featureDescription
if ((featureTitle == null) || (featureDescription == null)) {
throw new TransactionModuleException("The " +
((featureTitle == null) ?
"featureTitle" : "featureDescription") + " is null");
}
// empty featureTitle or featureDescription
if ((featureTitle.length() == 0) ||
(featureDescription.length() == 0)) {
throw new TransactionModuleException("The " +
((featureTitle.length() == 0) ?
"featureTitle" : "featureDescription") + " is empty");
}
// payload limit exceeded
if ((payload != null) && (payload.length > PAYLOAD_LIMIT)) {
throw new TransactionPayloadException();
}
// invalid feature ID
if ((featureID < 0) ||
(featureID >= getPaymentInfo().getNumFeatures())) {
throw new TransactionFeatureException();
}
// listener hasn't been set
if (listener == null) {
throw new TransactionListenerException();
}
return PaymentModule.getInstance().addTransaction(this, featureID,
featureTitle, featureDescription, payload);
|
protected abstract void | savePaymentInfo()Stores the payment provisioning information associated with the MIDlet.
|
public final synchronized void | setListener(javax.microedition.payment.TransactionListener listener)Sets the listener which should be notified about finishing of
transactions or removes the listener which has been set before if
listener is null .
this.listener = listener;
|