Class: UnivapayClientSdk::TransactionHistoryRefund

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/transaction_history_refund.rb

Overview

A single refund issued against the charge this row describes.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(refund_id: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, status: SKIP, reason: SKIP, additional_properties: nil) ⇒ TransactionHistoryRefund

Returns a new instance of TransactionHistoryRefund.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 65

def initialize(refund_id: SKIP, amount: SKIP, currency: SKIP,
               amount_formatted: SKIP, status: SKIP, reason: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @refund_id = refund_id unless refund_id == SKIP
  @amount = amount unless amount == SKIP
  @currency = currency unless currency == SKIP
  @amount_formatted = amount_formatted unless amount_formatted == SKIP
  @status = status unless status == SKIP
  @reason = reason unless reason == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountInteger

Refunded amount, in the currency's minor unit.

Returns:

  • (Integer)


18
19
20
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 18

def amount
  @amount
end

#amount_formattedFloat

Refunded amount, formatted per the currency's display scale.

Returns:

  • (Float)


26
27
28
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 26

def amount_formatted
  @amount_formatted
end

#currencyString

ISO-4217 currency code.

Returns:

  • (String)


22
23
24
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 22

def currency
  @currency
end

#reasonTransactionHistoryRefundReason

Reason code for a refund.



34
35
36
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 34

def reason
  @reason
end

#refund_idUUID | String

Unique identifier of the refund.

Returns:

  • (UUID | String)


14
15
16
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 14

def refund_id
  @refund_id
end

#statusTransactionHistoryRefundStatus

Status of a single refund entry.



30
31
32
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 30

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  refund_id = hash.key?('refund_id') ? hash['refund_id'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  amount_formatted =
    hash.key?('amount_formatted') ? hash['amount_formatted'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TransactionHistoryRefund.new(refund_id: refund_id,
                               amount: amount,
                               currency: currency,
                               amount_formatted: amount_formatted,
                               status: status,
                               reason: reason,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['refund_id'] = 'refund_id'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['amount_formatted'] = 'amount_formatted'
  @_hash['status'] = 'status'
  @_hash['reason'] = 'reason'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 49

def self.optionals
  %w[
    refund_id
    amount
    currency
    amount_formatted
    status
    reason
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



119
120
121
122
123
124
125
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 119

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_id: #{@refund_id.inspect}, amount: #{@amount.inspect}, currency:"\
  " #{@currency.inspect}, amount_formatted: #{@amount_formatted.inspect}, status:"\
  " #{@status.inspect}, reason: #{@reason.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



111
112
113
114
115
116
# File 'lib/univapay_client_sdk/models/transaction_history_refund.rb', line 111

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_id: #{@refund_id}, amount: #{@amount}, currency: #{@currency},"\
  " amount_formatted: #{@amount_formatted}, status: #{@status}, reason: #{@reason},"\
  " additional_properties: #{@additional_properties}>"
end