Skip to content

Add message for auto defended disputes #679

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

Merged
merged 9 commits into from
May 30, 2025

Conversation

glad-adyen
Copy link
Contributor

@glad-adyen glad-adyen commented May 27, 2025

Summary

This PR adds info alert for disputes that are automatically defended.

In addition, it also introduces the following changes:

  • Alert variant for expired and lost (due to inaction) disputes changed from SUCCESS to HIGHLIGHT.
  • Different alert message for expired and lost (due to inaction) disputes.
  • Alert message for undefended chargebacks that cannot be defended by any means.
  • Skip Respond by detail field for undefended chargebacks that cannot be defended.
  • Added some test cases for the alert message variants and modified existing test cases.
  • Added Expired on detail field for chargebacks lost without action.
  • Fixed files clearing bug after defense documents submission error.

Fixed issue: CXP-3693: Add message for Auto defended disputes

@glad-adyen glad-adyen self-assigned this May 27, 2025
@glad-adyen glad-adyen requested a review from a team as a code owner May 27, 2025 09:07
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @glad-adyen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello team, gemini-code-assist here to provide a summary of this pull request. This PR addresses issue CXP-3693 by introducing a new informational alert within the Dispute Management component. The purpose of this alert is to clearly indicate to the user when a specific dispute has been automatically defended by the system. This involves adding a new flag to the dispute data structure, updating the UI logic to check for this flag and display the appropriate alert, and adding the necessary translation strings for the new message.

Highlights

  • New 'autodefended' flag: A new boolean property autodefended has been added to the Defense type in the API schema and is used in mock data to indicate if a dispute was automatically defended.
  • Auto-defended alert UI: A new alert mode autoDefended is introduced in the DisputeDataAlert component. This mode displays a 'HIGHLIGHT' type, 'TIP' variant alert with a specific message when the autodefended flag is true on a dispute.
  • Alert display logic: The logic in the DisputeData component is updated to prioritize showing the autoDefended alert if the dispute's defense.autodefended property is true, before checking for other alert conditions like contactSupport or notDefended.
  • Translation strings: New translation keys and English strings (disputes.alert.autoDefended) have been added to support the new alert message.

Changelog

Click here to see the changelog
  • mocks/mock-data/disputes.ts
    • Added autodefended: false to default dispute defense mock data.
  • src/components/external/DisputeManagement/components/DisputesData/DisputeData.tsx
    • Added autoDefended to the DisputeDataAlertMode type.
    • Added a new case for autoDefended in the DisputeDataAlert component to render the new alert.
    • Changed the alert type for notDefended from SUCCESS to HIGHLIGHT.
    • Added logic in DisputeData to check for dispute?.defense?.autodefended === true and set the alert mode to autoDefended.
  • src/translations/en-US.instructions.json
    • Added instruction text for the new disputes.alert.autoDefended translation key.
  • src/translations/en-US.json
    • Added the English translation string for disputes.alert.autoDefended: "This chargeback was defended automatically.".
  • src/types/api/resources/DisputesResource.ts
    • Added the autodefended: boolean; property to the Defense interface.
    • Made the reason property in the Defense interface optional (string?).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


An alert appears,
Dispute defended, no fears,
Code change brings good news.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully introduces an informational alert for disputes that are automatically defended. The changes are well-targeted, modifying mock data, component logic, type definitions, and translation files to support this new feature.

I've identified a few areas for discussion and potential improvement, primarily concerning a change to an existing alert type, a modification to an API type definition, and the addition of tests for the new functionality. Addressing these points will help ensure the robustness and clarity of the changes.

Summary of Findings

  • Alert Type Change for 'notDefended' Case: The alert type for 'notDefended' disputes was changed from SUCCESS to HIGHLIGHT in DisputeData.tsx. Clarification is requested on whether this was an intentional part of the PR's scope.
  • Optional Defense Reason: The reason field in the Defense type definition (DisputesResource.ts) was made optional. Further context on this change is needed to understand its full implications, especially if it relates to auto-defended disputes or other scenarios.
  • Testing for New Functionality: The new 'autoDefended' alert functionality in DisputeData.tsx would benefit from dedicated unit tests to ensure its correctness and prevent regressions.

Merge Readiness

The pull request is a good step towards displaying information for auto-defended disputes. However, before merging, I recommend addressing the points raised in the review comments, particularly clarifying the intentionality of the notDefended alert change, the reasoning behind making the defense reason optional, and considering the addition of tests for the new alert logic. Once these medium-severity items are addressed, the PR should be in a better state for merging. As I am an AI assistant, I am not authorized to approve pull requests; please ensure further review and approval from team members.

@glad-adyen glad-adyen force-pushed the feature/auto-defended-dispute branch from fce201e to 4edf4f2 Compare May 27, 2025 09:38
# Conflicts:
#	src/components/external/DisputeManagement/components/DisputesData/DisputeData.tsx
#	src/translations/en-US.instructions.json
#	src/translations/en-US.json
@glad-adyen glad-adyen force-pushed the feature/auto-defended-dispute branch from 4edf4f2 to 00c97cd Compare May 27, 2025 09:44
@glad-adyen glad-adyen force-pushed the feature/auto-defended-dispute branch from c0bb369 to 7073142 Compare May 29, 2025 10:50
# Conflicts:
#	mocks/mock-server/disputes.ts
#	src/components/external/DisputeManagement/components/DisputesData/DisputeData.tsx
#	stories/mocked/disputeManagement.stories.tsx
@glad-adyen glad-adyen force-pushed the feature/auto-defended-dispute branch from 2f5587a to dc07101 Compare May 29, 2025 12:11
@glad-adyen glad-adyen merged commit 80bcded into group/disputes May 30, 2025
10 checks passed
@glad-adyen glad-adyen deleted the feature/auto-defended-dispute branch May 30, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants