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

Enable the Payment Activity Card for all merchants (remove feature flag _wcpay_feature_payment_overview_widget) #9012

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions changelog/update-remove-feature-flag-payment-overview-widget
Original file line number Diff line number Diff line change
@@ -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.
1 change: 0 additions & 1 deletion client/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ declare global {
isAuthAndCaptureEnabled: boolean;
paymentTimeline: boolean;
isDisputeIssuerEvidenceEnabled: boolean;
isPaymentOverviewWidgetEnabled?: boolean;
};
fraudServices: unknown[];
testMode: boolean;
Expand Down
14 changes: 3 additions & 11 deletions client/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const OverviewPage = () => {
accountStatus: { progressiveOnboarding },
accountLoans: { has_active_loan: hasActiveLoan },
enabledPaymentMethods,
featureFlags: { isPaymentOverviewWidgetEnabled },
overviewTasksVisibility,
showUpdateDetailsTask,
wpcomReconnectUrl,
Expand Down Expand Up @@ -194,7 +193,6 @@ const OverviewPage = () => {
{ ! accountRejected && ! accountUnderReview && (
<ErrorBoundary>
<Welcome />

{ showTaskList && (
<Card>
<ErrorBoundary>
Expand All @@ -207,21 +205,15 @@ const OverviewPage = () => {
</ErrorBoundary>
</Card>
) }

<Card>
<ErrorBoundary>
<AccountBalances />
</ErrorBoundary>
</Card>

{
/* Show Payment Activity widget only when feature flag is set. To be removed before go live */
isPaymentOverviewWidgetEnabled && (
<ErrorBoundary>
<PaymentActivity />
</ErrorBoundary>
)
}
<ErrorBoundary>
<PaymentActivity />
</ErrorBoundary>

<DepositsOverview />
</ErrorBoundary>
Expand Down
38 changes: 38 additions & 0 deletions client/overview/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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( {
Expand Down Expand Up @@ -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( [] );
Expand Down Expand Up @@ -352,4 +381,13 @@ describe( 'Overview page', () => {

expect( query() ).not.toBeInTheDocument();
} );

it( 'Displays the Payment Activity Card', () => {
const { getByLabelText, getByText } = render( <OverviewPage /> );

getByText( 'Your payment activity' );
// Check correct currency/value is displayed.
const tpvElement = getByLabelText( 'Total payment volume' );
expect( tpvElement ).toHaveTextContent( '€1.234,56' );
} );
} );
38 changes: 11 additions & 27 deletions includes/class-wc-payments-features.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Copy link
Member Author

Choose a reason for hiding this comment

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

⚠️ check flags modified in merge conflict resolution

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.
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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(),
Copy link
Member Author

Choose a reason for hiding this comment

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

⚠️ check flags modified in merge conflict resolution

'isStripeEceEnabled' => self::is_stripe_ece_enabled(),
]
);
Expand Down
Loading