API Reference
This page provides a technical reference for the redsys-tpv-business-lib repositories. It lists the available methods, parameters, and return types for each feature.
Common Types
RepositoryResult<T>
A generic sealed class wrapper for all asynchronous repository responses.
Success<T>: Contains the result data (val data: T).ConnectionError: Indicates a network or service connection failure.Cancelled: Indicates the operation was cancelled by the user (val message: String).ProtocolError: Indicates an integration or data mapping error (val type: ProtocolErrorType,val description: String?).
1. InitializationRepository
Purpose: Manage TPV initialization and configuration.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
initTpv | Initializes the TPV with the host. | None | RepositoryResult<TpvInfo> |
getTpvInfoRepositoryResult | Retrieves cached TPV information. | None | RepositoryResult<TpvInfo> |
saveTerminalInformation | Updates local terminal info. | tpvInfo: TpvInfo | Unit (Suspend) |
2. PaymentRepository
Purpose: Process card payments.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
makePayment | Performs a standard payment. | amount: Moneytip: Money?shiftInfo: ShiftInfo?financialConditions: FinancialConditions?proprietaryExtraData: ProprietaryExtraData?language: LanguageIso6391? | RepositoryResult<PaymentResult> |
PaymentResult (Sealed Interface)
Accepted(val data: Transaction)Denied(val data: Transaction)CardNotFound
3. RefundRepository
Purpose: Process refunds.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
makeRefund | Refund by original operation ID. | operationId: Stringamount: MoneyproprietaryExtraData: ProprietaryExtraData?language: LanguageIso6391? | RepositoryResult<RefundResult> |
makeRefundReadingCard | Refund by ID, forcing card read. | operationId: Stringamount: MoneyproprietaryExtraData: ProprietaryExtraData?language: LanguageIso6391? | RepositoryResult<RefundResult> |
makeRefundWithoutOriginal | Refund without previous ID. | amount: MoneyproprietaryExtraData: ProprietaryExtraData?language: LanguageIso6391? | RepositoryResult<RefundResult> |
RefundResult (Sealed Interface)
Accepted(val data: Transaction)Denied(val data: Transaction)ExceededAmount
4. PreauthorizationRepository
Purpose: Manage funds reservations.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
makePreauthorization | Create a new pre-auth. | amount: MoneyshiftInfo: ShiftInfo?proprietaryExtraData: ProprietaryExtraData?language: LanguageIso6391? | RepositoryResult<PreauthorizationResult> |
confirmPreauthorization | Confirm/Charge a pre-auth. | amount: MoneyoperationId: StringshiftInfo: ShiftInfo?proprietaryExtraData: ProprietaryExtraData?language: LanguageIso6391? | RepositoryResult<PreauthorizationResult> |
replacePreauthorization | Update the amount. | amount: MoneyoperationId: StringshiftInfo: ShiftInfo?proprietaryExtraData: ProprietaryExtraData?language: LanguageIso6391? | RepositoryResult<PreauthorizationResult> |
annulPreauthorization | Cancel the reservation. | operationId: Stringlanguage: LanguageIso6391? | RepositoryResult<PreauthorizationResult> |
PreauthorizationResult (Sealed Interface)
Accepted(val data: Transaction)Denied(val data: Transaction)
5. TransactionRepository
Purpose: Search historical transactions.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
getTransactions | Search transactions by date range. | initDate: DateendDate: Datefilter: TransactionFilter?resultsFilter: TransactionResultsFilter? | RepositoryResult<GetTransactionsResult> |
getTransactionsBySession | Search by session. | initDate: DateendDate: DatesessionDate: DatesessionId: Int?filter: TransactionFilter?resultsFilter: TransactionResultsFilter? | RepositoryResult<GetTransactionsResult> |
6. TotalsRepository
Purpose: Query accumulated totals.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
getSessions | Totals for all sessions on a date. | date: DatewantBrandDetails: Boolean | RepositoryResult<TotalsResult> |
getSession | Totals for a specific session ID. | date: DatesessionId: IntwantBrandDetails: Boolean | RepositoryResult<TotalsResult> |
getSessionsBetweenDates | Totals for sessions in range. | initDate: DateendDate: DatewantBrandDetails: Boolean | RepositoryResult<TotalsResult> |
getLastSession | Totals for the last closed session. | None | RepositoryResult<GetLastSessionResult> |
getShifts | Totals for all shifts on a date. | date: DatewantBrandDetails: Boolean | RepositoryResult<TotalsResult> |
getShift | Totals for a specific shift ID. | date: DateshiftId: StringwantBrandDetails: Boolean | RepositoryResult<TotalsResult> |
getShiftBetweenDates | Totals for shifts in range. | initDate: DateendDate: DatewantBrandDetails: Boolean | RepositoryResult<TotalsResult> |
TotalsResult (Sealed Interface)
IncomingData(val data: TotalsModel)EmptyDataWrongIdentifierError
7. ShiftRepository and SessionRepository
Purpose: Manage operational periods.
Methods
| Repository | Method | Parameters | Return Type |
|---|---|---|---|
ShiftRepository | openShift | number: Intdate: Date | RepositoryResult<Boolean> |
SessionRepository | closeSession | wantBrandDetails: Boolean | RepositoryResult<CloseSessionResult> |
8. PrinterRepository
Purpose: Control device printer.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
checkPaper | Check paper status. | None | RepositoryResult<Boolean> |
printBitmap | Print a custom bitmap. | bitmap: Bitmap | RepositoryResult<Boolean> |
printDefaultTicket | Print standard receipt. | context: ContextheaderIcon: Bitmaptransaction: Transaction | RepositoryResult<Boolean> |
9. TicketDigitalRepository
Purpose: Manage digital receipts.
Methods
| Method | Description | Parameters | Return Type |
|---|---|---|---|
sendTicketDigital | Send receipt via email. | operId: Stringemail: String | RepositoryResult<TicketDigitalResult> |
getTicketDigitalURL | Get receipt URL (for QR). | operId: String | RepositoryResult<TicketDigitalUrlResult> |
10. SettingsRepository and AuthRepository
Purpose: Configuration and Authentication.
Methods
| Repository | Method | Parameters | Return Type |
|---|---|---|---|
SettingsRepository | updateShowTransactionResult | showTransactionResult: Boolean | RepositoryResult<Boolean> |
SettingsRepository | updateLanguage | language: LanguageIso6391 | RepositoryResult<Boolean> |
AuthRepository | getToken | None | RepositoryResult<AuthResult> |
11. APM Repositories (Bizum, Alipay, WeChat)
Purpose: Alternative Payment Methods.
Methods
| Repository | Method | Parameters | Return Type |
|---|---|---|---|
BizumRepository | sendBizum | amount: MoneyphoneNumber: StringshiftInfo: ShiftInfo?language: LanguageIso6391? | RepositoryResult<SendBizumResult> |
AlipayRepository | makePayment | amount: Moneytip: MoneyqrId: StringtransactionName: StringqrIdType: QrIdTypelanguageIso6391: LanguageIso6391 | RepositoryResult<AlipayResult> |
AlipayRepository | makeRefund | amount: MoneyoriginalOperationId: StringlanguageIso6391: LanguageIso6391 | RepositoryResult<AlipayResult> |
WeChatRepository | makePayment | amount: Moneytip: MoneyqrId: StringtransactionName: String?languageIso6391: LanguageIso6391 | RepositoryResult<WeChatResult> |
WeChatRepository | makeRefund | amount: MoneyoriginalOperationId: StringlanguageIso6391: LanguageIso6391 | RepositoryResult<WeChatResult> |