Skip to content

Commit

Permalink
Inform hard blocked merchants they're under review (#8323)
Browse files Browse the repository at this point in the history
Co-authored-by: oaratovskyi <[email protected]>
  • Loading branch information
oaratovskyi and oaratovskyi authored Mar 6, 2024
1 parent 8a3d733 commit 8c681e7
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 5 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-server-4691-inform-merchants-about-under-review
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Inform hard blocked merchants they're under review
3 changes: 3 additions & 0 deletions client/components/account-status/status-chip.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ const StatusChip = ( props ) => {
} else if ( accountStatus.startsWith( 'rejected' ) ) {
description = __( 'Rejected', 'woocommerce-payments' );
type = 'light';
} else if ( accountStatus === 'under_review' ) {
description = __( 'Under review', 'woocommerce-payments' );
type = 'light';
}

return <Chip message={ description } type={ type } tooltip={ tooltip } />;
Expand Down
10 changes: 10 additions & 0 deletions client/components/account-status/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,16 @@ exports[`StatusChip renders restricted status 1`] = `
</div>
`;

exports[`StatusChip renders under review status 1`] = `
<div>
<span
class="chip chip-light"
>
Under review
</span>
</div>
`;

exports[`StatusChip renders unknown status 1`] = `
<div>
<span
Expand Down
5 changes: 5 additions & 0 deletions client/components/account-status/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ describe( 'StatusChip', () => {
expect( statusChip ).toMatchSnapshot();
} );

test( 'renders under review status', () => {
const { container: statusChip } = renderStatusChip( 'under_review' );
expect( statusChip ).toMatchSnapshot();
} );

test( 'renders pending verification status', () => {
const { container: statusChip } = renderStatusChip(
'pending_verification'
Expand Down
2 changes: 1 addition & 1 deletion client/components/deposits-status/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const DepositsStatus: React.FC< Props > = ( {
} ) => {
const isPoInProgress = poEnabled && ! poComplete;

if ( status === 'blocked' ) {
if ( status === 'blocked' || accountStatus === 'under_review' ) {
return (
<DepositsStatusSuspended
iconSize={ iconSize }
Expand Down
8 changes: 5 additions & 3 deletions client/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const OverviewPage = () => {
const queryParams = getQuery();
const accountRejected =
accountStatus.status && accountStatus.status.startsWith( 'rejected' );
const accountUnderReview = accountStatus.status === 'under_review';

const showConnectionSuccess =
queryParams[ 'wcpay-connection-success' ] === '1';
Expand All @@ -96,7 +97,8 @@ const OverviewPage = () => {
showConnectionSuccess &&
accountStatus.progressiveOnboarding.isEnabled &&
! accountStatus.progressiveOnboarding.isComplete;
const showTaskList = ! accountRejected && tasks.length > 0;
const showTaskList =
! accountRejected && ! accountUnderReview && tasks.length > 0;

const activeAccountFees = Object.entries( wcpaySettings.accountFees )
.map( ( [ key, value ] ) => {
Expand Down Expand Up @@ -163,7 +165,7 @@ const OverviewPage = () => {
<FRTDiscoverabilityBanner />
</ErrorBoundary>
{ showConnectionSuccess && <ConnectionSuccessNotice /> }
{ ! accountRejected && (
{ ! accountRejected && ! accountUnderReview && (
<ErrorBoundary>
<>
{ showTaskList ? (
Expand Down Expand Up @@ -205,7 +207,7 @@ const OverviewPage = () => {
<ActiveLoanSummary />
</ErrorBoundary>
) }
{ ! accountRejected && (
{ ! accountRejected && ! accountUnderReview && (
<ErrorBoundary>
<InboxNotifications />
</ErrorBoundary>
Expand Down
5 changes: 4 additions & 1 deletion includes/admin/class-wc-payments-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ public function add_payments_menu() {
]
);

if ( $this->account->is_account_rejected() ) {
// Merchants are unable to see their deposits, transactions, disputes and settings if their account is rejected or under review.
// That's expected, because account under review is hard-blocked account that spends in a review pretty short time-frame.
// Either merchant gets approved and continues to use payments or they remain suspended and can't use payments.
if ( $this->account->is_account_rejected() || $this->account->is_account_under_review() ) {
// If the account is rejected, only show the overview page.
wc_admin_register_page( $this->admin_child_pages['wc-payments-overview'] );
return;
Expand Down
15 changes: 15 additions & 0 deletions includes/class-wc-payments-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,21 @@ public function is_account_rejected(): bool {
return strpos( $account['status'] ?? '', 'rejected' ) === 0;
}

/**
* Checks if the account is under review, assumes the value of false on any account retrieval error.
* Returns false if the account is not connected.
*
* @return bool
*/
public function is_account_under_review(): bool {
if ( ! $this->is_stripe_connected() ) {
return false;
}

$account = $this->get_cached_account_data();
return 'under_review' === $account['status'];
}

/**
* Checks if the account "details_submitted" flag is true.
* This is a proxy for telling if an account has completed onboarding.
Expand Down

0 comments on commit 8c681e7

Please sign in to comment.