Class: Inttegro::Refund::PaymentMethodSettlement

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/refund/payment_method_settlement.rb

Overview

Typed representation of the payment method settlement object in the Inttegro API.

This generated model is immutable. Construct it with .new, or decode a string-keyed API payload with .from_hash. #serialize produces a string-keyed hash using the original wire field names and serialized enum values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#payment_method ⇒ Inttegro::Refund::SettlementPaymentMethod (readonly)

Caller-safe immutable snapshot of the original payment method. Account values are masked and management-only payment-method data is never included.

Required in the API payload. Wire name: payment_method.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/inttegro/refund/payment_method_settlement.rb', line 32

class PaymentMethodSettlement < T::Struct
  const :payment_method, Inttegro::Refund::SettlementPaymentMethod
  const :type, Inttegro::Refund::PaymentMethodSettlementType

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (payment_method_value = data["payment_method"]).is_a?(Hash)
      data["payment_method"] = case payment_method_value["type"]
      when "bank_account"
        Inttegro::Refund::SettlementBankAccountPaymentMethod.from_hash(payment_method_value)
      when "mobile_money"
        Inttegro::Refund::SettlementMobileMoneyPaymentMethod.from_hash(payment_method_value)
      else
        payment_method_value
      end
    end
    super(data, strict)
  end
end

#type ⇒ Inttegro::Refund::PaymentMethodSettlementType (readonly)

The refund returns to the original payment method used for the order.

Required in the API payload. Wire name: type.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/inttegro/refund/payment_method_settlement.rb', line 32

class PaymentMethodSettlement < T::Struct
  const :payment_method, Inttegro::Refund::SettlementPaymentMethod
  const :type, Inttegro::Refund::PaymentMethodSettlementType

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (payment_method_value = data["payment_method"]).is_a?(Hash)
      data["payment_method"] = case payment_method_value["type"]
      when "bank_account"
        Inttegro::Refund::SettlementBankAccountPaymentMethod.from_hash(payment_method_value)
      when "mobile_money"
        Inttegro::Refund::SettlementMobileMoneyPaymentMethod.from_hash(payment_method_value)
      else
        payment_method_value
      end
    end
    super(data, strict)
  end
end

Class Method Details

.from_hash(hash, strict = false) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/inttegro/refund/payment_method_settlement.rb', line 39

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (payment_method_value = data["payment_method"]).is_a?(Hash)
    data["payment_method"] = case payment_method_value["type"]
    when "bank_account"
      Inttegro::Refund::SettlementBankAccountPaymentMethod.from_hash(payment_method_value)
    when "mobile_money"
      Inttegro::Refund::SettlementMobileMoneyPaymentMethod.from_hash(payment_method_value)
    else
      payment_method_value
    end
  end
  super(data, strict)
end