HeadlessService
Overview
The HeadlessService object provides some methods for performing network action, such as requesting actions or retrieving transactions.
The service would fetch the request provided in the background and return the result. No UI will be shown.
Methods
createAction
This is a suspended method and should be called within a coroutine.
Creates an action using the provided PoiRequest.
Parameters
| Name | Type | Condition | Description |
|---|---|---|---|
action | PoiRequest | Required | The point of interaction request. |
Returns
| Return Type | Description |
|---|---|
Result<Transaction> | The result of the transaction creation. |
Usage
// in coroutine scope
val voidAction = PoiRequest.ActionVoid("tran_123456")
val actionResult = HeadlessService.createAction(voidAction)
// Result<Transaction>getTransaction
This is a suspended method and should be called within a coroutine.
Retrieves a transaction based on the provided reference.
Parameters
| Name | Type | Condition | Description |
|---|---|---|---|
reference | Referencable | Required | The reference to identify the transaction. |
Returns
| Return Type | Description |
|---|---|
Result<Transaction> | The result of the transaction retrieval. |
Usage
// in coroutine scope
val tranId = Referencable.TranId("tran_123456")
val getTranByTranId = HeadlessService.getTransaction(tranId)
// Result<Transaction>
val posReference = Referencable.PosReference("your-pos-reference")
val getTranByPosReference = HeadlessService.getTransaction(posReference)
// Result<Transaction>