Skip to main content

mix.exs

defmodule Rapyd.MixProject do
  use Mix.Project

  @version "1.0.0"
  @source_url "https://github.com/iamkanishka/rapyd"

  def project do
    [
      app: :rapyd,
      version: @version,
      elixir: "~> 1.18",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      description: description(),
      package: package(),
      docs: docs(),
      aliases: aliases(),
      test_coverage: [tool: ExCoveralls],
      preferred_cli_env: [
        coveralls: :test,
        "coveralls.detail": :test,
        "coveralls.post": :test,
        "coveralls.html": :test
      ],
      dialyzer: [
        plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
        plt_add_apps: [:mix]
      ]
    ]
  end

  def application do
    [
      extra_applications: [:logger, :crypto],
      mod: {Rapyd.Application, []}
    ]
  end

  defp deps do
    [
      # HTTP client
      {:req, "~> 0.5"},

      # JSON — use Jason for best-in-class performance
      {:jason, "~> 1.4"},

      # Dev / test only
      {:ex_doc, "~> 0.40", only: :dev, runtime: false},
      {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
      {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
      {:excoveralls, "~> 0.18", only: :test},
      {:bypass, "~> 2.1", only: :test},
      {:mox, "~> 1.1", only: :test}
    ]
  end

  defp description do
    """
    Production-grade Elixir SDK for the Rapyd fintech-as-a-service platform.
    Covers Collect, Disburse, Wallet, Issuing, Partner, Webhook, and Resource APIs
    with HMAC-SHA256 auth, full-jitter retry, structured errors, and typed responses.
    """
  end

  defp package do
    [
      name: "rapyd",
      licenses: ["MIT"],
      links: %{
        "GitHub" => @source_url,
        "Rapyd Docs" => "https://docs.rapyd.net"
      },
      maintainers: ["Kanishka"],
      files: ~w(lib .formatter.exs mix.exs README.md LICENSE CHANGELOG.md)
    ]
  end

  defp docs do
    [
      main: "readme",
      source_url: @source_url,
      source_ref: "v#{@version}",
      extras: ["README.md", "CHANGELOG.md", "LICENSE"],
      groups_for_modules: [
        "Entry Point": [Rapyd, Rapyd.Client],
        Services: [
          Rapyd.Services.Collect,
          Rapyd.Services.Disburse,
          Rapyd.Services.Wallet,
          Rapyd.Services.Issuing,
          Rapyd.Services.Partner,
          Rapyd.Services.Webhook,
          Rapyd.Services.Resource
        ],
        "Types — Payments": [
          Rapyd.Types.Payment,
          Rapyd.Types.Checkout,
          Rapyd.Types.PaymentLink,
          Rapyd.Types.GroupPayment,
          Rapyd.Types.Refund,
          Rapyd.Types.Dispute
        ],
        "Types — Disburse": [
          Rapyd.Types.Payout,
          Rapyd.Types.Beneficiary,
          Rapyd.Types.Sender
        ],
        "Types — Wallet": [
          Rapyd.Types.Wallet,
          Rapyd.Types.Contact,
          Rapyd.Types.VirtualAccount,
          Rapyd.Types.WalletTransaction,
          Rapyd.Types.Transfer,
          Rapyd.Types.Identity
        ],
        "Types — Issuing": [
          Rapyd.Types.IssuedCard,
          Rapyd.Types.CardToken
        ],
        "Types — Partner": [
          Rapyd.Types.Organization,
          Rapyd.Types.Application,
          Rapyd.Types.SettlementBankAccount
        ],
        "Types — Webhooks": [
          Rapyd.Types.WebhookEvent
        ],
        "Types — Shared": [
          Rapyd.Types.Address,
          Rapyd.Types.FXRate,
          Rapyd.Types.Customer
        ],
        Infrastructure: [
          Rapyd.HTTP.Client,
          Rapyd.Signing
        ],
        Errors: [Rapyd.Error]
      ]
    ]
  end

  defp aliases do
    [
      lint: ["format --check-formatted", "credo --strict"],
      "test.all": ["test --cover"]
    ]
  end
end