Closed apoorvdixit88 closed 2 weeks ago
Hi @apoorvdixit88 , I can help on this.
Hi @apoorvdixit88 ,
Just wondering which commit should I use as my branch base? I can successfully run hyperswitch using docker compose up -d
(I suppose this is production environment?). However, I tried to run the development environment on tagged revision v1.111.3 following this guide but failed. I think I need some guide on setting up the dev environment.
Here is a screen shot of what I encountered: I'm on branch tagged v1.111.3
Please let me know how to set up the development environment. Thanks!
Hey @qstommyshu I will suggest to Set up Rust and other dependencies natively it will be better for local development. You can use docker to run all other services, but for hyperswitch server local dev will be better.
In the screen shot all the services are running, please clone the repo and make a new branch and you can start the development. You can run the hyperswitch server locally.
Please let me know if you encounter any challenges. Thanks
Hi @apoorvdixit88 , I've finished working on this issue. Here is the result:
Before sending a POST
request to /sample_data
:
table payment_intent
starts with 18 non-generated records:
and table dispute
does not have any records:
After sending a POST
request to /sample_data
:
table payment_intent
now has 118 records:
table dispute
has 100 records with prefixed test_
dispute_id, payment_id, attempt_id, connector_dispute_id
We can also tell disputes are generated from diesel logs, for example, the highlighted area is a generated dispute as we can see keywords PreArbitration
and DisputeOpened
.
Then, we send a DELETE
request to /sample_data
:
We are now left with the original 18 records in the payment_intent
table and 0 records for the dispute
table:
For now, the /sample_data
generates as many disputes as payment intents. I will address the dispute number requirement and randomness requirement in #6117.
Should I submit a PR for this issue or you want me to submit a PR that combines this issue and #6117?
Hey @qstommyshu you can raise PR for this issue first.
Hi @apoorvdixit88, PR raised, here is the link: https://github.com/juspay/hyperswitch/pull/6293
Please take a look when you are available :)
Hey @qstommyshu, the PR looks great. Added few comments, please address.
Hi @apoorvdixit88 ,
Thanks for the quick reply. I've addressed all your comments. Please take a look when you are available.
It seems I also accidentally added resolve #5991
to the latest commit, this might close #5991 after the PR is merged. Do you know how can I fix it?
Hi @apoorvdixit88 ,
Thanks for the quick reply. I've addressed all your comments. Please take a look when you are available.
It seems I also accidentally added
resolve #5991
to the latest commit, this might close #5991 after the PR is merged. Do you know how can I fix it?
For other issue which you mentioned we can do Force Push that removes the issue from commit message. We can Squash commits. But we can simply open issue again after it gets closed. So let it be.
Hey @qstommyshu Thanks for participating! Kindly fill this form once all of your PRs are merged.
Feature Description
The issue is sub part of issue: #5991
We currently have a feature for generating sample data, which includes batch insertion of payments and refunds. The feature inserts payments and refunds in batches using the BatchSampleDataInterface trait. We need to extend this functionality to support batch insertion and deletion of disputes as well.
Steps to Implement Batch Support for Disputes
Extend the BatchSampleDataInterface Trait We need to extend the existing BatchSampleDataInterface to include methods for batch insertion and deletion of disputes. These methods will be similar to the ones already implemented for PaymentIntent, PaymentAttempt, and Refund.
New Methods for Disputes:
insert_disputes_batch_for_sample_data
: This method will handle batch insertion of disputes.delete_disputes_for_sample_data
: This method will handle (batch) deletion of disputes.Possible Implementation
Add Functions for Dispute Insert and Delete in
BatchSampleDataInterface
crates/router/src/db/user/sample_data.rs
Complete these interface functions for Store, Mock Db and Kafka like we did for other functions.
Write Batch Insert and Delete Queries for Disputes
crates/diesel_model/src/query/user/sample_data.rs
To test we can hard code some dummy dispute and try inserting using the function we made in core. We can check Db and see the logs for the query that is getting printed.
Steps for Testing Dispute Batch Insertion and Deletion
generate_sample_data_for_user
method from the core function to insert the disputes into the database. This should invoke the appropriate batch insertion logic. (Or we can make an api to test the behaviour when the function is invoked) Curl to invoke this core function:}'
curl --location 'http://localhost:8080/user/signup' \ --header 'Content-Type: application/json' \ --data-raw '{ "email": "JohnTest@test.com", "password": "Test@321" }'
curl --location 'http://localhost:8080/user/2fa/terminate?skip_two_factor_auth=true' \ --header 'Authorization: Bearer Intermediatetoken'
curl --location --request DELETE 'http://localhost:8080/user/sample_data' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer JWT' \ --data '{
}'