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

Fix PO Notice not appearing when adding APMs #7552

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/dev-fix-po-notice-not-appearing
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Update to properly show tooltip on Payments > Settings page when account is in PO state.
22 changes: 16 additions & 6 deletions client/components/payment-methods-list/payment-method.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,29 @@ const PaymentMethod = ( {
isPoEnabled,
isPoComplete,
}: PaymentMethodProps ): React.ReactElement => {
// We want to show a tooltip if PO is enabled and not yet complete. (We make an exception to not show this for card payments).
const isPoInProgress =
isPoEnabled &&
! isPoComplete &&
status !== upeCapabilityStatuses.ACTIVE;

// APMs are disabled if they are inactive or if Progressive Onboarding is enabled and not yet complete.
const disabled =
upeCapabilityStatuses.INACTIVE === status ||
( id !== 'card' && isPoEnabled && ! isPoComplete );
upeCapabilityStatuses.INACTIVE === status || isPoInProgress;
const {
accountFees,
}: { accountFees: Record< string, FeeStructure > } = useContext(
WCPaySettingsContext
);
const [ isManualCaptureEnabled ] = useManualCapture();

const needsAttention = [
const needsMoreInformation = [
upeCapabilityStatuses.INACTIVE,
upeCapabilityStatuses.PENDING_APPROVAL,
upeCapabilityStatuses.PENDING_VERIFICATION,
].includes( status );

const needsAttention = needsMoreInformation || isPoInProgress;
const shouldDisplayNotice = id === 'sofort';

const needsOverlay =
Expand Down Expand Up @@ -190,9 +196,13 @@ const PaymentMethod = ( {
'woocommerce-payments'
) }
/* eslint-disable-next-line max-len */
href={ getDocumentationUrlForDisabledPaymentMethod(
paymentMethodId
) }
href={
isPoInProgress
? 'https://woocommerce.com/document/woopayments/startup-guide/gradual-signup/#additional-payment-methods'
: getDocumentationUrlForDisabledPaymentMethod(
paymentMethodId
)
}
/>
),
},
Expand Down
Loading