#474 — [Bug]: rep can’t submit merchant with own fee template

Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned

Created: 2025-08-11 · Updated: 2025-09-15

Description

Steps to reproduce

  1. In staging open OpenAPI UI and login under any rep.
  2. Create fee config template via POST /api/v1/partner/fees/configs “Create Fee Template” API.
  3. Try to submit merchant (POST /api/v1/partner/merchants/{merchant_id}/submit) with this fee template

Expected behavior

Success

Actual behavior

404

{
  "detail": "Fee template not found for {user.id} user."
}

Implementation details:

See second check - creation of personal template doesn’t add it to partner fee_config_template_names field:

    if (
        # Check template exists.
        template is None
        # Check template is available for the partner.
        or template.name not in partner.fee_config_template_names
        # Check it is either system template or user is owner of a
        # template or user is owner of the whole partner.
        or (
            template.owner_id is not None
            and (
                template.owner_id != user.id
                or Role.PARTNER_OWNER in user.roles  # type: ignore
            )
        )
    ):
        raise HTTPException(
            status_code=404,
            detail=(f"Fee template not found for {user.id} user."),
        )

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets