Skip to content

Commit

Permalink
Reporting: Fix the View report link URL on Total payment volume til…
Browse files Browse the repository at this point in the history
…e, within Payment activity widget (#8726)

Co-authored-by: Nagesh Pai <[email protected]>
Co-authored-by: Jessy Pappachan <[email protected]>
  • Loading branch information
3 people authored May 2, 2024
1 parent dd28695 commit b6e8874
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
5 changes: 5 additions & 0 deletions changelog/fix-8706-tpv-view-report-link
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Comment: Fix the `View report` link on Total payment volume tile on the Payment activity widget. Changes behind feature flag, and part of larger change that adds the Payment activity widget.


33 changes: 30 additions & 3 deletions client/components/payment-activity/payment-activity-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,38 @@ import './style.scss';
*/
const getDateRange = (): DateRange => {
return {
// Subtract 7 days from the current date.
// Subtract 6 days from the current date. 7 days including the current day.
date_start: moment()
.subtract( 7, 'd' )
.subtract( 6, 'd' )
.format( 'YYYY-MM-DD\\THH:mm:ss' ),
date_end: moment().format( 'YYYY-MM-DD\\THH:mm:ss' ),
};
};

const searchTermsForViewReportLink = {
totalPaymentVolume: [
'charge',
'payment',
'payment_failure_refund',
'payment_refund',
'refund',
'refund_failure',
'dispute',
'dispute_reversal',
'card_reader_fee',
],
};

const getSearchParams = ( searchTerms: string[] ) => {
return searchTerms.reduce(
( acc, term, index ) => ( {
...acc,
[ `search[${ index }]` ]: term,
} ),
{}
);
};

const PaymentActivityData: React.FC = () => {
const { paymentActivityData, isLoading } = usePaymentActivityData(
getDateRange()
Expand Down Expand Up @@ -86,13 +110,16 @@ const PaymentActivityData: React.FC = () => {
reportLink={ getAdminUrl( {
page: 'wc-admin',
path: '/payments/transactions',
filter: 'advanced',
'date_between[0]': moment(
getDateRange().date_start
).format( 'YYYY-MM-DD' ),
'date_between[1]': moment( getDateRange().date_end ).format(
'YYYY-MM-DD'
),
filter: 'advanced',
...getSearchParams(
searchTermsForViewReportLink.totalPaymentVolume
),
} ) }
tracksSource="total_payment_volume"
isLoading={ isLoading }
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&date_between%5B0%5D=2024-04-01&date_between%5B1%5D=2024-04-08&filter=advanced"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&date_between%5B0%5D=2024-04-02&date_between%5B1%5D=2024-04-08&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 @@ -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&type_is=refund&date_between%5B0%5D=2024-04-01&date_between%5B1%5D=2024-04-08"
href="admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions&filter=advanced&type_is=refund&date_between%5B0%5D=2024-04-02&date_between%5B1%5D=2024-04-08"
>
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%2Fdisputes&filter=advanced&date_between%5B0%5D=2024-04-01&date_between%5B1%5D=2024-04-08&status_is=needs_response"
href="admin.php?page=wc-admin&path=%2Fpayments%2Fdisputes&filter=advanced&date_between%5B0%5D=2024-04-02&date_between%5B1%5D=2024-04-08&status_is=needs_response"
>
View report
</a>
Expand Down
7 changes: 5 additions & 2 deletions client/transactions/list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ $gap-small: 12px;
.woocommerce-search {
margin: 0 $gap;

.woocommerce-select-control__control {
height: 38px;
.components-base-control {
&.woocommerce-select-control__control {
min-height: 38px;
height: auto;
}
}
}

Expand Down

0 comments on commit b6e8874

Please sign in to comment.