PaymentSdkInterface

public class PaymentSdkInterface

The PaymentSdk is the main entry point for the SDK. Connection management is handled by this component.

Methods

UseDevice

public void UseDevice(PsdkDeviceInformation device, boolean saveDevice)

Sets/Removes this device as the one to use for future connections.

addListener

public void addListener(CommerceListener2 listener)

Allows adding new listeners for events.

Parameters:
  • listener – A listener for events.

configureLogFile

public static boolean configureLogFile(String filename, long size)

Sets the filename (including path) and maximum size (in KiB) for the log. The log will be truncated on reaching maximum size. Can be called before Initialize().

configureLogLevel

public static void configureLogLevel(PsdkLogLevel level)

Sets the log verbosity to desired level

create

public static PaymentSdkInterface create(PlatformContextInterface platformContext)

displayConfiguration

public void displayConfiguration(CommerceListener2 listener)

Displays the current configuration, or launches the setup wizard if setup is required. This is useful both when handling StatusCode.SetupRequired and displaying a general settings screen. This should be overridden by a method that also accepts the appropriate context/controller to display the setup screens, or returns the controller to be pushed onto the stack, this method is only provided to require subclasses to implement the necessary command, and should be hidden or restricted from being called directly.

getAccessibilityManager

public AccessibilityManager getAccessibilityManager()

Get AccessibilityManager for this session. Must have called setupSession successfully prior to making this call

getDeviceInformation

public PsdkDeviceInformation getDeviceInformation()

Simply returns the cached information about the device, does not perform any type of query to the device.

getTransactionManager

public TransactionManager getTransactionManager()

Get TransactionManager for this session Must have called setupSession successfully prior to making this call

getVersion

public static String getVersion()

initialize

public void initialize(CommerceListener2 listener)

Initializes the SDK, checking that the configuration is correct and the Engage device is configured and reachable. The listener receives a Status with type Status.STATUS_INITIALIZED. Expect StatusCode.SetupRequired to be sent if the device is not configured. Internally, create the platform context, coordinator, load the configuration, and initialize the various modules such as transport, payment adapter, and navigator.

initializeFromFile

public void initializeFromFile(CommerceListener2 listener, String path)

Initializes the SDK using the values read from the file combined with the values configured by the user and detected by the system. It’s important that the application already has the necessary permissions to read this file, the SDK will only try to read it directly. The file must be configured according to the configuration file documentation.

initializeFromValues

public void initializeFromValues(CommerceListener2 listener, HashMap<String, String> config)

Initializes the SDK using a parameter map passed into the method.

initializeWithConnection

public void initializeWithConnection(CommerceListener2 listener, HashMap<String, String> config, ConnectionInterface connection)

Initializes the SDK using a parameter map passed into the method and using the provided connection.

removeListener

public void removeListener(CommerceListener2 listener)

Removes a listener. The last listener cannot be removed through this method, as there must always be a listener until the PSDK is torn down.

Parameters:
  • listener – A registered listener for the session events.

tearDown

public void tearDown()

Teardown the session and all associated connections. Any objects that were returned from methods like getTransactionManager() will also be torn down after this call and any remaining references should not be used.