Chargebeex.Customer (chargebeex v0.6.0)
View SourceSummary
Functions
Callback implementation for Chargebeex.Resource.build/1
.
Allows to create a Customer
Callback implementation for Chargebeex.Resource.create/2
.
Deletes a Customer
Allows to list Customers
Callback implementation for Chargebeex.Resource.list/2
.
Allows to retrieve a Customer
Callback implementation for Chargebeex.Resource.retrieve/2
.
Allows to update a Customer
Callback implementation for Chargebeex.Resource.update/3
.
Types
@type t() :: %Chargebeex.Customer{ allow_direct_debit: boolean() | nil, auto_collection: String.t() | nil, backup_payment_source_id: String.t() | nil, billing_address: map() | nil, business_customer_without_vat_number: boolean() | nil, card_status: String.t() | nil, channel: String.t() | nil, company: String.t() | nil, created_at: integer() | nil, custom_fields: map(), deleted: boolean() | nil, email: String.t() | nil, excess_payments: integer() | nil, first_name: String.t() | nil, id: String.t() | nil, last_name: String.t() | nil, locale: String.t() | nil, net_term_days: integer() | nil, object: String.t() | nil, pii_cleared: String.t() | nil, preferred_currency_code: String.t() | nil, primary_payment_source_id: String.t() | nil, promotional_credits: integer() | nil, refundable_credits: integer() | nil, relationship: map() | nil, resource_version: integer() | nil, resources: map(), taxability: String.t() | nil, unbilled_charges: integer() | nil, updated_at: integer() | nil, vat_number: String.t() | nil, vat_number_status: String.t() | nil, vat_number_validated_time: integer() | nil }
Functions
Callback implementation for Chargebeex.Resource.build/1
.
@spec build(ExConstructor.map_or_kwlist(), Keyword.t()) :: %Chargebeex.Customer{ allow_direct_debit: term(), auto_collection: term(), backup_payment_source_id: term(), billing_address: term(), business_customer_without_vat_number: term(), card_status: term(), channel: term(), company: term(), created_at: term(), custom_fields: term(), deleted: term(), email: term(), excess_payments: term(), first_name: term(), id: term(), last_name: term(), locale: term(), net_term_days: term(), object: term(), pii_cleared: term(), preferred_currency_code: term(), primary_payment_source_id: term(), promotional_credits: term(), refundable_credits: term(), relationship: term(), resource_version: term(), resources: term(), taxability: term(), unbilled_charges: term(), updated_at: term(), vat_number: term(), vat_number_status: term(), vat_number_validated_time: term() }
Allows to create a Customer
Examples
iex> Chargebeex.Customer.create(%{company: "MyCompany"})
{:ok, %Chargebeex.Customer{
allow_direct_debit: false,
auto_collection: "on",
business_customer_without_vat_number: false,
card_status: "no_card",
channel: "web",
company: "MyCompany",
created_at: 1648489755,
custom_fields: %{
"cf_internal_identifier" => "1234",
"cf_other_custom_field" => "foobar"
},
deleted: false,
email: nil,
excess_payments: 0,
id: "169ljDT1Op0yuxET",
locale: nil,
net_term_days: 0,
object: "customer",
pii_cleared: "active",
preferred_currency_code: "EUR",
promotional_credits: 0,
refundable_credits: 0,
resource_version: 1648489755361,
resources: %{},
taxability: "taxable",
unbilled_charges: 0,
updated_at: 1648489755
}}
Callback implementation for Chargebeex.Resource.create/2
.
Deletes a Customer
Examples
iex> Chargebeex.Customer.delete("169ljDT1Op0yuxET")
{:ok, %Chargebeex.Customer{
allow_direct_debit: false,
auto_collection: "on",
business_customer_without_vat_number: false,
card_status: "no_card",
channel: "web",
company: "MyUpdatedCompany",
created_at: 1648489755,
custom_fields: %{
"cf_internal_identifier" => "1234",
"cf_other_custom_field" => "foobar"
},
deleted: false,
email: nil,
excess_payments: 0,
id: "169ljDT1Op0yuxET",
locale: nil,
net_term_days: 0,
object: "customer",
pii_cleared: "active",
preferred_currency_code: "EUR",
promotional_credits: 0,
refundable_credits: 0,
resource_version: 1648489755361,
resources: %{
"card" => %Chargebeex.Card{
billing_addr1: "my_address",
billing_addr2: nil,
billing_city: "Paris",
billing_country: "FR",
billing_state: nil,
billing_state_code: nil,
billing_zip: "12345",
card_type: "visa",
created_at: 1648490053,
customer_id: "169ljDT1Op0yuxET",
expiry_month: 12,
expiry_year: 2023,
first_name: "John",
funding_type: "credit",
gateway: "chargebee",
gateway_account_id: "gw_AzqPCGS1aaz5K3b",
iin: "411111",
ip_address: nil,
issuing_country: nil,
last4: "1111",
last_name: "M",
masked_number: "************1111",
object: "card",
payment_source_id: "pm_AzqYbtT1OqGcr5B1",
powered_by: nil,
ref_tx_id: nil,
resource_version: 1648490053804,
status: "valid",
updated_at: 1648490053
}
},
taxability: "taxable",
unbilled_charges: 0,
updated_at: 1648489755
}}
Allows to list Customers
Available filters can be found here: https://apidocs.chargebee.com/docs/api/customers#list_customers
Examples
iex> filters = %{limit: 2}
iex(2)> Chargebeex.Customer.list(filters)
{:ok, [%Chargebeex.Customer{...}, %Chargebeex.Customer{...}], %{"next_offset" => nil}}
Callback implementation for Chargebeex.Resource.list/2
.
Allows to retrieve a Customer
Examples
iex> Chargebeex.Customer.retrieve("AzyzkCSvjSUpY4xuB")
{:ok, %Chargebeex.Customer{
allow_direct_debit: false,
auto_collection: "on",
business_customer_without_vat_number: false,
card_status: "no_card",
channel: "web",
company: "MyCompany",
created_at: 1648489755,
custom_fields: %{
"cf_internal_identifier" => "1234",
"cf_other_custom_field" => "foobar"
},
deleted: false,
email: nil,
excess_payments: 0,
id: "169ljDT1Op0yuxET",
locale: nil,
net_term_days: 0,
object: "customer",
pii_cleared: "active",
preferred_currency_code: "EUR",
promotional_credits: 0,
refundable_credits: 0,
resource_version: 1648489755361,
resources: %{
"card" => %Chargebeex.Card{
billing_addr1: "my_address",
billing_addr2: nil,
billing_city: "Paris",
billing_country: "FR",
billing_state: nil,
billing_state_code: nil,
billing_zip: "12345",
card_type: "visa",
created_at: 1648490053,
customer_id: "169ljDT1Op0yuxET",
expiry_month: 12,
expiry_year: 2023,
first_name: "John",
funding_type: "credit",
gateway: "chargebee",
gateway_account_id: "gw_AzqPCGS1aaz5K3b",
iin: "411111",
ip_address: nil,
issuing_country: nil,
last4: "1111",
last_name: "M",
masked_number: "************1111",
object: "card",
payment_source_id: "pm_AzqYbtT1OqGcr5B1",
powered_by: nil,
ref_tx_id: nil,
resource_version: 1648490053804,
status: "valid",
updated_at: 1648490053
}
},
taxability: "taxable",
unbilled_charges: 0,
updated_at: 1648489755
}}
Callback implementation for Chargebeex.Resource.retrieve/2
.
Allows to update a Customer
Examples
iex> Chargebeex.Customer.update("169ljDT1Op0yuxET", %{company: "MyUpdatedCompany"})
{:ok, %Chargebeex.Customer{
allow_direct_debit: false,
auto_collection: "on",
business_customer_without_vat_number: false,
card_status: "no_card",
channel: "web",
company: "MyUpdatedCompany",
created_at: 1648489755,
custom_fields: %{
"cf_internal_identifier" => "1234",
"cf_other_custom_field" => "foobar"
},
deleted: false,
email: nil,
excess_payments: 0,
id: "169ljDT1Op0yuxET",
locale: nil,
net_term_days: 0,
object: "customer",
pii_cleared: "active",
preferred_currency_code: "EUR",
promotional_credits: 0,
refundable_credits: 0,
resource_version: 1648489755361,
resources: %{
"card" => %Chargebeex.Card{
billing_addr1: "my_address",
billing_addr2: nil,
billing_city: "Paris",
billing_country: "FR",
billing_state: nil,
billing_state_code: nil,
billing_zip: "12345",
card_type: "visa",
created_at: 1648490053,
customer_id: "169ljDT1Op0yuxET",
expiry_month: 12,
expiry_year: 2023,
first_name: "John",
funding_type: "credit",
gateway: "chargebee",
gateway_account_id: "gw_AzqPCGS1aaz5K3b",
iin: "411111",
ip_address: nil,
issuing_country: nil,
last4: "1111",
last_name: "M",
masked_number: "************1111",
object: "card",
payment_source_id: "pm_AzqYbtT1OqGcr5B1",
powered_by: nil,
ref_tx_id: nil,
resource_version: 1648490053804,
status: "valid",
updated_at: 1648490053
}
},
taxability: "taxable",
unbilled_charges: 0,
updated_at: 1648489755
}}
Callback implementation for Chargebeex.Resource.update/3
.