Current section
Files
Jump to
Current section
Files
lib/merchant/payments.ex
defmodule Merchant.Payments do
@moduledoc """
Module for payments.
"""
alias Merchant.Client
alias Merchant.PaymentV2
@doc """
Retrieve a `Merchant.Payment` object.
"""
@spec retrieve(String.t()) :: {:ok, PaymentV2.t()} | Client.error()
def retrieve(id) do
with {:ok, data} <- Client.req(:get, "/api/payments/#{id}") do
{:ok, Mappable.to_struct(data, PaymentV2)}
end
end
end