Skip to content

feat: trigger fraud evaluation on billing payment-method attach#44

Closed
mattdjenkinson wants to merge 2 commits into
feat/maxmind-tracking-tokenfrom
feat/billing-payment-method-fraud-trigger
Closed

feat: trigger fraud evaluation on billing payment-method attach#44
mattdjenkinson wants to merge 2 commits into
feat/maxmind-tracking-tokenfrom
feat/billing-payment-method-fraud-trigger

Conversation

@mattdjenkinson

Copy link
Copy Markdown
Contributor

Summary

  • New BillingPaymentMethodAttached trigger event + reconciler so fraud evaluation fires once a card has been attached at signup, not on raw User creation.
  • provider.Input.CreditCard fields (BIN, last4, country, AVS, CVC) sourced from BillingAccount.status.paymentMethod and forwarded to MaxMind as credit_card on /factors.
  • After PlatformAccessApproval creation, mirror approval onto any BillingAccount owned by the user so billing's phase controller can flip to Ready.

Base + replace caveat

  • Based on feat/maxmind-tracking-token. Rebase / change-base once that lands.
  • go.mod uses a local replace for go.miloapis.com/billing until that module is published — drop the replace before merge.

Pairs with

  • milo-os/billing: feat/stripe-payment-provider
  • datum-cloud/cloud-portal: feat/billing-setup-flow

Adds a BillingPaymentMethodAttached trigger event so fraud evaluation
fires once a card has been attached at signup, not on raw User
creation. Extends the provider input with card metadata (BIN, last4,
country, AVS, CVC) sourced from BillingAccount.status.paymentMethod
and forwards it to MaxMind as the credit_card sub-object on /factors.

Key changes:
- BillingPaymentMethodAttachedTriggerReconciler watches BillingAccount
  and creates FraudEvaluations when an active FraudPolicy has the new
  trigger event
- provider.CreditCard + resolver.resolvePaymentMethod() look up the
  user's BillingAccount via the iam.miloapis.com/owner-user label
- MaxMind buildRequest emits credit_card with issuer.iin, last_digits,
  country, avs_result, cvv_result
- After PlatformAccessApproval creation, mirror approval onto owned
  BillingAccounts so billing's phase controller can flip to Ready

Note: go.mod uses a local replace for go.miloapis.com/billing while
the module is unpublished. Drop the replace before merge.
The local-path replace directive blocked CI's go build. Point at a
pinned commit on github.com/milo-os/billing so the module is
resolvable on Linux runners. Update once go.miloapis.com/billing
publishes a tagged release.
@mattdjenkinson

Copy link
Copy Markdown
Contributor Author

Closing — depends on billing CRD shape that needs to be redone per milo-os/billing#33 (generic PaymentMethod with normalized status; Stripe-specific state in a separate stripe-provider repo). Will reopen once the upstream PaymentMethod schema lands, reading PaymentMethod.status.details rather than BillingAccount.status.paymentMethod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant