18.85. DD 85: Transfer status#

18.85.1. Summary#

We need a way to handle wire gateway incoming and outgoing transfer failures. Automatically when possible with fallbacks to manual resolution.

18.85.2. Motivation#

Right now when we make a deposit the wallet show confirmation before the transfer is actually made. In case of failure nothing is done automatically and the user has no way to see it from it’s wallet.

We already have a transfer status API in place but it’s not suitable for automation as it’s expose a paginated list of transfers and we need a pagniated list of transfer status changes.

I think the Wire Gateway API should expose a transfer status history endpoint and the logic for failure resolution should be done at a higher level in the exchange.

We also need an API for incoming transactions that are malformed but cannot be bounce.

18.85.3. Proposed Solution#

18.85.3.1. Database#

For each transfer we would store a list of all status it whent through.

TODO

18.85.3.2. API#

GET /transfers-status#

Return a list of transfers status changes.

Request:

Query Parameters:
  • limitOptional. At most return the given number of results. Negative for descending by row_id, positive for ascending by row_id. Defaults to -20.

  • offsetOptional. Starting row_id for pagination.

  • statusOptional. Filters by status.

  • transfer_idOptional Only list statuses for a specific transfer.

Response:

200 OK:

JSON object of type TransferList.

204 No content:

There are no transfers statuses to report (under the given filter).

400 Bad request:

Request malformed.

401 Unauthorized:

Authentication failed, likely the credentials are wrong.

404 Not found:

The endpoint is wrong or the user name is unknown.

Details:

interface TransferStatusList {
  // Array of transfers statuses
  statuses: TransferListStatus[];
}
interface TransferStatus {
  // Opaque ID of the status change.
  // Is is different from the /transfers
  row_id: SafeUint64;

  // Opaque ID of the wire transfer initiation performed by the bank.
  // It is different from the /history endpoints row_id.
  transfer_id: SafeUint64;

  // Status of the transfer at this time
  // pending: the transfer is in progress
  // transient_failure: the transfer has failed but may succeed later
  // permanent_failure: the transfer has failed permanently and will never appear in the outgoing history
  // success: the transfer has succeeded  and appears in the outgoing history
  status: "pending" | "transient_failure" | "permanent_failure" | "success";

  // Timestamp that indicates when this status was reached.
  timestamp: Timestamp;
}

18.85.4. Test Plan#

18.85.5. Alternatives#

18.85.6. Drawbacks#

18.85.7. Discussion / Q&A#