-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add correct inquiry docs link to active dispute/inquiry notice in transactions screen #7277
Changes from 8 commits
8e28971
fd803e1
9bc6046
6de1f35
1d4af95
2da525b
af3d03a
bac3892
7dc77b0
5ca7e88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: fix | ||
|
||
Update documentation links (new/changed docs content) when notifying merchant that a dispute needs response. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,11 +26,7 @@ import type { Dispute } from 'wcpay/types/disputes'; | |
import type { ChargeBillingDetails } from 'wcpay/types/charges'; | ||
import wcpayTracks from 'tracks'; | ||
import { useDisputeAccept } from 'wcpay/data'; | ||
import { | ||
getDisputeFeeFormatted, | ||
isAwaitingResponse, | ||
isInquiry, | ||
} from 'wcpay/disputes/utils'; | ||
import { getDisputeFeeFormatted, isInquiry } from 'wcpay/disputes/utils'; | ||
import { getAdminUrl } from 'wcpay/utils'; | ||
import DisputeNotice from './dispute-notice'; | ||
import IssuerEvidenceList from './evidence-list'; | ||
|
@@ -70,7 +66,7 @@ const DisputeAwaitingResponseDetails: React.FC< Props > = ( { | |
<CardBody className="transaction-details-dispute-details-body"> | ||
<DisputeNotice | ||
dispute={ dispute } | ||
urgent={ countdownDays <= 2 } | ||
isUrgent={ countdownDays <= 2 } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've renamed this to isUrgent so it's super obvious it's a boolean. I'm not sure if we have a relevant guideline but this is common in WP code (is my understanding). I saw |
||
/> | ||
{ hasStagedEvidence && ( | ||
<InlineNotice icon={ edit } isDismissible={ false }> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
*/ | ||
import React from 'react'; | ||
import { __, sprintf } from '@wordpress/i18n'; | ||
import { ExternalLink } from '@wordpress/components'; | ||
import { createInterpolateElement } from '@wordpress/element'; | ||
|
||
/** | ||
|
@@ -18,52 +19,61 @@ import { isInquiry } from 'wcpay/disputes/utils'; | |
|
||
interface DisputeNoticeProps { | ||
dispute: Dispute; | ||
urgent: boolean; | ||
isUrgent: boolean; | ||
} | ||
|
||
const DisputeNotice: React.FC< DisputeNoticeProps > = ( { | ||
dispute, | ||
urgent, | ||
isUrgent, | ||
} ) => { | ||
const clientClaim = | ||
const shopperDisputeReason = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed this, |
||
reasons[ dispute.reason ]?.claim ?? | ||
__( | ||
'The cardholder claims this is an unrecognized charge.', | ||
'woocommerce-payments' | ||
); | ||
|
||
const noticeText = isInquiry( dispute ) | ||
? /* translators: <a> link to dispute documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */ | ||
__( | ||
// eslint-disable-next-line max-len | ||
'<strong>%s</strong> You can challenge their claim if you believe it’s invalid. Not responding will result in an automatic loss. <a>Learn more</a>', | ||
'woocommerce-payments' | ||
) | ||
: /* translators: <a> link to dispute documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */ | ||
__( | ||
// eslint-disable-next-line max-len | ||
'<strong>%s</strong> Challenge the dispute if you believe the claim is invalid, or accept to forfeit the funds and pay the dispute fee. Non-response will result in an automatic loss. <a>Learn more about responding to disputes</a>', | ||
'woocommerce-payments' | ||
); | ||
/* translators: <a> link to dispute documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */ | ||
let noticeText = __( | ||
'<strong>%s</strong> Challenge the dispute if you believe the claim is invalid, ' + | ||
'or accept to forfeit the funds and pay the dispute fee. ' + | ||
'Non-response will result in an automatic loss. <a>Learn more about responding to disputes</a>', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Split these over multiple lines so we don't need to |
||
'woocommerce-payments' | ||
); | ||
let learnMoreDocsUrl = | ||
'https://woocommerce.com/document/woopayments/fraud-and-disputes/managing-disputes/#responding'; | ||
|
||
if ( isInquiry( dispute ) ) { | ||
/* translators: <a> link to dispute inquiry documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block overrides the string + url for inquiries. Hopefully makes this easier to read/understand – default is dispute, details are overridden for inquiries. |
||
noticeText = __( | ||
'<strong>%s</strong> You can challenge their claim if you believe it’s invalid. ' + | ||
'Not responding will result in an automatic loss. <a>Learn more about payment inquiries</a>', | ||
'woocommerce-payments' | ||
); | ||
learnMoreDocsUrl = | ||
'https://woocommerce.com/document/woopayments/fraud-and-disputes/managing-disputes/#inquiries'; | ||
} | ||
|
||
return ( | ||
<InlineNotice | ||
icon | ||
status={ urgent ? 'error' : 'warning' } | ||
status={ isUrgent ? 'error' : 'warning' } | ||
className="dispute-notice" | ||
isDismissible={ false } | ||
> | ||
{ createInterpolateElement( sprintf( noticeText, clientClaim ), { | ||
a: ( | ||
// eslint-disable-next-line jsx-a11y/anchor-has-content | ||
<a | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href="https://woocommerce.com/document/woopayments/fraud-and-disputes/managing-disputes/#section-3" | ||
/> | ||
), | ||
strong: <strong />, | ||
} ) } | ||
{ createInterpolateElement( | ||
sprintf( noticeText, shopperDisputeReason ), | ||
{ | ||
a: ( | ||
<ExternalLink | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href={ learnMoreDocsUrl } | ||
/> | ||
), | ||
strong: <strong />, | ||
haszari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
) } | ||
</InlineNotice> | ||
); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a "comment" changelog entry since it's behind a feature flag and not visible to users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point 😄 7dc77b0