The PaymentSdk is the main entry point for the SDK. Connection management is handled by this component.
UseDevice(PsdkDeviceInformation device, boolean saveDevice)¶
Sets/Removes this device as the one to use for future connections.
Allows adding new listeners for events.
listener – A listener for events.
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(). Returns false value in case any errors were encountered during log configuration. Log file size beyond maximal value of 500MiB or under minimal value of 1KiB will be ignored and the closest allowed value will be used instead. Such case will produce false result however the log will be switched to be written to filename in parameter.
public static boolean
configureLogFileWithRotation(String filename, long size, long rotate)¶
Sets the filename (including path), maximum size (in KiB) and number of rotated files for the log. On reaching maximum size the current log file will be renamed to .1 index moving the existing .1 file to .2 index and so on, up to the number supplied as rotate parameter Returns false value in case any errors were encountered during log configuration. Log file size beyond maximal value of 500MiB or under minimal value of 1KiB will be ignored and the closest allowed value will be used instead. Such case will produce false result however the log will be switched to be written to filename in parameter.
public static void
Sets the log verbosity to desired level
public static PaymentSdkInterface
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.
Get AccessibilityManager for this session. Must have called setupSession successfully prior to making this call
Simply returns the cached information about the device, does not perform any type of query to the device.
Get TransactionManager for this session Must have called setupSession successfully prior to making this call
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.
below are listed possible return status codes for different init scenarios Device not on the network -
StatusCode.DEVICE_NOT_FOUNDWrong device connection parameters -
StatusCode.DEVICE_NOT_FOUNDDevice not listening on port -
StatusCode.DEVICE_NOT_FOUNDDevice not using expected protocol -
StatusCode.CONFIGURATION_REQUIREDDevice already initialized -
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(CommerceListener2 listener, HashMap<String, String> config)¶
Initializes the SDK using a parameter map passed into the method.
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.
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.
listener – A registered listener for the session events.
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.