Class: EwayRapid::InternalModels::RefundDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/models/internal_models.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#currency_codeObject

Returns the value of attribute currency_code.



232
233
234
# File 'lib/eway_rapid/models/internal_models.rb', line 232

def currency_code
  @currency_code
end

#invoice_descriptionObject

Returns the value of attribute invoice_description.



230
231
232
# File 'lib/eway_rapid/models/internal_models.rb', line 230

def invoice_description
  @invoice_description
end

#invoice_numberObject

Returns the value of attribute invoice_number.



229
230
231
# File 'lib/eway_rapid/models/internal_models.rb', line 229

def invoice_number
  @invoice_number
end

#invoice_referenceObject

Returns the value of attribute invoice_reference.



231
232
233
# File 'lib/eway_rapid/models/internal_models.rb', line 231

def invoice_reference
  @invoice_reference
end

#original_transaction_idObject

Returns the value of attribute original_transaction_id.



227
228
229
# File 'lib/eway_rapid/models/internal_models.rb', line 227

def original_transaction_id
  @original_transaction_id
end

#total_amountObject

Returns the value of attribute total_amount.



228
229
230
# File 'lib/eway_rapid/models/internal_models.rb', line 228

def total_amount
  @total_amount
end

Class Method Details

.from_hash(hash) ⇒ Object



252
253
254
255
256
257
258
259
260
261
# File 'lib/eway_rapid/models/internal_models.rb', line 252

def self.from_hash(hash)
  refund_details = RefundDetails.new
  refund_details.original_transaction_id = hash[Constants::ORIGINAL_TRANSACTION_ID]
  refund_details.total_amount = hash[Constants::TOTAL_AMOUNT]
  refund_details.invoice_number = hash[Constants::INVOICE_NUMBER]
  refund_details.invoice_description = hash[Constants::INVOICE_DESCRIPTION]
  refund_details.invoice_reference = hash[Constants::INVOICE_REFERENCE]
  refund_details.currency_code = hash[Constants::CURRENCY_CODE]
  refund_details
end

.from_json(json) ⇒ Object



247
248
249
250
# File 'lib/eway_rapid/models/internal_models.rb', line 247

def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end

.to_hash(refund_details) ⇒ Object



234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/eway_rapid/models/internal_models.rb', line 234

def self.to_hash(refund_details)
  hash = {}
  if refund_details
   hash[Constants::ORIGINAL_TRANSACTION_ID] = refund_details.original_transaction_id if refund_details.original_transaction_id
   hash[Constants::TOTAL_AMOUNT] = refund_details.total_amount if refund_details.total_amount
   hash[Constants::INVOICE_NUMBER] = refund_details.invoice_number if refund_details.invoice_number
   hash[Constants::INVOICE_DESCRIPTION] = refund_details.invoice_description if refund_details.invoice_description
   hash[Constants::INVOICE_REFERENCE] = refund_details.invoice_reference if refund_details.invoice_reference
   hash[Constants::CURRENCY_CODE] = refund_details.currency_code if refund_details.currency_code
  end
  hash
end