Skip to content

DEV-3378 Configure a fraud policy by transaction, position, attempts and initiator - #269

Merged
TomK merged 24 commits into
masterfrom
DEV-3378
Oct 16, 2026
Merged

TomK merged 24 commits into
masterfrom
DEV-3378

Conversation

@TomK

@TomK TomK commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

A fraud policy could only run before an auth, after a successful auth, or on demand, and treated customer- and merchant-initiated payments the same. Renewals, mostly collected by a capture with no auth, never reached a fraud provider, and whether Kount was paid for a decision was set on the connector rather than per policy.

  • transactionType (auth, capture-auth, capture, on-demand) and position (pre, post, post-success, post-decline): the policy runs at that step. An on-demand policy runs when a scan is requested through the API, and has no position, attempts or declineOn.
  • attempts (first, every): the charge's first attempt at the step, or every one; defaults to every.
  • cit / mit (scan, inform, none): a scan asks the connectors for a result, an inform sends the payment for their records without one, and none leaves it out; both default to none.
  • Existing checkTime policies: unchanged, each value running as its trigger and scanning both initiators. checkTime can't be combined with the new fields.

Test plan: TestFraudPolicyCheckTimes validates through utils.Validate: full and on-demand triggers and every checkTime are accepted; checkTime with the new fields, a transaction without a position, on-demand with a position, attempts or declineOn, a policy that does nothing for either initiator, and unknown values are rejected. TestFraudPolicyTrigger, TestFraudTriggerRuns, TestFraudTriggerRunsOnDemand and TestFraudTriggerMode cover the checkTime mapping, defaults and matching. Assemble's DEV-3378 work builds and passes its tests against this branch, and chive validate built against it accepts a pre-auth customer scan policy and a post-capture inform policy.

🤖 Generated with Claude Code

TomK and others added 3 commits October 14, 2026 19:15
…er captures

A fraud policy takes checkTimes, a list, in place of the single checkTime, which still works on
its own. New times run a policy after a declined auth, and after a successful or declined capture
(a sale or the capture of an earlier auth). preauth-first and preauth-every cannot be listed
together, and ondemand stands alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A policy runs before the auth or after the payment, not both, so a payment is never decided on
twice by the same policy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In place of a list of check times, a policy sets when it checks a customer-initiated payment and
when it checks a merchant-initiated one, each a single time, so a payment is decided on one side
of the auth. postauth runs after an auth's outcome, while an approved auth can still be voided,
and postcapture after a capture's. A merchant-initiated payment has no pre-auth time, having no
customer present. checkTime still sets one time for every payment, with auth-success run as
postauth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK TomK changed the title DEV-3378 Let a fraud policy run at several check times, including after captures DEV-3378 Set a fraud policy's check time per initiator, including after the auth and the capture Oct 14, 2026
TomK and others added 2 commits October 14, 2026 19:59
…ated payments

In place of per-initiator check times, checkTime stays the one time a policy runs at, now with
postauth and postcapture, and merchantCheck runs a merchant-initiated payment's check after its
outcome instead. Without merchantCheck a policy behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK TomK changed the title DEV-3378 Set a fraud policy's check time per initiator, including after the auth and the capture DEV-3378 Add postauth and postcapture check times, and merchantCheck Oct 14, 2026
TomK and others added 3 commits October 14, 2026 21:29
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK TomK changed the title DEV-3378 Add postauth and postcapture check times, and merchantCheck DEV-3378 Add postauth and postcapture check times, and sendMIT Oct 14, 2026
TomK and others added 2 commits October 15, 2026 14:05
A record-only policy keeps its connectors informed of each payment without asking for a result
to act on, so it cannot set declineOn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
declineOn is ignored while recordOnly is set rather than rejected, so a policy can be made
record-only and reverted without losing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK TomK changed the title DEV-3378 Add postauth and postcapture check times, and sendMIT DEV-3378 Add postauth and postcapture check times, sendMIT and recordOnly Oct 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK TomK changed the title DEV-3378 Add postauth and postcapture check times, sendMIT and recordOnly DEV-3378 Add postauth and postcapture check times, recordMIT and recordOnly Oct 15, 2026
TomK and others added 8 commits October 15, 2026 14:52
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng them sales

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Corrected definitions for 'postauth' and 'postcapture' in the fraud policy documentation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecordOnly before recordMIT

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread docs/policy/fraud.md Resolved
TomK and others added 2 commits October 15, 2026 18:03
…and initiator

A fraud policy now sets the payment step it runs at (auth, capture-auth or capture), its position
(pre, post, post-success, post-decline, or ondemand), which attempts it runs on (first or every),
and what it does with customer- and merchant-initiated payments (scan, inform or none). This
replaces the check times, recordOnly and recordMIT added on this branch. checkTime still works
for existing policies, each value running as the trigger it stands for and scanning both
initiators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK TomK changed the title DEV-3378 Add postauth and postcapture check times, recordMIT and recordOnly DEV-3378 Configure a fraud policy by transaction, position, attempts and initiator Oct 15, 2026
The on-demand position is spelt on-demand; checkTime keeps ondemand. The docs and comments now say
what each field does as the code does it, with one term, transaction, for the step a policy runs
at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bajb
bajb previously approved these changes Oct 15, 2026
An on-demand scan is requested outside any payment, so it is set as transactionType on-demand,
with no position or attempts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An on-demand scan has no transaction to decline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK
TomK merged commit df9b2a4 into master Oct 16, 2026
1 check passed
@TomK
TomK deleted the DEV-3378 branch October 16, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants