Skip to content

Commit

Permalink
Merge branch 'develop' into add/8197-overview-survey
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaun1985 authored Mar 15, 2024
2 parents 58b196f + 18227bd commit 0d2115b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
4 changes: 4 additions & 0 deletions changelog/add-8346-deposits-overview-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: update

Updated deposits API documentation to add default_external_accounts element
4 changes: 4 additions & 0 deletions changelog/fix-6527-improved-navigation-time
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Used client side navigation to improve the UX for "View Deposit History"
23 changes: 14 additions & 9 deletions client/components/deposits-overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CardHeader,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { getHistory } from '@woocommerce/navigation';

/**
* Internal dependencies.
Expand Down Expand Up @@ -80,6 +81,18 @@ const DepositsOverview: React.FC = () => {
externalAccount.status === 'errored'
) ?? false;

const navigateToDepositsHistory = () => {
recordEvent( 'wcpay_overview_deposits_view_history_click' );

const history = getHistory();
history.push(
getAdminUrl( {
page: 'wc-admin',
path: '/payments/deposits',
} )
);
};

// Show a loading state if the page is still loading.
if ( isLoading ) {
return (
Expand Down Expand Up @@ -189,15 +202,7 @@ const DepositsOverview: React.FC = () => {
{ hasRecentDeposits && (
<Button
variant="secondary"
href={ getAdminUrl( {
page: 'wc-admin',
path: '/payments/deposits',
} ) }
onClick={ () =>
recordEvent(
'wcpay_overview_deposits_view_history_click'
)
}
onClick={ navigateToDepositsHistory }
>
{ __(
'View full deposits history',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ exports[`Deposits Overview information Component Renders 1`] = `
data-wp-c16t="true"
data-wp-component="CardFooter"
>
<a
<button
class="components-button is-secondary"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fdeposits"
type="button"
>
View full deposits history
</a>
</button>
<a
class="components-button is-tertiary"
href="admin.php?page=wc-settings&tab=checkout&section=woocommerce_payments#deposit-schedule"
Expand Down
15 changes: 14 additions & 1 deletion docs/rest-api/source/includes/wp-api-v3/deposits.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ Fetch an overview of account deposits for all deposit currencies. This includes
- `weekly_anchor` _string_ | _undefined_ - The day of the week that payments are paid out, e.g. `monday`.
- `monthly_anchor` _int_ | _undefined_ - The day of the month that payments are paid out. Specified as a number between 1–31. 29-31 will instead use the last day of a shorter month.
- `default_currency` _string_ - The default currency for the account.
- `default_external_accounts` _array_ - The default external payout accounts (deposit destinations) for the account.
- `currency` _string_ - The currency of the external account. e.g. `eur`, `chf`.
- `status` _string_ - The status of the external account. e.g. `new`, `errored`.

```shell
curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview-all \
Expand Down Expand Up @@ -168,7 +171,17 @@ curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview-all \
"interval": "weekly",
"weekly_anchor": "friday"
},
"default_currency": "eur"
"default_currency": "eur",
"default_external_accounts": [
{
"currency": "eur",
"status": "new"
},
{
"currency": "usd",
"status": "new"
}
]
}
}
```
Expand Down

0 comments on commit 0d2115b

Please sign in to comment.