Module: Arafa::Schemas

Defined in:
lib/arafa/schemas/ussd_callback_schema.rb,
lib/arafa/schemas/airtime_request_schema.rb,
lib/arafa/schemas/delivery_report_schema.rb

Defined Under Namespace

Modules: Types

Constant Summary collapse

UssdCallbackSchema =

Shared shape for inbound USSD webhook params, after each provider's Ussd::<Provider>.parse remaps its own callback keys onto this canonical set (session_id, phone_number, service_code, text).

Dry::Schema.Params do
  required(:session_id).filled(:string)
  required(:phone_number).filled(:string)
  required(:service_code).filled(:string)
  required(:text).maybe(:string)
end
AirtimeRequestSchema =

Wasiliana airtime request params.

Dry::Schema.JSON do
  required(:phone_number).value(Schemas::Types::PhoneNumberList)
  required(:currency_code).filled(:string)
  required(:amount).filled(:string)
  required(:callback).filled(:string)
  optional(:airtime_uid).filled(:string)
end
DeliveryReportSchema =

Wasiliana delivery-report callback body, e.g.: ["25472xxxxxxx"], "correlator": "message_...", "deliveryStatus": "0"

Dry::Schema.JSON do
  required(:phone).array(:string)
  required(:correlator).filled(:string)
  required(:deliveryStatus).filled(:string)
end