Class: Nombaone::Resources::Mandates
- Inherits:
-
BaseResource
- Object
- BaseResource
- Nombaone::Resources::Mandates
- Defined in:
- lib/nombaone/resources/mandates.rb,
sig/nombaone/resources.rbs
Overview
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 sweeps for activation and fires
payment_method.attached / payment_method.updated. Don't poll in a tight
loop; listen for the webhook, and don't charge before it's active
(MANDATE_NOT_ACTIVE / MANDATE_CONSENT_PENDING).
Instance Method Summary collapse
-
#create(customer_ref:, customer_account_number:, bank_code:, customer_name:, customer_account_name:, customer_phone_number:, customer_address:, narration:, max_amount_in_kobo:, frequency: OMIT, start_date: OMIT, end_date: OMIT, request_options: {}) ⇒ NombaObject
Create a mandate.
-
#retrieve(id, request_options: {}) ⇒ NombaObject
Check a mandate's current standing.
Methods inherited from BaseResource
#encode, #initialize, #request, #request_page
Constructor Details
This class inherits a constructor from Nombaone::Resources::BaseResource
Instance Method Details
#create(customer_ref:, customer_account_number:, bank_code:, customer_name:, customer_account_name:, customer_phone_number:, customer_address:, narration:, max_amount_in_kobo:, frequency: OMIT, start_date: OMIT, end_date: OMIT, request_options: {}) ⇒ NombaObject
Create a mandate. Requires an Idempotency-Key (sent automatically).
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/nombaone/resources/mandates.rb', line 38 def create(customer_ref:, customer_account_number:, bank_code:, customer_name:, customer_account_name:, customer_phone_number:, customer_address:, narration:, max_amount_in_kobo:, frequency: OMIT, start_date: OMIT, end_date: OMIT, request_options: {}) request(:post, "/mandates", body: { customer_ref: customer_ref, customer_account_number: customer_account_number, bank_code: bank_code, customer_name: customer_name, customer_account_name: customer_account_name, customer_phone_number: customer_phone_number, customer_address: customer_address, narration: narration, max_amount_in_kobo: max_amount_in_kobo, frequency: frequency, start_date: start_date, end_date: end_date, }, options: ) end |
#retrieve(id, request_options: {}) ⇒ NombaObject
Check a mandate's current standing. Returns the underlying
payment-method row (its status moves consent_pending → active).
66 67 68 |
# File 'lib/nombaone/resources/mandates.rb', line 66 def retrieve(id, request_options: {}) request(:get, "/mandates/#{encode(id)}", options: ) end |