Class: Pago::V2026_04::Models::BalanceCreditOrderMetadata

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])
{
  order_id: "order_id",
  product_id: "product_id",
  subscription_id: "subscription_id",
  amount: "amount",
  currency: "currency",
  tax_amount: "tax_amount",
  tax_state: "tax_state",
  tax_country: "tax_country",
  fee: "fee",
  exchange_rate: "exchange_rate"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["order_id", "amount", "currency", "tax_amount", "fee"].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(order_id:, product_id: ::Pago::UNSET, subscription_id: ::Pago::UNSET, amount:, currency:, tax_amount:, tax_state: ::Pago::UNSET, tax_country: ::Pago::UNSET, fee:, exchange_rate: ::Pago::UNSET) ⇒ BalanceCreditOrderMetadata

Returns a new instance of BalanceCreditOrderMetadata.

Parameters:

  • order_id: (String)
  • product_id: (String, nil) (defaults to: ::Pago::UNSET)
  • subscription_id: (String, nil) (defaults to: ::Pago::UNSET)
  • amount: (Integer)
  • currency: (String)
  • tax_amount: (Integer)
  • tax_state: (String, nil) (defaults to: ::Pago::UNSET)
  • tax_country: (String, nil) (defaults to: ::Pago::UNSET)
  • fee: (Integer)
  • exchange_rate: (Float, nil) (defaults to: ::Pago::UNSET)


849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
# File 'lib/pago/v2026_04/models.rb', line 849

def initialize(
  order_id:,
  product_id: ::Pago::UNSET,
  subscription_id: ::Pago::UNSET,
  amount:,
  currency:,
  tax_amount:,
  tax_state: ::Pago::UNSET,
  tax_country: ::Pago::UNSET,
  fee:,
  exchange_rate: ::Pago::UNSET
)
  super()
  assign(:order_id, order_id)
  assign(:product_id, product_id)
  assign(:subscription_id, subscription_id)
  assign(:amount, amount)
  assign(:currency, currency)
  assign(:tax_amount, tax_amount)
  assign(:tax_state, tax_state)
  assign(:tax_country, tax_country)
  assign(:fee, fee)
  assign(:exchange_rate, exchange_rate)
end

Instance Attribute Details

#amountInteger (readonly)

Returns:

  • (Integer)


829
830
831
# File 'lib/pago/v2026_04/models.rb', line 829

def amount
  @amount
end

#currencyString (readonly)

Returns:

  • (String)


832
833
834
# File 'lib/pago/v2026_04/models.rb', line 832

def currency
  @currency
end

#exchange_rateFloat (readonly)

Returns:

  • (Float)


847
848
849
# File 'lib/pago/v2026_04/models.rb', line 847

def exchange_rate
  @exchange_rate
end

#feeInteger (readonly)

Returns:

  • (Integer)


844
845
846
# File 'lib/pago/v2026_04/models.rb', line 844

def fee
  @fee
end

#order_idString (readonly)

Returns:

  • (String)


820
821
822
# File 'lib/pago/v2026_04/models.rb', line 820

def order_id
  @order_id
end

#product_idString (readonly)

Returns:

  • (String)


823
824
825
# File 'lib/pago/v2026_04/models.rb', line 823

def product_id
  @product_id
end

#subscription_idString (readonly)

Returns:

  • (String)


826
827
828
# File 'lib/pago/v2026_04/models.rb', line 826

def subscription_id
  @subscription_id
end

#tax_amountInteger (readonly)

Returns:

  • (Integer)


835
836
837
# File 'lib/pago/v2026_04/models.rb', line 835

def tax_amount
  @tax_amount
end

#tax_countryString? (readonly)

Returns:

  • (String, nil)


841
842
843
# File 'lib/pago/v2026_04/models.rb', line 841

def tax_country
  @tax_country
end

#tax_stateString? (readonly)

Returns:

  • (String, nil)


838
839
840
# File 'lib/pago/v2026_04/models.rb', line 838

def tax_state
  @tax_state
end

Class Method Details

.from_json(data) ⇒ BalanceCreditOrderMetadata?

Parameters:

  • data (Hash, String, nil)

Returns:



876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
# File 'lib/pago/v2026_04/models.rb', line 876

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(
      order_id: (data.key?("order_id") ? data["order_id"] : ::Pago::UNSET),
      product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET),
      subscription_id: (data.key?("subscription_id") ? data["subscription_id"] : ::Pago::UNSET),
      amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET),
      tax_amount: (data.key?("tax_amount") ? data["tax_amount"] : ::Pago::UNSET),
      tax_state: (data.key?("tax_state") ? data["tax_state"] : ::Pago::UNSET),
      tax_country: (data.key?("tax_country") ? data["tax_country"] : ::Pago::UNSET),
      fee: (data.key?("fee") ? data["fee"] : ::Pago::UNSET),
      exchange_rate: (data.key?("exchange_rate") ? data["exchange_rate"] : ::Pago::UNSET)
    ),
    data
  )
end