Class: UnivapayClientSdk::Refund
- Defined in:
- lib/univapay_client_sdk/models/refund.rb
Overview
Represents a refund issued against a charge.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
Refund amount in the smallest currency unit (e.g., cents for USD, yen for JPY).
-
#amount_formatted ⇒ Float
Refund amount formatted for display.
-
#charge_id ⇒ UUID | String
Charge identifier.
-
#created_on ⇒ DateTime
Timestamp when the resource was created.
-
#currency ⇒ String
ISO-4217 currency code.
-
#error ⇒ PaymentError
Payment error details, or null if successful.
-
#id ⇒ UUID | String
Unique identifier.
-
#message ⇒ String
Optional free-text note about the refund.
-
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
-
#mode ⇒ ChargeMode
Charge Mode schema.
-
#reason ⇒ RefundReasonResponse
Refund reason returned by the API, or
nullwhen unset. -
#status ⇒ RefundStatus
Current status of the refund.
-
#store_id ⇒ UUID | String
Store identifier.
-
#updated_on ⇒ DateTime
Timestamp when the resource was last updated.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(id: SKIP, store_id: SKIP, charge_id: SKIP, status: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, reason: SKIP, message: SKIP, error: SKIP, metadata: SKIP, mode: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) ⇒ Refund
constructor
A new instance of Refund.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
- #to_custom_updated_on ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id: SKIP, store_id: SKIP, charge_id: SKIP, status: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, reason: SKIP, message: SKIP, error: SKIP, metadata: SKIP, mode: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) ⇒ Refund
Returns a new instance of Refund.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 122 def initialize(id: SKIP, store_id: SKIP, charge_id: SKIP, status: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, reason: SKIP, message: SKIP, error: SKIP, metadata: SKIP, mode: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @store_id = store_id unless store_id == SKIP @charge_id = charge_id unless charge_id == SKIP @status = status unless status == SKIP @amount = amount unless amount == SKIP @currency = currency unless currency == SKIP @amount_formatted = amount_formatted unless amount_formatted == SKIP @reason = reason unless reason == SKIP @message = unless == SKIP @error = error unless error == SKIP @metadata = unless == SKIP @mode = mode unless mode == SKIP @created_on = created_on unless created_on == SKIP @updated_on = updated_on unless updated_on == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Integer
Refund amount in the smallest currency unit (e.g., cents for USD, yen for JPY).
35 36 37 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 35 def amount @amount end |
#amount_formatted ⇒ Float
Refund amount formatted for display.
43 44 45 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 43 def amount_formatted @amount_formatted end |
#charge_id ⇒ UUID | String
Charge identifier.
23 24 25 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 23 def charge_id @charge_id end |
#created_on ⇒ DateTime
Timestamp when the resource was created.
67 68 69 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 67 def created_on @created_on end |
#currency ⇒ String
ISO-4217 currency code. Must match the charged currency.
39 40 41 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 39 def currency @currency end |
#error ⇒ PaymentError
Payment error details, or null if successful.
55 56 57 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 55 def error @error end |
#id ⇒ UUID | String
Unique identifier.
15 16 17 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 15 def id @id end |
#message ⇒ String
Optional free-text note about the refund.
51 52 53 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 51 def @message end |
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
59 60 61 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 59 def @metadata end |
#mode ⇒ ChargeMode
Charge Mode schema.
63 64 65 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 63 def mode @mode end |
#reason ⇒ RefundReasonResponse
Refund reason returned by the API, or null when unset.
47 48 49 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 47 def reason @reason end |
#status ⇒ RefundStatus
Current status of the refund. pending: The refund has been created and
is being processed. successful: The refund was processed successfully.
failed: The refund was rejected by the gateway. error: An unexpected
error occurred during processing.
30 31 32 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 30 def status @status end |
#store_id ⇒ UUID | String
Store identifier.
19 20 21 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 19 def store_id @store_id end |
#updated_on ⇒ DateTime
Timestamp when the resource was last updated.
71 72 73 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 71 def updated_on @updated_on end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 148 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP store_id = hash.key?('store_id') ? hash['store_id'] : SKIP charge_id = hash.key?('charge_id') ? hash['charge_id'] : SKIP status = hash.key?('status') ? hash['status'] : 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 reason = hash.key?('reason') ? hash['reason'] : SKIP = hash.key?('message') ? hash['message'] : SKIP error = PaymentError.from_hash(hash['error']) if hash['error'] = GenericMetadata.from_hash(hash['metadata']) if hash['metadata'] mode = hash.key?('mode') ? hash['mode'] : SKIP created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) else SKIP end updated_on = if hash.key?('updated_on') (DateTimeHelper.from_rfc3339(hash['updated_on']) if hash['updated_on']) else SKIP end # 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. Refund.new(id: id, store_id: store_id, charge_id: charge_id, status: status, amount: amount, currency: currency, amount_formatted: amount_formatted, reason: reason, message: , error: error, metadata: , mode: mode, created_on: created_on, updated_on: updated_on, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 74 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['store_id'] = 'store_id' @_hash['charge_id'] = 'charge_id' @_hash['status'] = 'status' @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['amount_formatted'] = 'amount_formatted' @_hash['reason'] = 'reason' @_hash['message'] = 'message' @_hash['error'] = 'error' @_hash['metadata'] = 'metadata' @_hash['mode'] = 'mode' @_hash['created_on'] = 'created_on' @_hash['updated_on'] = 'updated_on' @_hash end |
.nullables ⇒ Object
An array for nullable fields
114 115 116 117 118 119 120 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 114 def self.nullables %w[ reason message error ] end |
.optionals ⇒ Object
An array for optional fields
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 94 def self.optionals %w[ id store_id charge_id status amount currency amount_formatted reason message error metadata mode created_on updated_on ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
211 212 213 214 215 216 217 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 211 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
230 231 232 233 234 235 236 237 238 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 230 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, store_id: #{@store_id.inspect}, charge_id:"\ " #{@charge_id.inspect}, status: #{@status.inspect}, amount: #{@amount.inspect}, currency:"\ " #{@currency.inspect}, amount_formatted: #{@amount_formatted.inspect}, reason:"\ " #{@reason.inspect}, message: #{@message.inspect}, error: #{@error.inspect}, metadata:"\ " #{@metadata.inspect}, mode: #{@mode.inspect}, created_on: #{@created_on.inspect},"\ " updated_on: #{@updated_on.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
201 202 203 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 201 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_custom_updated_on ⇒ Object
205 206 207 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 205 def to_custom_updated_on DateTimeHelper.to_rfc3339(updated_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
220 221 222 223 224 225 226 227 |
# File 'lib/univapay_client_sdk/models/refund.rb', line 220 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, store_id: #{@store_id}, charge_id: #{@charge_id}, status:"\ " #{@status}, amount: #{@amount}, currency: #{@currency}, amount_formatted:"\ " #{@amount_formatted}, reason: #{@reason}, message: #{@message}, error: #{@error},"\ " metadata: #{@metadata}, mode: #{@mode}, created_on: #{@created_on}, updated_on:"\ " #{@updated_on}, additional_properties: #{@additional_properties}>" end |