AtEx v0.20.21 AtEx.Gateway.Airtime View Source

This module holds the implementation for the HTTP Gateway that runs calls against the Africas Talking API Application Data endpoint, use it to POST and GET requests to the Application endpoint

Link to this section Summary

Functions

Process results from calling the gateway

Sends airtime to one or more numbers, accepts a map of parameters contaitning a list of maps each containing a phone numbers and an amount of airtime to send out to a number this is expected in the recipients key.

Link to this section Types

Link to this type

call_return()

View Source
call_return() :: {:ok, term()} | {:error, term()}
Link to this type

option()

View Source
option() ::
  {:method, Tesla.Env.method()}
  | {:url, Tesla.Env.url()}
  | {:query, Tesla.Env.query()}
  | {:headers, Tesla.Env.headers()}
  | {:body, Tesla.Env.body()}
  | {:opts, Tesla.Env.opts()}
Link to this type

send_input()

View Source
send_input() :: %{recipients: [map()]}

Link to this section Functions

Process results from calling the gateway

Link to this function

send_airtime(attrs)

View Source
send_airtime(send_input()) :: call_return()

Sends airtime to one or more numbers, accepts a map of parameters contaitning a list of maps each containing a phone numbers and an amount of airtime to send out to a number this is expected in the recipients key.

Parameters

  • map: map containing a recipients which is a list of maps each with a phone number and amount

Examples

AtEx.Gateway.Airtime.send_airtime(%{recipients: [%{phone_number: "+254721978097", amount: "KES 50"}]})