Crosswake.Commerce behaviour (crosswake v0.1.0)

View Source

Thin behaviour/orchestration seam for Phoenix-owned commerce intent and snapshot hooks.

Summary

Callbacks

Fetch the current entitlement snapshot for a given group.

Ingest evidence from device callbacks or webhooks.

Submit a purchase intent initiated by the Phoenix user.

Submit a restore intent initiated by the Phoenix user.

Callbacks

fetch_entitlement_snapshot(t)

@callback fetch_entitlement_snapshot(String.t()) ::
  {:ok, Crosswake.Commerce.Contracts.EntitlementSnapshot.t()} | {:error, term()}

Fetch the current entitlement snapshot for a given group.

ingest_reconciliation_evidence(t)

@callback ingest_reconciliation_evidence(
  Crosswake.Commerce.Contracts.ReconciliationEvidence.t()
) ::
  {:ok, Crosswake.Commerce.Reconciliation.EvidenceResult.t()} | {:error, term()}

Ingest evidence from device callbacks or webhooks.

submit_purchase_intent(t)

@callback submit_purchase_intent(Crosswake.Commerce.Contracts.PurchaseIntent.t()) ::
  :ok | {:error, term()}

Submit a purchase intent initiated by the Phoenix user.

submit_restore_intent(t)

@callback submit_restore_intent(Crosswake.Commerce.Contracts.RestoreIntent.t()) ::
  :ok | {:error, term()}

Submit a restore intent initiated by the Phoenix user.