Logo
Api reference

NGHeadlessService

NGHeadlessService

Overview

The NGHeadlessService 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 NGPoiRequest.

Parameters

NameTypeRequiredDescription
actionNGPoiRequestRequiredThe point of interaction request.

Returns

TypeDescription
Result<Transaction>The result of the transaction creation.

Usage

// in coroutine scope
val voidAction = NGPoiRequest.ActionVoid("tran_123456")
val actionResult = NGHeadlessService.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

NameTypeRequiredDescription
referenceReferencableRequiredThe reference to identify the transaction.

Returns

TypeDescription
Result<Transaction>The result of the transaction retrieval.

Usage

// in coroutine scope

val tranId = Referencable.TranId("tran_123456")
val getTranByTranId = NGHeadlessService.getTransaction(tranId)
// Result<Transaction>

val posReference = Referencable.PosReference("your-pos-reference")
val getTranByPosReference = NGHeadlessService.getTransaction(posReference)
// Result<Transaction>

On this page