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

Payment Activity Widget: Select report currency when clicking "View report" #8941

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions changelog/fix-8938-payment-activity-view-report-currency
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Behind feature flag: Ensure currency is set in Payment Activity "View report" urls


4 changes: 4 additions & 0 deletions client/components/payment-activity/payment-activity-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
page: 'wc-admin',
path: '/payments/transactions',
filter: 'advanced',
store_currency_is: currency,
'date_between[0]': moment(
paymentActivityData?.date_start
).format( 'YYYY-MM-DD' ),
Expand Down Expand Up @@ -154,6 +155,7 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
page: 'wc-admin',
path: '/payments/transactions',
filter: 'advanced',
store_currency_is: currency,
'date_between[0]': moment(
paymentActivityData?.date_start
).format( 'YYYY-MM-DD' ),
Expand All @@ -176,6 +178,7 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
page: 'wc-admin',
path: '/payments/transactions',
filter: 'advanced',
store_currency_is: currency,
'date_between[0]': moment(
paymentActivityData?.date_start
).format( 'YYYY-MM-DD' ),
Expand All @@ -198,6 +201,7 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
page: 'wc-admin',
path: '/payments/transactions',
filter: 'advanced',
store_currency_is: currency,
'date_between[0]': moment(
paymentActivityData?.date_start
).format( 'YYYY-MM-DD' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ exports[`PaymentActivity component should render 1`] = `
</p>
<a
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=charge&search%5B1%5D=payment&search%5B2%5D=payment_failure_refund&search%5B3%5D=payment_refund&search%5B4%5D=refund&search%5B5%5D=refund_failure&search%5B6%5D=dispute&search%5B7%5D=dispute_reversal&search%5B8%5D=card_reader_fee"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&store_currency_is=eur&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=charge&search%5B1%5D=payment&search%5B2%5D=payment_failure_refund&search%5B3%5D=payment_refund&search%5B4%5D=refund&search%5B5%5D=refund_failure&search%5B6%5D=dispute&search%5B7%5D=dispute_reversal&search%5B8%5D=card_reader_fee"
>
View report
</a>
Expand Down Expand Up @@ -136,7 +136,7 @@ exports[`PaymentActivity component should render 1`] = `
</p>
<a
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=charge&search%5B1%5D=payment&search%5B2%5D=adjustment"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&store_currency_is=eur&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=charge&search%5B1%5D=payment&search%5B2%5D=adjustment"
>
View report
</a>
Expand Down Expand Up @@ -165,7 +165,7 @@ exports[`PaymentActivity component should render 1`] = `
</p>
<a
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=refund&search%5B1%5D=refund_failure&search%5B2%5D=payment_refund&search%5B3%5D=payment_failure_refund"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&store_currency_is=eur&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=refund&search%5B1%5D=refund_failure&search%5B2%5D=payment_refund&search%5B3%5D=payment_failure_refund"
>
View report
</a>
Expand Down Expand Up @@ -194,7 +194,7 @@ exports[`PaymentActivity component should render 1`] = `
</p>
<a
data-link-type="wc-admin"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=dispute&search%5B1%5D=dispute_reversal"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&store_currency_is=eur&date_between%5B0%5D=2024-01-01&date_between%5B1%5D=2024-01-31&search%5B0%5D=dispute&search%5B1%5D=dispute_reversal"
>
View report
</a>
Expand Down
11 changes: 10 additions & 1 deletion client/components/payment-activity/test/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe( 'PaymentActivity component', () => {
} );

it( 'should render', () => {
const { container, getByText, getByLabelText } = render(
const { container, getByText, getByLabelText, getAllByText } = render(
<PaymentActivity />
);

Expand All @@ -133,6 +133,15 @@ describe( 'PaymentActivity component', () => {
const tpvElement = getByLabelText( 'Total payment volume' );
expect( tpvElement ).toHaveTextContent( '€1.234,56' );

// Check the "View report" link is rendered with the correct currency query param.
const viewReportLinks = getAllByText( 'View report' );
viewReportLinks.forEach( ( link ) => {
expect( link ).toHaveAttribute(
'href',
expect.stringContaining( 'store_currency_is=eur' )
);
} );

expect( container ).toMatchSnapshot();
} );

Expand Down
Loading