Skip to content

Revert "backend/feat: Stripe payout dynamic transfer top-up for Fleet…#1325

Merged
prakharritik merged 1 commit into
mainfrom
backend/reverting/pr
Jun 2, 2026
Merged

Revert "backend/feat: Stripe payout dynamic transfer top-up for Fleet…#1325
prakharritik merged 1 commit into
mainfrom
backend/reverting/pr

Conversation

@Kuldeepkumawat144
Copy link
Copy Markdown
Contributor

@Kuldeepkumawat144 Kuldeepkumawat144 commented Jun 2, 2026

… VA insufficient balance (#1320)"

This reverts commit 1e3abfa.

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

    • Added Stripe payout event webhook handling for enhanced transaction monitoring.
  • Refactor

    • Removed merchant top-up amount field from payout order responses.
    • Removed balance inquiry functions from internal Stripe integration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Walkthrough

This PR removes the Fleet VA balance checking and merchant account top-up logic from payout order creation across Stripe and Juspay providers. The CreatePayoutOrderResp schema is updated to remove the merchantTopUpAmount field, balance utility functions are removed from the Stripe module, and webhook event handling is added to process Stripe payout events.

Changes

Payout Order Top-Up Logic Removal

Layer / File(s) Summary
Response type schema update
lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs
CreatePayoutOrderResp record removes the merchantTopUpAmount field, changing the external schema for payout responses.
Stripe createPayoutOrder simplification
lib/mobility-core/src/Kernel/External/Payout/Interface.hs
createPayoutOrder StripeConfig branch eliminates Fleet VA balance checks and merchant top-up computation; transfer amount is created directly from the request and response building is updated.
Stripe payoutOrderStatus response mapping
lib/mobility-core/src/Kernel/External/Payout/Interface.hs
payoutOrderStatus response construction removes the explicit merchantTopUpAmount field assignment.
Juspay provider response updates
lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs
Both createPayoutOrder and payoutOrderStatus remove merchantTopUpAmount field assignments from their response records.
Stripe module refactoring
lib/mobility-core/src/Kernel/External/Payout/Interface/Stripe.hs, lib/mobility-core/src/Kernel/External/Payout/Stripe/Flow.hs
Remove getBalance, getAvailableForCurrency, BalanceFund, BalanceResp, and GetBalanceAPI exports and types; add Stripe payout webhook event handling with event-to-object mapping.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • nammayatri/shared-kernel#1320: Removes the Fleet VA shortfall top-up logic and the merchantTopUpAmount field that were added for Stripe createPayoutOrder and related responses.
  • nammayatri/shared-kernel#1287: Both PRs update the Stripe payout webhook integration, including payoutStripeServiceEventWebhook and related payout event/object mapping in webhook modules.

Suggested reviewers

  • khuzema786
  • Vignesh-772

Poem

🐰 No more checks for balances deep,
No top-ups needed, costs to keep—
Transfer swift with amounts straight,
Webhooks catch what Stripe sends in state!
Simpler flows, like morning's glow. ✨

🚥 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 accurately describes the main change: reverting a previous feature implementation for Stripe payout dynamic transfer top-up, which aligns with the comprehensive set of changes across multiple files that remove balance checking logic and top-up related fields.
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 backend/reverting/pr

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 11:01
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs (1)

75-92: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve backward compatibility for the v1 payout response.

Removing merchantTopUpAmount here changes the JSON/OpenAPI shape returned by the existing CreatePayoutOrderAPI and PayoutOrderStatusAPI in lib/mobility-core/src/Kernel/External/Payout/Juspay/Flow.hs:36-52 and lib/mobility-core/src/Kernel/External/Payout/Juspay/Flow.hs:60-80. Unless every caller was rolled back in lockstep, this is a breaking contract on a v1 API. Safer options are to keep the field as deprecated and return Nothing, or introduce a new versioned response type.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs` around lines
75 - 92, The CreatePayoutOrderResp type was changed and removed
merchantTopUpAmount which breaks the v1 JSON contract used by
CreatePayoutOrderAPI and PayoutOrderStatusAPI (see Juspay Flow handlers);
restore backward compatibility by adding merchantTopUpAmount :: Maybe
HighPrecMoney back into CreatePayoutOrderResp (marked deprecated in comments)
and ensure serialization still emits null when unset, or alternatively introduce
a new versioned response type (e.g., CreatePayoutOrderRespV2) and update the
Juspay Flow handlers to return the appropriate version while leaving the v1
handlers unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs`:
- Around line 75-92: The CreatePayoutOrderResp type was changed and removed
merchantTopUpAmount which breaks the v1 JSON contract used by
CreatePayoutOrderAPI and PayoutOrderStatusAPI (see Juspay Flow handlers);
restore backward compatibility by adding merchantTopUpAmount :: Maybe
HighPrecMoney back into CreatePayoutOrderResp (marked deprecated in comments)
and ensure serialization still emits null when unset, or alternatively introduce
a new versioned response type (e.g., CreatePayoutOrderRespV2) and update the
Juspay Flow handlers to return the appropriate version while leaving the v1
handlers unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9c53e215-5710-46d0-b2f0-f11d26fc71b9

📥 Commits

Reviewing files that changed from the base of the PR and between 1aa00c4 and f8ea88f.

📒 Files selected for processing (5)
  • lib/mobility-core/src/Kernel/External/Payout/Interface.hs
  • lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs
  • lib/mobility-core/src/Kernel/External/Payout/Interface/Stripe.hs
  • lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs
  • lib/mobility-core/src/Kernel/External/Payout/Stripe/Flow.hs
💤 Files with no reviewable changes (3)
  • lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs
  • lib/mobility-core/src/Kernel/External/Payout/Stripe/Flow.hs
  • lib/mobility-core/src/Kernel/External/Payout/Interface/Stripe.hs

@prakharritik prakharritik merged commit ce882b3 into main Jun 2, 2026
2 checks passed
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.

2 participants