Refund

A merchant refunds a customer on an open support case. The program has two modules and a system file.

What the interface says

Read support/refund.brass without its body:

Read payments/core.brass: refund takes the case and pays its customer. A body cannot choose the customer.

What breaks if it changes.

Which promises are checked, and where?

issue's four entry conditions depend on who calls it:

refund's before amount > 0 follows from issue's entry condition and carries that fact's tier.

Proven

Enforced

Assumed

The optional impact_modules policy reports changes that exceed the configured scope. It is separate from the promise tiers and does not reject a program. Its count is provisional (spec §10.1).

The wrong edit, rejected

A model widens issue "to handle every case":

# support/refund.brass — wrong edit
  fn issue(pay: StripePay, who: Merchant, case: payments.CaseRecord, amount: payments.Money) -> Outcome<payments.Receipt>

The body's pay.refund(case, amount) no longer fits refund's declaration:

fault argument type: expected payments.OpenCase, found payments.CaseRecord
  at support/refund.brass: fn issue, pay.refund(case, amount)
  fix: test case is payments.OpenCase first, or keep the parameter as payments.OpenCase

The wrong body that checks clean

This body satisfies every clause and refunds twice:

# support/refund.brass — passes every clause; refunds twice
body
  fn issue(pay, who, case, amount) =
    let first: payments.Receipt  = pay.refund(case, amount)?
    let second: payments.Receipt = pay.refund(case, amount)?
    let chosen: payments.Receipt = if first.amount == second.amount then first else second
    Ok(chosen)

before states conditions on inputs; after states conditions on successful results. Neither counts calls. Pay has only a per-transaction ceiling. A total would need a budget_<unit> bound and the host metering described in spec §8.2.

This grant permits both calls. A reviewer or test must inspect the body to find the duplicate refund.

What these declarations leave open

For state transitions with enters, see paddock and feeding.