Class: Pago::V2026_04::Models::CustomerOrder

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",
  product: "product",
  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", "product", "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, product:, subscription:, items:, description:, refundable_amount:, refundable_tax_amount:) ⇒ CustomerOrder

Returns a new instance of CustomerOrder.

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)
  • product: (Models::CustomerOrderProduct, nil)
  • subscription: (Models::CustomerOrderSubscription, nil)
  • items: (Array[Models::OrderItemSchema])
  • description: (String)
  • refundable_amount: (Integer)
  • refundable_tax_amount: (Integer)


17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
# File 'lib/pago/v2026_04/models.rb', line 17450

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,
  product:,
  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(:product, product)
  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)


17366
17367
17368
# File 'lib/pago/v2026_04/models.rb', line 17366

def applied_balance_amount
  @applied_balance_amount
end

#billing_addressModels::Address? (readonly)

Returns:



17391
17392
17393
# File 'lib/pago/v2026_04/models.rb', line 17391

def billing_address
  @billing_address
end

#billing_nameString? (readonly)

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

Returns:

  • (String, nil)


17388
17389
17390
# File 'lib/pago/v2026_04/models.rb', line 17388

def billing_name
  @billing_name
end

#billing_reasonString (readonly)

Returns:

  • (String)


17384
17385
17386
# File 'lib/pago/v2026_04/models.rb', line 17384

def billing_reason
  @billing_reason
end

#checkout_idString? (readonly)

Returns:

  • (String, nil)


17422
17423
17424
# File 'lib/pago/v2026_04/models.rb', line 17422

def checkout_id
  @checkout_id
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


17331
17332
17333
# File 'lib/pago/v2026_04/models.rb', line 17331

def created_at
  @created_at
end

#currencyString (readonly)

Returns:

  • (String)


17381
17382
17383
# File 'lib/pago/v2026_04/models.rb', line 17381

def currency
  @currency
end

#customer_idString (readonly)

Returns:

  • (String)


17410
17411
17412
# File 'lib/pago/v2026_04/models.rb', line 17410

def customer_id
  @customer_id
end

#descriptionString (readonly)

A summary description of the order.

Returns:

  • (String)


17440
17441
17442
# File 'lib/pago/v2026_04/models.rb', line 17440

def description
  @description
end

#discount_amountInteger (readonly)

Discount amount in cents.

Returns:

  • (Integer)


17350
17351
17352
# File 'lib/pago/v2026_04/models.rb', line 17350

def discount_amount
  @discount_amount
end

#discount_idString? (readonly)

Returns:

  • (String, nil)


17416
17417
17418
# File 'lib/pago/v2026_04/models.rb', line 17416

def discount_id
  @discount_id
end

#due_amountInteger (readonly)

Amount in cents that is due for this order.

Returns:

  • (Integer)


17370
17371
17372
# File 'lib/pago/v2026_04/models.rb', line 17370

def due_amount
  @due_amount
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


17327
17328
17329
# File 'lib/pago/v2026_04/models.rb', line 17327

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)


17395
17396
17397
# File 'lib/pago/v2026_04/models.rb', line 17395

def invoice_number
  @invoice_number
end

#is_invoice_generatedBoolean (readonly)

Whether an invoice has been generated for this order.

Returns:

  • (Boolean)


17399
17400
17401
# File 'lib/pago/v2026_04/models.rb', line 17399

def is_invoice_generated
  @is_invoice_generated
end

#itemsArray<Models::OrderItemSchema> (readonly)

Line items composing the order.

Returns:



17436
17437
17438
# File 'lib/pago/v2026_04/models.rb', line 17436

def items
  @items
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


17335
17336
17337
# File 'lib/pago/v2026_04/models.rb', line 17335

def modified_at
  @modified_at
end

#net_amountInteger (readonly)

Amount in cents, after discounts but before taxes.

Returns:

  • (Integer)


17354
17355
17356
# File 'lib/pago/v2026_04/models.rb', line 17354

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)


17426
17427
17428
# File 'lib/pago/v2026_04/models.rb', line 17426

def next_payment_attempt_at
  @next_payment_attempt_at
end

Whether the order has been paid for.

Returns:

  • (Boolean)


17342
17343
17344
# File 'lib/pago/v2026_04/models.rb', line 17342

def paid
  @paid
end

#productModels::CustomerOrderProduct? (readonly)



17429
17430
17431
# File 'lib/pago/v2026_04/models.rb', line 17429

def product
  @product
end

#product_idString? (readonly)

Returns:

  • (String, nil)


17413
17414
17415
# File 'lib/pago/v2026_04/models.rb', line 17413

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)


17403
17404
17405
# File 'lib/pago/v2026_04/models.rb', line 17403

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)


17444
17445
17446
# File 'lib/pago/v2026_04/models.rb', line 17444

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)


17448
17449
17450
# File 'lib/pago/v2026_04/models.rb', line 17448

def refundable_tax_amount
  @refundable_tax_amount
end

#refunded_amountInteger (readonly)

Amount refunded in cents.

Returns:

  • (Integer)


17374
17375
17376
# File 'lib/pago/v2026_04/models.rb', line 17374

def refunded_amount
  @refunded_amount
end

#refunded_tax_amountInteger (readonly)

Sales tax refunded in cents.

Returns:

  • (Integer)


17378
17379
17380
# File 'lib/pago/v2026_04/models.rb', line 17378

def refunded_tax_amount
  @refunded_tax_amount
end

#seatsInteger? (readonly)

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

Returns:

  • (Integer, nil)


17407
17408
17409
# File 'lib/pago/v2026_04/models.rb', line 17407

def seats
  @seats
end

#statusString (readonly)

Returns:

  • (String)


17338
17339
17340
# File 'lib/pago/v2026_04/models.rb', line 17338

def status
  @status
end

#subscriptionModels::CustomerOrderSubscription? (readonly)



17432
17433
17434
# File 'lib/pago/v2026_04/models.rb', line 17432

def subscription
  @subscription
end

#subscription_idString? (readonly)

Returns:

  • (String, nil)


17419
17420
17421
# File 'lib/pago/v2026_04/models.rb', line 17419

def subscription_id
  @subscription_id
end

#subtotal_amountInteger (readonly)

Amount in cents, before discounts and taxes.

Returns:

  • (Integer)


17346
17347
17348
# File 'lib/pago/v2026_04/models.rb', line 17346

def subtotal_amount
  @subtotal_amount
end

#tax_amountInteger (readonly)

Sales tax amount in cents.

Returns:

  • (Integer)


17358
17359
17360
# File 'lib/pago/v2026_04/models.rb', line 17358

def tax_amount
  @tax_amount
end

#total_amountInteger (readonly)

Amount in cents, after discounts and taxes.

Returns:

  • (Integer)


17362
17363
17364
# File 'lib/pago/v2026_04/models.rb', line 17362

def total_amount
  @total_amount
end

Class Method Details

.from_json(data) ⇒ CustomerOrder?

Parameters:

  • data (Hash, String, nil)

Returns:



17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
# File 'lib/pago/v2026_04/models.rb', line 17525

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),
      product: (data.key?("product") ? Models::CustomerOrderProduct.from_json(data["product"]) : ::Pago::UNSET),
      subscription: (data.key?("subscription") ? Models::CustomerOrderSubscription.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