Skip to content

feat: implement Merchant Registry on signup#180

Merged
Pvsaint merged 1 commit intoMetroLogic:mainfrom
Olowodarey:merchant
Feb 25, 2026
Merged

feat: implement Merchant Registry on signup#180
Pvsaint merged 1 commit intoMetroLogic:mainfrom
Olowodarey:merchant

Conversation

@Olowodarey
Copy link
Contributor

This PR addresses the requirement to ensure the merchant registration flow follows the correct order and handles on-chain registration failures appropriately, matching the Phase 1 specifications.

Changes Made

  • Database Schema Updates (schema.prisma):
    • Added a new ManualIntervention model to track issues requiring human review.
    • Added a one-to-many relationship between Merchant and ManualIntervention.
    • Added enums InterventionIssueType and InterventionStatus.
  • Merchant Registry Service Updates (merchantRegistry.service.ts):
    • Updated the register_merchant method to throw an error if the maximum number of retries (3) is exceeded.
    • Implemented logToManualInterventionQueue to persist a record in the ManualIntervention table upon failure.
    • Imported PrismaClient to interact with the database.
  • Merchant Service Updates (merchant.service.ts):
    • Modified signupMerchantService to explicitly await the execution of merchantRegistryService.register_merchant(merchant.id, business_name, settlement_currency).
    • This ensures the correct order of operations: DB Create -> Synchronous On-Chain Registration -> OTP Email.
    • Added a try-catch block around the registry call. If on-chain registration fails (which will also log it to the manual intervention table), the flow continues to send the OTP email, rather than halting the database creation or OTP verification. (This prevents merchants from being stuck in a limbo state without an OTP if the chain is temporarily down).

Technical Requirements Met

  • Ensure on-chain registration runs after DB create but before welcome email (current order: DB -> registry async -> OTP email).
  • On registry failure after max retries: persist to manual_intervention table.

closes #146

@Pvsaint Pvsaint merged commit 34deaa7 into MetroLogic:main Feb 25, 2026
1 check 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.

[Backend] Phase 1: Merchant Registry on signup (order and failure handling)

2 participants