submitTransfer
A callback to verify sender funds and create a transfer
Overview
+-------------+ +----------+ +------------+
| Customer |----(2)--->| Customer |----(3)--->| ReadyRemit |
| Application |<---(8)----| API(5) |<---(4)----| API |
+-------------+ +----------+ +------------+
| | |
| | | +------------+
| | ---------(6)--->| ReadyRemit |
| <----------(7)----| API |
| +------------+
|
| +------------+
<----------(1)----| ReadyRemit |
-----------(9)--->| SDK |
+------------+- SDK calls back the
submitTransfercallback with the transfer request data to send the transfer. - Customer application makes a network request to the Customer API to initiate the creation of a transfer.
- Customer API makes a network request to the ReadyRemit API to read quote details.
- ReadyRemit API returns the quote details or an error.
- Customer API makes performs additional prerequisites, such as verification of funds.
- Customer API makes a network request to the ReadyRemit API to create a transfer.
- ReadyRemit API returns the transfer details or an error.
- Customer API returns the transfer details or an error
- Customer application returns the transfer details or throws an error
Parameter passed through the callback
| Type | Description |
|---|---|
| ReadyRemitTransferRequest | A representation of the main identifiers to build and send the transfer. |
Expected objects to be sent by the app in the callback response to the sdk (TransferSubmissionResult)
| Parameter | Type | Description |
|---|---|---|
| transferId | String | The transfer ID. |
| ReadyRemitError | ReadyRemitError | A generic representation of an error for the ReadyRemit SDK. |
Sample Implementation
private val submitTransfer: suspend (ReadyRemitTransferRequest) -> TransferSubmissionResult = { transferRequest: ReadyRemitTransferRequest ->
try {
// calls the Quote Details API
val quoteDetails = readQuoteDetails(transferRequest.quoteHistoryId)
// calls your funtion to call the server
submitReadyRemitTransfer(
transferRequest = transferRequest,
quoteDetails = quoteDetails
)
} catch (e: QuoteDetailsException) {
TransferSubmissionResult.Error(e.error)
}
}
private fun submitReadyRemitTransfer(transferRequest: ReadyRemitTransferRequest, quoteDetails: ReadQuoteDetailsResponse) {
// call APIs
return TransferSubmissionResult.success("transfer_id") // or TransferSubmissionResult.Error(ReadyRemitError(...))
}
Updated 8 days ago
