juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.83k stars 1.24k forks source link

[FEATURE] Add functionality to generate and delete sample disputes based on payment count in sample data #5991

Open apoorvdixit88 opened 4 days ago

apoorvdixit88 commented 4 days ago

Feature Description

This issue consists of two parts that must be resolved sequentially: Part 1: #6111 Part 2: #6117

The /sample_data API currently generates sample data for payments and refunds, with refunds making up 20% of the payments. We need to extend the functionality to generate disputes based on the number of payments generated:

2 disputes if the number of generated payments is between 50-100 1 dispute if the number of generated payments is less than 50. Current Behavior:

The DELETE request to /sample_data should also delete these sample disputes when cleaning up the data.

Possible Implementation

Affected Code: The current route configuration is as follows:

route = route.service(
    web::resource("/sample_data")
        .route(web::post().to(user::generate_sample_data))  // Modify to generate disputes based on payment count
        .route(web::delete().to(user::delete_sample_data)), // Modify to delete generated disputes
)

Additional Context: This change ensures that sample disputes are proportionally generated based on the volume of payments, allowing for more realistic sample data and better coverage for testing dispute-related processes.

Have you spent some time checking if this feature request has been raised before?

Submission Process:

Refer here for Terms and conditions for the contest.

qstommyshu commented 2 days ago

Hi! I would like to help on this!

apoorvdixit88 commented 10 hours ago

Hi @qstommyshu,

Thank you for your willingness to help! I've split the issue into two parts:

Part 1: #6111 This involves writing the database logic. Part 2: #6117 This focuses on generating random disputes based on the specified criteria, and it can be tackled only after Part 1 is completed.

Please start with Part 1, and feel free to reach out if you have any questions or need assistance. Looking forward to your contributions!

qstommyshu commented 4 hours ago

Got it, thanks. I'll take a look and let you know if I need help!

apoorvdixit88 commented 4 hours ago

Sure, take a look and let us know if you're interested in submitting a PR for this. If so, I will assign this issue to you.