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

fix(process): add process tracker support for instant refunds #5818

Merged
merged 7 commits into from
Sep 16, 2024

Conversation

AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented Sep 5, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR
Earlier pending refunds was not added to the process tracker. With this PR, the task will be added in the process tracker and process tracker will update respective refund's status.

How did you test it?

  1. Create an instant refund with any connector
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_TDO8FwbwbQCasgvL5qiuYqCFVhWyTBUdBFA8usraNSQekdO51E9BKsiikwfVDyAR' \
--data '{"payment_id":"pay_GQ2WnvGFRKq6pa9024Or","amount":600,"reason":"Customer returned product","refund_type":"instant","metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"}}'

Response

{
    "refund_id": "ref_opOquELRfQVFvtWf2C72",
    "payment_id": "pay_GQ2WnvGFRKq6pa9024Or",
    "amount": 600,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "created_at": "2024-09-05T13:24:10.440Z",
    "updated_at": "2024-09-05T13:24:11.917Z",
    "connector": "braintree",
    "profile_id": "pro_HSgGgX0GeQYxpGzOewm6",
    "merchant_connector_id": "mca_E99QghpSKd5cBgMTHwR7",
    "charges": null
}
  1. Wait for the process tracker to update the status
    Process_tracker
    Screenshot 2024-09-05 at 7 00 08 PM
    Refunds table with updated status
    Screenshot 2024-09-05 at 6 59 39 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@AkshayaFoiger AkshayaFoiger requested review from a team as code owners September 5, 2024 13:31
Copy link

semanticdiff-com bot commented Sep 5, 2024

Review changes with SemanticDiff.

Analyzed 5 of 5 files.

Overall, the semantic diff is 6% smaller than the GitHub diff.

Filename Status
✔️ crates/router/src/workflows/outgoing_webhook_retry.rs Analyzed
✔️ crates/router/src/routes/refunds.rs Analyzed
✔️ crates/router/src/core/refunds.rs 10.5% smaller
✔️ crates/router/src/core/webhooks/incoming.rs Analyzed
✔️ crates/router/src/compatibility/stripe/refunds.rs Analyzed

@AkshayaFoiger AkshayaFoiger self-assigned this Sep 5, 2024
@AkshayaFoiger AkshayaFoiger added A-process-tracker Area: Process tracker A-refunds Area: Refund flows labels Sep 5, 2024
crates/router/src/core/refunds.rs Outdated Show resolved Hide resolved
crates/router/src/core/refunds.rs Outdated Show resolved Hide resolved
crates/router/src/core/refunds.rs Show resolved Hide resolved
SanchithHegde
SanchithHegde previously approved these changes Sep 11, 2024
Chethan-rao
Chethan-rao previously approved these changes Sep 11, 2024
))?;
}
}
update_refund
Copy link
Member

Choose a reason for hiding this comment

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

Use match and handle error case

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Sep 16, 2024
Merged via the queue into main with commit 6e74b80 Sep 16, 2024
26 checks passed
@Gnanasundari24 Gnanasundari24 deleted the refund-process-tracker branch September 16, 2024 12:56
cookieg13 pushed a commit that referenced this pull request Sep 19, 2024
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-process-tracker Area: Process tracker A-refunds Area: Refund flows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants