Skip to content

fix: stripe reverse transfer#1323

Open
TejaswiniT167 wants to merge 1 commit into
mainfrom
fix-stripe-reverse-transfer
Open

fix: stripe reverse transfer#1323
TejaswiniT167 wants to merge 1 commit into
mainfrom
fix-stripe-reverse-transfer

Conversation

@TejaswiniT167
Copy link
Copy Markdown
Contributor

@TejaswiniT167 TejaswiniT167 commented Jun 2, 2026

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates

Description

Additional Changes

  • This PR modifies the database schema (database migration added)
  • This PR modifies dhall configs/environment variables

Motivation and Context

How did you test it?

Checklist

  • I formatted the code and addressed linter errors ./dev/format-all-files.sh
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

Summary by CodeRabbit

  • New Features
    • Refunds gain a configurable "deduct from driver" option, allowing refunds to optionally deduct amounts from drivers.
    • Platform-initiated refunds now honor this new setting (falling back to the previous default when unspecified); refunds for connected accounts behave as before.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 380bd7b3-4864-4a80-8d8e-7b619017cd6b

📥 Commits

Reviewing files that changed from the base of the PR and between dbc22b0 and 5c4c53f.

📒 Files selected for processing (3)
  • lib/mobility-core/src/Kernel/External/Payment/Interface.hs
  • lib/mobility-core/src/Kernel/External/Payment/Interface/Stripe.hs
  • lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs
🚧 Files skipped from review as they are similar to previous changes (3)
  • lib/mobility-core/src/Kernel/External/Payment/Interface.hs
  • lib/mobility-core/src/Kernel/External/Payment/Interface/Stripe.hs
  • lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs

Walkthrough

This PR adds an optional deductFromDriver flag to refund request types, threads it into the Stripe refund request, and uses it to conditionally set Stripe Platform refunds' reverse_transfer behavior (defaults to true when absent).

Changes

Refund Deduction Control Feature

Layer / File(s) Summary
Request schema extensions
lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs
CreateRefundReq and RefundPaymentReq types each receive a new optional deductFromDriver :: Maybe Bool field to signal driver balance deduction intent.
Stripe refund request building
lib/mobility-core/src/Kernel/External/Payment/Interface.hs
The Stripe branch in refundPayment now passes the deductFromDriver field when constructing the CreateRefundReq payload, alongside the existing email field.
Platform reverse transfer logic
lib/mobility-core/src/Kernel/External/Payment/Interface/Stripe.hs
createRefund uses deductFromDriver to conditionally set reverseTransfer for Platform refunds (falling back to Just True), while Connected-account refunds continue to send Nothing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • khuzema786
  • Vignesh-772

Poem

🐰 A little hop, a tiny change in code,
A flag for drivers on the refund road.
Threads through types and Stripe's reply,
Reverse if chosen — or default to try.
Hooray, the refund path now knows where to go!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: stripe reverse transfer' directly aligns with the main code changes, which modify how the Stripe reverse transfer flag is determined based on the new deductFromDriver field.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-stripe-reverse-transfer

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot requested review from Vignesh-772 and khuzema786 June 2, 2026 09:48
@TejaswiniT167 TejaswiniT167 force-pushed the fix-stripe-reverse-transfer branch from dbc22b0 to 5c4c53f Compare June 2, 2026 21:16
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

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.

1 participant