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

Payouts: Add payout bank reference key to payout reports and CSV #9832

Merged
merged 9 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
4 changes: 4 additions & 0 deletions changelog/add-5316-payout-trace-id
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Add Trace ID column in Payout reports. This will help reconcile WooPayments Payouts with bank statements.
9 changes: 9 additions & 0 deletions client/deposits/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ const getColumns = ( sortByDate?: boolean ): DepositsTableHeader[] => [
screenReaderLabel: __( 'Bank account', 'woocommerce-payments' ),
isLeftAligned: true,
},
{
key: 'traceId',
label: __( 'Trace ID', 'woocommerce-payments' ),
screenReaderLabel: __( 'Trace ID', 'woocommerce-payments' ),
Copy link
Contributor

Choose a reason for hiding this comment

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

We should consider changing this to something that is clearer to Merchants such as Reference

},
];

export const DepositsList = (): JSX.Element => {
Expand Down Expand Up @@ -165,6 +170,10 @@ export const DepositsList = (): JSX.Element => {
value: deposit.bankAccount,
display: clickable( deposit.bankAccount ),
},
traceId: {
value: deposit.trace_id,
display: clickable( deposit.trace_id ?? 'N/A' ),
},
};

return columns.map( ( { key } ) => data[ key ] || { display: null } );
Expand Down
104 changes: 104 additions & 0 deletions client/deposits/list/test/__snapshots__/index.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,22 @@ exports[`Deposits list renders correctly a single deposit 1`] = `
Bank account
</span>
</th>
<th
class="woocommerce-table__header is-left-aligned"
role="columnheader"
scope="col"
>
<span
aria-hidden="true"
>
Trace ID
</span>
<span
class="screen-reader-text"
>
Trace ID
</span>
</th>
</tr>
<tr>
<th
Expand Down Expand Up @@ -400,6 +416,18 @@ exports[`Deposits list renders correctly a single deposit 1`] = `
MOCK BANK •••• 1234 (USD)
</a>
</td>
<td
class="woocommerce-table__item is-left-aligned"
>
<a
class="woocommerce-table__clickable-cell"
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fpayouts%2Fdetails&id=po_mock1"
tabindex="-1"
>
mock_trace_id
</a>
</td>
</tr>
<tr>
<th
Expand Down Expand Up @@ -487,6 +515,18 @@ exports[`Deposits list renders correctly a single deposit 1`] = `
MOCK BANK •••• 1234 (USD)
</a>
</td>
<td
class="woocommerce-table__item is-left-aligned"
>
<a
class="woocommerce-table__clickable-cell"
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fpayouts%2Fdetails&id=po_mock2"
tabindex="-1"
>
mock_trace_id
</a>
</td>
</tr>
<tr>
<th
Expand Down Expand Up @@ -574,6 +614,18 @@ exports[`Deposits list renders correctly a single deposit 1`] = `
MOCK BANK •••• 1234 (USD)
</a>
</td>
<td
class="woocommerce-table__item is-left-aligned"
>
<a
class="woocommerce-table__clickable-cell"
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fpayouts%2Fdetails&id=po_mock3"
tabindex="-1"
>
mock_trace_id
</a>
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -949,6 +1001,22 @@ exports[`Deposits list renders correctly with multiple currencies 1`] = `
Bank account
</span>
</th>
<th
class="woocommerce-table__header is-left-aligned"
role="columnheader"
scope="col"
>
<span
aria-hidden="true"
>
Trace ID
</span>
<span
class="screen-reader-text"
>
Trace ID
</span>
</th>
</tr>
<tr>
<th
Expand Down Expand Up @@ -1036,6 +1104,18 @@ exports[`Deposits list renders correctly with multiple currencies 1`] = `
MOCK BANK •••• 1234 (USD)
</a>
</td>
<td
class="woocommerce-table__item is-left-aligned"
>
<a
class="woocommerce-table__clickable-cell"
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fpayouts%2Fdetails&id=po_mock1"
tabindex="-1"
>
mock_trace_id
</a>
</td>
</tr>
<tr>
<th
Expand Down Expand Up @@ -1123,6 +1203,18 @@ exports[`Deposits list renders correctly with multiple currencies 1`] = `
MOCK BANK •••• 1234 (USD)
</a>
</td>
<td
class="woocommerce-table__item is-left-aligned"
>
<a
class="woocommerce-table__clickable-cell"
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fpayouts%2Fdetails&id=po_mock2"
tabindex="-1"
>
mock_trace_id
</a>
</td>
</tr>
<tr>
<th
Expand Down Expand Up @@ -1210,6 +1302,18 @@ exports[`Deposits list renders correctly with multiple currencies 1`] = `
MOCK BANK •••• 1234 (USD)
</a>
</td>
<td
class="woocommerce-table__item is-left-aligned"
>
<a
class="woocommerce-table__clickable-cell"
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fpayouts%2Fdetails&id=po_mock3"
tabindex="-1"
>
mock_trace_id
</a>
</td>
</tr>
</tbody>
</table>
Expand Down
7 changes: 7 additions & 0 deletions client/deposits/list/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const mockDeposits = [
status: 'paid',
bankAccount: 'MOCK BANK •••• 1234 (USD)',
currency: 'USD',
trace_id: 'mock_trace_id',
} as CachedDeposit,
{
id: 'po_mock2',
Expand All @@ -62,6 +63,7 @@ const mockDeposits = [
status: 'pending',
bankAccount: 'MOCK BANK •••• 1234 (USD)',
currency: 'USD',
trace_id: 'mock_trace_id',
} as CachedDeposit,
{
id: 'po_mock3',
Expand All @@ -71,6 +73,7 @@ const mockDeposits = [
status: 'paid',
bankAccount: 'MOCK BANK •••• 1234 (USD)',
currency: 'USD',
trace_id: 'mock_trace_id',
} as CachedDeposit,
];

Expand Down Expand Up @@ -287,6 +290,7 @@ describe( 'Deposits list', () => {
'Amount',
'Status',
'"Bank account"',
'"Trace ID"',
];

const csvContent = mockDownloadCSVFile.mock.calls[ 0 ][ 1 ];
Expand Down Expand Up @@ -332,6 +336,9 @@ describe( 'Deposits list', () => {
expect( csvFirstDeposit[ 5 ] ).toBe(
`"${ displayFirstDeposit[ 4 ] }"`
); // bank account
expect( csvFirstDeposit[ 6 ] ).toBe(
`${ displayFirstDeposit[ 5 ] }`
); // Trace ID
} );

test( 'should fetch export after confirmation when download button is selected for unfiltered exports larger than 1000.', async () => {
Expand Down
10 changes: 9 additions & 1 deletion client/types/deposits.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import { TableCardColumn } from '@woocommerce/components';

export interface DepositsTableHeader extends TableCardColumn {
key: 'details' | 'date' | 'type' | 'amount' | 'status' | 'bankAccount';
key:
| 'details'
| 'date'
| 'type'
| 'amount'
| 'status'
| 'bankAccount'
| 'traceId';
cellClassName?: string;
}

Expand All @@ -24,6 +31,7 @@ export interface CachedDeposit {
status: DepositStatus;
bankAccount: string;
automatic: boolean;
trace_id: string;
}

export interface DepositsSummaryCache {
Expand Down
Loading