feat(partnerships): add create_account MCP tool for sub-merchant onboarding#102
Open
rzp-slash[bot] wants to merge 14 commits into
Open
feat(partnerships): add create_account MCP tool for sub-merchant onboarding#102rzp-slash[bot] wants to merge 14 commits into
rzp-slash[bot] wants to merge 14 commits into
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (1.79%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #102 +/- ##
==========================================
- Coverage 97.35% 89.62% -7.73%
==========================================
Files 35 39 +4
Lines 7567 8233 +666
==========================================
+ Hits 7367 7379 +12
- Misses 136 790 +654
Partials 64 64
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…dd auth token tool - Move accounts.go → pkg/razorpay/partnerships/onboarding_apis/account.go (package onboardingapis) to support future partnerships sub-categories - Add pkg/razorpay/partnerships/auth/token.go with generate_access_token tool (POST https://auth.razorpay.com/token, client_credentials grant) - Add helpers.go in each sub-package (getClientFromContextOrDefault, formatErrorMessage, validator) to avoid circular imports with pkg/razorpay - Register partnerships toolset with generate_access_token (write), create_account (write), fetch_account (read) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Switch from JSON to application/x-www-form-urlencoded (OAuth standard) - Pick auth token URL based on APP_ENV: devstack/dev → auth.dev.razorpay.in, prod → auth.razorpay.com Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… as integer Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Flatten all create_account fields into individual params (no nested objects) - Add preview_create_account: validates mandatory fields, assembles nested JSON, shows constructed payload before submission - Mandatory fields: email, phone, legal_business_name, business_type, contact_name — validated in both preview and create - Profile address fields validated conditionally when profile is provided - create_account blocks on mandatory errors, preview surfaces as warnings Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… HTTP - Drop razorpay-go SDK from create_account and fetch_account - Add bearer_token as required param on both tools (obtained from generate_access_token) - Use direct HTTP calls to Partnerships API with Bearer auth - APP_ENV=devstack/dev → api-web.ext.dev.razorpay.in, else api.razorpay.com - Devstack: auto-add X-Org-Id, kong-debug, rzpctx-dev-serve-user (DEVSTACK_LABEL) headers Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Fixes flaky TestRunStdioServer/handles_server_creation_error — when context is cancelled, stdioSrv.Listen returns context.Canceled which raced with ctx.Done(). Treat context.Canceled as a graceful shutdown (return nil). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- gocyclo: split buildAccountPayload into buildProfileBlock, buildLegalInfoBlock, buildContactInfoBlock, buildOperationAddress - gosec G101: add nolint on URL constants (not credentials) - lll: wrap long lines across auth/ and onboarding_apis/ - Add comment explaining context.Canceled handling in stdio.go Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
jating06
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
create_accountMCP tool for Razorpay's Partnerships Onboarding API, enabling partner agents to onboard sub-merchants programmatically.pkg/razorpay/accounts.gowith theCreateAccounttool (POST /v2/accounts)partnershipstoolset inpkg/razorpay/tools.goclient.Account.Createfrom therazorpay-goSDK (already supports v2)Tool:
create_accountRequired:
phoneOptional:
email,legal_business_name,business_type,contact_name,customer_facing_business_name,reference_id,type,profile(category + subcategory + addresses),legal_info(pan/gst/cin),brand(hex color without#),notes,contact_info(chargeback/refund/support/dispute),apps(websites/android/ios)Field validations sourced directly from
razorpay/partnershipsvalidator:phoneis a string (not number), validated viaIsPhoneNumberbusiness_typeenum matches the partnerships service constants exactlybrand.coloris 6-char hex WITHOUT#prefix (^[0-9a-fA-F]{6}$)contact_infohas 4 sub-fields: chargeback, refund, support, disputeprofile.addresses.registeredis required when profile is providedTest plan
create_accounttool appears in thepartnershipstoolsetphonesucceeds (only required field)business_typereturns API-level validation error from Razorpaybrand.colorwith#prefix returns error from Razorpay API🤖 Generated with Claude Code