### Start Onboarding (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/index Launches the 'Welcome' application if it is installed and the terminal is deactivated. This function does not take any parameters and returns void. ```kotlin abstract fun startOnBoarding() ``` -------------------------------- ### Start Onboarding (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Launches the 'Welcome' application if installed and the terminal is deactivated. This function does not require parameters. ```kotlin open override fun startOnBoarding() ``` -------------------------------- ### Start Onboarding with PlugPag Wrapper (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/start-on-boarding Initiates the 'Welcome' application if it's installed and the terminal is deactivated. This function requires an Android Context and an instance of IPlugPagWrapper. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag fun startOnBoardingProcess(context: Context) { val plugPag: IPlugPagWrapper = PlugPag(context) plugPag.startOnBoarding() } ``` -------------------------------- ### Start Onboarding with PlugPagWrapper in Kotlin Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/start-on-boarding This Kotlin code snippet demonstrates how to initiate the 'Welcome' application using the `startOnBoarding` method from the `IPlugPagWrapper` interface. It requires an Android `Context` and an instance of `PlugPag` initialized with it. The function is designed to be called when the terminal is deactivated and the application is installed. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag fun startOnBoarding(context: Context) { val plugPag: IPlugPagWrapper = PlugPag(context) plugPag.startOnBoarding() } ``` -------------------------------- ### Calculate Installments with PlugPag SDK (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/calculate-installments Demonstrates how to calculate payment installments using the PlugPag SDK. It initializes the IPlugPagWrapper and calls the calculateInstallments method with a sale value. The result is an iterable list of installment options. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag fun calculateInstallmentsExample(context: Context) { val plugPag: IPlugPagWrapper = PlugPag(context) val saleValue = "2000" // Example sale value in cents val installments = plugPag.calculateInstallments(saleValue = saleValue) installments.forEach { installment -> // Process each installment option println("Installment: ${installment.value}, Number: ${installment.number}") } } ``` -------------------------------- ### startOnBoarding Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/start-on-boarding Executes the 'Welcome' application if it is installed and the terminal is disabled. ```APIDOC ## POST /startOnBoarding ### Description Executes the 'Welcome' application if it is installed and the terminal is disabled. ### Method POST ### Endpoint /startOnBoarding ### Parameters #### Query Parameters - **context** (Context) - Required - The Android application context. ### Request Body This endpoint does not require a request body. ### Request Example ```kotlin val plugPag: IPlugPagWrapper = PlugPag(context) plugPag.startOnBoarding() ``` ### Response #### Success Response (200) This endpoint does not return a specific success response body, but it initiates the 'Welcome' application. #### Response Example (No specific JSON response body is defined for success.) #### Error Response (Non-2xx) - **PlugPagException** - Thrown if an error occurs during the execution. ``` -------------------------------- ### IWrapperOnboarding - startOnBoarding Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper.onboarding/-i-wrapper-onboarding/index Executes the 'Welcome' application if it is installed and the terminal is deactivated. ```APIDOC ## startOnBoarding ### Description Executes the 'Welcome' application if it is installed and the terminal is deactivated. ### Method [Method not specified, likely an abstract function call] ### Endpoint [Endpoint not specified] ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response [Response details not specified] #### Response Example None ``` -------------------------------- ### PlugPagPaymentData Constructor for Basic Setup (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-payment-data/index Constructs a PlugPagPaymentData object, defaulting to no partial payment, no 'carnê' type, and no establishment receipt printing. This is useful for basic payment setups. ```kotlin constructor( type: Int, amount: Int, installmentType: Int, installments: Int, userReference: String? ) ``` -------------------------------- ### Initiate PlugPag Payment Request Example Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/do-payment This snippet illustrates how to request a payment using the PlugPag SDK. It defines a PlugPagPaymentData object specifying payment type, amount, installments, and other transaction details. The doPayment method is then called, and the result is checked to determine if the sale was successful or failed. Dependencies include the PlugPag SDK and its constants for payment types and installment types. ```kotlin // Executa a solicitação de pagamento. val paymentData = PlugPagPaymentData( type = PlugPag.TYPE_CREDITO, amount = 2000, // R$ 20,00 installmentType = PlugPag.INSTALLMENT_TYPE_PARC_COMPRADOR, installments = 5, userReference = "Código da Venda", printReceipt = false, partialPay = false, isCarne = false ) val plugPagTransactionResult = plugPag.doPayment(paymentData = paymentData) if (plugPagTransactionResult.result == PlugPag.RET_OK) { // Venda efetuada com sucesso. } else { // Falha durante a execução da venda. } ``` -------------------------------- ### POST /calculateInstallments Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/calculate-installments Calculates the installment values for a given sale amount and installment type. It returns a list of PlugPagInstallment objects, each representing a calculated installment. ```APIDOC ## POST /calculateInstallments ### Description Executes the calculation of installment values for a sale. ### Method POST ### Endpoint /calculateInstallments ### Parameters #### Query Parameters - **saleValue** (String) - Required - The sale value in cents. For example, a transaction of "R$ 10.00" would have a value of 1000. - **installmentType** (Int) - Required - The type of installment. Possible values are: PlugPag.INSTALLMENT_TYPE_A_VISTA, PlugPag.INSTALLMENT_TYPE_PARC_VENDEDOR, and PlugPag.INSTALLMENT_TYPE_PARC_COMPRADOR. ### Request Example ```json { "saleValue": "2000", "installmentType": 1 } ``` ### Response #### Success Response (200) - **PlugPagInstallment** (List) - A list containing the values of each installment, where each element is an instance of PlugPagInstallment. #### Response Example ```json [ { "installmentValue": "10.00", "numberOfInstallments": 2 } ] ``` ### Deprecation This method is deprecated and will be removed in future updates. Consider using the `calculateInstallments` function with `installmentType = PlugPag.INSTALLMENT_TYPE_PARC_COMPRADOR` for buyer-side installments. ``` -------------------------------- ### Implement PlugPagInstallmentsListener for Installment Calculation Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper.listeners/-plug-pag-installments-listener/index This snippet demonstrates how to implement the PlugPagInstallmentsListener interface to handle the results of installment calculations. It includes the onCalculateInstallments and onCalculateInstallmentsWithTotalAmount methods. The onCalculateInstallments method receives an array of strings representing installment options, while onCalculateInstallmentsWithTotalAmount receives a more detailed array of PlugPagInstallment objects. ```kotlin interface PlugPagInstallmentsListener { fun onCalculateInstallments(installments: Array) fun onCalculateInstallmentsWithTotalAmount(installmentsWithTotalAmount: Array) fun onError(errorMessage: String) } // Example implementation (not part of the interface definition itself) class MyInstallmentsListener : PlugPagInstallmentsListener { override fun onCalculateInstallments(installments: Array) { println("Installment options: ${installments.joinToString()}") } override fun onCalculateInstallmentsWithTotalAmount(installmentsWithTotalAmount: Array) { println("Installments with total amount: $installmentsWithTotalAmount") } override fun onError(errorMessage: String) { println("Error calculating installments: $errorMessage") } } ``` -------------------------------- ### Calculate Installments with PlugPag SDK in Android Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/async-calculate-installments Demonstrates how to calculate payment installments using the PlugPag SDK. It initializes the PlugPag wrapper, defines a listener to handle installment calculation results or errors, and then calls the asynchronous method to perform the calculation with a specified sale value. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInstallment import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagInstallmentsListener fun exampleFunction(context: Context) { val plugPag: IPlugPagWrapper = PlugPag(context) val listener = object : PlugPagInstallmentsListener { override fun onCalculateInstallments(installments: Array) { // Action to be executed upon calculating installments. } override fun onCalculateInstallmentsWithTotalAmount( installmentsWithTotalAmount: Array ) { // Action to be executed upon calculating installments with total amount. } override fun onError(errorMessage: String) { // Action to be executed when an error occurs during installment calculation. } } plugPag.asyncCalculateInstallments( saleValue = "2000", // R$ 20,00, listener = listener ) } ``` -------------------------------- ### Calculate Installments Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Calculate installment values for a purchase. ```APIDOC ## GET /plugpag/calculateInstallments ### Description Executes the calculation of installment values for a PlugPag installment type. ### Method GET ### Endpoint /plugpag/calculateInstallments ### Parameters #### Query Parameters - **saleValue** (string) - Required - The total sale value. - **installmentType** (int) - Optional - The type of installment calculation (e.g., INSTALLMENT_TYPE_PARC_COMPRADOR). ### Request Example ```json { "saleValue": "100.00", "installmentType": 1 } ``` ### Response #### Success Response (200) - **Array** or **List** - A list of calculated installment options. #### Response Example ```json { "installments": [ "10.00", "20.00" ] } ``` ``` -------------------------------- ### Instantiate PlugPagPaymentData with All Options (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-payment-data/-plug-pag-payment-data Constructs a PlugPagPaymentData object with all available configuration options. This includes payment type, amount, installment type, number of installments, user reference, receipt printing, partial payment flag, and carne payment flag. Use this for maximum flexibility. ```kotlin constructor( type: Int, amount: Int, installmentType: Int, installments: Int, userReference: String?, printReceipt: Boolean, partialPay: Boolean, isCarne: Boolean) ``` -------------------------------- ### Instantiate PlugPagPaymentData with Receipt Printing (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-payment-data/-plug-pag-payment-data Constructs a PlugPagPaymentData object specifying payment type, amount, installment type, number of installments, user reference, and whether to print the establishment's receipt. This is the most comprehensive constructor. ```kotlin constructor( type: Int, amount: Int, installmentType: Int, installments: Int, userReference: String?, printReceipt: Boolean) ``` -------------------------------- ### Create Pre-Authorized Transaction with PlugPag SDK Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/do-pre-auto-create Demonstrates how to create a pre-authorized transaction using the PlugPag SDK. It requires a context, and payment details such as amount, installment type, number of installments, user reference, and whether to print a receipt. The function returns a PlugPagTransactionResult indicating success or failure. ```kotlin import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPreAutoData import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper fun createPreAuthorizedTransaction(context: Any) { val plugPag: IPlugPagWrapper = PlugPag(context) val data = PlugPagPreAutoData( amount = 2000, // R$ 20,00 installmentType = PlugPag.INSTALLMENT_TYPE_A_VISTA, installments = PlugPag.A_VISTA_INSTALLMENT_QUANTITY, userReference = "Código da Venda", printReceipt = false, ) val plugPagTransactionResult = plugPag.doPreAutoCreate(plugPagPreAutoData = data) if (plugPagTransactionResult.result == PlugPag.RET_OK) { // Transação pré-autorizada criada com sucesso. println("Transaction successful") } else { // Falha na criação da transação pré-autorizada. println("Transaction failed") } } ``` -------------------------------- ### PlugPagPreAutoData Constructor (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-pre-auto-data/index Provides the constructor for the PlugPagPreAutoData class in Kotlin. This constructor allows for the initialization of all properties: amount, installment type, number of installments, user reference, and the print receipt option. ```kotlin constructor( amount: Int? = 0, installmentType: Int = 0, installments: Int = 0, userReference: String? = EMPTY_STRING, printReceipt: Boolean? = false ) ``` -------------------------------- ### Start Direct NFC Card Operation (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/index Executes a request to turn on the NFC system antenna. This function returns an integer status code. ```kotlin abstract fun startNFCCardDirectly(): Int ``` -------------------------------- ### Execute PlugPag Payment Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/do-payment Provides an example of initiating a payment transaction using PlugPagPaymentData. This includes specifying the payment type, amount, installments, and other transaction details. Handles the result of the payment attempt. ```kotlin // Executa a solicitação de pagamento. val paymentData = PlugPagPaymentData( type = PlugPag.TYPE_CREDITO, amount = 2000, // R$ 20,00 installmentType = PlugPag.INSTALLMENT_TYPE_PARC_VENDEDOR, installments = 5, userReference = "Código da Venda", printReceipt = false, partialPay = false, isCarne = false ) val plugPagTransactionResult = plugPag.doPayment(paymentData = paymentData) if (plugPagTransactionResult.result == PlugPag.RET_OK) { // Venda efetuada com sucesso. } else { // Falha durante a venda. } ``` -------------------------------- ### Get NFC Card Information - Kotlin Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/get-n-f-c-infos Executes a request to query information from an NFC card. This function takes the card type as an integer input and returns PlugPagNFCInfosResult. It may throw a PlugPagException if the query is unsuccessful. Refer to br.com.uol.pagseguro.samples.wrapper.nfc.getNFCInfosSample for usage examples. ```kotlin open override fun getNFCInfos(cardType: Int): PlugPagNFCInfosResult ``` -------------------------------- ### Call startOnBoarding Method (Android Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper.onboarding/-i-wrapper-onboarding/start-on-boarding This snippet shows how to call the startOnBoarding() method on an already initialized IPlugPagWrapper instance. This action triggers the 'Welcome' application. ```kotlin import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper // Assuming 'plugPag' is an initialized IPlugPagWrapper instance plugPag.startOnBoarding() ``` -------------------------------- ### Calculate Installments in PlugPagServiceWrapper Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/index Calculates installment values for a PlugPag transaction. Supports different installment types and returns a list of installment options. ```Kotlin abstract fun calculateInstallments( saleValue: String, installmentType: Int): List ``` -------------------------------- ### Event and Style Management Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Methods for setting event listeners, LED configurations, and UI styles. ```APIDOC ## SET EVENT LISTENER ### Description Define os métodos a serem chamados quando existem novos eventos de pagamento, estorno, desativação ou ativação. ### Method `setEventListener` ### Endpoint N/A (Local method call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **listener** (PlugPagEventListener) - Required - The event listener to be set. ### Request Example ```json { "listener": { "onPaymentEvent": "handlePaymentEvent", "onDeactivationEvent": "handleDeactivationEvent" } } ``` ### Response #### Success Response (Void) This method does not return a value upon successful execution. #### Response Example (No response body for success) --- ## SET LED ### Description Executa uma solicitação de definição do LED que será usado em ações que usam o mesmo. ### Method `setLed` ### Endpoint N/A (Local method call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **ledData** (PlugPagLedData) - Required - Data specifying the LED configuration. ### Request Example ```json { "ledData": { "color": "BLUE", "blinkRate": 500 } } ``` ### Response #### Success Response (Int) - **resultCode** (Int) - Result code indicating the status of the LED setting operation. #### Response Example ```json { "resultCode": 0 } ``` --- ## SET PLUG PAG CUSTOM PRINTER LAYOUT ### Description Executa a customização dos elementos da tela de impressão da via do cliente. ### Method `setPlugPagCustomPrinterLayout` ### Endpoint N/A (Local method call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **plugPagCustomPrinterLayout** (PlugPagCustomPrinterLayout) - Required - Custom layout data for the client receipt. ### Request Example ```json { "plugPagCustomPrinterLayout": { "showLogo": true, "headerText": "Company Name" } } ``` ### Response #### Success Response (Void) This method does not return a value upon successful execution. #### Response Example (No response body for success) --- ## SET STYLE DATA ### Description Executa uma solicitação de definição de cores a serem usadas no design das telas fornecidas pela PlugPagService. ### Method `setStyleData` ### Endpoint N/A (Local method call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **styleData** (PlugPagStyleData) - Required - Data defining the style and colors for PlugPagService screens. ### Request Example ```json { "styleData": { "primaryColor": "#007bff", "secondaryColor": "#6c757d" } } ``` ### Response #### Success Response (Boolean) - **result** (Boolean) - True if the style data was set successfully, false otherwise. #### Response Example ```json { "result": true } ``` ``` -------------------------------- ### Calculate Installments for Seller Installment Type in Kotlin Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/calculate-installments Executes the calculation of installment values for a seller-based installment type. It takes the sale value in cents and the installment type as input. The function returns a list of `PlugPagInstallment` objects, each representing a calculated installment. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInstallment fun main() { val plugPag: IPlugPagWrapper = PlugPag(context) val installments = plugPag.calculateInstallments( saleValue = "2000", // R$ 20,00 installmentType = PlugPag.INSTALLMENT_TYPE_PARC_VENDEDOR ) installments.forEach { parcela -> // Lista com cada valor de parcela. } } ``` -------------------------------- ### Calculate Installments Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Executes the calculation of installment values for a PlugPag.INSTALLMENT_TYPE_PARC_COMPRADOR type of installment. Overloaded to accept an installment type for more general calculation. ```Kotlin open override fun calculateInstallments(saleValue: String): Array ``` ```Kotlin open override fun calculateInstallments( saleValue: String, installmentType: Int): List ``` -------------------------------- ### Terminal Initialization and Activation Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Methods for initializing and activating the terminal, including PagBank activation. ```APIDOC ## INITIALIZE AND ACTIVATE PINPAD ### Description Executa uma solicitação de inicialização e ativação do terminal. ### Method `initializeAndActivatePinpad` ### Endpoint N/A (Local method call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **activationData** (PlugPagActivationData) - Required - Data required for terminal activation. ### Request Example ```json { "activationData": { "applicationCode": "APP123" } } ``` ### Response #### Success Response (PlugPagInitializationResult) - **success** (Boolean) - Indicates if the initialization and activation were successful. - **errorMessage** (String) - Error message if it failed. #### Response Example ```json { "success": true, "errorMessage": null } ``` --- ## INIT PAG BANK ACTIVATION ### Description Executa uma ativação através do QRCode do PagBank. ### Method `initPagBankActivation` ### Endpoint N/A (Local method call) ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (PlugPagPagBankActivationResult) - **success** (Boolean) - Indicates if the activation was successful. - **qrCode** (String) - The QR code generated for activation. - **errorMessage** (String) - Error message if activation failed. #### Response Example ```json { "success": true, "qrCode": "https://example.com/qrcode", "errorMessage": null } ``` --- ## START ON BOARDING ### Description Executa a aplicação "Boas Vindas" caso a mesma esteja instalada e o terminal esteja desativado. ### Method `startOnBoarding` ### Endpoint N/A (Local method call) ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (Void) This method does not return a value upon successful execution. #### Response Example (No response body for success) ``` -------------------------------- ### Initialize PagBank Activation (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Initiates the activation process using a PagBank QRCode. This function returns a PagBank activation result. ```kotlin open override fun initPagBankActivation(): PlugPagPagBankActivationResult ``` -------------------------------- ### Define Installment Type Constants (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/-companion/index Defines constants for different installment payment types, including 'a vista' (cash), 'parc_vendedor' (seller installment), and 'parc_comprador' (buyer installment). These are used to specify how a transaction should be paid. ```kotlin const val INSTALLMENT_TYPE_A_VISTA: Int = 1 const val INSTALLMENT_TYPE_PARC_VENDEDOR: Int = 2 const val INSTALLMENT_TYPE_PARC_COMPRADOR: Int = 3 ``` -------------------------------- ### PlugPagInstallmentsListener Interface Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper.listeners/-plug-pag-installments-listener/index This interface provides methods to handle the results of installment calculations, including successful calculations with or without total amount, and error handling. ```APIDOC ## PlugPagInstallmentsListener ### Description Interface for handling installment calculation results. ### Methods #### onCalculateInstallments ##### Description Callback method executed when installment calculation is performed. ##### Parameters - **installments** (Array) - Required - An array of strings representing the calculated installments. #### onCalculateInstallmentsWithTotalAmount ##### Description Callback method executed when installment calculation is performed with total amount. ##### Parameters - **installmentsWithTotalAmount** (Array) - Required - An array of PlugPagInstallment objects representing the calculated installments with total amount. #### onError ##### Description Callback method executed when an error occurs during installment calculation. ##### Parameters - **errorMessage** (String) - Required - A string describing the error that occurred. ``` -------------------------------- ### Invalid Installment Type Constants Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/-companion/index These constants indicate invalid installment types or configurations. They are used to signal errors related to how a transaction is being divided into payments, such as incorrect types for 'carnê' (installment plan) or general installment data. ```kotlin const val INVALID_INSTALL_TYPE_CARNE: Int // Código utilizado quando o tipo de parcelamento é inválido para carnê. const val INVALID_INSTALLMENT: Int // Código utilizado para indicar que o parcelamento da transação é inválido, podendo ser um erro da quantidade de parcelas ou valor de cada parcela. A quantidade de parcelas deve ser superior a 0 e inferior ao limite máximo para aquela conta / terminal (definido dinamicamente). O valor da parcela não pode ser inferior a R$5,00. Nesse caso só é permitido à vista. const val INVALID_INSTALLMENT_COUNT: Int // Código utilizado quando é informado um número de parcelas inválido. const val INVALID_INSTALLMENT_TYPE: Int // Código utilizado para indicar que um tipo de parcelamento inválido foi informado. const val INVALID_PAYMENT_METHOD_CARNE: Int // Código utilizado quando o tipo de pagamento é inválido para carnê. ``` -------------------------------- ### Initialize and Activate Pinpad (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/index Executes an initialization and activation request for the payment terminal (pinpad). This function requires PlugPagActivationData as input and returns a PlugPagInitializationResult. ```kotlin abstract fun initializeAndActivatePinpad( activationData: PlugPagActivationData): PlugPagInitializationResult ``` -------------------------------- ### Calculate Installments with Type (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/calculate-installments Executes the calculation of installment values for a sale. This function accepts the sale value in cents and an installment type. It returns a list of PlugPagInstallment objects, providing detailed information about each installment. ```kotlin import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInstallment fun calculateInstallmentsWithType(plugPag: IPlugPagWrapper, saleValue: String, installmentType: Int): List { return plugPag.calculateInstallments(saleValue, installmentType) } ``` -------------------------------- ### Define Onboarding Service Wrapper Version (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-extras/-o-n-b-o-a-r-d-i-n-g_-s-t-a-r-t_-s-e-r-v-i-c-e_-w-r-a-p-p-e-r_-v-e-r-s-i-o-n Defines the constant ONBOARDING_START_SERVICE_WRAPPER_VERSION used as a key to specify the wrapper version when calling the OnBoardingService. This is crucial for ensuring compatibility between the application and the SDK. ```kotlin const val ONBOARDING_START_SERVICE_WRAPPER_VERSION: String ``` -------------------------------- ### Get Pre-Authorization List Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Executes a query for a list of pre-authorizations made via card. This function retrieves multiple pre-authorization records. ```Kotlin open override fun getPreAutoList(): PlugPagPreAutoQueryResult ``` -------------------------------- ### PlugPag Initialization and Core Operations (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/index Demonstrates the core PlugPag class for initiating transactions, activation, and deactivation. It relies on the Android Context and a metric listener. Key functionalities are exposed via the IPlugPagWrapper interface. ```kotlin open class PlugPag( val context: Context, metricListener: WrapperMetricListener) : AsyncPlugPag Classe principal da biblioteca. Responsável por executar todas as ações referentes a PlugPag, como transação, ativação, desativação, entre outros. As documentações dessa funcionalidade se encontram em: IPlugPagWrapper ``` ```kotlin interface IPlugPagWrapper : IWrapperNFC, IWrapperUserProfile, IWrapperPrinter, IWrapperSystem Classe principal da biblioteca. Responsável por executar todas as ações referentes a PlugPag, como transação, ativação, desativação, entre outros. ``` -------------------------------- ### Initialize and Activate Pinpad Asynchronously (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/do-async-initialize-and-activate-pinpad Executes an asynchronous request to initialize and activate the terminal. Requires PlugPagActivationData for activation and a PlugPagActivationListener to handle callback methods during activation or deactivation. ```kotlin open override fun doAsyncInitializeAndActivatePinpad( activationData: PlugPagActivationData, listener: PlugPagActivationListener) ``` -------------------------------- ### Implement onCalculateInstallmentsWithTotalAmount for Installment Calculation Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper.listeners/-plug-pag-installments-listener/on-calculate-installments-with-total-amount This function is an abstract method to be implemented when calculating installments with a total amount. It receives an array of PlugPagInstallment objects, representing the details of each installment. ```kotlin abstract fun onCalculateInstallmentsWithTotalAmount( installmentsWithTotalAmount: Array) ``` -------------------------------- ### Initialize and Activate Pinpad with Listener - Android Kotlin Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/do-async-initialize-and-activate-pinpad This snippet demonstrates how to initialize and activate a Pinpad using the PlugPag SDK. It includes a listener to handle activation progress, success, and error events. The required input is an activation code. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagActivationData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInitializationResult import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagActivationListener fun exampleFunction(context: Context) { val plugPag: IPlugPagWrapper = PlugPag(context) val listener = object : PlugPagActivationListener { override fun onActivationProgress(data: PlugPagEventData) { // Action to be executed during activation or deactivation processes. } override fun onSuccess(result: PlugPagInitializationResult) { // Action to be executed upon successful completion of activation or deactivation. } override fun onError(result: PlugPagInitializationResult) { // Action to be executed when an activation or deactivation fails. } } val data = PlugPagActivationData(activationCode = "Seu Código de Ativação") plugPag.doAsyncInitializeAndActivatePinpad(activationData = data, listener = listener) } ``` -------------------------------- ### Define Buyer Installment Type (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/-companion/-i-n-s-t-a-l-l-m-e-n-t_-t-y-p-e_-p-a-r-c_-c-o-m-p-r-a-d-o-r Defines the integer constant for buyer installment type (INSTALLMENT_TYPE_PARC_COMPRADOR) used in the PagSeguro SDK. This value represents the 'Parcelamento comprador' or buyer installments. ```kotlin const val INSTALLMENT_TYPE_PARC_COMPRADOR: Int = 3 ``` -------------------------------- ### Initialize and Activate Pinpad with Activation Code - Kotlin Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/do-async-initialize-and-activate-pinpad This snippet demonstrates how to initialize and activate the Pinpad using an activation code. It requires the Android Context and the PlugPag SDK. The activation code is passed via PlugPagActivationData, and a listener is used to handle activation progress, success, and error events. ```kotlin val plugPag: IPlugPagWrapper = PlugPag(context) val listener = object : PlugPagActivationListener { override fun onActivationProgress(data: PlugPagEventData) { // Ação a ser executada durante os processos de ativação ou desativação. } override fun onSuccess(result: PlugPagInitializationResult) { // Ação a ser executada ao ser finalizada uma ativação ou desativação com sucesso. } override fun onError(result: PlugPagInitializationResult) { // Ação a ser executada ao ocorrer uma falha na ativação ou desativação. } } val data = PlugPagActivationData(activationCode = "Seu Código de Ativação") plugPag.doAsyncInitializeAndActivatePinpad(activationData = data, listener = listener) ``` -------------------------------- ### Define INVALID_INSTALLMENT Constant (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/-companion/-i-n-v-a-l-i-d_-i-n-s-t-a-l-l-m-e-n-t Defines an integer constant `INVALID_INSTALLMENT` used to signal invalid transaction installments. This constant is part of the PagSeguro SDK PlugPagServiceWrapper and helps identify errors related to the number or value of installments. The installment count must be greater than 0 and within the account/terminal's limit, and the installment value cannot be less than R$5.00. ```kotlin const val INVALID_INSTALLMENT: Int ``` -------------------------------- ### Initialize Sub-Acquirer Profile (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/index Initializes the sub-acquirer profile for the terminal. This function takes PlugPagSubAcquirerData as input and returns a PlugPagInitializationResult. ```kotlin abstract fun initializeSubAcquirer( data: PlugPagSubAcquirerData): PlugPagInitializationResult ``` -------------------------------- ### doAsyncInitializeAndActivatePinpad Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-async-plug-pag/do-async-initialize-and-activate-pinpad Executes an asynchronous request to initialize and activate the terminal. ```APIDOC ## doAsyncInitializeAndActivatePinpad ### Description Executes an asynchronous request to initialize and activate the terminal. ### Method Open (This appears to be a method signature from a Kotlin-like language, not a standard HTTP method. Assuming it corresponds to an internal SDK method call.) ### Endpoint N/A (This is an SDK method, not a REST endpoint.) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **activationData** (PlugPagActivationData) - Required - Values needed for the activation request. - **listener** (PlugPagActivationListener) - Required - Methods called during activation or deactivation. Refer to PlugPagActivationListener for details. ``` -------------------------------- ### Calculate Installments (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/index Executes the calculation of installment values for PlugPag.INSTALLMENT_TYPE_PARC_COMPRADOR. Returns an array of strings. ```kotlin abstract fun calculateInstallments(saleValue: String): Array ``` -------------------------------- ### Inherited Functions for Application Info (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-app-identification/index Provides inherited functions to retrieve application-specific information. These include 'getApplicationInfo' to get application info from context, 'getPackageInfo' to get package info from context, and 'getPackageManager' to get the package manager from context. ```kotlin fun getApplicationInfo(context: Context): ApplicationInfo fun getPackageInfo(context: Context): PackageInfo fun getPackageManager(context: Context): PackageManager ``` -------------------------------- ### Asynchronously Initialize and Activate Pinpad (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper.asyncplugpag/-plug-pag-async-contract/do-async-initialize-and-activate-pinpad Executes an asynchronous request to initialize and activate the terminal using the activation code. It requires a listener for activation callbacks and an operation that returns the initialization result. ```kotlin abstract fun doAsyncInitializeAndActivatePinpad( listener: PlugPagActivationListener, operation: () -> PlugPagInitializationResult) ``` -------------------------------- ### Perform Pre-Auto Transaction with Keying Data (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/do-pre-auto-create This sample demonstrates how to perform a pre-authorized transaction using keyed data with the PagSeguro PlugPag SDK. It initializes the PlugPag wrapper, creates a PlugPagPreAutoKeyingData object with transaction details like amount, installment type, and user reference, and then calls the doPreAutoCreate method. The result is checked to determine success or failure. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagActivationData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagCommand import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagCustomPrinterLayout import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEffectuatePreAutoData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventListener import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagExtras import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInitializationResult import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInstallment import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagNFCResult import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagNearFieldCardData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPaymentData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPreAutoData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPreAutoKeyingData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPreAutoQueryData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrintResult import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrinterListener import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagReceiptSMSData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagStyleData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagTransactionResult import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagVoidData import br.com.uol.pagseguro.plugpagservice.wrapper.TerminalCapabilities import br.com.uol.pagseguro.plugpagservice.wrapper.data.result.PlugPagCmdExchangeResult import br.com.uol.pagseguro.plugpagservice.wrapper.exception.PlugPagException import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagAPDUCmdExchangeListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagAbortListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagActivationListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagInstallmentsListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagIsActivatedListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagLastTransactionListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagNFCListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagPaymentListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagPrintActionListener import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagSetStylesListener import br.com.uol.pagseguro.plugpagservice.wrapper.value fun main() { //sampleStart val plugPag: IPlugPagWrapper = PlugPag(context) val data = PlugPagPreAutoKeyingData( amount = 2000, // R$ 20,00 installmentType = PlugPag.INSTALLMENT_TYPE_PARC_COMPRADOR, installments = 5, userReference = "Código da Venda", printReceipt = false, ) val plugPagTransactionResult = plugPag.doPreAutoCreate(plugPagPreAutoKeyingData = data) if (plugPagTransactionResult.result == PlugPag.RET_OK) { // Transação pré-autorizada digitada criada com sucesso. } else { // Falha na criação da transação pré-autorizada digitada. } //sampleEnd } ``` -------------------------------- ### PlugPagPreAutoKeyingData Constructor (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-pre-auto-keying-data/index Provides the constructor for the PlugPagPreAutoKeyingData class in Kotlin. This constructor initializes an object with all the necessary parameters for a pre-authorization transaction, allowing for optional values and default settings. ```kotlin constructor( amount: Int? = 0, installmentType: Int = 0, installments: Int = 0, userReference: String? = EMPTY_STRING, printReceipt: Boolean? = false, pan: String = EMPTY_STRING, securityCode: String = EMPTY_STRING, expirationDate: String = EMPTY_STRING ) ``` -------------------------------- ### Asynchronous Calculate Installments Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/index Executes the asynchronous calculation of installment values. Requires the sale value and a PlugPagInstallmentsListener. ```kotlin open override fun asyncCalculateInstallments( saleValue: String, listener: PlugPagInstallmentsListener) ``` -------------------------------- ### POST /initializeAndActivatePinpad Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/initialize-and-activate-pinpad Executes a request to initialize and activate the terminal. This method takes PlugPagActivationData as input and returns PlugPagInitializationResult. ```APIDOC ## POST initializeAndActivatePinpad ### Description Executes a request to initialize and activate the terminal. ### Method POST ### Endpoint /initializeAndActivatePinpad ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **activationData** (PlugPagActivationData) - Required - Values needed for the activation request. ### Request Example ```json { "activationData": { "activationCode": "Seu Código de Ativação" } } ``` ### Response #### Success Response (200) - **result** (PlugPagInitializationResult) - The resulting values from an activation request. #### Response Example ```json { "result": "000", "message": "Success" } ``` #### Error Response - **result** (string) - Error code. - **message** (string) - Error message. ### Sample Usage ```kotlin val plugPag: IPlugPagWrapper = PlugPag(context) val data = PlugPagActivationData(activationCode = "Seu Código de Ativação") val plugPagInitializationResult = plugPag.initializeAndActivatePinpad(activationData = data) if (plugPagInitializationResult.result == PlugPag.RET_OK) { // PinPad initialized and activated successfully. } else { // Failed to initialize or activate. } ``` ``` -------------------------------- ### Initialize PlugPag and Process Asynchronous Payment (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-i-plug-pag-wrapper/do-async-payment Demonstrates how to initialize the IPlugPagWrapper and initiate an asynchronous payment using PlugPag. It includes a listener to handle payment success, errors, progress, and printer events. The payment data includes type, amount, installment type, and user reference. ```kotlin import android.content.Context import br.com.uol.pagseguro.plugpagservice.wrapper.IPlugPagWrapper import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPaymentData import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrintResult import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagTransactionResult import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagPaymentListener fun main(context: Context) { val plugPag: IPlugPagWrapper = PlugPag(context) val listener = object : PlugPagPaymentListener { override fun onSuccess(transactionResult: PlugPagTransactionResult) { // Ação a ser executada ao ser finalizada a transação com sucesso. } override fun onError(transactionResult: PlugPagTransactionResult) { // Ação a ser executada ao ocorrer uma falha na transação. } override fun onPaymentProgress(eventData: PlugPagEventData) { // Ação a ser executada durante os processos da transação. } override fun onPrinterSuccess(printerResult: PlugPagPrintResult) { // Ação a ser executada ao finalizar uma impressão com sucesso. } override fun onPrinterError(printerResult: PlugPagPrintResult) { // Ação a ser executada ao ocorrer uma falha em uma impressão. } } val data = PlugPagPaymentData( type = PlugPag.TYPE_CREDITO, amount = 2000, // R$ 20,00 installmentType = PlugPag.INSTALLMENT_TYPE_PARC_VENDEDOR, installments = 5, userReference = "Código da Venda", printReceipt = false, partialPay = false, isCarne = false, ) plugPag.doAsyncPayment(paymentData = data, listener = listener) } ``` -------------------------------- ### Define Default Installment for Cash Sale (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag/-companion/-a_-v-i-s-t-a_-i-n-s-t-a-l-l-m-e-n-t_-q-u-a-n-t-i-t-y Defines the default number of installments for an "à vista" (cash) sale. This constant is typically used in payment processing logic to set a standard value when no specific installment plan is chosen for cash transactions. ```kotlin const val A_VISTA_INSTALLMENT_QUANTITY: Int = 1 ``` -------------------------------- ### PlugPagInstallment Data Class Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/index Represents the result of installment calculations for a transaction, including quantity, amount per installment, and total amount. ```APIDOC ## PlugPagInstallment ### Description Contains the resulting values from the calculation of transaction installments. ### Data Class `PlugPagInstallment` ### Properties - `quantity` (Int) - The number of installments. - `amount` (Int) - The amount for each installment. - `total` (Int) - The total amount of the transaction across all installments. ### Usage Used to display or process installment information for a transaction. ``` -------------------------------- ### Declare ONBOARDING_START_SERVICE Constant (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-extras/-o-n-b-o-a-r-d-i-n-g_-s-t-a-r-t_-s-e-r-v-i-c-e Declares the ONBOARDING_START_SERVICE constant as a String. This constant serves as a key to identify the name of the application interacting with the OnBoardingService. ```kotlin const val ONBOARDING_START_SERVICE: String ``` -------------------------------- ### Declare ONBOARDING_START_SERVICE_APP_VERSION Constant (Kotlin) Source: https://pagseguro.github.io/pagseguro-sdk-plugpagservicewrapper/-wrapper-p-p-s/br.com.uol.pagseguro.plugpagservice.wrapper/-plug-pag-extras/-o-n-b-o-a-r-d-i-n-g_-s-t-a-r-t_-s-e-r-v-i-c-e_-a-p-p_-v-e-r-s-i-o-n Declares a constant string named ONBOARDING_START_SERVICE_APP_VERSION. This constant serves as a key to identify the application's version when initiating calls to the OnBoardingService. ```kotlin const val ONBOARDING_START_SERVICE_APP_VERSION: String ```