Class: Inttegro::BalanceTransaction

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/models.rb,
lib/inttegro/generated/models.rb

Instance Method Summary collapse

Instance Method Details

#source_idObject



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/inttegro/models.rb', line 83

def source_id
  payment = payment_id
  refund = refund_id
  if type == Inttegro::BalanceTransactionType::PAYMENT && payment && !payment.empty? && refund.nil?
    return payment
  end
  if type == Inttegro::BalanceTransactionType::REFUND && refund && !refund.empty? && payment.nil?
    return refund
  end

  nil
end

#valid?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/inttegro/models.rb', line 102

def valid?
  !id.empty? && !order_id.empty? && !created_at.empty? && valid_source?
end

#valid_source?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/inttegro/models.rb', line 97

def valid_source?
  !source_id.nil?
end