NGHeadlessSetup
NGHeadlessSetup
Overview
The NGHeadlessSetup object provides essential methods for initializing and configuring the SoftPOS. This includes setting up EMV parameters, CAPKs, terminal parameters and keys.
Methods
initSoftPos
This is a suspended method and should be called within a coroutine.
Initializes the SoftPOS SDK. This method should be called each time the application starts up (for example, in the Application's onCreate).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| app | Application | Required | The application instance. |
| licenseFileName | String | Required | The name of the license file. |
Returns
| Type | Description |
|---|---|
NGWrappedResult<SdkInitResp> | A wrapped result containing the SDK version and ID. |
Usage
val initResult = NGHeadlessSetup.initSoftPos(application, "license_file_name")
// Success(value=SdkInitResp(sdkVersion=1.10.105.12.17, sdkId=4411be126c0c91b7))initialSetup
This is a suspended method and should be called within a coroutine.
Performs the initial setup for the SoftPOS. This method should be called once per app installation.
Parameters
| Name | Type | Description |
|---|---|---|
| context | Context | The application or activity context. |
| builderAction | (SetupOptionBuilder.() -> Unit)? | Optional configuration for the setup options. |
Returns
| Type | Description |
|---|---|
SetupResp | The setup response containing the results of the setup process. |
Usage
// with default option
val setupResult1 = NGHeadlessSetup.initialSetup(context)
// with test capk
val setupResult2 = NGHeadlessSetup.initialSetup(context) {
withTestCapk = true
}getEmvParams
Retrieves the list of configured EMV parameters.
Returns
| Type | Description |
|---|---|
List<EmvParam> | A list of EMV parameters. |
Usage
val emvParams = NGHeadlessSetup.getEmvParams()getCapks
Retrieves the list of configured CAPKs.
Returns
| Type | Description |
|---|---|
List<CapkParam> | A list of CAPKs. |
Usage
val capks = NGHeadlessSetup.getCapks()getTermParam
Retrieves the terminal parameters.
Returns
| Type | Description |
|---|---|
TerminalParam | The terminal parameters. |
Usage
val termParam = NGHeadlessSetup.getTermParam()Data Classes
SetupResp
Represents the setup response.
Properties
| Name | Type | Description |
|---|---|---|
| sdkRes | NGWrappedResult<SdkInitResp> | The SDK initialization result. |
| emvRes | List<NGWrappedResult<EmvParamResp>> | The EMV setup results. |
| capkRes | List<NGWrappedResult<CapkResp>> | The CAPK setup results. |
| termRes | NGWrappedResult<TermParamResp> | The terminal setup result. |
| keyRes | List<NGWrappedResult<InjectKeyResp>> | The key setup results. |
SdkInitResp
Represents the SDK initialization response.
Properties
| Name | Type | Description |
|---|---|---|
| sdkVersion | String | The SDK version. |
| sdkId | String | The SDK ID. |
EmvParamResp
Represents the EMV parameter response.
Properties
| Name | Type | Description |
|---|---|---|
| aid | String | The AID of the EMV parameter. |
CapkResp
Represents the CAPK response.
Properties
| Name | Type | Description |
|---|---|---|
| rid | String | The RID of the CAPK. |
| keyIndex | Int | The key index of the CAPK. |
TermParamResp
Represents the terminal parameter response.
Properties
| Name | Type | Description |
|---|---|---|
| terminalType | String | The terminal type. |
InjectKeyResp
Represents the injected key response.
Properties
| Name | Type | Description |
|---|---|---|
| clientKeyType | String | The client key type. |