Current section

Files

Jump to
polarex lib polarex schemas checkout.ex
Raw

lib/polarex/schemas/checkout.ex

defmodule Polarex.Checkout do
@moduledoc """
Provides struct and type for a Checkout
"""
@type t :: %__MODULE__{
allow_discount_codes: boolean,
amount: integer,
attached_custom_fields: [Polarex.AttachedCustomField.t()],
client_secret: String.t(),
created_at: DateTime.t(),
currency: String.t(),
custom_field_data: Polarex.CustomFieldData.t() | nil,
customer_billing_address: Polarex.Address.t() | nil,
customer_billing_address_fields: Polarex.CheckoutCustomerBillingAddressFields.t(),
customer_billing_name: String.t() | nil,
customer_email: String.t() | nil,
customer_external_id: String.t() | nil,
customer_id: String.t() | nil,
customer_ip_address: String.t() | nil,
customer_metadata: Polarex.CustomerMetadata.t(),
customer_name: String.t() | nil,
customer_tax_id: String.t() | nil,
discount: map | nil,
discount_amount: integer,
discount_id: String.t() | nil,
embed_origin: String.t() | nil,
expires_at: DateTime.t(),
id: String.t(),
is_business_customer: boolean,
is_discount_applicable: boolean,
is_free_product_price: boolean,
is_payment_form_required: boolean,
is_payment_required: boolean,
is_payment_setup_required: boolean,
metadata: Polarex.Metadata.t(),
modified_at: DateTime.t() | nil,
net_amount: integer,
payment_processor: String.t(),
payment_processor_metadata: Polarex.PaymentProcessorMetadata.t(),
product: Polarex.CheckoutProduct.t(),
product_id: String.t(),
product_price: map,
product_price_id: String.t(),
products: [Polarex.CheckoutProduct.t()],
require_billing_address: boolean,
status: String.t(),
subscription_id: String.t() | nil,
success_url: String.t(),
tax_amount: integer | nil,
total_amount: integer,
url: String.t()
}
defstruct [
:allow_discount_codes,
:amount,
:attached_custom_fields,
:client_secret,
:created_at,
:currency,
:custom_field_data,
:customer_billing_address,
:customer_billing_address_fields,
:customer_billing_name,
:customer_email,
:customer_external_id,
:customer_id,
:customer_ip_address,
:customer_metadata,
:customer_name,
:customer_tax_id,
:discount,
:discount_amount,
:discount_id,
:embed_origin,
:expires_at,
:id,
:is_business_customer,
:is_discount_applicable,
:is_free_product_price,
:is_payment_form_required,
:is_payment_required,
:is_payment_setup_required,
:metadata,
:modified_at,
:net_amount,
:payment_processor,
:payment_processor_metadata,
:product,
:product_id,
:product_price,
:product_price_id,
:products,
:require_billing_address,
:status,
:subscription_id,
:success_url,
:tax_amount,
:total_amount,
:url
]
@doc false
@spec __fields__(atom) :: keyword
def __fields__(type \\ :t)
def __fields__(:t) do
[
allow_discount_codes: :boolean,
amount: :integer,
attached_custom_fields: [{Polarex.AttachedCustomField, :t}],
client_secret: {:string, :generic},
created_at: {:string, :date_time},
currency: {:string, :generic},
custom_field_data: {Polarex.CustomFieldData, :t},
customer_billing_address: {:union, [{Polarex.Address, :t}, :null]},
customer_billing_address_fields: {Polarex.CheckoutCustomerBillingAddressFields, :t},
customer_billing_name: {:union, [{:string, :generic}, :null]},
customer_email: {:union, [{:string, :generic}, :null]},
customer_external_id: {:union, [{:string, :generic}, :null]},
customer_id: {:union, [{:string, :generic}, :null]},
customer_ip_address: {:union, [{:string, :generic}, :null]},
customer_metadata: {Polarex.CustomerMetadata, :t},
customer_name: {:union, [{:string, :generic}, :null]},
customer_tax_id: {:union, [{:string, :generic}, :null]},
discount: {:union, [:map, :null]},
discount_amount: :integer,
discount_id: {:union, [{:string, :generic}, :null]},
embed_origin: {:union, [{:string, :generic}, :null]},
expires_at: {:string, :date_time},
id: {:string, :generic},
is_business_customer: :boolean,
is_discount_applicable: :boolean,
is_free_product_price: :boolean,
is_payment_form_required: :boolean,
is_payment_required: :boolean,
is_payment_setup_required: :boolean,
metadata: {Polarex.Metadata, :t},
modified_at: {:union, [{:string, :date_time}, :null]},
net_amount: :integer,
payment_processor: {:const, "stripe"},
payment_processor_metadata: {Polarex.PaymentProcessorMetadata, :t},
product: {Polarex.CheckoutProduct, :t},
product_id: {:string, :generic},
product_price: :map,
product_price_id: {:string, :generic},
products: [{Polarex.CheckoutProduct, :t}],
require_billing_address: :boolean,
status: {:enum, ["open", "expired", "confirmed", "succeeded", "failed"]},
subscription_id: {:union, [{:string, :generic}, :null]},
success_url: {:string, :generic},
tax_amount: {:union, [:integer, :null]},
total_amount: :integer,
url: {:string, :generic}
]
end
end