Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deposits REST API docs with decoupled deposit changes #7848

Merged
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
cf0f973
Add Deposits overview all docs
Jinksi Dec 6, 2023
cc62461
Add `/deposits/overview` docs
Jinksi Dec 6, 2023
b76e9d3
Add GET `/deposits` docs
Jinksi Dec 6, 2023
df00b61
Add changelog entry
Jinksi Dec 6, 2023
ef008fa
Fix incorrect POST in cURL command examples
Jinksi Dec 6, 2023
ae0266f
Add GET `/deposits/summary` docs
Jinksi Dec 6, 2023
66d1f22
Add GET `/deposits/{deposit_id}` docs
Jinksi Dec 6, 2023
b5f56a8
Add POST `/deposits` docs
Jinksi Dec 6, 2023
9b62e9d
Add slate docs readme
Jinksi Dec 6, 2023
dfc4b7f
Merge branch 'develop' into fix/7839-deposits-rest-api-docs
Jinksi Dec 6, 2023
ba1094e
Add POST `/deposits/download` docs
Jinksi Dec 7, 2023
e1cb5bb
Use consistent naming for titles
Jinksi Dec 7, 2023
35e7937
Expand overview-all balances response
Jinksi Dec 7, 2023
44703f9
Expand overview balances response
Jinksi Dec 7, 2023
dcafa75
Show monthly/weekly anchors as potentially undefined
Jinksi Dec 7, 2023
379d51b
Fix nesting within `overview` return docs
Jinksi Dec 7, 2023
32c4bfd
Deprecate return values for `/deposits/overview-all`
Jinksi Dec 7, 2023
46b6d39
Deprecate return values for `/deposits/overview`
Jinksi Dec 7, 2023
627d5c3
Deprecate return values for GET `/deposits` and `deposits/summary`
Jinksi Dec 7, 2023
46b347e
Deprecate return values for GET `/deposits/id`
Jinksi Dec 7, 2023
d3d4c16
Fix text formatting
Jinksi Dec 7, 2023
a3724d3
Update POST `/deposits` docs with new params
Jinksi Dec 7, 2023
2405ff3
Update POST `/deposits/download` docs with deprecated params
Jinksi Dec 7, 2023
c50324f
Tweak formatting
Jinksi Dec 7, 2023
55b97a4
Update CSV export deprecation comment
Jinksi Dec 7, 2023
dc5eaf5
Add changelog entry
Jinksi Dec 7, 2023
02fc498
Update `transaction_ids` to show `undefined`/no longer present
Jinksi Dec 7, 2023
dac0ba7
Add not found response for GET `/deposits/id`
Jinksi Dec 7, 2023
c84796a
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
Jinksi Dec 7, 2023
bf5f475
Merge branch 'develop' into fix/7839-deposits-rest-api-docs
shendy-a8c Dec 7, 2023
e77f9ab
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
shendy-a8c Dec 7, 2023
2cbd3c8
Merge branch 'develop' into fix/7839-deposits-rest-api-docs
Jinksi Dec 8, 2023
ec0da8e
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
Jinksi Dec 8, 2023
c4f4244
No longer return `next_scheduled`
Jinksi Dec 8, 2023
1a27029
No longer return `next_deposit`
Jinksi Dec 8, 2023
9455183
Show `404` response if deposit not found
Jinksi Dec 8, 2023
38daf7d
Add Deposit object and update deposit overview
Jinksi Dec 8, 2023
d633b2d
Update deposit return types in `deposits/overview`
Jinksi Dec 8, 2023
e3f1c7b
Add deposit object example
Jinksi Dec 8, 2023
fd2924c
Use deposit object return type in list deposits
Jinksi Dec 8, 2023
8d9a3b5
Use deposit object return type in GET single deposit
Jinksi Dec 8, 2023
64648dc
Update balance `source_types` response description
Jinksi Dec 8, 2023
bb21368
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
Jinksi Dec 8, 2023
61e2910
Deprecate `estimated` status from Deposit Object
Jinksi Dec 8, 2023
4e25220
Deprecated `balance.deposits_count`
Jinksi Dec 8, 2023
08b4515
Tweak formatting
Jinksi Dec 8, 2023
6c39012
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi Dec 8, 2023
dd3d3a5
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi Dec 19, 2023
3dd1439
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi Jan 2, 2024
f40b855
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi Jan 4, 2024
4f49e0a
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi Jan 8, 2024
dc9227b
Change est deposit deprecation version 7.0.0 → 7.1.0
Jinksi Jan 8, 2024
3525517
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi Jan 23, 2024
4e44254
Remove deposit status `estimated` value
Jinksi Jan 23, 2024
0c8f6f3
Remove deprecated overview-all fields
Jinksi Jan 23, 2024
1cc7a42
Remove deprecated overview fields
Jinksi Jan 23, 2024
96f48c0
Remove deprecated deposit list values
Jinksi Jan 23, 2024
3d6cb98
Remove deprecated deposit summary values
Jinksi Jan 23, 2024
0370a3a
Update get deposit description
Jinksi Jan 23, 2024
9d44377
Remove deprecated POST instant deposit field
Jinksi Jan 23, 2024
809796e
Remove deprecated POST deposit download values
Jinksi Jan 23, 2024
9e68172
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi Jan 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Update REST API documentation for deposits endpoints with changes to estimated and instant deposits
105 changes: 17 additions & 88 deletions docs/rest-api/source/includes/wp-api-v3/deposits.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The Deposits API endpoints provide access to an account's deposits data, includi
- `date` _int_ - The arrival date of the deposit in unix timestamp milliseconds.
- `type` _string_ - The type of deposit. `deposit` `withdrawal`
- `amount` _int_ - The amount of the deposit.
- `status` _string_ - The status of the deposit. `paid` `pending` `in_transit` `canceled` `failed` `estimated`
- `status` _string_ - The status of the deposit. `paid` `pending` `in_transit` `canceled` `failed`
- `bankAccount` _string_ - The bank account the deposit was/will be paid to.
- `currency` _string_ - The currency of the deposit. E.g. `eur`
- `automatic` _bool_ - Returns `true` if the payout is created by an automated schedule and `false` if it’s requested manually.
Expand All @@ -51,14 +51,12 @@ Fetch an overview of account deposits for all deposit currencies. This includes

- `deposit` _object_
- `last_paid` _array_ of [**Deposit**](#deposit-object) - The last deposit that has been paid for each deposit currency.
- `next_scheduled` _array_ of [**Deposit**](#deposit-object) - The next scheduled deposit for each deposit currency.
- `last_manual_deposits` _array_ of [**Deposit**](#deposit-object) - Manual deposits that have been paid in the last 24 hours.
- `balance` _object_
- `pending` _array_ - The pending balance for each deposit currency.
- `amount` _int_ - The amount of the balance.
- `currency` _string_ - The currency of the balance. E.g. `usd`.
- `source_types` _object_ | _null_ - The amount of the balance from each source type, e.g. `{ "card": 12345 }`
- `deposits_count` _int_ - The number of deposits that make up the balance.
- `available` _array_ - The available balance for each deposit currency.
- `amount` _int_ - The amount of the balance.
- `currency` _string_ - The currency of the balance. E.g. `usd`.
Expand All @@ -69,7 +67,6 @@ Fetch an overview of account deposits for all deposit currencies. This includes
- `fee` _int_ - The fee amount of the balance.
- `fee_percentage` _int_ - The fee percentage of the balance.
- `net` _int_ - The net amount of the balance.
- `transaction_ids` _array_ - The list of transaction IDs that make up the balance.
- `account` _object_
- `deposits_enabled` _bool_ - Whether deposits are enabled for the account.
- `deposits_blocked` _bool_ - Whether deposits are blocked for the account.
Expand Down Expand Up @@ -118,34 +115,6 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview-all \
"created": 1701302400
}
],
"next_scheduled": [
{
"id": "wcpay_estimated_weekly_eur_1702598400",
"date": 1702598400000,
"type": "deposit",
"amount": 458784,
"status": "estimated",
"bankAccount": "STRIPE TEST BANK •••• 3000 (EUR)",
"currency": "eur",
"automatic": true,
"fee": 0,
"fee_percentage": 0,
"created": 1702598400
},
{
"id": "wcpay_estimated_weekly_usd_1701993600",
"date": 1701993600000,
"type": "deposit",
"amount": 823789,
"status": "estimated",
"bankAccount": "STRIPE TEST BANK •••• 6789 (USD)",
"currency": "usd",
"automatic": true,
"fee": 0,
"fee_percentage": 0,
"created": 1701993600
}
],
"last_manual_deposits": []
},
"balance": {
Expand All @@ -155,16 +124,14 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview-all \
"currency": "eur",
"source_types": {
"card": -114696
},
"deposits_count": 1
}
},
{
"amount": 707676,
"currency": "usd",
"source_types": {
"card": 707676
},
"deposits_count": 2
}
}
],
"available": [
Expand All @@ -189,11 +156,7 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview-all \
"currency": "usd",
"fee": 185,
"fee_percentage": 1.5,
"net": 0,
"transaction_ids": [
"txn_3OHyIxCIHGKp1UAi0aVyDQ5D",
"txn_3OJSuOCIHGKp1UAi1mRA2lL5"
]
"net": 0
}
]
},
Expand Down Expand Up @@ -226,13 +189,11 @@ Fetch an overview of account deposits for a single deposit currency. This includ
### Returns

- `last_deposit` _object_ [**Deposit**](#deposit-object) | _null_- The last deposit that has been paid for the deposit currency.
- `next_deposit` _object_ [**Deposit**](#deposit-object) | _null_ - The next scheduled deposit for the deposit currency.
- `balance` _object_
- `pending` _object_ - The pending balance for the deposit currency.
- `amount` _int_ - The amount of the balance.
- `currency` _string_ - The currency of the balance. E.g. `usd`.
- `source_types` _object_ | _null_ - The amount of the balance from each source type, e.g. `{ "card": 12345 }`
- `deposits_count` _int_ - The number of deposits that make up the balance.
- `available` _object_ - The available balance for the deposit currency.
- `amount` _int_ - The amount of the balance.
- `currency` _string_ - The currency of the balance. E.g. `usd`.
Expand All @@ -243,7 +204,6 @@ Fetch an overview of account deposits for a single deposit currency. This includ
- `fee` _int_ - The fee amount of the balance.
- `fee_percentage` _int_ - The fee percentage of the balance.
- `net` _int_ - The net amount of the balance.
- `transaction_ids` _array_ - The list of transaction IDs that make up the balance.
- `account` _object_
- `deposits_disabled` _bool_ - Whether deposits are enabled for the account.
- `deposits_blocked` _bool_ - Whether deposits are blocked for the account.
Expand Down Expand Up @@ -276,19 +236,6 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview \
"fee_percentage": 0,
"created": 1701648000
},
"next_deposit": {
"id": "wcpay_estimated_weekly_eur_1702598400",
"date": 1702598400000,
"type": "deposit",
"amount": 458784,
"status": "estimated",
"bankAccount": "STRIPE TEST BANK •••• 3000 (EUR)",
"currency": "eur",
"automatic": true,
"fee": 0,
"fee_percentage": 0,
"created": 1702598400
},
"balance": {
"available": {
"amount": 573480,
Expand All @@ -302,17 +249,15 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview \
"currency": "eur",
"source_types": {
"card": -114696
},
"deposits_count": 1
}
}
},
"instant_balance": {
"amount": 0,
"currency": "usd",
"fee": 0,
"fee_percentage": 1.5,
"net": 0,
"transaction_ids": []
"net": 0
},
"account": {
"deposits_disabled": false,
Expand Down Expand Up @@ -351,8 +296,8 @@ Fetch a list of deposits.
- `date_before` _string_
- `date_after` _string_
- `date_between` _array_
- `status_is` _string_ `paid` `pending` `in_transit` `canceled` `failed` `estimated`
- `status_is_not` _string_ `paid` `pending` `in_transit` `canceled` `failed` `estimated`
- `status_is` _string_ `paid` `pending` `in_transit` `canceled` `failed`
- `status_is_not` _string_ `paid` `pending` `in_transit` `canceled` `failed`
- `direction` _string_
- `page` _integer_
- `pagesize` _integer_
Expand All @@ -372,19 +317,6 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits?sort=date \
```json
{
"data": [
{
"id": "wcpay_estimated_weekly_eur_1702598400",
"date": 1702598400000,
"type": "deposit",
"amount": 458784,
"status": "estimated",
"bankAccount": "STRIPE TEST BANK •••• 3000 (EUR)",
"currency": "eur",
"automatic": true,
"fee": 0,
"fee_percentage": 0,
"created": 1702598400
},
{
"id": "po_1OJ466CBu6Jj8nBr38JRxdNE",
"date": 1701648000000,
Expand Down Expand Up @@ -412,7 +344,7 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits?sort=date \
"created": 1701302400
}
],
"total_count": 3
"total_count": 2
}
```

Expand All @@ -438,8 +370,8 @@ Useful in combination with the **List deposits** endpoint to get a summary of de
- `date_before` _string_
- `date_after` _string_
- `date_between` _array_
- `status_is` _string_ - `paid` `pending` `in_transit` `canceled` `failed` `estimated`
- `status_is_not` _string_ - `paid` `pending` `in_transit` `canceled` `failed` `estimated`
- `status_is` _string_ - `paid` `pending` `in_transit` `canceled` `failed`
- `status_is_not` _string_ - `paid` `pending` `in_transit` `canceled` `failed`

### Returns

Expand Down Expand Up @@ -481,7 +413,7 @@ Fetches a deposit by ID.

If a deposit is found for the provided ID, the response will return a [**Deposit**](#deposit-object) object.

If no deposit is found for the provided ID, the response will be an empty array.
If no deposit is found for the provided ID, the response will return a `500` status code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: The HTTP response code was changed to 404 on the server, the client still responds with 500.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting … I like the idea that we work towards no 500 errors from any of our APIs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh this came up in #4342 which implemented the server returning 404, only for client to swap it to a 500.

For now, the docs should reflect the current state of the REST API but we can open a new issue to ensure 404's are passed through to client REST API responses.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yea I'm thinking long term here. Also might be a cool way into more monitoring of our APIs – e.g. monitoring can tell us when we return 500, we can work toward no 500s (maybe in API paths that we own).


```shell
curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/po_123abc \
Expand Down Expand Up @@ -522,17 +454,14 @@ Submit an instant deposit for a list of transactions. Only for eligible accounts
### Required body properties

- `type`: _string_ - The type of deposit. `instant`
- `transaction_ids`: _array_ - The list of transaction IDs to deposit.
- `currency`: _string_ - The currency of the balance to deposit. E.g. `usd`

```shell
curl -X POST 'https://example.com/wp-json/wc/v3/payments/deposits' \
-u consumer_key:consumer_secret
--data '{
"type": "instant",
"transaction_ids": [
"txn_3OHyIxCIHGKp1UAi0aVyDQ5D",
"txn_3OJSuOCIHGKp1UAi1mRA2lL5"
]
"currency": "usd"
}'
```

Expand Down Expand Up @@ -560,8 +489,8 @@ Request a CSV export of deposits matching the query. A link to the exported CSV
- `date_before` _string_
- `date_after` _string_
- `date_between` _array_
- `status_is` _string_ - `paid` `pending` `in_transit` `canceled` `failed` `estimated`
- `status_is_not` _string_ - `paid` `pending` `in_transit` `canceled` `failed` `estimated`
- `status_is` _string_ - `paid` `pending` `in_transit` `canceled` `failed`
- `status_is_not` _string_ - `paid` `pending` `in_transit` `canceled` `failed`

### Returns

Expand All @@ -571,7 +500,7 @@ Request a CSV export of deposits matching the query. A link to the exported CSV
curl -X POST 'https://example.com/wp-json/wc/v3/payments/deposits/download?status_is=paid' \
-u consumer_key:consumer_secret
--data '{
"user_email": "[email protected]",
"user_email": "[email protected]"
}'
```

Expand Down
Loading