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 Transaction Details dispute footer for disputes not awaiting a response #7047

Merged
merged 82 commits into from
Sep 19, 2023

Conversation

Jinksi
Copy link
Member

@Jinksi Jinksi commented Aug 23, 2023

Fixes #6927

Note
This PR is behind feature flag _wcpay_feature_dispute_on_transaction_page

Changes proposed in this Pull Request

This PR renders a CardFooter with a message and call-to-action button for disputes that are not awaiting a response from the merchant.

TypeScript interfaces for Dispute and BalanceTransaction have been updated with properties relevant to dispute metadata and fees.

A new tracks event wcpay_payment_details_view_dispute_evidence_button_click will be fired when clicking the view dispute details button.

The DisputeDetails component has been renamed DisputeAwaitingResponseDetails to clarify the intent and distinguish it from this PR's new DisputeResolutionFooter component.

See design on Figma: RiEQmaKRI7u9USAI3lyZz0VX-fi-7047_436287

Testing instructions

  1. Enable the feature flag by running update_option( '_wcpay_feature_dispute_on_transaction_page', '1' ); in WP Console or wp-cli.
  2. View the transaction details screen for each of the following dispute statuses, ensuring that the content, action button link and background color match the requirements:
  • Lost via challenge
    • This dispute was lost on December 14, 2023. The $15 USD fee has been deducted from your account, and the disputed amount returned to the cardholder. Learn more about preventing disputes.
    • Action button: View dispute details links to dispute challenge form (read-only)
    • Color: new grey (#f2f4f5)
  • Accepted (disputes.metadata.__closed_by_merchant)
  • Lost due to non-response (no dispute.metadata.__evidence_submitted_at)
  • Under review
    • You submitted evidence for this dispute on June 16, 2023. The cardholder’s bank is reviewing the case, which can take 60 days or more. You will be alerted when they make their final decision. Learn more about the dispute process.
    • Action button: View submitted evidence links to dispute challenge form (read-only)
    • Color: $wp-blue-0
  • Won
    • Good news! You won this dispute on December 14, 2023. The disputed amount and the dispute fee have been credited back to your account. Learn more about preventing disputes.
    • Action button: View dispute details links to dispute challenge form (read-only)
    • Color: new grey (#f2f4f5)

Testing tip: To progress a test mode dispute to each new status:

  • won: Provide winning evidence by submitting the challenge form with winning_evidence in the “Additional details” field.
  • under_review: Provide any evidence by submitting the challenge form.
  • lost (losing evidence): Provide winning evidence by submitting the challenge form with losing_evidence in the “Additional details” field.
  • lost (accepted): Accept the dispute using the Accept dispute button on the Dispute Details screen.
  • lost (no response): no way to test this organically in test mode AFAIK. I mocked this state my setting the property dispute.metadata.__evidence_submitted_at = undefined; within the <DisputeDetails /> component (code ref).

Screenshots

Lost via challenge
image

Accepted
image

Lost via non-response
image

Under Review
image

Won
image

Small viewport
image


  • 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

@botwoo
Copy link
Collaborator

botwoo commented Aug 23, 2023

Test the build

Option 1. Jetpack Beta

  • Install and activate Jetpack Beta.
  • Use this build by searching for PR number 7047 or branch name add/6927-dispute-details-not-awaiting-response 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: 4910837
  • Build time: 2023-09-19 02:17:20 UTC

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 23, 2023

Size Change: +1.35 kB (0%)

Total Size: 1.41 MB

Filename Size Change
release/woocommerce-payments/dist/blocks-checkout.js 73.7 kB +36 B (0%)
release/woocommerce-payments/dist/checkout.js 28.7 kB +34 B (0%)
release/woocommerce-payments/dist/index-rtl.css 36.1 kB +62 B (0%)
release/woocommerce-payments/dist/index.css 36.1 kB +61 B (0%)
release/woocommerce-payments/dist/index.js 280 kB +802 B (0%)
release/woocommerce-payments/dist/multi-currency-switcher-block.js 60 kB +29 B (0%)
release/woocommerce-payments/dist/multi-currency.js 54.6 kB +28 B (0%)
release/woocommerce-payments/dist/order.js 40.7 kB +27 B (0%)
release/woocommerce-payments/dist/payment-gateways.js 38.3 kB +34 B (0%)
release/woocommerce-payments/dist/settings.js 231 kB +29 B (0%)
release/woocommerce-payments/dist/subscription-product-onboarding-modal.js 20.2 kB +33 B (0%)
release/woocommerce-payments/dist/subscriptions-empty-state.js 19.4 kB +39 B (0%)
release/woocommerce-payments/dist/tos.js 21.8 kB +38 B (0%)
release/woocommerce-payments/dist/upe_with_deferred_intent_creation_checkout.js 36.6 kB +35 B (0%)
release/woocommerce-payments/dist/woopay-express-button.js 50.6 kB +32 B (0%)
release/woocommerce-payments/dist/woopay.js 71.6 kB +36 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/checkout-rtl.css 440 B
release/woocommerce-payments/dist/checkout.css 441 B
release/woocommerce-payments/dist/multi-currency-analytics.js 1.05 kB
release/woocommerce-payments/dist/multi-currency-rtl.css 2.87 kB
release/woocommerce-payments/dist/multi-currency.css 2.87 kB
release/woocommerce-payments/dist/order-rtl.css 675 B
release/woocommerce-payments/dist/order.css 676 B
release/woocommerce-payments/dist/payment-gateways-rtl.css 686 B
release/woocommerce-payments/dist/payment-gateways.css 688 B
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.7 kB
release/woocommerce-payments/dist/product-details.js 789 B
release/woocommerce-payments/dist/settings-rtl.css 8.9 kB
release/woocommerce-payments/dist/settings.css 8.91 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-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/tos-rtl.css 230 B
release/woocommerce-payments/dist/tos.css 231 B
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-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-rtl.css 3.85 kB
release/woocommerce-payments/dist/woopay.css 3.85 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

@@ -95,6 +95,8 @@ const events = {
'wcpay_subscriptions_account_not_connected_product_modal_finish_setup',
SUBSCRIPTIONS_ACCOUNT_NOT_CONNECTED_PRODUCT_MODAL_DISMISS:
'wcpay_subscriptions_account_not_connected_product_modal_dismiss',
DISPUTE_RESOLVED_MESSAGE_VIEW_BUTTON_CLICK:
'wcpay_dispute_resolved_message_view_button_click',
Copy link
Contributor

Choose a reason for hiding this comment

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

This tracks event is better named 😁

Though I still wonder if the user action here is different things (which we'd need to dig into props to discover). What are the actions here – view_dispute_details_click

OK that confirms how confused I was! 🤣 These buttons all do one action – viewing the dispute details (including submitted evidence etc). So the button function (and the user action / tracks event) is something like wcpay_payment_details_view_dispute_details_click or wcpay_payment_details_view_dispute_submission_click – is that accurate or do I misunderstand?

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed again to wcpay_payment_details_view_dispute_evidence_button_click

Which aims to represent "the merchant clicked the payment details View dispute evidence details button".

Copy link
Member Author

Choose a reason for hiding this comment

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

This DisputeDetails component has been renamed to DisputeAwaitingResponseDetails to clarify it's intended use and content.

@Jinksi Jinksi requested a review from haszari September 15, 2023 04:36
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.

Looking good! I retested a couple of disputes and confirmed the correct footers show.

General lost (e.g. timeout, or failed challenge)
General lost
Merchant accepted lost
Accepted lost

While testing, I noticed some extra padding in the dispute details / take action box (also on develop). Ah… I see this is the focus of #7206 #7093.

Screenshot 2023-09-18 at 12 28 16 PM

path: '/payments/disputes/challenge',
id: dispute?.id,
} );
getHistory().push( challengeUrl );
Copy link
Contributor

Choose a reason for hiding this comment

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

Hiding the url/href in the onClick handler impacts usability in 2 ways:

  • Can't cmd-click to open in new tab (moderate)
  • Can't hover over button to see URL (minor)

However I can see that using History::push is much faster and nicer experience (is there a way we can have that AND retain normal browser link handling?). I'd like to get aligned on how we use history API and "soft" page loads in WooPayments and Woo admin generally. Personally I like using regular links as much as possible, so the user has more control (e.g. can open in separate tabs).

Not a blocker, just sharing my personal opinion out loud - in my testing I've been frustrated when various Woo admin links don't let me open a new tab!

Copy link
Member Author

Choose a reason for hiding this comment

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

I totally agree, thanks for pointing this out. I've addresses this in fa71276, let me know what you think!

As a workaround (solution), I've wrapped each Button with Link from @woocommerce/components, which already handles the getHistory().push() functionality while allowing the CMD-click for native.

Using Button without the href/onClick provides the correct UI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me! So is this a pattern you recommend in general? e.g. <Link><Button /></Link>?

Tested one of the buttons and it's fast and flexible 🙌🏻

Copy link
Member Author

Choose a reason for hiding this comment

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

I found a little caveat with this approach – CMD+click won't run the onClick handler provided to Link, therefore, tracks event recording should be conducted within the Button's onClick.

Updated in e6e38ea

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

@Jinksi Jinksi enabled auto-merge September 19, 2023 02:13
@Jinksi
Copy link
Member Author

Jinksi commented Sep 19, 2023

I've conducted a final round of testing and have added this PR to the merge queue 🚀

@Jinksi Jinksi added this pull request to the merge queue Sep 19, 2023
Merged via the queue into develop with commit e355f04 Sep 19, 2023
27 checks passed
@Jinksi Jinksi deleted the add/6927-dispute-details-not-awaiting-response branch September 19, 2023 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants