Contract that every HTTP client implementation must satisfy.
In production, Rapyd.HTTP.Client fulfills this contract. In tests,
a Mox mock can be injected via the http_client: option on
Rapyd.new/1:
Mox.defmock(MockHTTP, for: Rapyd.HTTP.Behaviour)
client = Rapyd.new!(
access_key: "key",
secret_key: "secret",
http_client: MockHTTP
)
Summary
Callbacks
Execute a signed HTTP request against the Rapyd API.
Callbacks
@callback request( client :: Rapyd.Client.t(), method :: :get | :post | :put | :patch | :delete, path :: String.t(), body :: map() | list() | nil, opts :: keyword() ) :: {:ok, term()} | {:error, Rapyd.Error.t()}
Execute a signed HTTP request against the Rapyd API.
client—%Rapyd.Client{}carrying credentials and configmethod—:get | :post | :put | :patch | :deletepath— API path starting with/, e.g."/v1/payments"body— JSON-serialisable map / list, ornilfor bodyless requestsopts— reserved for future use; pass[]
Returns {:ok, data} where data is the decoded "data" field from the
Rapyd envelope, or {:error, %Rapyd.Error{}}.