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

Add dispute steps to resolve to the transaction details page. #7206

Merged
merged 33 commits into from
Sep 21, 2023

Conversation

shendy-a8c
Copy link
Contributor

@shendy-a8c shendy-a8c commented Sep 13, 2023

Fixes #6925.

Note
This PR is behind feature flag _wcpay_feature_dispute_on_transaction_page

Changes proposed in this Pull Request

Add the 'Steps to resolve' section on the transaction details page for disputes (not inquiries – handled in issue #7245).

steps

Inquiries will not see the steps rendered:
image

Notes:

Testing instructions

  • Enable the feature flag by running update_option( '_wcpay_feature_dispute_on_transaction_page', '1' ); in WP Console.
  • Purchase a product with card 4000000000000259 to get disputed right away.
  • Open the transaction details page of that new order by going to admin > Payments > Transactions > click on the top most transaction.
  • Confirm there is 'Steps to resolve' section.
  • Confirm the steps are:
1. Email the customer to address their concerns.
2. Provide guidance on dispute withdrawal if the customer agrees.
3. Challenge (?) or accept (?) the dispute by {dispute due by date} ({n} days left to respond)
  • Click on the 'Email the customer' link. It should open your local email client. Confirm:
    • To address is the customer's email address.
    • Subject is Problem with your purchase from {store name} on {YYYY-MM-DD of the charge date}?
    • Body is:
Hello {customer name}

We noticed that on {YYYY-MM-DD of the dispute created date}, you disputed a {currency formatted dispute amount, eg: $10.00} from {YYYY-MM-DD of the charge date}. We wanted to contact you to make sure everything was all right with your purchase and see if there's anything else we can do to resolve any problems you might have had.

Alternatively, if the dispute was a mistake, you could easily withdraw it by calling the number on the back of your card. Thank you so much - we appreciate your business and look forward to working with you.
Challenge the dispute if you consider the claim invalid. You'll need to provide evidence to back your claim. Keep in mind that challenging doesn't ensure a resolution in your favor.
  • The second icon when clicked will explain about accepting the dispute:
Accepting this dispute will automatically close it. Your account will be charged a {currency formatted dispute fee, eg: $15.00} fee, and the disputed amount will be refunded to the cardholder.
  • Confirm the 3rd step shows the dispute's due by date:
    • You can either edit this code or pass daysRemaining at your will here, or hardcode the dispute's due by date to test these cases:
    • When due date is still 7-day away or more, the text color is black.
      Screenshot 2023-09-14 at 06 59 20
    • When due date is between 2 and 7-day away, the text color is yellow.
      Screenshot 2023-09-14 at 07 02 53
    • When due date is less than 3-day away, the text color is red.
      Screenshot 2023-09-14 at 07 04 36
    • When due date is today, the text color is red and it says Last day today.
      Screenshot 2023-09-14 at 07 06 45

Inquiries

  • Purchase a product with card 4000000000001976 to create an inquiry.
  • Open the transaction details page of that new order by going to admin > Payments > Transactions > click on the top most transaction.
  • Confirm that the card is rendered correctly with the appropriate styling, but no "Steps to Resolve" section is displayed.

  • Run npm run changelog to add a changelog file, choose patch to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Post merge

@shendy-a8c shendy-a8c added the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Sep 13, 2023
@botwoo
Copy link
Collaborator

botwoo commented Sep 13, 2023

Test the build

Option 1. Jetpack Beta

  • Install and activate Jetpack Beta.
  • Use this build by searching for PR number 7206 or branch name add/6925-steps-to-resolve in your-test.site/wp-admin/admin.php?page=jetpack-beta&plugin=woocommerce-payments

Option 2. Jurassic Ninja - available for logged-in A12s

🚀 Launch a JN site with this branch 🚀

ℹ️ Install this Tampermonkey script to get more options.


Build info:

  • Latest commit: 71a3349
  • Build time: 2023-09-21 22:32:23 UTC

Note: the build is updated when a new commit is pushed to this PR.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 2023

Size Change: +1.1 kB (0%)

Total Size: 1.42 MB

Filename Size Change
release/woocommerce-payments/dist/index-rtl.css 36.4 kB +94 B (0%)
release/woocommerce-payments/dist/index.css 36.4 kB +95 B (0%)
release/woocommerce-payments/dist/index.js 282 kB +883 B (0%)
release/woocommerce-payments/dist/settings-rtl.css 8.92 kB +14 B (0%)
release/woocommerce-payments/dist/settings.css 8.92 kB +15 B (0%)
ℹ️ View Unchanged
Filename Size
release/woocommerce-payments/assets/css/admin.css 1.03 kB
release/woocommerce-payments/assets/css/success.css 158 B
release/woocommerce-payments/dist/blocks-checkout-rtl.css 1.51 kB
release/woocommerce-payments/dist/blocks-checkout.css 1.51 kB
release/woocommerce-payments/dist/blocks-checkout.js 73.7 kB
release/woocommerce-payments/dist/checkout-rtl.css 440 B
release/woocommerce-payments/dist/checkout.css 441 B
release/woocommerce-payments/dist/checkout.js 28.7 kB
release/woocommerce-payments/dist/multi-currency-analytics.js 1.05 kB
release/woocommerce-payments/dist/multi-currency-rtl.css 2.88 kB
release/woocommerce-payments/dist/multi-currency-switcher-block.js 60.1 kB
release/woocommerce-payments/dist/multi-currency.css 2.88 kB
release/woocommerce-payments/dist/multi-currency.js 54.7 kB
release/woocommerce-payments/dist/order-rtl.css 676 B
release/woocommerce-payments/dist/order.css 679 B
release/woocommerce-payments/dist/order.js 40.9 kB
release/woocommerce-payments/dist/payment-gateways-rtl.css 690 B
release/woocommerce-payments/dist/payment-gateways.css 692 B
release/woocommerce-payments/dist/payment-gateways.js 38.4 kB
release/woocommerce-payments/dist/payment-request-rtl.css 146 B
release/woocommerce-payments/dist/payment-request.css 146 B
release/woocommerce-payments/dist/payment-request.js 11.6 kB
release/woocommerce-payments/dist/product-details.js 789 B
release/woocommerce-payments/dist/settings.js 231 kB
release/woocommerce-payments/dist/subscription-edit-page.js 669 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal-rtl.css 519 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.css 519 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.js 20.3 kB
release/woocommerce-payments/dist/subscription-product-onboarding-toast.js 693 B
release/woocommerce-payments/dist/subscriptions-empty-state-rtl.css 117 B
release/woocommerce-payments/dist/subscriptions-empty-state.css 117 B
release/woocommerce-payments/dist/subscriptions-empty-state.js 19.4 kB
release/woocommerce-payments/dist/tos-rtl.css 230 B
release/woocommerce-payments/dist/tos.css 231 B
release/woocommerce-payments/dist/tos.js 21.9 kB
release/woocommerce-payments/dist/upe_checkout-rtl.css 440 B
release/woocommerce-payments/dist/upe_checkout.css 441 B
release/woocommerce-payments/dist/upe_checkout.js 34 kB
release/woocommerce-payments/dist/upe_split_checkout-rtl.css 440 B
release/woocommerce-payments/dist/upe_split_checkout.css 441 B
release/woocommerce-payments/dist/upe_split_checkout.js 34.6 kB
release/woocommerce-payments/dist/upe_with_deferred_intent_creation_checkout.js 36.6 kB
release/woocommerce-payments/dist/upe-blocks-checkout-rtl.css 1.51 kB
release/woocommerce-payments/dist/upe-blocks-checkout.css 1.51 kB
release/woocommerce-payments/dist/upe-blocks-checkout.js 39.5 kB
release/woocommerce-payments/dist/upe-split-blocks-checkout-rtl.css 1.51 kB
release/woocommerce-payments/dist/upe-split-blocks-checkout.css 1.51 kB
release/woocommerce-payments/dist/upe-split-blocks-checkout.js 41 kB
release/woocommerce-payments/dist/woopay-express-button-rtl.css 146 B
release/woocommerce-payments/dist/woopay-express-button.css 146 B
release/woocommerce-payments/dist/woopay-express-button.js 50.6 kB
release/woocommerce-payments/dist/woopay-rtl.css 3.85 kB
release/woocommerce-payments/dist/woopay.css 3.85 kB
release/woocommerce-payments/dist/woopay.js 71.6 kB
release/woocommerce-payments/includes/subscriptions/assets/css/plugin-page.css 633 B
release/woocommerce-payments/includes/subscriptions/assets/js/plugin-page.js 720 B
release/woocommerce-payments/vendor/automattic/jetpack-assets/build/i18n-loader.js 2.43 kB
release/woocommerce-payments/vendor/automattic/jetpack-assets/src/js/i18n-loader.js 1.01 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-ajax.js 522 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-callables.js 581 B
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/babel.config.js 160 B
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.css 2.32 kB
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.js 13.8 kB
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.rtl.css 2.32 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/about.css 1.2 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-empty-state.css 291 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-order-statuses.css 403 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin.css 3.56 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/checkout.css 299 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/modal.css 742 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/view-subscription.css 572 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/wcs-upgrade.css 411 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin-pointers.js 544 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js 9.63 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.js 6.8 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.min.js 3.83 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-coupon.js 544 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-subscription.js 2.38 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.js 22.1 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.min.js 11.6 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/payment-method-restrictions.js 1.29 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/wcs-meta-boxes-order.js 502 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/payment-methods.js 355 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/single-product.js 429 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/view-subscription.js 1.38 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js 781 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/modal.js 1.1 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/wcs-upgrade.js 1.27 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.css 392 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.js 3.06 kB

compressed-size-action

'Y-m-d',
moment( dispute.created * 1000 ).toISOString()
);
const emailSubject = `Problem with your purchase from ${ wcpaySettings.storeName } on ${ chargeDate }?`;
Copy link
Contributor Author

@shendy-a8c shendy-a8c Sep 14, 2023

Choose a reason for hiding this comment

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

I intentionally do not translate the email subject and body because it is a bit weird to translate a content that is for the customer who might not speak the same language as merchant.

What do you think @souravdebnath1986 @nikkivias? Should we send this email as merchant's language or in English? Or maybe both as I've seen that practice (sending in 2 languages in one email) a lot, but if so, what about the subject?

Copy link
Contributor

@haszari haszari Sep 20, 2023

Choose a reason for hiding this comment

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

Can we keep it simple? This is site content, so it should be translatable. Just like content on pages, buttons, or in site emails.

The merchant has control of all of this. The default experience should not have mixed languages IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note – this will not send an email, just generate a draft email in merchant's email client.

Copy link
Contributor

Choose a reason for hiding this comment

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

For example, if a multilingual merchant wants to send a localised "is everything ok with your purchase" email, they can edit in their mail client of choice or use another mailing solution such as MailPoet etc.

Copy link
Member

Choose a reason for hiding this comment

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

I've made the email subject and body translatable in 787b8d9 to let the merchant decide what language to use.

Choose a reason for hiding this comment

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

I think to default to the merchant's language is better than to suddenly see English if they have localized configuration.

) } from ${ chargeDate }. We wanted to contact you to make sure everything was all right with your purchase and see if there's anything else we can do to resolve any problems you might have had.\n\n` +
`Alternatively, if the dispute was a mistake, you could easily withdraw it by calling the number on the back of your card. Thank you so much - we appreciate your business and look forward to working with you.`;

emailLink = `mailto:${ customer.email }?subject=${ encodeURIComponent(
Copy link
Contributor Author

@shendy-a8c shendy-a8c Sep 14, 2023

Choose a reason for hiding this comment

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

Wanted to use querystring.strinfigy() but I don't see it's used at all in the codebase, so I just use encodeURIComponent() to escape each param's value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Has anyone tested clicking the link correctly works with at least one email client? If there's any issue with escaping or protocol then that would catch it! I have this behaviour disabled on my mac (because I use GMail), so wasn't able to test.

Noting so we can test in our test swarm today e.g. on mobile or if someone has mailto configured right :)

/>
),
disputeduedate: (
<span className="dispute-steps__steps__response-date">
Copy link
Contributor Author

@shendy-a8c shendy-a8c Sep 14, 2023

Choose a reason for hiding this comment

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

I copied this from DisputeSummaryRow's so it looks consistent.

One doubt I have is that in the design paJDYF-9Ip-p2, when due date is still more than 7-day away, it does not show the ({n} days left to respond) part.

Screenshot 2023-09-14 at 07 16 13

but I see in DisputeSummaryRow, it shows that text, so for consistency sake, I follow DisputeSummaryRow.

@shendy-a8c
Copy link
Contributor Author

shendy-a8c commented Sep 14, 2023

Just to note that I'm open for suggestion to improve this PR, especially because of prop-drilling, ie since DisputeSteps needs data outside the dispute object like customer name, email, charge created, etc. Maybe that cannot be avoided? Or maybe pass the whole charge object instead of just dispute (or maybe not)?

@shendy-a8c shendy-a8c requested a review from a team September 14, 2023 00:36
@shendy-a8c shendy-a8c marked this pull request as ready for review September 14, 2023 00:36
@shendy-a8c
Copy link
Contributor Author

Even though there are couple blockers, I think this PR can be reviewed already.

# Conflicts:
#	client/payment-details/dispute-details/index.tsx
#	client/payment-details/dispute-details/style.scss
@Jinksi
Copy link
Member

Jinksi commented Sep 21, 2023

FYI @shendy-a8c I've resolved a few of the TODOs and discussion points for this PR.

From what I see, it's just the email translation discussion to resolve: #7206 (comment).

Update: I've made the email subject and body translatable in 787b8d9 to let the merchant decide what language to use.

@Jinksi Jinksi requested review from a team and removed request for a team September 21, 2023 04:51
@Jinksi
Copy link
Member

Jinksi commented Sep 21, 2023

This PR is ready for another review. FYI @shendy-a8c 🙏

Copy link
Contributor Author

@shendy-a8c shendy-a8c left a comment

Choose a reason for hiding this comment

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

Looks great, @Jinksi !

Tested:

  • With dispute, I could see the steps and actions.
  • With inquiry, I did not see the steps and actions.
  • The tooltip CSS move made me nervous because that means it will affect all TooltipBase usage, ie ClickTooltip and HoverTooltip but I checked they all look good as if that CSS does not do anything =p. Checking HoverTooltip is a bit much but mainly the settings page and the payment logo (eg Visa's) on the transactions list page. I see it's used in WooPay as well but I don't know how to test that.

Thank you for the great work!

I can't approve this PR as I authored it, so go ahead approve and merge.

Copy link
Contributor

@haszari haszari left a comment

Choose a reason for hiding this comment

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

Did a quick review and tested one dispute – looking good and working well. Based on previous reviews this is good to merge so I will merge! 🚢

client/components/tooltip/style.scss Outdated Show resolved Hide resolved
) } from ${ chargeDate }. We wanted to contact you to make sure everything was all right with your purchase and see if there's anything else we can do to resolve any problems you might have had.\n\n` +
`Alternatively, if the dispute was a mistake, you could easily withdraw it by calling the number on the back of your card. Thank you so much - we appreciate your business and look forward to working with you.`;

emailLink = `mailto:${ customer.email }?subject=${ encodeURIComponent(
Copy link
Contributor

Choose a reason for hiding this comment

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

Has anyone tested clicking the link correctly works with at least one email client? If there's any issue with escaping or protocol then that would catch it! I have this behaviour disabled on my mac (because I use GMail), so wasn't able to test.

Noting so we can test in our test swarm today e.g. on mobile or if someone has mailto configured right :)

<li>
{ createInterpolateElement(
__(
'Challenge <challengeicon/> or accept <accepticon/> the dispute by <disputeduedate/>.',
Copy link
Contributor

Choose a reason for hiding this comment

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

I found these inline icon tooltips a bit weird, they break the flow of the sentence. It's functioning well though and super clear and usable so not a blocker.

Maybe that info could be in a single help popup, nearer the action buttons. Thinking out loud – @nikkivias is our UX expert here.

@haszari haszari added this pull request to the merge queue Sep 21, 2023
@Jinksi Jinksi removed this pull request from the merge queue due to a manual request Sep 21, 2023
@Jinksi
Copy link
Member

Jinksi commented Sep 21, 2023

Has anyone tested clicking the link correctly works with at least one email client? If there's any issue with escaping or protocol then that would catch it!

@haszari I have tested the mailto links with macOS mail, works well!

I'll share a screenshot when I get the chance.

@shendy-a8c
Copy link
Contributor Author

shendy-a8c commented Sep 21, 2023

Has anyone tested clicking the link correctly works with at least one email client? If there's any issue with escaping

I have tested it and it worked but in English. If we really want to be sure escaping works, it should be tested with non-ASCII charset languages like Chinese, Japanese, Arabic, etc. I will try it during testing. Good call out!

Update: hmm but since the strings won't be translated yet, I think it has to be tested manually.

@Jinksi Jinksi disabled auto-merge September 21, 2023 22:30
@Jinksi
Copy link
Member

Jinksi commented Sep 21, 2023

Disabling auto-merge, will merge this manually once GH checks complete.

@Jinksi Jinksi merged commit 16f322f into develop Sep 21, 2023
27 checks passed
@Jinksi Jinksi deleted the add/6925-steps-to-resolve branch September 21, 2023 22:43
@Jinksi
Copy link
Member

Jinksi commented Sep 21, 2023

I'll share a screenshot when I get the chance.

An example email in macOS that appears when clicking Email the customer.

image

cc @haszari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction Details > Dispute Details > Steps to resolve for disputes
6 participants