Class: Pago::V2026_04::Models::Order

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  id: "id",
  created_at: "created_at",
  modified_at: "modified_at",
  status: "status",
  paid: "paid",
  subtotal_amount: "subtotal_amount",
  discount_amount: "discount_amount",
  net_amount: "net_amount",
  tax_amount: "tax_amount",
  total_amount: "total_amount",
  applied_balance_amount: "applied_balance_amount",
  due_amount: "due_amount",
  refunded_amount: "refunded_amount",
  refunded_tax_amount: "refunded_tax_amount",
  currency: "currency",
  billing_reason: "billing_reason",
  billing_name: "billing_name",
  billing_address: "billing_address",
  invoice_number: "invoice_number",
  is_invoice_generated: "is_invoice_generated",
  receipt_number: "receipt_number",
  seats: "seats",
  customer_id: "customer_id",
  product_id: "product_id",
  discount_id: "discount_id",
  subscription_id: "subscription_id",
  checkout_id: "checkout_id",
  next_payment_attempt_at: "next_payment_attempt_at",
  metadata: "metadata",
  custom_field_data: "custom_field_data",
  platform_fee_amount: "platform_fee_amount",
  platform_fee_currency: "platform_fee_currency",
  customer: "customer",
  product: "product",
  discount: "discount",
  subscription: "subscription",
  items: "items",
  description: "description",
  refundable_amount: "refundable_amount",
  refundable_tax_amount: "refundable_tax_amount"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["id", "created_at", "modified_at", "status", "paid", "subtotal_amount", "discount_amount", "net_amount", "tax_amount", "total_amount", "applied_balance_amount", "due_amount", "refunded_amount", "refunded_tax_amount", "currency", "billing_reason", "billing_name", "billing_address", "invoice_number", "is_invoice_generated", "receipt_number", "customer_id", "product_id", "discount_id", "subscription_id", "checkout_id", "metadata", "platform_fee_amount", "platform_fee_currency", "customer", "product", "discount", "subscription", "items", "description", "refundable_amount", "refundable_tax_amount"].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw

Constructor Details

#initialize(id:, created_at:, modified_at:, status:, paid:, subtotal_amount:, discount_amount:, net_amount:, tax_amount:, total_amount:, applied_balance_amount:, due_amount:, refunded_amount:, refunded_tax_amount:, currency:, billing_reason:, billing_name:, billing_address:, invoice_number:, is_invoice_generated:, receipt_number:, seats: ::Pago::UNSET, customer_id:, product_id:, discount_id:, subscription_id:, checkout_id:, next_payment_attempt_at: ::Pago::UNSET, metadata:, custom_field_data: ::Pago::UNSET, platform_fee_amount:, platform_fee_currency:, customer:, product:, discount:, subscription:, items:, description:, refundable_amount:, refundable_tax_amount:) ⇒ Order

Returns a new instance of Order.

Parameters:

  • id: (String)
  • created_at: (String)
  • modified_at: (String, nil)
  • status: (String)
  • paid: (Boolean)
  • subtotal_amount: (Integer)
  • discount_amount: (Integer)
  • net_amount: (Integer)
  • tax_amount: (Integer)
  • total_amount: (Integer)
  • applied_balance_amount: (Integer)
  • due_amount: (Integer)
  • refunded_amount: (Integer)
  • refunded_tax_amount: (Integer)
  • currency: (String)
  • billing_reason: (String)
  • billing_name: (String, nil)
  • billing_address: (Models::Address, nil)
  • invoice_number: (String, nil)
  • is_invoice_generated: (Boolean)
  • receipt_number: (String, nil)
  • seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • customer_id: (String)
  • product_id: (String, nil)
  • discount_id: (String, nil)
  • subscription_id: (String, nil)
  • checkout_id: (String, nil)
  • next_payment_attempt_at: (String, nil) (defaults to: ::Pago::UNSET)
  • metadata: (Hash[String, untyped])
  • custom_field_data: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • platform_fee_amount: (Integer)
  • platform_fee_currency: (String, nil)
  • customer: (Models::OrderCustomer)
  • product: (Models::OrderProduct, nil)
  • discount: (Object)
  • subscription: (Models::OrderSubscription, nil)
  • items: (Array[Models::OrderItemSchema])
  • description: (String)
  • refundable_amount: (Integer)
  • refundable_tax_amount: (Integer)


32038
32039
32040
32041
32042
32043
32044
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
32057
32058
32059
32060
32061
32062
32063
32064
32065
32066
32067
32068
32069
32070
32071
32072
32073
32074
32075
32076
32077
32078
32079
32080
32081
32082
32083
32084
32085
32086
32087
32088
32089
32090
32091
32092
32093
32094
32095
32096
32097
32098
32099
32100
32101
32102
32103
32104
32105
32106
32107
32108
32109
32110
32111
32112
32113
32114
32115
32116
32117
32118
32119
32120
32121
# File 'lib/pago/v2026_04/models.rb', line 32038

def initialize(
  id:,
  created_at:,
  modified_at:,
  status:,
  paid:,
  subtotal_amount:,
  discount_amount:,
  net_amount:,
  tax_amount:,
  total_amount:,
  applied_balance_amount:,
  due_amount:,
  refunded_amount:,
  refunded_tax_amount:,
  currency:,
  billing_reason:,
  billing_name:,
  billing_address:,
  invoice_number:,
  is_invoice_generated:,
  receipt_number:,
  seats: ::Pago::UNSET,
  customer_id:,
  product_id:,
  discount_id:,
  subscription_id:,
  checkout_id:,
  next_payment_attempt_at: ::Pago::UNSET,
  metadata:,
  custom_field_data: ::Pago::UNSET,
  platform_fee_amount:,
  platform_fee_currency:,
  customer:,
  product:,
  discount:,
  subscription:,
  items:,
  description:,
  refundable_amount:,
  refundable_tax_amount:
)
  super()
  assign(:id, id)
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:status, status)
  assign(:paid, paid)
  assign(:subtotal_amount, subtotal_amount)
  assign(:discount_amount, discount_amount)
  assign(:net_amount, net_amount)
  assign(:tax_amount, tax_amount)
  assign(:total_amount, total_amount)
  assign(:applied_balance_amount, applied_balance_amount)
  assign(:due_amount, due_amount)
  assign(:refunded_amount, refunded_amount)
  assign(:refunded_tax_amount, refunded_tax_amount)
  assign(:currency, currency)
  assign(:billing_reason, billing_reason)
  assign(:billing_name, billing_name)
  assign(:billing_address, billing_address)
  assign(:invoice_number, invoice_number)
  assign(:is_invoice_generated, is_invoice_generated)
  assign(:receipt_number, receipt_number)
  assign(:seats, seats)
  assign(:customer_id, customer_id)
  assign(:product_id, product_id)
  assign(:discount_id, discount_id)
  assign(:subscription_id, subscription_id)
  assign(:checkout_id, checkout_id)
  assign(:next_payment_attempt_at, next_payment_attempt_at)
  assign(:metadata, )
  assign(:custom_field_data, custom_field_data)
  assign(:platform_fee_amount, platform_fee_amount)
  assign(:platform_fee_currency, platform_fee_currency)
  assign(:customer, customer)
  assign(:product, product)
  assign(:discount, discount)
  assign(:subscription, subscription)
  assign(:items, items)
  assign(:description, description)
  assign(:refundable_amount, refundable_amount)
  assign(:refundable_tax_amount, refundable_tax_amount)
end

Instance Attribute Details

#applied_balance_amountInteger (readonly)

Customer's balance amount applied to this invoice. Can increase the total amount paid, if the customer has a negative balance, or decrease it, if the customer has a positive balance.Amount in cents.

Returns:

  • (Integer)


31933
31934
31935
# File 'lib/pago/v2026_04/models.rb', line 31933

def applied_balance_amount
  @applied_balance_amount
end

#billing_addressModels::Address? (readonly)

Returns:



31958
31959
31960
# File 'lib/pago/v2026_04/models.rb', line 31958

def billing_address
  @billing_address
end

#billing_nameString? (readonly)

The name of the customer that should appear on the invoice.

Returns:

  • (String, nil)


31955
31956
31957
# File 'lib/pago/v2026_04/models.rb', line 31955

def billing_name
  @billing_name
end

#billing_reasonString (readonly)

Returns:

  • (String)


31951
31952
31953
# File 'lib/pago/v2026_04/models.rb', line 31951

def billing_reason
  @billing_reason
end

#checkout_idString? (readonly)

Returns:

  • (String, nil)


31989
31990
31991
# File 'lib/pago/v2026_04/models.rb', line 31989

def checkout_id
  @checkout_id
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


31898
31899
31900
# File 'lib/pago/v2026_04/models.rb', line 31898

def created_at
  @created_at
end

#currencyString (readonly)

Returns:

  • (String)


31948
31949
31950
# File 'lib/pago/v2026_04/models.rb', line 31948

def currency
  @currency
end

#custom_field_dataHash{String => String, Integer, Boolean, nil} (readonly)

Key-value object storing custom field values.

Returns:

  • (Hash{String => String, Integer, Boolean, nil})


32000
32001
32002
# File 'lib/pago/v2026_04/models.rb', line 32000

def custom_field_data
  @custom_field_data
end

#customerModels::OrderCustomer (readonly)



32011
32012
32013
# File 'lib/pago/v2026_04/models.rb', line 32011

def customer
  @customer
end

#customer_idString (readonly)

Returns:

  • (String)


31977
31978
31979
# File 'lib/pago/v2026_04/models.rb', line 31977

def customer_id
  @customer_id
end

#descriptionString (readonly)

A summary description of the order.

Returns:

  • (String)


32028
32029
32030
# File 'lib/pago/v2026_04/models.rb', line 32028

def description
  @description
end

#discountModels::DiscountFixedOnceForeverDurationBase, ... (readonly)



32017
32018
32019
# File 'lib/pago/v2026_04/models.rb', line 32017

def discount
  @discount
end

#discount_amountInteger (readonly)

Discount amount in cents.

Returns:

  • (Integer)


31917
31918
31919
# File 'lib/pago/v2026_04/models.rb', line 31917

def discount_amount
  @discount_amount
end

#discount_idString? (readonly)

Returns:

  • (String, nil)


31983
31984
31985
# File 'lib/pago/v2026_04/models.rb', line 31983

def discount_id
  @discount_id
end

#due_amountInteger (readonly)

Amount in cents that is due for this order.

Returns:

  • (Integer)


31937
31938
31939
# File 'lib/pago/v2026_04/models.rb', line 31937

def due_amount
  @due_amount
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


31894
31895
31896
# File 'lib/pago/v2026_04/models.rb', line 31894

def id
  @id
end

#invoice_numberString? (readonly)

The invoice number associated with this order. null while the order is in draft status; assigned at finalize.

Returns:

  • (String, nil)


31962
31963
31964
# File 'lib/pago/v2026_04/models.rb', line 31962

def invoice_number
  @invoice_number
end

#is_invoice_generatedBoolean (readonly)

Whether an invoice has been generated for this order.

Returns:

  • (Boolean)


31966
31967
31968
# File 'lib/pago/v2026_04/models.rb', line 31966

def is_invoice_generated
  @is_invoice_generated
end

#itemsArray<Models::OrderItemSchema> (readonly)

Line items composing the order.

Returns:



32024
32025
32026
# File 'lib/pago/v2026_04/models.rb', line 32024

def items
  @items
end

#metadataHash{String => String, Integer, Float, Boolean} (readonly)

Returns:

  • (Hash{String => String, Integer, Float, Boolean})


31996
31997
31998
# File 'lib/pago/v2026_04/models.rb', line 31996

def 
  @metadata
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


31902
31903
31904
# File 'lib/pago/v2026_04/models.rb', line 31902

def modified_at
  @modified_at
end

#net_amountInteger (readonly)

Amount in cents, after discounts but before taxes.

Returns:

  • (Integer)


31921
31922
31923
# File 'lib/pago/v2026_04/models.rb', line 31921

def net_amount
  @net_amount
end

#next_payment_attempt_atString? (readonly)

When the next automatic payment retry is scheduled. null if the order is not in dunning or all retries have been exhausted.

Returns:

  • (String, nil)


31993
31994
31995
# File 'lib/pago/v2026_04/models.rb', line 31993

def next_payment_attempt_at
  @next_payment_attempt_at
end

Whether the order has been paid for.

Returns:

  • (Boolean)


31909
31910
31911
# File 'lib/pago/v2026_04/models.rb', line 31909

def paid
  @paid
end

#platform_fee_amountInteger (readonly)

Platform fee amount in cents.

Returns:

  • (Integer)


32004
32005
32006
# File 'lib/pago/v2026_04/models.rb', line 32004

def platform_fee_amount
  @platform_fee_amount
end

#platform_fee_currencyString? (readonly)

Currency of the platform fee.

Returns:

  • (String, nil)


32008
32009
32010
# File 'lib/pago/v2026_04/models.rb', line 32008

def platform_fee_currency
  @platform_fee_currency
end

#productModels::OrderProduct? (readonly)

Returns:



32014
32015
32016
# File 'lib/pago/v2026_04/models.rb', line 32014

def product
  @product
end

#product_idString? (readonly)

Returns:

  • (String, nil)


31980
31981
31982
# File 'lib/pago/v2026_04/models.rb', line 31980

def product_id
  @product_id
end

#receipt_numberString? (readonly)

The receipt number for this order. Set once the order is paid for organizations with receipts enabled. When set, a downloadable receipt PDF can be obtained via the receipt endpoint.

Returns:

  • (String, nil)


31970
31971
31972
# File 'lib/pago/v2026_04/models.rb', line 31970

def receipt_number
  @receipt_number
end

#refundable_amountInteger (readonly)

Amount in cents that can still be refunded (net, before taxes). Accounts for any applied customer balance and previous refunds.

Returns:

  • (Integer)


32032
32033
32034
# File 'lib/pago/v2026_04/models.rb', line 32032

def refundable_amount
  @refundable_amount
end

#refundable_tax_amountInteger (readonly)

Sales tax in cents that would be refunded if the full refundable amount is refunded.

Returns:

  • (Integer)


32036
32037
32038
# File 'lib/pago/v2026_04/models.rb', line 32036

def refundable_tax_amount
  @refundable_tax_amount
end

#refunded_amountInteger (readonly)

Amount refunded in cents.

Returns:

  • (Integer)


31941
31942
31943
# File 'lib/pago/v2026_04/models.rb', line 31941

def refunded_amount
  @refunded_amount
end

#refunded_tax_amountInteger (readonly)

Sales tax refunded in cents.

Returns:

  • (Integer)


31945
31946
31947
# File 'lib/pago/v2026_04/models.rb', line 31945

def refunded_tax_amount
  @refunded_tax_amount
end

#seatsInteger? (readonly)

Number of seats purchased (for seat-based one-time orders).

Returns:

  • (Integer, nil)


31974
31975
31976
# File 'lib/pago/v2026_04/models.rb', line 31974

def seats
  @seats
end

#statusString (readonly)

Returns:

  • (String)


31905
31906
31907
# File 'lib/pago/v2026_04/models.rb', line 31905

def status
  @status
end

#subscriptionModels::OrderSubscription? (readonly)

Returns:



32020
32021
32022
# File 'lib/pago/v2026_04/models.rb', line 32020

def subscription
  @subscription
end

#subscription_idString? (readonly)

Returns:

  • (String, nil)


31986
31987
31988
# File 'lib/pago/v2026_04/models.rb', line 31986

def subscription_id
  @subscription_id
end

#subtotal_amountInteger (readonly)

Amount in cents, before discounts and taxes.

Returns:

  • (Integer)


31913
31914
31915
# File 'lib/pago/v2026_04/models.rb', line 31913

def subtotal_amount
  @subtotal_amount
end

#tax_amountInteger (readonly)

Sales tax amount in cents.

Returns:

  • (Integer)


31925
31926
31927
# File 'lib/pago/v2026_04/models.rb', line 31925

def tax_amount
  @tax_amount
end

#total_amountInteger (readonly)

Amount in cents, after discounts and taxes.

Returns:

  • (Integer)


31929
31930
31931
# File 'lib/pago/v2026_04/models.rb', line 31929

def total_amount
  @total_amount
end

Class Method Details

.from_json(data) ⇒ Order?

Parameters:

  • data (Hash, String, nil)

Returns:



32125
32126
32127
32128
32129
32130
32131
32132
32133
32134
32135
32136
32137
32138
32139
32140
32141
32142
32143
32144
32145
32146
32147
32148
32149
32150
32151
32152
32153
32154
32155
32156
32157
32158
32159
32160
32161
32162
32163
32164
32165
32166
32167
32168
32169
32170
32171
32172
32173
32174
32175
# File 'lib/pago/v2026_04/models.rb', line 32125

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  data = ::Pago::Serde.object(data)
  return nil if data.nil?

  wrap_raw(
    new(
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      status: (data.key?("status") ? data["status"] : ::Pago::UNSET),
      paid: (data.key?("paid") ? data["paid"] : ::Pago::UNSET),
      subtotal_amount: (data.key?("subtotal_amount") ? data["subtotal_amount"] : ::Pago::UNSET),
      discount_amount: (data.key?("discount_amount") ? data["discount_amount"] : ::Pago::UNSET),
      net_amount: (data.key?("net_amount") ? data["net_amount"] : ::Pago::UNSET),
      tax_amount: (data.key?("tax_amount") ? data["tax_amount"] : ::Pago::UNSET),
      total_amount: (data.key?("total_amount") ? data["total_amount"] : ::Pago::UNSET),
      applied_balance_amount: (data.key?("applied_balance_amount") ? data["applied_balance_amount"] : ::Pago::UNSET),
      due_amount: (data.key?("due_amount") ? data["due_amount"] : ::Pago::UNSET),
      refunded_amount: (data.key?("refunded_amount") ? data["refunded_amount"] : ::Pago::UNSET),
      refunded_tax_amount: (data.key?("refunded_tax_amount") ? data["refunded_tax_amount"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET),
      billing_reason: (data.key?("billing_reason") ? data["billing_reason"] : ::Pago::UNSET),
      billing_name: (data.key?("billing_name") ? data["billing_name"] : ::Pago::UNSET),
      billing_address: (data.key?("billing_address") ? Models::Address.from_json(data["billing_address"]) : ::Pago::UNSET),
      invoice_number: (data.key?("invoice_number") ? data["invoice_number"] : ::Pago::UNSET),
      is_invoice_generated: (data.key?("is_invoice_generated") ? data["is_invoice_generated"] : ::Pago::UNSET),
      receipt_number: (data.key?("receipt_number") ? data["receipt_number"] : ::Pago::UNSET),
      seats: (data.key?("seats") ? data["seats"] : ::Pago::UNSET),
      customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET),
      product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET),
      discount_id: (data.key?("discount_id") ? data["discount_id"] : ::Pago::UNSET),
      subscription_id: (data.key?("subscription_id") ? data["subscription_id"] : ::Pago::UNSET),
      checkout_id: (data.key?("checkout_id") ? data["checkout_id"] : ::Pago::UNSET),
      next_payment_attempt_at: (data.key?("next_payment_attempt_at") ? data["next_payment_attempt_at"] : ::Pago::UNSET),
      metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET),
      custom_field_data: (data.key?("custom_field_data") ? data["custom_field_data"] : ::Pago::UNSET),
      platform_fee_amount: (data.key?("platform_fee_amount") ? data["platform_fee_amount"] : ::Pago::UNSET),
      platform_fee_currency: (data.key?("platform_fee_currency") ? data["platform_fee_currency"] : ::Pago::UNSET),
      customer: (data.key?("customer") ? Models::OrderCustomer.from_json(data["customer"]) : ::Pago::UNSET),
      product: (data.key?("product") ? Models::OrderProduct.from_json(data["product"]) : ::Pago::UNSET),
      discount: (data.key?("discount") ? ::Pago::Serde.union(data["discount"], variants: [Models::DiscountFixedOnceForeverDurationBase, Models::DiscountFixedRepeatDurationBase, Models::DiscountPercentageOnceForeverDurationBase, Models::DiscountPercentageRepeatDurationBase]) : ::Pago::UNSET),
      subscription: (data.key?("subscription") ? Models::OrderSubscription.from_json(data["subscription"]) : ::Pago::UNSET),
      items: (data.key?("items") ? ::Pago::Serde.array(data["items"]) { |item0| Models::OrderItemSchema.from_json(item0) } : ::Pago::UNSET),
      description: (data.key?("description") ? data["description"] : ::Pago::UNSET),
      refundable_amount: (data.key?("refundable_amount") ? data["refundable_amount"] : ::Pago::UNSET),
      refundable_tax_amount: (data.key?("refundable_tax_amount") ? data["refundable_tax_amount"] : ::Pago::UNSET)
    ),
    data
  )
end