Class: Pago::V2026_04::Models::CardPayment

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 card 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",
  method_metadata: "method_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", "method_metadata"].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, method_metadata:) ⇒ CardPayment

Returns a new instance of CardPayment.

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)
  • method_metadata: (Models::CardPaymentMetadata)


8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
# File 'lib/pago/v2026_04/models.rb', line 8963

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,
  method_metadata:
)
  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, )
  assign(:method_metadata, )
end

Instance Attribute Details

#amountInteger (readonly)

The payment amount in cents.

Returns:

  • (Integer)


8922
8923
8924
# File 'lib/pago/v2026_04/models.rb', line 8922

def amount
  @amount
end

#checkout_idString? (readonly)

The ID of the checkout session associated with this payment.

Returns:

  • (String, nil)


8950
8951
8952
# File 'lib/pago/v2026_04/models.rb', line 8950

def checkout_id
  @checkout_id
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


8904
8905
8906
# File 'lib/pago/v2026_04/models.rb', line 8904

def created_at
  @created_at
end

#currencyString (readonly)

The payment currency. Currently, only usd is supported.

Returns:

  • (String)


8926
8927
8928
# File 'lib/pago/v2026_04/models.rb', line 8926

def currency
  @currency
end

#decline_messageString? (readonly)

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

Returns:

  • (String, nil)


8942
8943
8944
# File 'lib/pago/v2026_04/models.rb', line 8942

def decline_message
  @decline_message
end

#decline_reasonString? (readonly)

Error code, if the payment was declined.

Returns:

  • (String, nil)


8938
8939
8940
# File 'lib/pago/v2026_04/models.rb', line 8938

def decline_reason
  @decline_reason
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


8912
8913
8914
# File 'lib/pago/v2026_04/models.rb', line 8912

def id
  @id
end

#methodString (readonly)

The payment method used.

Returns:

  • (String)


8930
8931
8932
# File 'lib/pago/v2026_04/models.rb', line 8930

def method
  @method
end

#method_metadataModels::CardPaymentMetadata (readonly)



8961
8962
8963
# File 'lib/pago/v2026_04/models.rb', line 8961

def 
  @method_metadata
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


8908
8909
8910
# File 'lib/pago/v2026_04/models.rb', line 8908

def modified_at
  @modified_at
end

#order_idString? (readonly)

The ID of the order associated with this payment.

Returns:

  • (String, nil)


8954
8955
8956
# File 'lib/pago/v2026_04/models.rb', line 8954

def order_id
  @order_id
end

#organization_idString (readonly)

The ID of the organization that owns the payment.

Returns:

  • (String)


8946
8947
8948
# File 'lib/pago/v2026_04/models.rb', line 8946

def organization_id
  @organization_id
end

#processorString (readonly)

Returns:

  • (String)


8915
8916
8917
# File 'lib/pago/v2026_04/models.rb', line 8915

def processor
  @processor
end

#processor_metadataHash{String => Object} (readonly)

Additional metadata from the payment processor for internal use.

Returns:

  • (Hash{String => Object})


8958
8959
8960
# File 'lib/pago/v2026_04/models.rb', line 8958

def 
  @processor_metadata
end

#statusString (readonly)

Returns:

  • (String)


8918
8919
8920
# File 'lib/pago/v2026_04/models.rb', line 8918

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)


8934
8935
8936
# File 'lib/pago/v2026_04/models.rb', line 8934

def trigger
  @trigger
end

Class Method Details

.from_json(data) ⇒ CardPayment?

Parameters:

  • data (Hash, String, nil)

Returns:



9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
# File 'lib/pago/v2026_04/models.rb', line 9002

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),
      method_metadata: (data.key?("method_metadata") ? Models::CardPaymentMetadata.from_json(data["method_metadata"]) : ::Pago::UNSET)
    ),
    data
  )
end