Skip to content

Commit

Permalink
Fix PO Notice not appearing when adding APMs (#7552)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmallory42 authored Oct 25, 2023
1 parent 98ed205 commit d22c2ce
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
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

0 comments on commit d22c2ce

Please sign in to comment.