Files
telecom-platform/sdk/elixir/lib/telecom_sdk/currency_api.ex
T
nutcas3 9f51d6f20e feat: Add analytics, security, and currency SDK modules with comprehensive API endpoints across Elixir and Go SDKs
- Add AnalyticsAPI with churn prediction (predict, metrics, at-risk), market analytics (metrics, competitors, opportunities), predictive maintenance (metrics, assets, alerts, predict), and pricing optimization (metrics, optimize, elasticity) endpoints
- Add SecurityAPI with fraud detection (analyze, alerts, update status, metrics, patterns) and SIM swap protection (verify, history) endpoints
- Add CurrencyAPI with currency conversion (convert, exchange rates, rate
2026-05-03 13:29:44 +03:00

62 lines
2.0 KiB
Elixir

defmodule TelecomSDK.CurrencyAPI do
@moduledoc """
Currency and Billing API
"""
defstruct [:http_client]
def new(http_client) do
%__MODULE__{http_client: http_client}
end
# Currency Conversion
def convert(%__MODULE__{http_client: client}, from, to, amount) do
body = %{from: from, to: to, amount: amount}
HTTPClient.post(client, "/api/v1/currency/convert", body)
end
def get_exchange_rate(%__MODULE__{http_client: client}, from, to) do
HTTPClient.get(client, "/api/v1/currency/exchange/#{from}/#{to}", %{})
end
def get_exchange_rate_history(%__MODULE__{http_client: client}, from, to, days \\ 30) do
params = %{days: days}
HTTPClient.get(client, "/api/v1/currency/exchange/#{from}/#{to}/history", params)
end
def get_supported_currencies(%__MODULE__{http_client: client}) do
HTTPClient.get(client, "/api/v1/currency/currencies", %{})
end
def refresh_exchange_rates(%__MODULE__{http_client: client}) do
HTTPClient.post(client, "/api/v1/currency/exchange/refresh", %{})
end
# Billing
def process_billing(%__MODULE__{http_client: client}, billing_data) do
HTTPClient.post(client, "/api/v1/currency/billing", billing_data)
end
def get_billing_history(%__MODULE__{http_client: client}, profile_id, limit \\ 50) do
params = %{limit: limit}
HTTPClient.get(client, "/api/v1/currency/billing/history/#{profile_id}", params)
end
def get_billing_summary(%__MODULE__{http_client: client}, profile_id, period \\ "monthly") do
params = %{period: period}
HTTPClient.get(client, "/api/v1/currency/billing/summary/#{profile_id}", params)
end
def process_refund(%__MODULE__{http_client: client}, transaction_id, reason) do
body = %{reason: reason}
HTTPClient.post(client, "/api/v1/currency/billing/refund/#{transaction_id}", body)
end
def get_billing_analytics(%__MODULE__{http_client: client}, period \\ "monthly") do
params = %{period: period}
HTTPClient.get(client, "/api/v1/currency/billing/analytics", params)
end
end