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

Change Dispute → Details links to Transaction → Details #7087

Merged

Conversation

Jinksi
Copy link
Member

@Jinksi Jinksi commented Aug 29, 2023

Fixes #6929

Warning
This PR is NOT behind a feature flag

Changes proposed in this Pull Request

The goal of this PR is to update any links to disputes anywhere in the UI. As we are now using the transaction detail page for managing and surfacing disputes, links to "a dispute" should point to the relevant transaction detail URL.

Here's a list of places in the UI that are affected (might not be complete, please explore!):

  • Payments overview reminder notice - Respond to dispute for $33 now!
  • Transaction detail timeline
    • mapEvents dispute_needs_response ?
  • Dispute list – row click, button click
  • Order service (PHP)
    • Order note when dispute created
    • Order note when dispute closed
  • dispute_updated webhook handler
    • Transaction note when dispute funds withdrawn
    • Transaction note when dispute funds reinstated
    • Transaction note when dispute updated (unsure what causes this)
  • Order edit screen: disputed order notice

Testing instructions

Review the WooPayments admin UI for places that mention or might link to disputes and ensure they now link to the correct transaction detail screen. Ensure that the transaction screen shows the relevant info about the dispute and the merchant can action, resolve, respond to the dispute.

TBD - list of specific places this PR has fixed


  • 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

@Jinksi Jinksi changed the title Change Dispute → Details links to Transaction → Details Change Dispute → Details links to Transaction → Details Aug 29, 2023
@botwoo
Copy link
Collaborator

botwoo commented Aug 29, 2023

Test the build

Option 1. Jetpack Beta

  • Install and activate Jetpack Beta.
  • Use this build by searching for PR number 7087 or branch name fix/6929-change-dispute-details-links-to-transactions-details 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: dcae68f
  • Build time: 2023-10-06 02:18:32 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 29, 2023

Size Change: +2 B (0%)

Total Size: 1.42 MB

Filename Size Change
release/woocommerce-payments/dist/index.js 284 kB +9 B (0%)
release/woocommerce-payments/dist/order.js 41.1 kB -7 B (0%)
ℹ️ View Unchanged
Filename Size
release/woocommerce-payments/assets/css/admin.css 1.04 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 74.6 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.8 kB
release/woocommerce-payments/dist/index-rtl.css 36.4 kB
release/woocommerce-payments/dist/index.css 36.4 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.2 kB
release/woocommerce-payments/dist/multi-currency.css 2.88 kB
release/woocommerce-payments/dist/multi-currency.js 54.9 kB
release/woocommerce-payments/dist/order-rtl.css 676 B
release/woocommerce-payments/dist/order.css 679 B
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.5 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.8 kB
release/woocommerce-payments/dist/product-details.js 898 B
release/woocommerce-payments/dist/settings-rtl.css 8.93 kB
release/woocommerce-payments/dist/settings.css 8.94 kB
release/woocommerce-payments/dist/settings.js 233 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.5 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.1 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.8 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.6 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 51.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 622 B
release/woocommerce-payments/includes/subscriptions/assets/js/plugin-page.js 814 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

Base automatically changed from dev/details-link-ts-migration to develop August 31, 2023 22:48
@@ -15,7 +15,7 @@ import { getAdminUrl } from 'wcpay/utils';
/**
* The parent segment is the first part of the URL after the /payments/ path.
*/
type ParentSegment = 'deposits' | 'transactions' | 'disputes';
type ParentSegment = 'deposits' | 'transactions';
Copy link
Member Author

Choose a reason for hiding this comment

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

We no longer want to support '/payments/disputes/details' as a link destination.

Copy link
Contributor

Choose a reason for hiding this comment

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

This component knows quite a bit about what's happening above/around it. What's its job?

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be simpler to just require clients to pass the url in? Then simplify this to just rendering a link with a specific visual look & icon.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Not relevant for this PR, just noting so I can move on.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Related, DetailsLink exports getDetailsURL anyway, and it's effectively a (typed) wrapper for getAdminUrl. I prefer to use standard APIs throughout over wrapping (which effectively creates a second, forked API). The part I don't understand is whether ParentSegment is a meaningful & useful type.

@Jinksi Jinksi changed the base branch from develop to add/7289-remove-transaction-dispute-details-feature-flag October 4, 2023 06:18
Jinksi added 4 commits October 4, 2023 16:19
…g' into fix/6929-change-dispute-details-links-to-transactions-details
…g' into fix/6929-change-dispute-details-links-to-transactions-details
Copy link
Contributor

@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 good and tested well.

I have some minor feedbacks.

Mainly on not-encoded URL parameter value, which browser would auto encode anyway actually.

client/overview/task-list/tasks/dispute-task.tsx Outdated Show resolved Hide resolved
includes/class-wc-payments-order-service.php Outdated Show resolved Hide resolved
return add_query_arg(
[
'page' => 'wc-admin',
'path' => '/payments/disputes/details',
'id' => $dispute_id,
'path' => '/payments/transactions/details',
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice one of the URL from the dispute order note has / in the query string parameter value. Forward slash should be encoded to %2F.

Screen.Recording.2023-10-06.at.01.48.22.mov

To confirm encodeURIComponent('/') in Javascript would return %2F.

I was surprised add_query_arg() does not encode the parameter value but then I read that it expects the parameter value is already encoded.

Suggested change
'path' => '/payments/transactions/details',
'path' => '%2Fpayments%2Ftransactions%2Fdetails',

or

Suggested change
'path' => '/payments/transactions/details',
'path' => urlencode( '/payments/transactions/details' ),

Copy link
Member Author

@Jinksi Jinksi Oct 5, 2023

Choose a reason for hiding this comment

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

I've tried this and it ends up with a malformed URL with 0.00000 inserted in place of //%2F.

/wp-admin/admin.php?page=wc-admin&path=0.000000payments0.000000transactions0.000000details&id=ch_3Ny06gC15a3WbJ1t14zIF3QB

This URL is being processed by through WC_Payments_Utils::esc_interpolated_html(), so I'll see if there's another way to urlencode.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ow wow. Not sure what's going on there. I only tried it on WP Console.

Screenshot 2023-10-06 at 08 50 23

Let's do it in a separate PR.

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've opened an issue for this: #7399.

includes/class-wc-payments-webhook-processing-service.php Outdated Show resolved Hide resolved
includes/class-wc-payments-webhook-processing-service.php Outdated Show resolved Hide resolved
[ 'id' => $dispute_id ],
admin_url( 'admin.php?page=wc-admin&path=/payments/disputes/details' )
[ 'id' => $charge_id ],
admin_url( 'admin.php?page=wc-admin&path=/payments/transactions/details' )
Copy link
Contributor

Choose a reason for hiding this comment

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

Either

Suggested change
admin_url( 'admin.php?page=wc-admin&path=/payments/transactions/details' )
admin_url( 'admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions%2Fdetails' )

Or consistent with compose_dispute_url():

add_query_arg(
	[
		'page' => 'wc-admin',
		'path' => urlencode( '/payments/transactions/details' ),
		'id' => $charge_id
	],
	admin_url( 'admin.php' )
)

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've opened a followup issue for this: #7399.

@shendy-a8c
Copy link
Contributor

I also feel like removing disputes here is a good idea so Typescript will scream when it's used. Not sure why it's reverted.

@shendy-a8c
Copy link
Contributor

Here's a list of places in the UI that are affected (might not be complete, please explore!)

I can't think of any other places than what you have listed. Your list is more comprehensive that what I initially thought even.

Anyway, I tried to search these terms

  • getDetailsURL.
  • DetailsLink.
  • getAdminUrl.
  • %2Fdisputes%2Fdetails.
  • /disputes/details.

Found:

  • This in client/order/index.js, and
  • Some parentSegment="disputes" in client/components/details-link/test/index.test.tsx.

Worst case, #7310 will redirect.

@Jinksi
Copy link
Member Author

Jinksi commented Oct 5, 2023

I also feel like removing disputes #7087 (comment) is a good idea so Typescript will scream when it's used. Not sure why it's reverted.

That was my first idea, but in discussion above I/we determined that it was out of this PR's scope since there may be more decisions to make with those functions.

Removing disputes from the ParentSegment TS type may be more relevant to #7363 (I've added this to the issue description).

@Jinksi
Copy link
Member Author

Jinksi commented Oct 5, 2023

This in client/order/index.js

Thanks for spotting this! Updated to transaction details in 0a958e5

@Jinksi
Copy link
Member Author

Jinksi commented Oct 6, 2023

Requesting re-review @shendy-a8c as all comments/suggestions are resolved (or issue logged for follow-up).

Copy link
Contributor

@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 good.

The dispute notice on order edit page when dispute has been responded shows correct link now.

Screenshot 2023-10-06 at 09 21 37

@Jinksi Jinksi enabled auto-merge October 6, 2023 02:23
@Jinksi Jinksi added this pull request to the merge queue Oct 6, 2023
Merged via the queue into develop with commit 59e8b2f Oct 6, 2023
26 of 27 checks passed
@Jinksi Jinksi deleted the fix/6929-change-dispute-details-links-to-transactions-details branch October 6, 2023 02:38
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.

Change any link to dispute details link to transaction details link – client.
4 participants