From e75c81b6c309f740322547ce1ee6d559b3a92dc3 Mon Sep 17 00:00:00 2001 From: Andy Clifford Date: Wed, 18 Oct 2023 14:57:13 +1300 Subject: [PATCH] Migrate bank account approvals page --- astro.config.mjs | 4 + .../links.integration.test.js.snap | 1 + src/content/api/bank-account-approvals.mdx | 356 ++++++++++++++++++ 3 files changed, 361 insertions(+) create mode 100644 src/content/api/bank-account-approvals.mdx diff --git a/astro.config.mjs b/astro.config.mjs index 0d95e399d..3923f35f9 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -39,5 +39,9 @@ export default defineConfig({ redirects: { '/guides/merchant-terminals/': '/guides/payment-flows/', '/accounts/': '/api/accounts/', + '/fiat/': '/api/bank-accounts/', + '/fiat/bank-accounts/': '/api/bank-accounts/', + '/fiat/bank-authorities': '/api/bank-accounts/', + '/fiat/authorities': '/api/bank-accounts/', }, }); diff --git a/src/__tests__/__snapshots__/links.integration.test.js.snap b/src/__tests__/__snapshots__/links.integration.test.js.snap index 28aa3724e..23a565477 100644 --- a/src/__tests__/__snapshots__/links.integration.test.js.snap +++ b/src/__tests__/__snapshots__/links.integration.test.js.snap @@ -85,6 +85,7 @@ exports[`the build should not break any links 1`] = ` "/api/bank-account-approvals#accept-a-bank-account-approval-experimental", "/api/bank-account-approvals#bank-account-approval", "/api/bank-account-approvals#bank-account-approval-activity", + "/api/bank-account-approvals#bank-account-approval-model", "/api/bank-account-approvals#bank-account-approval-types", "/api/bank-account-approvals#bank-account-approvals", "/api/bank-account-approvals#contents", diff --git a/src/content/api/bank-account-approvals.mdx b/src/content/api/bank-account-approvals.mdx new file mode 100644 index 000000000..eaf11ed58 --- /dev/null +++ b/src/content/api/bank-account-approvals.mdx @@ -0,0 +1,356 @@ +--- +title: Bank Account Approvals +description: Bank Account Approval model and related endpoints +draft: true +nav: + path: API + order: 17 +--- +import Properties from '../../components/Properties.astro'; +import Property from '../../components/Property.astro'; +import Endpoint from '../../components/Endpoint.astro'; +import CodeGroup from '../../components/CodeGroup.astro'; +import Badge from '../../components/Badge.astro'; + +A Bank Account Approval represents any added authorization on a [Bank Account](/api/bank-accounts). +This may be an approval from Centrapay or a consent from a Centrapay [Account](/api/accounts) owner +that allows access to a third-party system. See [Bank Account Approval Types](#bank-account-approval-types). + +## Bank Account Approval Model + +### Attributes + + + + The Bank Account Approval's unique identifier. + + + + The id of the associated [Bank Account](/api/bank-accounts/). + + + + The id of the owning Centrapay [Account](/api/accounts/). + + + + The type of Bank Account Approval. See [Bank Account Approval Types](#bank-account-approval-types). + + + + The current status of the Bank Account Approval. Supported values are `created`, `pending`, `approved`, `declined` and `done`. + + + + When the Bank Account Approval was created. + + + + The User or API Key that created the Bank Account Approval. + + + + When the Bank Account Approval was updated. + + + + The User or API Key that updated the Bank Account Approval. + + + + An array of [Bank Account Approval Activity] associated with the Bank Account Approval. + + + + The id of the associated [Media Upload](/api/media-uploads). Required for type `settlement`. + + + + A long lived access token for access to a third-party system. Required for type `account-consent` and `payment-consent`. + + + + A unique identifier for an authorization in a third-party system. + + + +### Bank Account Approval Types + +| Name | description | +| :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| settlement | An `approved` Bank Account Approval of type `settlement` is required for the funds in a [Settlement Wallet](https://docs.centrapay.com/api/wallets#settlement-wallets) to be released. A [Media Upload](/api/media-uploads) is uploaded by the user to provide evidence of ownership of the [Bank Account](/api/bank-accounts) to be approved. | +| account-consent | An `approved` Bank Account Approval of type `account-consent` provides an access token to read account details from a third-party. | +| payment-consent | An `approved` Bank Account Approval of type `payment-consent` provides an access token for creating payments with a third-party. | + +--- + +## Bank Account Approval Activity Model + +### Attributes + + + + Unique sequential Bank Account Approval Activity number. + + + + The id of the associated [Bank Account Approval](#bank-account-approval-model). + + + + The type of the Bank Account Approval Activity. + + + + When the Bank Account Approval Activity was created. + + + + The User or API Key that created the Bank Account Approval Activity. + + + +--- + + + ## Request Bank Account Approval + + This endpoint allows you to request a Bank Account Approval. + + ### Attributes + + + The id of the associated [Media Upload][/api/media-uploads]. + + + + The id of the associated [Bank Account](/api/bank-accounts). + + + + The [Bank Account Approval Type](#bank-account-approval-types). A Bank Account Approval can only be requested for type `settlement`. + + + + ### Errors + + + There is already a Bank Account Approval in progress that is awaiting review from Centrapay. + + + + + ```bash + curl -X POST https://service.centrapay.com/api/bank-account-approvals \ + -H "X-Api-Key: $api_key" \ + -H "Content-Type: application/json" \ + -d '{ + "mediaUploadId": "uooxSens6ykJaim1Cu1Q55", + "bankAccountId": "WRhAxxWpTKb5U7pXyxQjjY", + "type": "settlement" + }' + ``` + + ```json + { + "id": "DcTs3U38HdhfEqwF1GKoT3", + "mediaUploadId": "uooxSens6ykJaim1Cu1Q55", + "bankAccountId": "WRhAxxWpTKb5U7pXyxQjjY", + "accountId": "Jaim1Cu1Q55uooxSens6yk", + "type": "settlement", + "status": "created", + "createdAt": "2021-11-08T21:52:39.915Z", + "createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey", + "modifiedAt": "2021-11-08T21:52:39.915Z", + "modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey" + } + ``` + + + +--- + + + ## Get Bank Account Approval + + This endpoint allows you to retrieve a Bank Account Approval. + + ### Attributes + No attributes. + + + ```bash + curl https://service.centrapay.com/api/bank-account-approvals/bbab9a768921019cb856 \ + -H "X-Api-Key: $api_key" + ``` + + ```json + { + "id": "bbab9a768921019cb856", + "bankAccountId": "WRhAxxWpTKb5U7pXyxQjjY", + "accountId": "Jaim1Cu1Q55uooxSens6yk", + "type": "account-consent", + "status": "approved", + "createdAt": "2021-11-08T21:52:39.915Z", + "createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey", + "modifiedAt": "2021-11-08T21:52:39.915Z", + "modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey", + "refreshToken": "y04Njk3LTRjNmZkYjBhMzRiZSIsIm5vbmNlIjoiOTg3MTJjMGNkZmFiNWZjNzMwM2MxMzNl", + "consentId": "d24dbe-e2bc46ac-d924e38af112" + } + ``` + + + +--- + + + ## Accept Bank Account Approval + + This endpoint allows you to accept a Bank Account Approval. + + ### Attributes + + + The reason for accepting the Bank Account Approval. + + + + ### Errors + + + The Bank Account Approval has already been accepted or declined. + + + + + ```bash + curl -X POST https://service.centrapay.com/api/bank-account-approvals/DcTs3U38HdhfEqwF1GKoT3/accept \ + -H "X-Api-Key: $api_key" \ + -H "Content-Type: application/json" \ + -d '{ + "reason": "All details match" + }' + ``` + + ```json + {} + ``` + + + +--- + + + ## Decline Bank Account Approval + + This endpoint allows you to decline a Bank Account Approval. + + ### Attributes + + + The reason for declining the Bank Account Approval. + + + + ### Errors + + + The Bank Account Approval has already been accepted or declined. + + + + + ```bash + curl -X POST https://service.centrapay.com/api/bank-account-approvals/DcTs3U38HdhfEqwF1GKoT3/decline \ + -H "X-Api-Key: $api_key" \ + -H "Content-Type: application/json" \ + -d '{ + "reason": "No details match" + }' + ``` + + ```json + {} + ``` + + + +--- + + + ## List Bank Account Approvals + + This endpoint allows you to list the Bank Account Approvals for a Bank Account. + + ### Attributes + No attributes. + + + ```bash + curl https://service.centrapay.com/api/bank-accounts/5vpkxjn6z787LiAKCqwuf9/approvals \ + -H "X-Api-Key: $api_key" + ``` + + ```json + { + "items": [ + { + "id": "PJ6jTgDNv1xfFAooCoWZLe", + "bankAccountId": "5vpkxjn6z787LiAKCqwuf9", + "createdAt": "2022-08-21T21:41:46.361Z", + "modifiedAt": "2022-08-21T21:41:46.361Z", + "accountId": "TEZiZWAtX6v1hJucU4fGKx", + "createdBy": "crn::user:7c0a034a-c36e-4645-b12b-57dec339ab47", + "modifiedBy": "crn::user:7c0a034a-c36e-4645-b12b-57dec339ab47", + "type": "account-consent", + "status": "approved", + "refreshToken": "tXC4dFm3yNAQbLrm4JxY6pynGoEG8vSJ", + "consentId": "fFAoo-CoWZLea8-4dFm3yNAoWZLe" + }, + { + "id": "WiFna4hCc7k4KYUxncFPg4", + "bankAccountId": "5vpkxjn6z787LiAKCqwuf9", + "createdAt": "2022-08-11T20:53:57.337Z", + "modifiedAt": "2022-08-11T20:53:57.337Z", + "accountId": "TEZiZWAtX6v1hJucU4fGKx", + "createdBy": "crn::user:7c0a034a-c36e-4645-b12b-57dec339ab47", + "modifiedBy": "crn::user:7c0a034a-c36e-4645-b12b-57dec339ab47", + "type": "payment-consent", + "status": "approved", + "refreshToken": "dAGLl8AfnNCGEKEmBm1FryaDyW1JBh28", + "consentId": "4KYUx-ncFPg4a8-Ll8AfnNCcFPg4" + }, + { + "id": "SoQkkv4rWRwrknrdkYbBuB", + "bankAccountId": "5vpkxjn6z787LiAKCqwuf9", + "createdAt": "2022-08-21T21:41:22.345Z", + "modifiedAt": "2022-08-21T21:41:22.345Z", + "accountId": "TEZiZWAtX6v1hJucU4fGKx", + "createdBy": "crn::user:7c0a034a-c36e-4645-b12b-57dec339ab47", + "modifiedBy": "crn::user:7c0a034a-c36e-4645-b12b-57dec339ab47", + "type": "account-consent", + "status": "declined", + "refreshToken": "rX3MNTxFwKIU2lhyZOrq87Aw74ASSHUM", + "consentId": "rknrd-kYbBuBa8-MNTxFwKIYbBuB" + } + ] + } + ``` + +