Cielo.HTTP (Cielo v0.1.8) View Source
HTTP Wrapper Module for all API's interaction,
Link to this section Summary
Functions
Wrapp a hackey call with GET verb passing only path to function
Wrapp a hackey call with POST verb passing path and payload to function
Wrapp a hackey call with POST verb passing path, payload and a configuration list
Wrapp a hackey call with PUT verb passing path and payload to function
Wrapp a hackey call with PUT verb passing path, payload and a configuration list
Link to this section Types
Specs
Link to this section Functions
Wrapp a hackey call with GET verb passing only path to function
Example
iex> Cielo.HTTP.get("/1/cardBin/538965")
{:ok, %{
card_type: "Débito",
corporate_card: false,
foreign_card: true,
issuer: "Bradesco",
issuer_code: "237",
provider: "MASTERCARD",
status: "00"
}}
iex> Cielo.HTTP.get("/1/cardBin/000000")
{:error, :not_found}
Wrapp a hackey call with POST verb passing path and payload to function
Example
iex> Cielo.HTTP.post("/1/sales", %{merchant_order_id: order_key})
{:ok, %{
merchant_order_id: order_key,
...
}}
Wrapp a hackey call with POST verb passing path, payload and a configuration list
Example
iex> Cielo.HTTP.post("/1/sales", %{merchant_order_id: order_key}, sandbox: true)
{:ok, %{
merchant_order_id: order_key,
...
}}
Valid options
sandbox
: Redirect calls to sandbox API
Wrapp a hackey call with PUT verb passing path and payload to function
Example
iex> Cielo.HTTP.put("/1/sales", %{merchant_order_id: order_key})
{:ok, %{
merchant_order_id: order_key,
...
}}
Wrapp a hackey call with PUT verb passing path, payload and a configuration list
Example
iex> Cielo.HTTP.put("/1/sales", %{merchant_order_id: order_key}, sandbox: true)
{:ok, %{
merchant_order_id: order_key,
...
}}
Valid options
sandbox
: Redirect calls to sandbox API