Chargebeex.EntitlementOverride (chargebeex v0.6.0)

View Source

Struct that represent a Chargebee's API entitlement override resource.

Summary

Types

A single entitlement override map.

"subscription"

t()

Parameters for the upsert_or_remove function. The action field must be either upsert or remove.

Functions

Upserts or removes a set of entitlement_overrides for a subscription depending on the action specified

Types

entitlement_override()

@type entitlement_override() :: %{
  :feature_id => String.t(),
  optional(:value) => String.t(),
  optional(:expires_at) => non_neg_integer(),
  optional(:effective_from) => non_neg_integer()
}

A single entitlement override map.

entity_type()

@type entity_type() :: String.t()

"subscription"

t()

@type t() :: %Chargebeex.EntitlementOverride{
  entity_id: String.t() | nil,
  entity_type: entity_type() | nil,
  feature_id: String.t() | nil,
  feature_name: String.t() | nil,
  id: String.t() | nil,
  name: String.t() | nil,
  object: String.t() | nil,
  value: String.t() | nil
}

upsert_or_remove_params()

@type upsert_or_remove_params() :: %{
  :action => :upsert | :remove,
  optional(:entitlement_overrides) => [entitlement_override()],
  optional(any()) => any()
}

Parameters for the upsert_or_remove function. The action field must be either upsert or remove.

Functions

build(map_or_kwlist, opts \\ [])

@spec build(ExConstructor.map_or_kwlist(), Keyword.t()) ::
  %Chargebeex.EntitlementOverride{
    entity_id: term(),
    entity_type: term(),
    feature_id: term(),
    feature_name: term(),
    id: term(),
    name: term(),
    object: term(),
    value: term()
  }

upsert_or_remove(subscription_id, params, opts \\ [])

@spec upsert_or_remove(String.t(), upsert_or_remove_params(), keyword()) :: any()

Upserts or removes a set of entitlement_overrides for a subscription depending on the action specified

More info: https://apidocs.eu.chargebee.com/docs/api/entitlement_overrides?lang=curl#upsert/remove_entitlement_overrides_for_a_subscription

Examples

iex(1)> subscription_id = "BTLybZUInBGCXDMY" "BTLybZUInBGCXDMY" iex(2)> params = %{ ...(2)> "action" => :upsert, ...(2)> "entitlement_overrides" => [ ...(2)> %{ ...(2)> "feature_id" => "foo", ...(2)> "value" => "false" ...(2)> } ...(2)> ] ...(2)> } %{

"action" => :upsert,
"entitlement_overrides" => [
  %{"feature_id" => "foo", "value" => "false"}
]

} iex(3)> Chargebeex.EntitlementOverride.upsert_or_remove(subscription_id, params) {:ok, [

 %Chargebeex.EntitlementOverride{...}

], %{"next_offset" => nil}}