diff options
author | Antoine A <> | 2023-10-24 14:17:57 +0000 |
---|---|---|
committer | Antoine A <> | 2023-10-24 16:56:47 +0000 |
commit | 4ce92c1d9593ab225a35ec67200924c92fcedf64 (patch) | |
tree | e10b7bd78368708fb8a3622a6a1fce119ce050c1 | |
parent | 2ef6141a0c47f87d5c9d08d13c2e3bd4f7830b0a (diff) | |
download | docs-4ce92c1d9593ab225a35ec67200924c92fcedf64.tar.gz docs-4ce92c1d9593ab225a35ec67200924c92fcedf64.tar.bz2 docs-4ce92c1d9593ab225a35ec67200924c92fcedf64.zip |
Fix core bank spec and harmonise style
-rw-r--r-- | core/api-corebank.rst | 174 |
1 files changed, 92 insertions, 82 deletions
diff --git a/core/api-corebank.rst b/core/api-corebank.rst index e352869f..a207b2d9 100644 --- a/core/api-corebank.rst +++ b/core/api-corebank.rst @@ -708,11 +708,6 @@ Cashouts **Request:** - :query start: *Optional.* - Row identifier to explicitly set the *starting point* of the query. - :query delta: *Optional.* - The *delta* value that determines the range of the query. - .. ts:def:: TanChannel enum TanChannel { @@ -832,87 +827,91 @@ Cashouts :http:statuscode:`503 Service unavailable`: This server does not support cashout, client should check config response. -.. _cashout-rates: - -.. http:get:: /cashout-rate +.. _circuit-cashouts: - This public endpoint allows clients to calculate - the exchange rate between the regional currency - and the external banking system. +.. http:get:: /accounts/$USERNAME/cashouts - This endpoint shows how the bank would apply the cash-out - ratio and fee to one input amount. Typically, frontends - ask this endpoint before creating cash-out operations. - At least one of the two query parameters must be provided. If both are - given, then the server checks their correctness. Amounts must include the - currency. + Returns the list of all the (pending and confirmed) cash-out operations + for an account. **Request:** - :query amount_debit: this is the amount that the user will get - deducted from their regional bank account. - - :query amount_credit: this is the amount that the user will receive - in their fiat bank account. + :query start: *Optional.* + Row identifier to explicitly set the *starting point* of the query. + :query delta: *Optional.* + The *delta* value that determines the range of the query. **Response:** :http:statuscode:`200 OK`: - Response is a `CashoutConversionResponse`. - :http:statuscode:`400 Bad request`: - Both parameters have been provided and the calculation is not correct, - or none of them has been provided, or the requested currency was not - supported. The response should clarify which case. + Response is a `Cashouts`. + :http:statuscode:`204 No Content`: + No cash-out operations were found at the bank :http:statuscode:`404 Not found`: - The server does not support local currency conversion. + Username not fuond. :http:statuscode:`503 Service unavailable`: This server does not support cashout, client should check config response. **Details:** - .. ts:def:: CashoutConversionResponse + .. ts:def:: Cashouts - interface CashoutConversionResponse { - // Amount that the user will get deducted from their regional - // bank account, according to the 'amount_credit' value. - amount_debit: Amount; - // Amount that the user will receive in their fiat - // bank account, according to 'amount_debit'. - amount_credit: Amount; + interface Cashouts { + // Every string represents a cash-out operation ID. + cashouts: CashoutInfo[]; } -.. _circuit-cashouts: + .. ts:def:: CashoutInfo -.. http:get:: /accounts/$USERNAME/cashouts + interface CashoutInfo { + cashout_id: string; + status: "pending" | "confirmed"; + } - Returns the list of all the (pending and confirmed) cash-out operations - for an account. +.. _circuit-cashout-details: + +.. http:get:: /accounts/$USERNAME/cashouts/$CASHOUT_ID + + Returns information about the status of the ``$CASHOUT_ID`` operation. + The request is available to the administrator and the account owner. **Response:** :http:statuscode:`200 OK`: - Response is a `Cashouts`. - :http:statuscode:`204 No Content`: - No cash-out operations were found at the bank + Response is a `CashoutStatusResponse`. :http:statuscode:`404 Not found`: - Username not fuond. + The cashout operation was not found. + Aborted cashout operations will also not be found. :http:statuscode:`503 Service unavailable`: This server does not support cashout, client should check config response. **Details:** - .. ts:def:: Cashouts + .. ts:def:: CashoutStatusResponse - interface Cashouts { - // Every string represents a cash-out operation ID. - cashouts: CashoutInfo[]; - } + interface CashoutStatusResponse { + status: "pending" | "confirmed"; - .. ts:def:: CashoutInfo + // Amount debited to the internal + // regional currency bank account. + amount_debit: Amount; - interface CashoutInfo { - cashout_id: string; - status: "pending" | "confirmed"; + // Amount credited to the external bank account. + amount_credit: Amount; + + // Transaction subject. + subject: string; + + // Fiat bank account that will receive the cashed out amount. + // Specified as a payto URI. + credit_payto_uri: string; + + // Time when the cashout was created. + creation_time: Timestamp; + + // Time when the cashout was confirmed via its TAN. + // Missing when the operation wasn't confirmed yet. + confirmation_time?: Timestamp; } .. http:get:: /cashouts @@ -922,10 +921,18 @@ Cashouts Typically can only be used by the administrators. + **Request:** + + :query start: *Optional.* + Row identifier to explicitly set the *starting point* of the query. + :query delta: *Optional.* + The *delta* value that determines the range of the query. + .. note:: We might want to add a filter in the future to only query pending cashout operations. + **Response:** @@ -952,50 +959,53 @@ Cashouts status: "pending" | "confirmed"; } -.. _circuit-cashout-details: +.. _cashout-rates: -.. http:get:: /accounts/$USERNAME/cashouts/$CASHOUT_ID +.. http:get:: /cashout-rate - Returns information about the status of the ``$CASHOUT_ID`` operation. - The request is available to the administrator and the account owner. + This public endpoint allows clients to calculate + the exchange rate between the regional currency + and the external banking system. + + This endpoint shows how the bank would apply the cash-out + ratio and fee to one input amount. Typically, frontends + ask this endpoint before creating cash-out operations. + At least one of the two query parameters must be provided. If both are + given, then the server checks their correctness. Amounts must include the + currency. + + **Request:** + + :query amount_debit: this is the amount that the user will get + deducted from their regional bank account. + + :query amount_credit: this is the amount that the user will receive + in their fiat bank account. **Response:** :http:statuscode:`200 OK`: - Response is a `CashoutStatusResponse`. + Response is a `CashoutConversionResponse`. + :http:statuscode:`400 Bad request`: + Both parameters have been provided and the calculation is not correct, + or none of them has been provided, or the requested currency was not + supported. The response should clarify which case. :http:statuscode:`404 Not found`: - The cashout operation was not found. - Aborted cashout operations will also not be found. + The server does not support local currency conversion. :http:statuscode:`503 Service unavailable`: This server does not support cashout, client should check config response. **Details:** - .. ts:def:: CashoutStatusResponse - - interface CashoutStatusResponse { - status: "pending" | "confirmed"; + .. ts:def:: CashoutConversionResponse - // Amount debited to the internal - // regional currency bank account. + interface CashoutConversionResponse { + // Amount that the user will get deducted from their regional + // bank account, according to the 'amount_credit' value. amount_debit: Amount; - - // Amount credited to the external bank account. + // Amount that the user will receive in their fiat + // bank account, according to 'amount_debit'. amount_credit: Amount; - - // Transaction subject. - subject: string; - - // Fiat bank account that will receive the cashed out amount. - // Specified as a payto URI. - credit_payto_uri: string; - - // Time when the cashout was created. - creation_time: Timestamp; - - // Time when the cashout was confirmed via its TAN. - // Missing when the operation wasn't confirmed yet. - confirmation_time?: Timestamp; } Monitor |