Please go through this requirement.md file for the detail requirements
Please follow the SETUP.md file for all the setup instructions(Only for macos users).
Please review the codebase commit by commit starting with first commit.
- Create setup instructions file for Linux and WSL users
- UI/UX improvements(table, sections, div, flash)
- Add the pagination with page size 10
- Add the rdoc documentation for all the ruby code
- Implement user management so we can easily onboard the user
- Investigate and replace sidekiq with Solidus if possible
- Investigate Turbo, Propshaft, Stimulus, Turbo frames as its available in 8.1.1
- Introduce tailwindcss-rails and move code according to it.
Create sample users with different roles:
bin/rails users:sampleThis creates:
admin@disputor.local/admin123(admin role)reviewer@disputor.local/reviewer123(reviewer role)readonly@disputor.local/readonly123(read_only role)
Or create a custom user:
bin/rails users:create[your@email.com,password123,admin,UTC]Terminal 1 - Rails server:
bin/rails serverTerminal 2 - Sidekiq worker:
bundle exec sidekiq- Open your browser: http://localhost:3000
- Sign in with one of the test users (e.g.,
admin@disputor.local/admin123)
bin/rails consolecharge = Charge.create!(
external_id: "chg_test_#{Time.now.to_i}",
amount_cents: 5000,
currency: "USD"
)Option A: Using the script
dispute.opened webhook!
# 1. Create the charge first
bin/rails runner "Charge.create!(external_id: 'chg_test_1', amount_cents: 5000, currency: 'USD')"
# 2. Then send webhook
./scripts/post_webhook.sh dispute.opened dsp_test_1 chg_test_1
# For updated/closed events, the dispute must already exist
./scripts/post_webhook.sh dispute.updated dsp_test_1
./scripts/post_webhook.sh dispute.closed dsp_test_1Note: If you send a webhook for a non-existent charge, the webhook will be accepted but the background job will fail.
Option B: Using curl directly
curl -X POST http://localhost:3000/webhooks/disputes \
-H "Content-Type: application/json" \
-d '{
"event_type": "dispute.opened",
"event_id": "evt_123",
"dispute": {
"external_id": "dsp_123",
"charge_external_id": "chg_test_1",
"amount_cents": 5000,
"currency": "USD",
"status": "open",
"occurred_at": "2024-11-25T10:00:00Z"
}
}'Option C: Using Rails console
charge = Charge.create!(external_id: "chg_123", amount_cents: 1000, currency: "USD")
dispute = Dispute.create!(
charge: charge,
external_id: "dsp_123",
amount_cents: 1000,
currency: "USD",
opened_at: Time.current,
status: "open"
)- Navigate to: http://localhost:3000 (root)
- View all disputes in a table
- Click "View" to see dispute details
- View dispute information
- Transition Status: Select a valid status and add a note
- Reopen Dispute: For won/lost disputes, use the reopen form
- Add Evidence: Upload files and add notes
- View Audit Trail: See all case actions
- Daily Volume: http://localhost:3000/reports/daily_volume
- Filter by date range
- Download JSON for charts
- Time To Decision: http://localhost:3000/reports/time_to_decision
- View p50/p90 percentiles by week
- Download JSON
- Admin: Can transition disputes, add evidence, view reports
- Reviewer: Can transition disputes, add evidence, view reports(no user management its future enhancement)
- Read Only: Can view disputes and reports, but forms are disabled
- Sidekiq Web UI: http://localhost:3000/sidekiq (development only)
- View webhook processing jobs
- Check job status and retries
- Make sure Sidekiq is running:
bundle exec sidekiq - Check Sidekiq Web UI: http://localhost:3000/sidekiq
- Check logs:
tail -f log/development.log
- Verify users exist:
bin/rails consolethenUser.all - Create users:
bin/rails users:sample
- Create a charge first (via console or webhook)
- Send a webhook event to create a dispute
- Check that Sidekiq processed the job
# 1. Create users
bin/rails users:sample
# 2. Create a charge
bin/rails runner "Charge.create!(external_id: 'chg_test', amount_cents: 5000, currency: 'USD')"
# 3. Send webhook to create dispute
./scripts/post_webhook.sh dispute.opened dsp_test chg_test
# 4. Start the app
bin/devThen visit http://localhost:3000 and sign in with admin@disputor.local / admin123