Skip to content

Commit 33bae2f

Browse files
max-korontombing
andauthored
Doc 1352/account statement query new fields description review (#457)
* Update guide-generate-statement.mdx * Update guide-generate-statement.mdx * DOC-1383/add-documentation-and-a-guide-about-updating-a-capital-deposit * Revert "DOC-1383/add-documentation-and-a-guide-about-updating-a-capital-deposit" This reverts commit b9ce134. * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: ntombing <[email protected]> * Final Peer Review edits * Update docs/topics/accounts/overview/guide-generate-statement.mdx Co-authored-by: ntombing <[email protected]> --------- Co-authored-by: ntombing <[email protected]>
1 parent a584a67 commit 33bae2f

File tree

1 file changed

+110
-17
lines changed

1 file changed

+110
-17
lines changed

docs/topics/accounts/overview/guide-generate-statement.mdx

Lines changed: 110 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22
title: Generate account statement
33
---
44

5-
# Generate account statement
5+
# Generate an account statement
66

77
Generate an account statement for a custom time period **using the API** or on your **Dashboard**.
88

99
## API guide {#guide}
1010

1111
1. Call the `generateAccountStatement` mutation.
12-
1. Add the `accountId`.
13-
1. Add the `openingDate` and `closingDate` with the following format: `YYYY-MM-DDT00:00:00.000Z` (up to three months).
14-
1. Set the `language` for your account statement, and choose `PDF` or `CSV` if you'd like.
15-
1. Add all information you'd like to review about the statement (lines 11-21).
12+
1. Add the `accountId` (line 4).
13+
1. Add the `openingDate` and `closingDate` using format `YYYY-MM-DDT00:00:00.000Z` (lines 5-6).
14+
- Maximum period: three months.
15+
1. Set the `language` for your account statement, and provide the file `format` (`PDF` or `CSV`) (lines 7-8).
16+
1. Add all information you'd like to review about the statement (lines 11-27).
1617

1718
### Mutation {#mutation}
1819

19-
<a href="https://explorer.swan.io?query=bXV0YXRpb24gR2VuZXJhdGVBY2NvdW50U3RhdGVtZW50IHsKICBnZW5lcmF0ZUFjY291bnRTdGF0ZW1lbnQoCiAgICBpbnB1dDogewogICAgICBhY2NvdW50SWQ6ICIkQUNDT1VOVF9JRCIKICAgICAgb3BlbmluZ0RhdGU6ICIyMDI0LTA0LTEyVDAwOjAwOjAwLjAwMFoiCiAgICAgIGNsb3NpbmdEYXRlOiAiMjAyNC0wNi0xMlQwMDowMDowMC4wMDBaIgogICAgICBsYW5ndWFnZTogbmwKICAgICAgc3RhdGVtZW50VHlwZTogUERGCiAgICB9CiAgKSB7CiAgICBjbG9zaW5nRGF0ZQogICAgY3JlYXRlZEF0CiAgICBmZWVzIHsKICAgICAgY3VycmVuY3kKICAgICAgdmFsdWUKICAgIH0KICAgIGlkCiAgICBvcGVuaW5nRGF0ZQogICAgcGVyaW9kCiAgICBzdGF0dXMKICAgIHVwZGF0ZWRBdAogIH0KfQo%3D&tab=api" className="explorer-badge">Open in API Explorer</a>
20+
<a href="https://explorer.swan.io?query=bXV0YXRpb24gR2VuZXJhdGVBY2NvdW50U3RhdGVtZW50IHsKICBnZW5lcmF0ZUFjY291bnRTdGF0ZW1lbnQoCiAgICBpbnB1dDogewogICAgICBhY2NvdW50SWQ6ICIkQUNDT1VOVF9JRCIKICAgICAgb3BlbmluZ0RhdGU6ICIyMDI0LTA0LTEyVDAwOjAwOjAwLjAwMFoiCiAgICAgIGNsb3NpbmdEYXRlOiAiMjAyNC0wNi0xMlQwMDowMDowMC4wMDBaIgogICAgICBsYW5ndWFnZTogbmwKICAgICAgZm9ybWF0OiBQREYKICAgIH0KICApIHsKICAgIGNsb3NpbmdEYXRlCiAgICBjcmVhdGVkQXQKICAgIGZlZUNyZWRpdHMgewogICAgICBjdXJyZW5jeQogICAgICB2YWx1ZQogICAgfQogICAgZmVlRGViaXRzIHsKICAgICAgY3VycmVuY3kKICAgICAgdmFsdWUKICAgIH0KICAgIGlkCiAgICBvcGVuaW5nRGF0ZQogICAgcGVyaW9kCiAgICBzdGF0dXNJbmZvIHsKICAgICAgc3RhdHVzCiAgICB9CiAgICB1cGRhdGVkQXQKICB9Cn0K" className="explorer-badge">Open in API Explorer</a>
2021

2122
```graphql {4-8} showLineNumbers
2223
mutation GenerateAccountStatement {
@@ -26,50 +27,142 @@ mutation GenerateAccountStatement {
2627
openingDate: "2024-04-12T00:00:00.000Z"
2728
closingDate: "2024-06-12T00:00:00.000Z"
2829
language: nl
29-
statementType: PDF
30+
format: PDF
3031
}
3132
) {
3233
closingDate
3334
createdAt
34-
fees {
35+
feeCredits {
36+
currency
37+
value
38+
}
39+
feeDebits {
3540
currency
3641
value
3742
}
3843
id
3944
openingDate
4045
period
41-
status
46+
statusInfo {
47+
status
48+
}
4249
updatedAt
4350
}
4451
}
45-
4652
```
4753

4854
### Payload {#payload}
4955

5056
The mutation returns all of the requested information.
51-
Notice the `period` = `Custom` (line 12), indicating that you generated this account statement, not Swan.
5257

53-
```json {12} showLineNumbers
58+
The `period` field shows `Custom` (line 16) for on-demand statements. Swan automatically generates statements with `period` values of `Monthly` or `Custom`.
59+
60+
The `statusInfo.status` shows `Pending` while Swan generates the statement (line 18).
61+
62+
```json {16,18} showLineNumbers
5463
{
5564
"data": {
5665
"generateAccountStatement": {
5766
"closingDate": "2024-06-12T00:00:00.000Z",
5867
"createdAt": "2024-06-20T15:56:50.096Z",
59-
"fees": {
68+
"feeCredits": {
69+
"currency": "EUR",
70+
"value": "5.50"
71+
},
72+
"feeDebits": {
6073
"currency": "EUR",
61-
"value": "0"
74+
"value": "12.00"
6275
},
6376
"id": "$ACCOUNT_STATEMENT_ID",
6477
"openingDate": "2024-04-12T00:00:00.000Z",
6578
"period": "Custom",
66-
"status": "Available",
79+
"statusInfo": {
80+
"status": "Pending"
81+
},
6782
"updatedAt": "2024-06-20T15:56:52.423Z"
6883
}
6984
}
7085
}
7186
```
7287

88+
### Retrieve generated statement {#retrieve}
89+
90+
After generating the account statement, the `statusInfo` > `status` changes to `Generated`.
91+
When the status is `Generated`, you can retrieve the download URL.
92+
93+
1. Call the `accountStatement` query.
94+
1. Add the account statement `id` (line 2).
95+
1. Add `statusInfo` for all statuses (line 8). The URL to download the statement is provided in `statusInfo` > `GeneratedStatusInfo` > `url` (line 12).
96+
97+
<a href="https://explorer.swan.io?query=cXVlcnkgR2V0QWNjb3VudFN0YXRlbWVudCB7CiAgYWNjb3VudFN0YXRlbWVudChpZDogIiRBQ0NPVU5UX1NUQVRFTUVOVF9JRCIpIHsKICAgIGNsb3NpbmdEYXRlCiAgICBjcmVhdGVkQXQKICAgIGlkCiAgICBvcGVuaW5nRGF0ZQogICAgcGVyaW9kCiAgICBzdGF0dXNJbmZvIHsKICAgICAgc3RhdHVzCiAgICAgIC4uLiBvbiBHZW5lcmF0ZWRTdGF0dXNJbmZvIHsKICAgICAgICBzdGF0dXMKICAgICAgICB1cmwKICAgICAgfQogICAgICAuLi4gb24gUGVuZGluZ1N0YXR1c0luZm8gewogICAgICAgIHN0YXR1cwogICAgICB9CiAgICAgIC4uLiBvbiBGYWlsZWRTdGF0dXNJbmZvIHsKICAgICAgICBzdGF0dXMKICAgICAgfQogICAgICAuLi4gb24gVm9pZGVkU3RhdHVzSW5mbyB7CiAgICAgICAgc3RhdHVzCiAgICAgICAgdXJsCiAgICAgIH0KICAgIH0KICAgIHVwZGF0ZWRBdAogIH0KfQo=" className="explorer-badge">Open in API Explorer</a>
98+
99+
```graphql {2,8,12} showLineNumbers
100+
query GetAccountStatement {
101+
accountStatement(id: "$ACCOUNT_STATEMENT_ID") {
102+
closingDate
103+
createdAt
104+
id
105+
openingDate
106+
period
107+
statusInfo {
108+
status
109+
... on GeneratedStatusInfo {
110+
status
111+
url
112+
}
113+
... on PendingStatusInfo {
114+
status
115+
}
116+
... on FailedStatusInfo {
117+
status
118+
}
119+
... on VoidedStatusInfo {
120+
status
121+
url
122+
}
123+
}
124+
updatedAt
125+
}
126+
}
127+
```
128+
129+
#### Payload {#retrieve-payload}
130+
131+
The `period` field shows `Custom` (line 8) for on-demand statements.
132+
133+
Use the `url` to download the statement (line 12).
134+
135+
1. Copy the `url` from the payload.
136+
1. Paste the `url` into your preferred browser and press enter.
137+
1. The document downloads automatically.
138+
139+
```json {8,12} showLineNumbers
140+
{
141+
"data": {
142+
"accountStatement": {
143+
"closingDate": "2024-06-12T00:00:00.000Z",
144+
"createdAt": "2024-06-20T15:56:50.096Z",
145+
"id": "$ACCOUNT_STATEMENT_ID",
146+
"openingDate": "2024-04-12T00:00:00.000Z",
147+
"period": "Custom",
148+
"statusInfo": {
149+
"__typename": "GeneratedStatusInfo",
150+
"status": "Generated",
151+
"url": "$DOWNLOAD_URL"
152+
},
153+
"updatedAt": "2024-06-20T15:56:58.234Z"
154+
}
155+
}
156+
}
157+
```
158+
159+
:::caution Account statement statuses
160+
- **`Pending`**: The statement is being generated.
161+
- **`Generated`**: The statement is ready to download. The `url` field contains the download link.
162+
- **`Failed`**: Statement generation failed. Double-check your account ID and generate a new statement.
163+
- **`Voided`**: The statement has been voided. A voided statement `url` is still available for reference.
164+
:::
165+
73166
## Dashboard {#dashboard}
74167

75168
You can also generate statements from your Dashboard.
@@ -81,13 +174,13 @@ You can also generate statements from your Dashboard.
81174

82175
![Screenshot of the Dashboard Account statements tab](../../../images/topics/accounts/statement-generate-1.png)
83176

84-
5. Enter the start date and closing date. The time period can cover **up to three months**.
177+
5. Enter the opening date and closing date. The time period can cover **up to three months**.
85178
1. Choose the format and language.
86179
1. Click **Save**.
87180

88181
![Screenshot of Dashboard modal to generate an account statement](../../../images/topics/accounts/statement-generate-2.png)
89182

90183
Your new statement appears on your list of account statements with the status `Pending`.
91-
After the status changes to `Available`, you can download your statement.
184+
After the status changes to `Generated`, you can download your statement.
92185

93186
![Screenshot of new account statement line with pending status](../../../images/topics/accounts/statement-generate-3.png)

0 commit comments

Comments
 (0)