Nombaone.Mandates (Nomba One v0.1.0)

View Source

Direct-debit mandates (NIBSS). Creation is asynchronous: the mandate starts consent_pending and activates only after the customer authorizes it with their bank — the engine fires payment_method.attached / payment_method.updated. Don't poll; listen for the webhook, and don't charge before it's active (MANDATE_NOT_ACTIVE / MANDATE_CONSENT_PENDING).

Summary

Functions

Create a mandate. This provisions money-moving consent, so the SDK sends an Idempotency-Key automatically.

Check a mandate's current standing. Returns the underlying payment method (its status moves consent_pendingactive) — not a mandate object.

Functions

create(client, params, opts \\ [])

@spec create(Nombaone.Client.t(), map(), keyword()) ::
  {:ok, Nombaone.MandateSetup.t()} | {:error, Nombaone.Error.t()}

Create a mandate. This provisions money-moving consent, so the SDK sends an Idempotency-Key automatically.

Money is integer kobo

max_amount_in_kobo (the hard per-debit ceiling) is integer kobo.

Example

{:ok, mandate} =
  Nombaone.Mandates.create(client, %{
    customer_ref: customer.id,
    customer_account_number: "0123456789",
    bank_code: "058",
    customer_name: "Ada Lovelace",
    customer_account_name: "Ada Lovelace",
    customer_phone_number: "+2348012345678",
    customer_address: "1 Marina, Lagos",
    narration: "Acme Pro subscription",
    max_amount_in_kobo: 500_000
  })

# Relay mandate.consent_instruction to the customer, then wait for the webhook.

create!(client, params, opts \\ [])

Raising variant of create/3.

retrieve(client, id, opts \\ [])

@spec retrieve(Nombaone.Client.t(), String.t(), keyword()) ::
  {:ok, Nombaone.PaymentMethod.t()} | {:error, Nombaone.Error.t()}

Check a mandate's current standing. Returns the underlying payment method (its status moves consent_pendingactive) — not a mandate object.

retrieve!(client, id, opts \\ [])

Raising variant of retrieve/3.