Class: Pago::V2026_04::Models::RefundCreate

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])
{
  metadata: "metadata",
  order_id: "order_id",
  reason: "reason",
  amount: "amount",
  comment: "comment",
  revoke_benefits: "revoke_benefits"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["order_id", "reason", "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(metadata: ::Pago::UNSET, order_id:, reason:, amount:, comment: ::Pago::UNSET, revoke_benefits: ::Pago::UNSET) ⇒ RefundCreate

Returns a new instance of RefundCreate.

Parameters:

  • metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • order_id: (String)
  • reason: (String)
  • amount: (Integer)
  • comment: (String, nil) (defaults to: ::Pago::UNSET)
  • revoke_benefits: (Boolean, nil) (defaults to: ::Pago::UNSET)


38379
38380
38381
38382
38383
38384
38385
38386
38387
38388
38389
38390
38391
38392
38393
38394
# File 'lib/pago/v2026_04/models.rb', line 38379

def initialize(
  metadata: ::Pago::UNSET,
  order_id:,
  reason:,
  amount:,
  comment: ::Pago::UNSET,
  revoke_benefits: ::Pago::UNSET
)
  super()
  assign(:metadata, )
  assign(:order_id, order_id)
  assign(:reason, reason)
  assign(:amount, amount)
  assign(:comment, comment)
  assign(:revoke_benefits, revoke_benefits)
end

Instance Attribute Details

#amountInteger (readonly)

Amount to refund in cents. Minimum is 1.

Returns:

  • (Integer)


38364
38365
38366
# File 'lib/pago/v2026_04/models.rb', line 38364

def amount
  @amount
end

#commentString? (readonly)

An internal comment about the refund.

Returns:

  • (String, nil)


38368
38369
38370
# File 'lib/pago/v2026_04/models.rb', line 38368

def comment
  @comment
end

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

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

Returns:

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


38353
38354
38355
# File 'lib/pago/v2026_04/models.rb', line 38353

def 
  @metadata
end

#order_idString (readonly)

Returns:

  • (String)


38356
38357
38358
# File 'lib/pago/v2026_04/models.rb', line 38356

def order_id
  @order_id
end

#reasonString (readonly)

Reason for the refund.

Returns:

  • (String)


38360
38361
38362
# File 'lib/pago/v2026_04/models.rb', line 38360

def reason
  @reason
end

#revoke_benefitsBoolean (readonly)

Should this refund trigger the associated customer benefits to be revoked?

Note: Only allowed in case the order is a one-time purchase. Subscriptions automatically revoke customer benefits once the subscription itself is revoked, i.e fully canceled.

Returns:

  • (Boolean)


38377
38378
38379
# File 'lib/pago/v2026_04/models.rb', line 38377

def revoke_benefits
  @revoke_benefits
end

Class Method Details

.from_json(data) ⇒ RefundCreate?

Parameters:

  • data (Hash, String, nil)

Returns:



38398
38399
38400
38401
38402
38403
38404
38405
38406
38407
38408
38409
38410
38411
38412
38413
38414
# File 'lib/pago/v2026_04/models.rb', line 38398

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(
      metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET),
      order_id: (data.key?("order_id") ? data["order_id"] : ::Pago::UNSET),
      reason: (data.key?("reason") ? data["reason"] : ::Pago::UNSET),
      amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      comment: (data.key?("comment") ? data["comment"] : ::Pago::UNSET),
      revoke_benefits: (data.key?("revoke_benefits") ? data["revoke_benefits"] : ::Pago::UNSET)
    ),
    data
  )
end