co.saltpay.epos.models.response.ReverseLastPaymentResponse.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of epos-core-models Show documentation
Show all versions of epos-core-models Show documentation
Internal lib to handle epos requests.
package co.saltpay.epos.models.response
import kotlinx.serialization.Serializable
/**
* Subtype of [ResponseModel] which contains possible responses
* for the [co.saltpay.epos.models.request.ReverseLastPayment] request.
*/
@Serializable
sealed interface ReverseLastPaymentResponse : ResponseModel {
/**
* Subtype of [ReverseLastPaymentResponse] sent when the reversal payment
* request is approved by payment application.
*
* @property requestId see [ResponseModel.requestId]
* @property creationDateEpochTimestamp epoch timestamp in milliseconds of the payment creation
* @property reversalId id of the reversal payment
*/
@Serializable
data class Approved(
override val requestId: String,
val creationDateEpochTimestamp: Long,
val reversalId: String
) : ReverseLastPaymentResponse
/**
* Subtype of [ReverseLastPaymentResponse] sent when the reversal payment
* request failed for some [Reason].
*
* [creationDateEpochTimestamp] and [reversalId] might be null if the error was local
* before processing the payment in the backend.
*
* @property requestId see [ResponseModel.requestId]
* @property creationDateEpochTimestamp epoch timestamp in milliseconds of the refund creation
* @property reversalId id of the reversal
* @property reason reason for the failure [Reason]
*/
@Serializable
data class Failed(
override val requestId: String,
val creationDateEpochTimestamp: Long?,
val reversalId: String?,
val reason: Reason
) : ReverseLastPaymentResponse {
enum class Reason {
/**
* Returned when the [co.saltpay.epos.models.request.ReverseLastPayment] included the
* [co.saltpay.epos.models.request.ReverseLastPayment.askForManagerPIN] as true and the
* user failed to input the correct PIN.
*/
WRONG_MANAGER_PIN,
/**
* Some error occurred while processing the reversal
*/
FAILED,
/**
* The payment was canceled by the user
*/
CANCELLED
}
}
}