# SDK Methods Reference

The Get Mini framework is organized into specialized modules. This reference documents the primary classes and methods used for payment processing, device management, and transaction queries.

## Global Configuration (CommonUtils)

The `CommonUtils` class handles global settings that must be configured before any other SDK interaction.

| Method | Parameters | Description |
| :---- | :---- | :---- |
| `setEntorno` | String (e.g., "int", "real") | Sets the execution environment (Development, Integration, Certification, or Real). |
| `setAppLicense` | String | Configures the application license provided by Get Mini. |

## Hardware & Connection (RedsysPinpadManager)

This class manages the Bluetooth connection and real-time interaction with the PIN pad hardware.

### findBluetoothDevices

Scans for PIN pad accessories paired with the iOS system. Results are returned via the `onProcessOK` delegate callback as an array of `EAAccessory`.

### connectAndConfigureDevice

Establishes a connection to a specific device and performs the mandatory terminal configuration (key injection).

| Parameter | Type | Description |
| :---- | :---- | :---- |
| `device` | id (EAAccessory) | The accessory object discovered via `findBluetoothDevices`. |
| `merchan` | MerchanDTO | Object containing FUC, Terminal, and Merchant Key. |
| `withDelegate` | id&lt;RedsysBTPinpadInitDelegate> | Delegate to monitor the initialization progress. |

### payWithPinpadBluetooth

The primary method for processing card-present transactions, including Sales and Pre-authorizations.

| Parameter | Type | Description |
| :---- | :---- | :---- |
| `device` | id | The connected hardware accessory. |
| `merchan` | MerchanDTO | Merchant credentials. |
| `config` | PinpadConfig | The configuration object returned by `onInitFinished`. |
| `andPagoDTO` | PagoDTO | Transaction details (Amount, Currency, and Type). |
| `withDelegate` | id&lt;RedsysBTPinpadPaymentDelegate> | Delegate to receive payment results and handle DCC feedback. |

## Gateway Operations (RedsysTransactionManager)

This class manages Web Service calls for operations that may or may not require card presence.

### peticionDevolucion

Processes a standard refund linked to a previous transaction.

| Parameter | Type | Description |
| :---- | :---- | :---- |
| `dictDevolucion` | EnvioDevolucionDTO | Contains the original operation and the refund amount. |
| `withBlock` | CompletionBlock | Returns a `DevolucionResponseDTO` or an `NSError`. |

### peticionConsultaFechaPagina

Used for transaction history queries and **Confirmations** of pre-authorized payments.

| Parameter | Type | Description |
| :---- | :---- | :---- |
| `dictConsulta` | ConsultaFechasDTO | Search parameters (Date range, Terminal, Page). |
| `conValores` | NSDictionary | Optional filters (e.g., `setTipoOperacion:@"CONFIRMACION"`). |
| `withBlock` | CompletionBlock | Returns a `ListaOperacionesDTO`. |

### peticionPagoPorReferencia

Processes a card-on-file (recurring) payment using a previously obtained token.

### peticionPaygold

Generates a payment link sent via SMS or Email to the customer.

## Key Data Transfer Objects (DTOs)

| DTO | Purpose |
| :---- | :---- |
| **PagoDTO** | Defines the amount (in cents), currency, and type (PAGO or PREAUTORIZACION). |
| **MerchanDTO** | Houses merchant credentials for PIN pad initialization. |
| **RespuestaTransaccionDTO** | Returned after payments; contains the `identificadorRTS` and `literales`. |
| **OperacionDTO** | Represents a single transaction in a history list, used for issuing refunds. |

## Implementation Notes

1. **Threading**: Most methods use block-based callbacks that execute asynchronously. Ensure UI updates are performed on the main thread.
2. **DTO Precision**: Amounts are typically handled as integers (cents) in PinpadManager methods but as strings (e.g., "10.00") in TransactionManager refund methods. Refer to specific guides for formatting.
3. **Permissions**: Use `PerfilComercioManager` to verify active terminal features before calling transaction methods.