Skip to content

Commit

Permalink
Merge branch 'develop' into update-billing-address-saved-card
Browse files Browse the repository at this point in the history
  • Loading branch information
gpressutto5 committed May 2, 2024
2 parents a115bc7 + b6e8874 commit 6bc77ce
Show file tree
Hide file tree
Showing 70 changed files with 780 additions and 235 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/post-release-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ jobs:
echo ":warning: File "$NEXT_RELEASE_VERSION_INSTRUCTIONS_FILENAME.md" already exists. No action needed." >> $GITHUB_STEP_SUMMARY
fi
# If an entry for the next version doesn't exist yet
# Check if this release version exists in Release-testing-instructions.md
if ! grep -q "v$NEXT_RELEASE_VERSION" Release-testing-instructions.md; then
# If it doesn't exist, remove all trailing newlines and add the new version for this release
perl -pi -e 'BEGIN{undef $/;} s/\n+\z//' Release-testing-instructions.md
echo -ne "\n* [v$NEXT_RELEASE_VERSION](https://github.com/Automattic/woocommerce-payments/wiki/$NEXT_RELEASE_VERSION_INSTRUCTIONS_FILENAME)" >> Release-testing-instructions.md
echo "Added a new entry for v$NEXT_RELEASE_VERSION in \"Release-testing-instructions.md\"." >> $GITHUB_STEP_SUMMARY
HAS_CHANGES=true
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Install the following plugins:

- WooCommerce
- WCPay Dev Tools (clone or download [the GitHub repo](https://github.com/Automattic/woocommerce-payments-dev-tools))
- This dependency is automatically updated to the latest version each time you perform a `git pull` or `git merge` in this repository, as long as the WCPay Dev Tools repository is cloned locally and remains on the `trunk` branch. For more details, please refer to the [post-merge](.husky/post-merge) hook.

### Optional local.env file

Expand Down
8 changes: 6 additions & 2 deletions assets/css/success.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
.wc-payment-gateway-method-name-woopay-wrapper {
.wc-payment-gateway-method-logo-wrapper {
display: flex;
align-items: center;
flex-wrap: wrap;
line-height: 1;
}

.wc-payment-gateway-method-name-woopay-wrapper img {
.wc-payment-gateway-method-logo-wrapper img {
margin-right: 0.5rem;
padding-top: 4px;
}

.wc-payment-gateway-method-logo-wrapper.wc-payment-bnpl-logo img {
max-height: 30px;
}
4 changes: 4 additions & 0 deletions changelog/8249-add-bnpl-icons-to-thank-you-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Display BNPL payment method logos on the thank you page.
5 changes: 5 additions & 0 deletions changelog/add-8686-track-events-payment-activity-widget
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: add
Comment: The PR adds track events for clicks on `View report` links on the Payment activity widget. Changes currently behind a feature flag.


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: update

Add support of a third-party plugin with PRBs into duplicates detection mechanism.
5 changes: 5 additions & 0 deletions changelog/add-track-gateway-type
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Record gateway name when placing the order


4 changes: 4 additions & 0 deletions changelog/fix-5151-fraud-outcome-type-error
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix type error for fraud outcome API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Update Payment Activity Card to use correct currency for rendering amounts.


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.


5 changes: 5 additions & 0 deletions changelog/fix-8710-payment-activity-survey-all-admin-users
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Part of Payment Activity Card behind feature flag. Allow non-accountholder users to submit the feedback survey.


5 changes: 5 additions & 0 deletions changelog/fix-8724-are-these-metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: This is covered by emoji survey changelog from #8506


4 changes: 4 additions & 0 deletions changelog/fix-fatals-on-plugin-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Avoid warnings about fatal error during plugin update due to problems with plugin initialization.
5 changes: 5 additions & 0 deletions changelog/fix-pre-check-sve-my-info-exception
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: just a bug fix for a feature that did not make into the release yet


4 changes: 4 additions & 0 deletions changelog/fix-woopay-tracks-userid-for-logged-in-users
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix WooPay tracks user ID for logged in users.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Revert: Add Multi-Currency Support to Page Caching via Cookies.
5 changes: 5 additions & 0 deletions changelog/update-post-release-updates
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Just a minor change in a GitHub Actions workflow to make it more robust.


5 changes: 5 additions & 0 deletions changelog/update-readme-wcpay-dev-tools-updates
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: This change doesn't impact production code, just updates the README file to clarify how the WCPay Dev Tools dependency is updated in this repository.


49 changes: 40 additions & 9 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 All @@ -41,14 +65,14 @@ const PaymentActivityData: React.FC = () => {
const fees = paymentActivityData?.fees ?? 0;
const disputes = paymentActivityData?.disputes ?? 0;
const refunds = paymentActivityData?.refunds ?? 0;
const { storeCurrency } = wcpaySettings;
const currency = paymentActivityData?.currency;

return (
<div className="wcpay-payment-activity-data">
<PaymentDataTile
id="wcpay-payment-activity-data__total-payment-volume"
label={ __( 'Total payment volume', 'woocommerce-payments' ) }
currencyCode={ storeCurrency }
currencyCode={ currency }
tooltip={
<ClickTooltip
className="wcpay-payment-activity-data__total-payment-volume__tooltip"
Expand Down Expand Up @@ -86,21 +110,25 @@ 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 }
/>
<div className="wcpay-payment-data-highlights">
<PaymentDataTile
id="wcpay-payment-data-highlights__charges"
label={ __( 'Charges', 'woocommerce-payments' ) }
currencyCode={ storeCurrency }
currencyCode={ currency }
tooltip={
<ClickTooltip
className="payment-data-highlights__charges__tooltip"
Expand All @@ -127,12 +155,13 @@ const PaymentActivityData: React.FC = () => {
filter: 'advanced',
type_is: 'charge',
} ) }
tracksSource="charges"
isLoading={ isLoading }
/>
<PaymentDataTile
id="wcpay-payment-data-highlights__refunds"
label={ __( 'Refunds', 'woocommerce-payments' ) }
currencyCode={ storeCurrency }
currencyCode={ currency }
amount={ refunds }
reportLink={ getAdminUrl( {
page: 'wc-admin',
Expand All @@ -146,12 +175,13 @@ const PaymentActivityData: React.FC = () => {
getDateRange().date_end
).format( 'YYYY-MM-DD' ),
} ) }
tracksSource="refunds"
isLoading={ isLoading }
/>
<PaymentDataTile
id="wcpay-payment-data-highlights__disputes"
label={ __( 'Disputes', 'woocommerce-payments' ) }
currencyCode={ storeCurrency }
currencyCode={ currency }
amount={ disputes }
reportLink={ getAdminUrl( {
page: 'wc-admin',
Expand All @@ -165,12 +195,13 @@ const PaymentActivityData: React.FC = () => {
).format( 'YYYY-MM-DD' ),
status_is: 'needs_response',
} ) }
tracksSource="disputes"
isLoading={ isLoading }
/>
<PaymentDataTile
id="wcpay-payment-data-highlights__fees"
label={ __( 'Fees', 'woocommerce-payments' ) }
currencyCode={ storeCurrency }
currencyCode={ currency }
tooltip={
<ClickTooltip
className="payment-data-highlights__fees__tooltip"
Expand Down
21 changes: 16 additions & 5 deletions client/components/payment-activity/payment-data-tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import * as React from 'react';
import { __ } from '@wordpress/i18n';
import { Link } from '@woocommerce/components';
import { recordEvent } from 'wcpay/tracks';

/**
* Internal dependencies
*/

import { formatCurrency } from 'wcpay/utils/currency';
import Loadable from '../loadable';
import './style.scss';

interface PaymentDataTileProps {
/**
* The id for the tile, can be used for CSS styling.
Expand All @@ -24,7 +25,7 @@ interface PaymentDataTileProps {
/**
* The currency code for the amount displayed.
*/
currencyCode: string;
currencyCode?: string;
/**
* For optionally passing a ClickTooltip component.
*/
Expand All @@ -41,6 +42,10 @@ interface PaymentDataTileProps {
* Optional hover link to view report.
*/
reportLink?: string;
/**
* The source of the event tracking.
*/
tracksSource?: string;
}

const PaymentDataTile: React.FC< PaymentDataTileProps > = ( {
Expand All @@ -51,11 +56,17 @@ const PaymentDataTile: React.FC< PaymentDataTileProps > = ( {
amount = 0,
isLoading = false,
reportLink,
tracksSource,
} ) => {
const handleReportLinkClick = () => {
recordEvent( 'wcpay_overview_payment_activity_click', {
source: tracksSource,
} );
};
return (
<div id={ id } className="wcpay-payment-data-highlights__item">
<div className="wcpay-payment-data-highlights__item">
<p className="wcpay-payment-data-highlights__item__label">
<span>{ label }</span>
<span id={ id }>{ label }</span>
{ ! isLoading && tooltip }
</p>
<div className="wcpay-payment-data-highlights__item__wrapper">
Expand All @@ -71,7 +82,7 @@ const PaymentDataTile: React.FC< PaymentDataTileProps > = ( {
/>
</p>
{ reportLink && (
<Link href={ reportLink }>
<Link href={ reportLink } onClick={ handleReportLinkClick }>
{ __( 'View report', 'woocommerce_payments' ) }
</Link>
) }
Expand Down
2 changes: 1 addition & 1 deletion client/components/payment-activity/survey/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const Survey: React.FC = () => {
<div className="wcpay-payments-activity__survey">
<div className="survey_container">
{ __(
'Are those metrics helpful?',
'Are these metrics helpful?',
'woocommerce-payments'
) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`WcPayOverviewSurveyContextProvider test survey initial display 1`] = `
<div
class="survey_container"
>
Are those metrics helpful?
Are these metrics helpful?
<div
class="survey_container__emoticons"
>
Expand Down Expand Up @@ -92,7 +92,7 @@ exports[`WcPayOverviewSurveyContextProvider test survey with comments textbox 1`
<div
class="survey_container"
>
Are those metrics helpful?
Are these metrics helpful?
<div
class="survey_container__emoticons"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe( 'WcPayOverviewSurveyContextProvider', () => {
</WcPayOverviewSurveyContextProvider>
);

const surveyText = screen.getByText( 'Are those metrics helpful?' );
const surveyText = screen.getByText( 'Are these metrics helpful?' );
expect( surveyText ).toBeInTheDocument();

const buttons = screen.getAllByRole( 'button' );
Expand Down
Loading

0 comments on commit 6bc77ce

Please sign in to comment.