pub(crate) async fn apply_outcome(
conn: &mut PgConnection,
registration: &CreditRegistration,
outcome: &Outcome,
event: OutcomeEvent<'_>,
expected_from_state: Option<CreditRegistrationState>,
) -> Result<()>Expand description
Applies one decided outcome to one row, with the exchange that produced it.
expected_from_state guards against writing back a decision made from a row snapshot that an
await (an external call, or just the gap since claiming) has let go stale: pass the state the
phase itself put the row in before that await, or Some(registration.state) when the phase
never moved the row before its own await.