mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-20 20:04:24 +00:00
- Add README.md with installation instructions, architecture overview, and API examples for all SDK modules - Refactor TelecomSDK main module to use modular API clients (SubscribersAPI, UsageAPI, PaymentAPI, RatingPlanAPI, SystemAPI, GraphQLAPI) - Add AuthProvider class with API key and JWT token support (generate_jwt_token, validate_jwt_token methods) - Add HTTPClient base
32 lines
943 B
Elixir
32 lines
943 B
Elixir
defmodule TelecomSDK.PaymentAPI do
|
|
@moduledoc """
|
|
API for payment management
|
|
"""
|
|
|
|
defstruct [:client]
|
|
|
|
def new(client) do
|
|
%__MODULE__{client: client}
|
|
end
|
|
|
|
def create_transaction(api, request) do
|
|
TelecomSDK.HTTPClient.post(api.client, "/v1/payments/transactions", request)
|
|
end
|
|
|
|
def get_transaction(api, transaction_id) do
|
|
TelecomSDK.HTTPClient.get(api.client, "/v1/payments/transactions/#{transaction_id}")
|
|
end
|
|
|
|
def list_transactions(api, opts \\ []) do
|
|
params = %{
|
|
page: Keyword.get(opts, :page, 1),
|
|
page_size: Keyword.get(opts, :page_size, 50)
|
|
}
|
|
|
|
params = if Keyword.get(opts, :subscriber_id), do: Map.put(params, :subscriber_id, Keyword.get(opts, :subscriber_id)), else: params
|
|
params = if Keyword.get(opts, :status), do: Map.put(params, :status, Keyword.get(opts, :status)), else: params
|
|
|
|
TelecomSDK.HTTPClient.get(api.client, "/v1/payments/transactions", params)
|
|
end
|
|
end
|