#1099 — Create API to review and select processor for Master

Repo: Twill-AI/facade State: closed | Status: done Assignee: nadddder, sparsh-twillpayments

Created: 2026-03-05 · Updated: 2026-03-12

Description

Context

After a merchant’s application is submitted, it enters in_review status. Master needs an API to review the merchant’s pricing, select a processor, and trigger the underwriting flow — which updates status and sends a signing link to the merchant.

New field on DbMerchant

  • processor (enum): luqra, ems, priority
  • docuseal_submission_id (text, nullable) — needed by #1102 to look up the merchant from the Docuseal webhook payload

Endpoint

PATCH /master/merchants/{merchant_id}/processor

Request body:

{ "processor": "luqra" | "ems" | "priority" }

Behavior:

  1. Validate merchant is in in_review status
  2. Set processor on merchant record
  3. Generate a Docuseal signing link via Docuseal API (pre-populate template with merchant + fee data)
  4. Store signing_url and docuseal_submission_id on merchant
  5. Update merchant status → SENT_FOR_SIGNATURE
  6. Send email to merchant with login link, inviting to sign (whitelabeled)
  7. Log activity: “Processor selected: {processor}. Sent for Signature.”

AC

  • processor and docuseal_submission_id fields added to DbMerchant
  • PATCH endpoint validates status, sets processor, generates Docuseal link, updates status, sends email
  • signing_url and docuseal_submission_id stored on merchant
  • Activity logged on status change
  • Unit tests for status transition and Docuseal link generation

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets