Class: Pago::V2026_04::Models::GenericPayment

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

Overview

Schema of a payment with a generic payment method.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  created_at: "created_at",
  modified_at: "modified_at",
  id: "id",
  processor: "processor",
  status: "status",
  amount: "amount",
  currency: "currency",
  method: "method",
  trigger: "trigger",
  decline_reason: "decline_reason",
  decline_message: "decline_message",
  organization_id: "organization_id",
  checkout_id: "checkout_id",
  order_id: "order_id",
  processor_metadata: "processor_metadata"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["created_at", "modified_at", "id", "processor", "status", "amount", "currency", "method", "trigger", "decline_reason", "decline_message", "organization_id", "checkout_id", "order_id"].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(created_at:, modified_at:, id:, processor:, status:, amount:, currency:, method:, trigger:, decline_reason:, decline_message:, organization_id:, checkout_id:, order_id:, processor_metadata: ::Pago::UNSET) ⇒ GenericPayment

Returns a new instance of GenericPayment.

Parameters:

  • created_at: (String)
  • modified_at: (String, nil)
  • id: (String)
  • processor: (String)
  • status: (String)
  • amount: (Integer)
  • currency: (String)
  • method: (String)
  • trigger: (String, nil)
  • decline_reason: (String, nil)
  • decline_message: (String, nil)
  • organization_id: (String)
  • checkout_id: (String, nil)
  • order_id: (String, nil)
  • processor_metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)


25977
25978
25979
25980
25981
25982
25983
25984
25985
25986
25987
25988
25989
25990
25991
25992
25993
25994
25995
25996
25997
25998
25999
26000
26001
26002
26003
26004
26005
26006
26007
26008
26009
26010
# File 'lib/pago/v2026_04/models.rb', line 25977

def initialize(
  created_at:,
  modified_at:,
  id:,
  processor:,
  status:,
  amount:,
  currency:,
  method:,
  trigger:,
  decline_reason:,
  decline_message:,
  organization_id:,
  checkout_id:,
  order_id:,
  processor_metadata: ::Pago::UNSET
)
  super()
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:id, id)
  assign(:processor, processor)
  assign(:status, status)
  assign(:amount, amount)
  assign(:currency, currency)
  assign(:method, method)
  assign(:trigger, trigger)
  assign(:decline_reason, decline_reason)
  assign(:decline_message, decline_message)
  assign(:organization_id, organization_id)
  assign(:checkout_id, checkout_id)
  assign(:order_id, order_id)
  assign(:processor_metadata, )
end

Instance Attribute Details

#amountInteger (readonly)

The payment amount in cents.

Returns:

  • (Integer)


25939
25940
25941
# File 'lib/pago/v2026_04/models.rb', line 25939

def amount
  @amount
end

#checkout_idString? (readonly)

The ID of the checkout session associated with this payment.

Returns:

  • (String, nil)


25967
25968
25969
# File 'lib/pago/v2026_04/models.rb', line 25967

def checkout_id
  @checkout_id
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


25921
25922
25923
# File 'lib/pago/v2026_04/models.rb', line 25921

def created_at
  @created_at
end

#currencyString (readonly)

The payment currency. Currently, only usd is supported.

Returns:

  • (String)


25943
25944
25945
# File 'lib/pago/v2026_04/models.rb', line 25943

def currency
  @currency
end

#decline_messageString? (readonly)

Human-readable error message, if the payment was declined.

Returns:

  • (String, nil)


25959
25960
25961
# File 'lib/pago/v2026_04/models.rb', line 25959

def decline_message
  @decline_message
end

#decline_reasonString? (readonly)

Error code, if the payment was declined.

Returns:

  • (String, nil)


25955
25956
25957
# File 'lib/pago/v2026_04/models.rb', line 25955

def decline_reason
  @decline_reason
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


25929
25930
25931
# File 'lib/pago/v2026_04/models.rb', line 25929

def id
  @id
end

#methodString (readonly)

The payment method used.

Returns:

  • (String)


25947
25948
25949
# File 'lib/pago/v2026_04/models.rb', line 25947

def method
  @method
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


25925
25926
25927
# File 'lib/pago/v2026_04/models.rb', line 25925

def modified_at
  @modified_at
end

#order_idString? (readonly)

The ID of the order associated with this payment.

Returns:

  • (String, nil)


25971
25972
25973
# File 'lib/pago/v2026_04/models.rb', line 25971

def order_id
  @order_id
end

#organization_idString (readonly)

The ID of the organization that owns the payment.

Returns:

  • (String)


25963
25964
25965
# File 'lib/pago/v2026_04/models.rb', line 25963

def organization_id
  @organization_id
end

#processorString (readonly)

Returns:

  • (String)


25932
25933
25934
# File 'lib/pago/v2026_04/models.rb', line 25932

def processor
  @processor
end

#processor_metadataHash{String => Object} (readonly)

Additional metadata from the payment processor for internal use.

Returns:

  • (Hash{String => Object})


25975
25976
25977
# File 'lib/pago/v2026_04/models.rb', line 25975

def 
  @processor_metadata
end

#statusString (readonly)

Returns:

  • (String)


25935
25936
25937
# File 'lib/pago/v2026_04/models.rb', line 25935

def status
  @status
end

#triggerString? (readonly)

What initiated this payment attempt, e.g. initial purchase, subscription renewal, or an automated dunning retry.

Returns:

  • (String, nil)


25951
25952
25953
# File 'lib/pago/v2026_04/models.rb', line 25951

def trigger
  @trigger
end

Class Method Details

.from_json(data) ⇒ GenericPayment?

Parameters:

  • data (Hash, String, nil)

Returns:



26014
26015
26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
26027
26028
26029
26030
26031
26032
26033
26034
26035
26036
26037
26038
26039
# File 'lib/pago/v2026_04/models.rb', line 26014

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(
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      processor: (data.key?("processor") ? data["processor"] : ::Pago::UNSET),
      status: (data.key?("status") ? data["status"] : ::Pago::UNSET),
      amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET),
      method: (data.key?("method") ? data["method"] : ::Pago::UNSET),
      trigger: (data.key?("trigger") ? data["trigger"] : ::Pago::UNSET),
      decline_reason: (data.key?("decline_reason") ? data["decline_reason"] : ::Pago::UNSET),
      decline_message: (data.key?("decline_message") ? data["decline_message"] : ::Pago::UNSET),
      organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET),
      checkout_id: (data.key?("checkout_id") ? data["checkout_id"] : ::Pago::UNSET),
      order_id: (data.key?("order_id") ? data["order_id"] : ::Pago::UNSET),
      processor_metadata: (data.key?("processor_metadata") ? data["processor_metadata"] : ::Pago::UNSET)
    ),
    data
  )
end