From 3b0b45d611657bb4721ef796b0064805a094ffb2 Mon Sep 17 00:00:00 2001 From: Andy Clifford Date: Thu, 19 Oct 2023 08:42:10 +1300 Subject: [PATCH] Migrate Funds Transfers Page --- src/components/Error.astro | 29 ++ src/components/Properties.astro | 2 +- src/content/api/account-memberships.mdx | 9 +- src/content/api/accounts.mdx | 14 +- .../api/bank-account-connection-intents.mdx | 5 +- src/content/api/bank-accounts.mdx | 119 +++-- src/content/api/businesses.mdx | 27 +- src/content/api/funds-transfers.mdx | 464 ++++++++++++++++++ 8 files changed, 617 insertions(+), 52 deletions(-) create mode 100644 src/components/Error.astro create mode 100644 src/content/api/funds-transfers.mdx diff --git a/src/components/Error.astro b/src/components/Error.astro new file mode 100644 index 000000000..67463cd68 --- /dev/null +++ b/src/components/Error.astro @@ -0,0 +1,29 @@ + +--- +import Badge from '../components/Badge.astro'; + +const { code, message } = Astro.props; +--- + +
  • +
    +
    + Error Code +
    +
    + {code} +
    +
    + Error Message +
    +
    + +
    +
    + Description +
    +
    + +
    +
    +
  • diff --git a/src/components/Properties.astro b/src/components/Properties.astro index 47d0ebde5..40c32e91a 100644 --- a/src/components/Properties.astro +++ b/src/components/Properties.astro @@ -1,7 +1,7 @@
    diff --git a/src/content/api/account-memberships.mdx b/src/content/api/account-memberships.mdx index 925826859..23045cf7c 100644 --- a/src/content/api/account-memberships.mdx +++ b/src/content/api/account-memberships.mdx @@ -8,6 +8,7 @@ nav: --- import Properties from '../../components/Properties.astro'; import Property from '../../components/Property.astro'; +import Error from '../../components/Error.astro'; import Endpoint from '../../components/Endpoint.astro'; import Badge from '../../components/Badge.astro'; import CodePanel from '../../components/CodePanel.astro'; @@ -193,9 +194,11 @@ A Member contains extended information about a user's access to an account. No attributes. ### Errors - | Status | Code | Description | - | :----- | :----------------------- | :------------------------------------------------------------- | - | 403 | LAST_OWNER_NOT_REVOKABLE | The last remaining membership to an account cannot be revoked. | + + + The last remaining membership to an account cannot be revoked. + + ```bash diff --git a/src/content/api/accounts.mdx b/src/content/api/accounts.mdx index 1267f8e42..5d80ece18 100644 --- a/src/content/api/accounts.mdx +++ b/src/content/api/accounts.mdx @@ -8,6 +8,7 @@ nav: --- import Properties from '../../components/Properties.astro'; import Property from '../../components/Property.astro'; +import Error from '../../components/Error.astro'; import Endpoint from '../../components/Endpoint.astro'; import CodePanel from '../../components/CodePanel.astro'; @@ -263,9 +264,14 @@ individual account. ### Errors - | Status | Code | Description | - | :----- | :------------------- | :------------------------------------------------- | - | 403 | INVALID_ACCOUNT_ID | The account does not exist. | - | 403 | INVALID_SUBSCRIPTION | One of the subscriptions in the list is not valid. | + + + The account does not exist. + + + + One of the subscriptions in the list is not valid. + + diff --git a/src/content/api/bank-account-connection-intents.mdx b/src/content/api/bank-account-connection-intents.mdx index fc64a3c58..a21cf7acc 100644 --- a/src/content/api/bank-account-connection-intents.mdx +++ b/src/content/api/bank-account-connection-intents.mdx @@ -8,6 +8,7 @@ nav: --- import Properties from '../../components/Properties.astro'; import Property from '../../components/Property.astro'; +import Error from '../../components/Error.astro'; import Endpoint from '../../components/Endpoint.astro'; import CodePanel from '../../components/CodePanel.astro'; import Badge from '../../components/Badge.astro'; @@ -98,9 +99,9 @@ A Bank Account Connection Intent facilitates user authorization of access to Ban ### Errors - + Only Bank Account Connection Intents with the `test` flag can be associated with test [Bank Accounts](/api/bank-accounts/), and vice versa. - + diff --git a/src/content/api/bank-accounts.mdx b/src/content/api/bank-accounts.mdx index 6011641ac..658cd5a7a 100644 --- a/src/content/api/bank-accounts.mdx +++ b/src/content/api/bank-accounts.mdx @@ -8,6 +8,7 @@ nav: --- import Properties from '../../components/Properties.astro'; import Property from '../../components/Property.astro'; +import Error from '../../components/Error.astro'; import Endpoint from '../../components/Endpoint.astro'; import Badge from '../../components/Badge.astro'; import CodePanel from '../../components/CodePanel.astro'; @@ -158,7 +159,7 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank `directDebitAuthority`, the user accepts our [Direct Debit terms](https://centrapay.com/directdebit-termsandconditions/) and has authority to operate this account. - `phone`,`fullName` and `emailAddress` are all required to create a direct-debit authority. This is required to be able to Top Up a Bank Account. + `phone`, `fullName` and `emailAddress` are all required to create a direct-debit authority. This is required to be able to Top Up a Bank Account. ### Attributes @@ -196,11 +197,19 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank ### Errors - | Status | Code | Description | - | :----- | :--------------------------------- | :----------------------------------------------------------------------------------------------- | - | 403 | BANK_ACCOUNT_LIMIT_EXCEEDED | The Centrapay account already has the max amount of directDebitAuthorized enabled Bank Accounts. | - | 403 | BANK_ACCOUNT_HOLDER_LIMIT_EXCEEDED | The global maximum Bank Accounts for the provided Bank Account number has been reached. | - | 403 | DUPLICATE_BANK_ACCOUNT | The Centrapay account already holds this Bank Account. | + + + The Centrapay account already has the max amount of directDebitAuthorized enabled Bank Accounts. + + + + The global maximum Bank Accounts for the provided Bank Account number has been reached. + + + + The Centrapay account already holds this Bank Account. + + ```bash @@ -268,10 +277,15 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank ### Errors - | Status | Code | Description | - | :----- | :------------------------------ | :----------------------------------------------------------------------------------------------- | - | 403 | DIRECT_DEBIT_ALREADY_AUTHORIZED | This bank authority cannot be changed as all fields have been set. | - | 403 | DIRECT_DEBIT_LIMIT_EXCEEDED | The Centrapay account already has the max amount of directDebitAuthorized enabled Bank Accounts. | + + + This bank authority cannot be changed as all fields have been set. + + + + The Centrapay account already has the max amount of directDebitAuthorized enabled Bank Accounts. + + ```bash @@ -372,10 +386,15 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank No attributes. ### Errors - | Status | Code | Description | - | :----- | :------------------------- | :------------------------------------------------------------------------------------------ | - | 403 | BANK_BALANCE_NOT_SUPPORTED | The [Bank Account Type][] does not support retrieval of a balance using Open Banking flows. | - | 403 | BANK_AUTHORIZATION_INVALID | The access token to retrieve the [Bank Account Balance][] is no longer valid. | + + + The [Bank Account Type](#bank-account-type) does not support retrieval of a balance using Open Banking flows. + + + + The access token to retrieve the [Bank Account Balance](#bank-account-balance-model) is no longer valid. + + ```bash @@ -414,12 +433,23 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank ### Errors - | Status | Code | Description | - | :----- | :------------------------------------------ | :------------------------------------------------------------------------------ | - | 403 | BANK_ACCOUNT_ALREADY_VERIFIED | The bank account is already verified. | - | 403 | VERIFICATION_CODE_INVALID | The verification code is incorrect. | - | 403 | BANK_ACCOUNT_VERIFICATION_ATTEMPTS_EXCEEDED | The bank account's maximum failed verification attempts has been reached. | - | 403 | ACCOUNT_MISMATCH | The top up / withdrawal and the bank account do not belong to the same account. | + + + The bank account is already verified. + + + + The verification code is incorrect. + + + + The bank account's maximum failed verification attempts has been reached. + + + + The top up / withdrawal and the bank account do not belong to the same account. + + ```bash @@ -460,12 +490,23 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank ### Errors - | Status | Code | Description | - | :----- | :------------------------------------------ | :------------------------------------------------------------------------------ | - | 403 | BANK_ACCOUNT_ALREADY_VERIFIED | The bank account is already verified. | - | 403 | VERIFICATION_CODE_INVALID | The verification code is incorrect. | - | 403 | BANK_ACCOUNT_VERIFICATION_ATTEMPTS_EXCEEDED | The bank account's maximum failed verification attempts has been reached. | - | 403 | ACCOUNT_MISMATCH | The top up / withdrawal and the bank account do not belong to the same account. | + + + The bank account is already verified. + + + + The verification code is incorrect. + + + + The bank account's maximum failed verification attempts has been reached. + + + + The top up / withdrawal and the bank account do not belong to the same account. + + ```bash @@ -657,10 +698,15 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank ### Errors - | Status | Code | Description | - | :----- | :----------------------------------------- | :------------------------------------------------------------------------------------------------------ | - | 403 | BANK_AUTHORITY_LIMIT_EXCEEDED | The account already has the max amount of bank accounts. | - | 403 | BANK_AUTHORITIES_FOR_BANK_ACCOUNT_EXCEEDED | There are already two bank accounts for the provided bank account number, which is the maximum allowed. | + + + The account already has the max amount of bank accounts. + + + + There are already two bank accounts for the provided bank account number, which is the maximum allowed. + + ```bash @@ -713,10 +759,15 @@ The Bank Account balance, retrieved using Open Banking flows. The supported Bank No attributes. ### Errors - | Status | Code | Description | - | :----- | :----------------------------------------- | :------------------------------------------------------------------------------------------------------ | - | 403 | BANK_AUTHORITY_LIMIT_EXCEEDED | The account already has the max amount of bank accounts. | - | 403 | BANK_AUTHORITIES_FOR_BANK_ACCOUNT_EXCEEDED | There are already two bank accounts for the provided bank account number, which is the maximum allowed. | + + + The account already has the max amount of bank accounts. + + + + There are already two bank accounts for the provided bank account number, which is the maximum allowed. + + ```bash diff --git a/src/content/api/businesses.mdx b/src/content/api/businesses.mdx index e9af1de55..c20139221 100644 --- a/src/content/api/businesses.mdx +++ b/src/content/api/businesses.mdx @@ -8,6 +8,7 @@ nav: --- import Properties from '../../components/Properties.astro'; import Property from '../../components/Property.astro'; +import Error from '../../components/Error.astro'; import Endpoint from '../../components/Endpoint.astro'; import Badge from '../../components/Badge.astro'; import CodePanel from '../../components/CodePanel.astro'; @@ -143,10 +144,15 @@ A Business represents a company registered with the New Zealand Companies Office ### Errors - | Status | Code | Description | - | :----- | :-------------- | :------------------------------------------------------------------------------------------- | - | 403 | INVALID_ACCOUNT | Account does not exist, is not authorized, is of the wrong type, or is not in the NZ region. | - | 403 | INVALID_NZBN | The NZBN provided does not match any NZ business. | + + + Account does not exist, is not authorized, is of the wrong type, or is not in the NZ region. + + + + The NZBN provided does not match any NZ business. + + ```bash @@ -210,10 +216,15 @@ A Business represents a company registered with the New Zealand Companies Office ### Errors - | Status | Code | Description | - | :----- | :-------------- | :------------------------------------------------------------------------------------------- | - | 403 | INVALID_ACCOUNT | Account does not exist, is not authorized, is of the wrong type, or is not in the NZ region. | - | 403 | INVALID_NZBN | The NZBN provided does not match any NZ business. | + + + Account does not exist, is not authorized, is of the wrong type, or is not in the NZ region. + + + + The NZBN provided does not match any NZ business. + + ```bash diff --git a/src/content/api/funds-transfers.mdx b/src/content/api/funds-transfers.mdx new file mode 100644 index 000000000..9ea842356 --- /dev/null +++ b/src/content/api/funds-transfers.mdx @@ -0,0 +1,464 @@ +--- +title: Funds Transfers +description: Endpoints for managing Funds Transfers +draft: true +nav: + path: API + order: 19 +--- + +import Properties from '../../components/Properties.astro'; +import Property from '../../components/Property.astro'; +import Error from '../../components/Error.astro'; +import Endpoint from '../../components/Endpoint.astro'; +import CodePanel from '../../components/CodePanel.astro'; +import Badge from '../../components/Badge.astro'; + +A funds transfer represents either a top up to or a withdrawal from a Centrapay wallet. Topping up a wallet consists of making a bank transfer from the user's bank account to Centrapay. Once Centrapay has verified the transfer was successful a user will be given credit on their Centrapay wallet equal to the amount of the bank transfer. + +--- + + + ## Create a Top Up + + This endpoint allows you to create a topup. + + ### Attributes + + + Total amount of the transaction in cents + + + + The id of the asset + + + + The id of the bank account + + + + ### Errors + + + The wallet and the bank account for the top up request do not belong to the same account. + + + + The bank account already has ten pending top ups, which is the maximum a bank authority can have at any one time. + + + + The top up can not be created because it is above the max amount of funds a bank account can have pending at any one time. The max amount is $1000.00 for verified bank accounts and $100.00 for non-verified bank accounts. + + + + The topup exceeds one or more top up quota limits. See [Quota Error Response](https://docs.centrapay.com/api/quotas#quota-error-response). + + + + Bank account requires authorization for top up. See bank accounts [direct debit endpoint](https://docs.centrapay.com/api/bank-accounts#direct-debit-authority). + + + + The wallet type does not support top ups. See [settlement wallets](https://docs.centrapay.com/api/wallets#settlement-wallets). + + + + The bank account type is not configured for topups. Only `centrapay` type bank accounts are configured. + + + + + ```bash + curl -X POST https://service.centrapay.com/api/topups \ + -H "X-Api-Key: $api_key" \ + -H "Content-Type: application/json" \ + -d '{ + "amount": "10000", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY" + }' + ``` + + + + ```json + { + "id": "hg2RfYTQ635tPBZEPJdCre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "topup", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + } + ``` + + + +--- + + + ## Get Top Up + + This endpoint allows you to retrieve a Top Up by id. + + ### Attributes + No attributes. + + + ```bash + curl https://service.centrapay.com/api/topups/WRhAxxWpTKb5U7pXyxQjjY \ + -H "X-Api-Key: $api_key" + ``` + + + + ```json + { + "id": "hg2RfYTQ635tPBZEPJdCre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "topup", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + } + ``` + + + +--- + + + ## List Top Ups For Authorized Accounts + + This endpoint allows you to list the Top Ups for authorized accounts. + + ### Attributes + No attributes. + + + ```bash + curl https://service.centrapay.com/api/topups \ + -H "X-Api-Key: $api_key" + ``` + + + + ```json + [ + { + "id": "5thg2RPBZEfYTPJdQ63Cre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "topup", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + }, + { + "id": "hg2RfYTQ635tPBZEPJdCre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "topup", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + } + ] + ``` + + + +--- + + + ## List Top Ups For an Account + + This endpoint allows you to list the Top Ups for an account. + + ### Attributes + No attributes. + + + ```bash + curl https://service.centrapay.com/api/accounts/aBc932S9182qwCDqwer/topups \ + -H "X-Api-Key: $api_key" + ``` + + + + ```json + [ + { + "id": "5thg2RPBZEfYTPJdQ63Cre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "topup", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + }, + { + "id": "hg2RfYTQ635tPBZEPJdCre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "topup", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + } + ] + ``` + + + + +--- + + + ## Create Withdrawal + + This endpoint allows you to create a withdrawal. + + ### Attributes + + + Total amount of the transaction in cents + + + + The id of the asset + + + + The id of the bank account + + + + ### Errors + + + The wallet and the bank account for the withdrawal request do not belong to the same account. + + + + The wallet balance is less than the required amount. + + + + The wallet type does not support withdrawals. See [settlement wallets](https://docs.centrapay.com/api/wallets#settlement-wallets). + + + + The bank account type is not configured for withdrawals. Only `centrapay` type bank accounts are configured. + + + + + ```bash + curl -X POST https://service.centrapay.com/api/withdrawals \ + -H "X-Api-Key: $api_key" \ + -H "Content-Type: application/json" \ + -d '{ + "amount": "10000", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY" + }' + ``` + + + + ```json + { + "id": "hg2RfYTQ635tPBZEPJdCre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "withdrawal", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + } + ``` + + + + +--- + + + ## Get Withdrawal + + This endpoint allows you to retrieve a Withdrawal by id. + + ### Attributes + No attributes. + + ### Errors + + + The wallet and the bank account for the withdrawal request do not belong to the same account. + + + + The wallet balance is less than the required amount. + + + + The wallet type does not support withdrawals. See [settlement wallets](https://docs.centrapay.com/api/wallets#settlement-wallets). + + + + The bank account type is not configured for withdrawals. Only `centrapay` type bank accounts are configured. + + + + + ```bash + curl https://service.centrapay.com/api/withdrawals/WRhAxxWpTKb5U7pXyxQjjY \ + -H "X-Api-Key: $api_key" + ``` + + + + ```json + { + "id": "hg2RfYTQ635tPBZEPJdCre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "withdrawal", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + } + ``` + + + + +--- + + + ## List Withdrawals for an Account + + This endpoint allows you to list the withdrawals for an Account. + + ### Attributes + No attributes. + + + ```bash + curl https://service.centrapay.com/api/accounts/aBc932S9182qwCDqwer/withdrawals \ + -H "X-Api-Key: $api_key" + ``` + + + + + ```json + { + "items": [ + { + "id": "5thg2RPBZEfYTPJdQ63Cre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "withdrawal", + "amount": "10000", + "status": "created", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + }, + { + "id": "hg2RfYTQ635tPBZEPJdCre", + "assetId": "Te2uDM7xhDLWGVJU3nzwnh", + "bankAccountId": "FRhAzzWpTKb5U7pZygQjjY", + "accountId": "aBc932S9182qwCDqwer", + "type": "withdrawal", + "amount": "10000", + "status": "done", + "createdAt": "2020-05-01T12:30:00.000Z", + "updatedAt": "2020-05-01T12:30:00.000Z" + } + ] + } + ``` + + + +--- + + + ## Abort Funds Transfer + + This endpoint allows you to abort a Funds Transfer. + + ### Attributes + No attributes. + + ### Errors + + + Aborting funds transfers of type `withdrawal` is not supported. + + + + The funds transfer is already complete. + + + + + ```bash + curl -X POST https://service.centrapay.com/api/funds-transfers/5thg2RPBZEfYTPJdQ63Cre/abort \ + -H "X-Api-Key: $api_key" + ``` + + + + ```json + {} + ``` + +