diff --git a/changelog/update-remove-feature-flag-payment-overview-widget b/changelog/update-remove-feature-flag-payment-overview-widget new file mode 100644 index 00000000000..ac8d2f22abd --- /dev/null +++ b/changelog/update-remove-feature-flag-payment-overview-widget @@ -0,0 +1,4 @@ +Significance: minor +Type: add + +Enable the Payment Activity Card for all merchants, allowing merchants to easily view a snapshot and analysis of their payment activity from the Payments Overview screen. diff --git a/client/globals.d.ts b/client/globals.d.ts index a97d40f9590..a0f989d21c2 100644 --- a/client/globals.d.ts +++ b/client/globals.d.ts @@ -15,7 +15,6 @@ declare global { isAuthAndCaptureEnabled: boolean; paymentTimeline: boolean; isDisputeIssuerEvidenceEnabled: boolean; - isPaymentOverviewWidgetEnabled?: boolean; }; fraudServices: unknown[]; testMode: boolean; diff --git a/client/overview/index.js b/client/overview/index.js index a0312035349..7b4634a0958 100644 --- a/client/overview/index.js +++ b/client/overview/index.js @@ -61,7 +61,6 @@ const OverviewPage = () => { accountStatus: { progressiveOnboarding }, accountLoans: { has_active_loan: hasActiveLoan }, enabledPaymentMethods, - featureFlags: { isPaymentOverviewWidgetEnabled }, overviewTasksVisibility, showUpdateDetailsTask, wpcomReconnectUrl, @@ -194,7 +193,6 @@ const OverviewPage = () => { { ! accountRejected && ! accountUnderReview && ( - { showTaskList && ( @@ -207,21 +205,15 @@ const OverviewPage = () => { ) } - - { - /* Show Payment Activity widget only when feature flag is set. To be removed before go live */ - isPaymentOverviewWidgetEnabled && ( - - - - ) - } + + + diff --git a/client/overview/test/index.js b/client/overview/test/index.js index f399e6488ce..477c21ec769 100644 --- a/client/overview/test/index.js +++ b/client/overview/test/index.js @@ -66,6 +66,21 @@ jest.mock( 'wcpay/data', () => ( { .fn() .mockReturnValue( { overviews: { currencies: [] } } ), useActiveLoanSummary: jest.fn().mockReturnValue( { isLoading: true } ), + usePaymentActivityData: jest.fn().mockReturnValue( { + paymentActivityData: { + currency: 'eur', + total_payment_volume: 123456, + charges: 9876, + fees: 1234, + disputes: 5555, + refunds: 4444, + date_start: '2024-01-01', + date_end: '2024-01-31', + timezone: 'UTC', + interval: 'daily', + }, + isLoading: false, + } ), } ) ); select.mockReturnValue( { @@ -111,6 +126,20 @@ describe( 'Overview page', () => { remindMeAt: null, dontShowAgain: false, } ), + connect: { + country: 'DE', + }, + lifetimeTPV: 1000, + currencyData: { + EU: { + code: 'EUR', + symbol: '€', + symbolPosition: 'left', + thousandSeparator: '.', + decimalSeparator: ',', + precision: 2, + }, + }, }; getQuery.mockReturnValue( {} ); getTasks.mockReturnValue( [] ); @@ -352,4 +381,13 @@ describe( 'Overview page', () => { expect( query() ).not.toBeInTheDocument(); } ); + + it( 'Displays the Payment Activity Card', () => { + const { getByLabelText, getByText } = render( ); + + getByText( 'Your payment activity' ); + // Check correct currency/value is displayed. + const tpvElement = getByLabelText( 'Total payment volume' ); + expect( tpvElement ).toHaveTextContent( '€1.234,56' ); + } ); } ); diff --git a/includes/class-wc-payments-features.php b/includes/class-wc-payments-features.php index 161cd8e3935..bb733ac0d15 100644 --- a/includes/class-wc-payments-features.php +++ b/includes/class-wc-payments-features.php @@ -15,23 +15,16 @@ * WC Payments Features class */ class WC_Payments_Features { - /** - * If you need to remove or deprecate a flag: - * - Please update the `Erase_Deprecated_Flags_And_Options` migration with: - * - The next version of WooPayments. - * - The flag to be deleted. - */ - const WCPAY_SUBSCRIPTIONS_FLAG_NAME = '_wcpay_feature_subscriptions'; - const STRIPE_BILLING_FLAG_NAME = '_wcpay_feature_stripe_billing'; - const STRIPE_ECE_FLAG_NAME = '_wcpay_feature_stripe_ece'; - const WOOPAY_EXPRESS_CHECKOUT_FLAG_NAME = '_wcpay_feature_woopay_express_checkout'; - const WOOPAY_FIRST_PARTY_AUTH_FLAG_NAME = '_wcpay_feature_woopay_first_party_auth'; - const WOOPAY_DIRECT_CHECKOUT_FLAG_NAME = '_wcpay_feature_woopay_direct_checkout'; - const AUTH_AND_CAPTURE_FLAG_NAME = '_wcpay_feature_auth_and_capture'; - const DISPUTE_ISSUER_EVIDENCE = '_wcpay_feature_dispute_issuer_evidence'; - const TOKENIZED_CART_PRB_FLAG_NAME = '_wcpay_feature_tokenized_cart_prb'; - const PAYMENT_OVERVIEW_WIDGET_FLAG_NAME = '_wcpay_feature_payment_overview_widget'; - const WOOPAY_GLOBAL_THEME_SUPPORT_FLAG_NAME = '_wcpay_feature_woopay_global_theme_support'; + const WCPAY_SUBSCRIPTIONS_FLAG_NAME = '_wcpay_feature_subscriptions'; + const STRIPE_BILLING_FLAG_NAME = '_wcpay_feature_stripe_billing'; + const STRIPE_ECE_FLAG_NAME = '_wcpay_feature_stripe_ece'; + const WOOPAY_EXPRESS_CHECKOUT_FLAG_NAME = '_wcpay_feature_woopay_express_checkout'; + const WOOPAY_FIRST_PARTY_AUTH_FLAG_NAME = '_wcpay_feature_woopay_first_party_auth'; + const WOOPAY_DIRECT_CHECKOUT_FLAG_NAME = '_wcpay_feature_woopay_direct_checkout'; + const AUTH_AND_CAPTURE_FLAG_NAME = '_wcpay_feature_auth_and_capture'; + const DISPUTE_ISSUER_EVIDENCE = '_wcpay_feature_dispute_issuer_evidence'; + const STREAMLINE_REFUNDS_FLAG_NAME = '_wcpay_feature_streamline_refunds'; + const TOKENIZED_CART_PRB_FLAG_NAME = '_wcpay_feature_tokenized_cart_prb'; /** * Indicates whether card payments are enabled for this (Stripe) account. @@ -239,15 +232,6 @@ public static function is_woopay_first_party_auth_enabled() { return '1' === get_option( self::WOOPAY_FIRST_PARTY_AUTH_FLAG_NAME, '1' ) && self::is_woopay_express_checkout_enabled(); } - /** - * Checks whether Payment Overview Widget is enabled. - * - * @return bool - */ - public static function is_payment_overview_widget_ui_enabled(): bool { - return '1' === get_option( self::PAYMENT_OVERVIEW_WIDGET_FLAG_NAME, '0' ); - } - /** * Checks whether WooPay Direct Checkout is enabled. * @@ -385,7 +369,7 @@ public static function to_array() { 'woopayExpressCheckout' => self::is_woopay_express_checkout_enabled(), 'isAuthAndCaptureEnabled' => self::is_auth_and_capture_enabled(), 'isDisputeIssuerEvidenceEnabled' => self::is_dispute_issuer_evidence_enabled(), - 'isPaymentOverviewWidgetEnabled' => self::is_payment_overview_widget_ui_enabled(), + 'isRefundControlsEnabled' => self::is_streamline_refunds_enabled(), 'isStripeEceEnabled' => self::is_stripe_ece_enabled(), ] );