Mobile SDK
Android
Configuration
6 min
toro config the toro sdk can be configured using the toroconfig class the default configuration is as follows data class toroconfig( / the mode in which to capture payments `automatic` (default) the payment will be captured automatically when sent for authorisation `manual` the payment will need to be captured later manually / val capturemode capturemode = capturemode automatic, / whether to collect geolocation data for transactions `false` (default) geolocation data will not be collected `true` geolocation data will be collected / val collectgeolocation boolean = false, / whether to enable gratuity for transactions `false` (default) gratuity will not be enabled `true` gratuity will be enabled / val gratuityenabled boolean = false, / the options for gratuity percentages `\[0, 10, 15, 20]` (default) the options will be 0%, 10%, 15%, and 20% / val gratuitypercentages mutablelist\<int> = mutablelistof(0, 10, 15, 20), / the mode in which to capture signatures `device` (default) the signature will be captured on the miura device (e g ped) if the device does not support signature capture an \[toroexception devicenotsupported] will be thrown `app` the signature will always be captured in the app / val signaturemode signaturemode = signaturemode device, / the mode in which to connect to the miura device `bluetooth` (default) the miura device will be connected using bluetooth `usb` the miura device will be connected using usb usb serial must be enabled on the device / val connectionmode connectionmode = connectionmode bluetooth, / whether to allow partial approvals for transactions default is false / val allowpartialapprovals boolean = false, / use this to override strings used in messages displayed on the device and in the signatureactivity / val strings torostrings = torostrings(), / maximum time to wait for a response from the toro gateway / val gatewaytimeoutseconds long = 30l, / the passphrase used to generate macs for requests sent to the toro gateway / val passphrase string? = null, / the policy for verifying and generating security trailers / val securitytrailerpolicy securitytrailerpolicy = securitytrailerpolicy verify and generate, / merchant details / val merchant merchantconfig, / whether to preserve the session after a transaction ends when false (default), the session is automatically closed when oncomplete, oncancel, or onerror is called when true, the session remains open and must be manually closed using closesession() / val preservesessionontransactionend boolean = false ) to set the configuration on app initialisation, the toroclient constructor takes a toroconfig instance as its second parameter val toro = toroclient(applicationcontext, toroconfig( )) the toroconfig can also be updated during runtime using the setconfig method toro setconfig(toroconfig( ))toro setconfig(new toroconfig( )); the config cannot be updated when a transaction is in progress doing so will result in an illegalstateexception being thrown string customisation the sdk allows integrators to customise all user facing text through the strings property in toroconfig this includes messages displayed directly on the ped, as well is in the built in signatureactivity val config = toroconfig( strings = torostrings( // messages presented on ped processingmagswipetransaction = "kártya feldolgozása ", uploadingconfigfiles = "konfigurációs fájlok feltöltése ", entersignaturepos = "adja meg aláírását a pos terminálon", // other ped messages here // signatureactivity signatureheading = "aláírás szükséges", signatureclear = "törlés", signaturecancel = "mégsem" // other strings here ) ) this allows integrators to support different languages for their application all strings have default english values if not specified otherwise note that some messages displayed on the ped are determined by the configuration files stored directly on them, such as pin entry messages to amend these you will need to consult the miura documentation, one such configuration file is mpi dynamic cfg logging the toroclient automatically selects an appropriate logger based on your build variant debug builds use debuglogger by default, which logs helpful messages using the android log class release builds use mutedlogger by default, which disables logging entirely to prevent sensitive information leaks you can override this default behavior by implementing the torologger interface and passing your own logger to the toroclient constructor class customlogger torologger { override fun d(message string) { savelogmessage("debug", message) } override fun i(message string) { savelogmessage("info", message) } override fun w(message string) { savelogmessage("warning", message) } override fun e(message string, e toroexception) { savelogmessage("error", message, e) } } toroclient(applicationcontext, toroconfig(), customlogger())public class customlogger implements torologger { @override public void d(@nonnull string message) { savelogmessage("debug", message); } @override public void i(@nonnull string message) { savelogmessage("info", message); } @override public void w(@nonnull string message) { savelogmessage("warning", message); } @override public void e(@nonnull string message, toroexception e) { savelogmessage("error", message, e); } } new toroclient( applicationcontext, new toroconfig(), miuramanager getinstance(), new customlogger() ); this way you can retain logs for monitoring and debugging purposes in production, which is highly recommended please be cautious with logging in production as it can potentially leak sensitive information
