Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Basic transaction
A basic OLA transaction includes the following steps:
...
Code Block |
---|
private fun doTransaction(): OlaError { Log.v("Transaction", "doTransaction - buildCandidateList") val nbCandidatesHolder = SingleObjectHolder<Int>() var ret = contactless.buildCandidateList(nbCandidatesHolder) if (ret != OlaError.OLA_OK) { Outcome.showOutcome(contactless, ret) } Log.v("Transaction", "doTransaction - nb of candidates: ${nbCandidatesHolder.get()}") Log.v("Transaction", "doTransaction - finalSelectCandidate") val kernel_id_holder = SingleObjectHolder<Byte>() ret = contactless.finalSelectCandidate(1, kernel_id_holder) if (ret != OlaError.OLA_OK) { Outcome.showOutcome(contactless, ret) } Log.v("Transaction", "doTransaction - doTransaction") ret = contactless.doTransaction() Outcome.showOutcome(contactless, ret) if (ret == OlaError.OLA_OK) { val bytesHolder = SingleObjectHolder<ByteArray>() for (olaTag in batch) { val result = emv.getTag(olaTag, bytesHolder) if (result == OlaError.OLA_OK) { Log.v("Transaction", "doTransaction - result for getTag(): $result => " + Utils.bytesToHex(bytesHolder.get())) } else { Log.v("Transaction", "doTransaction - result for getTag(): $result => tag missing") } } } Log.d("Transaction", "doTransaction - **** REMOVE CARD **** ") contactless.clean(); return ret } |
Outcome and errors management
At the end of a transaction, the OlaOutcomeParameter
structure should be retrieved for analysis. To retrieve the outcome, use the following code:
Code Block |
---|
val olaOutcomeParameterHolder = Holders.SingleObjectHolder<OlaOutcomeParameter>()
val ret = agnos.olaContactlessGetOutcome(olaOutcomeParameterHolder)
val olaOutcomeParameter = olaOutcomeParameterHolder.get() |
Please refer to the Javadoc/Kotlindoc for more information on the OlaOutcomeParameter class.
The first element to verify is the value of the outcome
member. In a Tap to Phone environement, its value should be either of the following:
SelectNext,
TryAgain,
Declined
OnlineRequest,
EndApplication
The transaction should never be accepted offline.
EndApplication outcome
In case the outcome is EndApplication, the application should look into OlaErrorIndicator
element to understand what possibly caused the premature end of the transaction. To retrieve that information, one should use the following API:
Code Block |
---|
val olaErrorIndicatorHolder = Holders.SingleObjectHolder<OlaErrorIndicator>()
val ret = agnos.olaContactlessGetErrorIndicator(olaErrorIndicatorHolder)
val olaErrorIndicator: OlaErrorIndicator = errorHolder.get() |
The OlaErrorIndicator
class contains different levels of errors represented by the following members:
Code Block |
---|
OlaErrorL2 errorL2
OlaErrorL3 errorL3 |
Only one of them can be filled at once.
Please refer to the Javadoc/Kotlindoc for more information on the OlaErrorL2 and OlaErrorL3 values.