-
Notifications
You must be signed in to change notification settings - Fork 69
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
Jinksi
merged 62 commits into
develop
from
fix/7847-update-deposits-api-docs-estimated-deposits-rm
Jan 25, 2024
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
cf0f973
Add Deposits overview all docs
Jinksi cc62461
Add `/deposits/overview` docs
Jinksi b76e9d3
Add GET `/deposits` docs
Jinksi df00b61
Add changelog entry
Jinksi ef008fa
Fix incorrect POST in cURL command examples
Jinksi ae0266f
Add GET `/deposits/summary` docs
Jinksi 66d1f22
Add GET `/deposits/{deposit_id}` docs
Jinksi b5f56a8
Add POST `/deposits` docs
Jinksi 9b62e9d
Add slate docs readme
Jinksi dfc4b7f
Merge branch 'develop' into fix/7839-deposits-rest-api-docs
Jinksi ba1094e
Add POST `/deposits/download` docs
Jinksi e1cb5bb
Use consistent naming for titles
Jinksi 35e7937
Expand overview-all balances response
Jinksi 44703f9
Expand overview balances response
Jinksi dcafa75
Show monthly/weekly anchors as potentially undefined
Jinksi 379d51b
Fix nesting within `overview` return docs
Jinksi 32c4bfd
Deprecate return values for `/deposits/overview-all`
Jinksi 46b6d39
Deprecate return values for `/deposits/overview`
Jinksi 627d5c3
Deprecate return values for GET `/deposits` and `deposits/summary`
Jinksi 46b347e
Deprecate return values for GET `/deposits/id`
Jinksi d3d4c16
Fix text formatting
Jinksi a3724d3
Update POST `/deposits` docs with new params
Jinksi 2405ff3
Update POST `/deposits/download` docs with deprecated params
Jinksi c50324f
Tweak formatting
Jinksi 55b97a4
Update CSV export deprecation comment
Jinksi dc5eaf5
Add changelog entry
Jinksi 02fc498
Update `transaction_ids` to show `undefined`/no longer present
Jinksi dac0ba7
Add not found response for GET `/deposits/id`
Jinksi c84796a
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
Jinksi bf5f475
Merge branch 'develop' into fix/7839-deposits-rest-api-docs
shendy-a8c e77f9ab
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
shendy-a8c 2cbd3c8
Merge branch 'develop' into fix/7839-deposits-rest-api-docs
Jinksi ec0da8e
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
Jinksi c4f4244
No longer return `next_scheduled`
Jinksi 1a27029
No longer return `next_deposit`
Jinksi 9455183
Show `404` response if deposit not found
Jinksi 38daf7d
Add Deposit object and update deposit overview
Jinksi d633b2d
Update deposit return types in `deposits/overview`
Jinksi e3f1c7b
Add deposit object example
Jinksi fd2924c
Use deposit object return type in list deposits
Jinksi 8d9a3b5
Use deposit object return type in GET single deposit
Jinksi 64648dc
Update balance `source_types` response description
Jinksi bb21368
Merge branch 'fix/7839-deposits-rest-api-docs' into fix/7847-update-d…
Jinksi 61e2910
Deprecate `estimated` status from Deposit Object
Jinksi 4e25220
Deprecated `balance.deposits_count`
Jinksi 08b4515
Tweak formatting
Jinksi 6c39012
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi dd3d3a5
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi 3dd1439
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi f40b855
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi 4f49e0a
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi dc9227b
Change est deposit deprecation version 7.0.0 → 7.1.0
Jinksi 3525517
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi 4e44254
Remove deposit status `estimated` value
Jinksi 0c8f6f3
Remove deprecated overview-all fields
Jinksi 1cc7a42
Remove deprecated overview fields
Jinksi 96f48c0
Remove deprecated deposit list values
Jinksi 3d6cb98
Remove deprecated deposit summary values
Jinksi 0370a3a
Update get deposit description
Jinksi 9d44377
Remove deprecated POST instant deposit field
Jinksi 809796e
Remove deprecated POST deposit download values
Jinksi 9e68172
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Jinksi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelog/fix-7847-update-deposits-api-docs-estimated-deposits-rm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -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`. | ||
|
@@ -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. | ||
|
@@ -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": { | ||
|
@@ -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": [ | ||
|
@@ -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 | ||
} | ||
] | ||
}, | ||
|
@@ -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`. | ||
|
@@ -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. | ||
|
@@ -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, | ||
|
@@ -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, | ||
|
@@ -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_ | ||
|
@@ -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, | ||
|
@@ -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 | ||
} | ||
``` | ||
|
||
|
@@ -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 | ||
|
||
|
@@ -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. | ||
|
||
```shell | ||
curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/po_123abc \ | ||
|
@@ -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" | ||
}' | ||
``` | ||
|
||
|
@@ -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 | ||
|
||
|
@@ -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]" | ||
}' | ||
``` | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 with500
.There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 a500
.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.There was a problem hiding this comment.
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).