Class: EwayRapid::InternalModels::Payment

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.



196
197
198
# File 'lib/eway_rapid/models/internal_models.rb', line 196

def currency_code
  @currency_code
end

#invoice_descriptionObject

Returns the value of attribute invoice_description.



194
195
196
# File 'lib/eway_rapid/models/internal_models.rb', line 194

def invoice_description
  @invoice_description
end

#invoice_numberObject

Returns the value of attribute invoice_number.



193
194
195
# File 'lib/eway_rapid/models/internal_models.rb', line 193

def invoice_number
  @invoice_number
end

#invoice_referenceObject

Returns the value of attribute invoice_reference.



195
196
197
# File 'lib/eway_rapid/models/internal_models.rb', line 195

def invoice_reference
  @invoice_reference
end

#total_amountObject

Returns the value of attribute total_amount.



192
193
194
# File 'lib/eway_rapid/models/internal_models.rb', line 192

def total_amount
  @total_amount
end

Class Method Details

.from_hash(hash) ⇒ Object



215
216
217
218
219
220
221
222
223
# File 'lib/eway_rapid/models/internal_models.rb', line 215

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

.from_json(json) ⇒ Object



210
211
212
213
# File 'lib/eway_rapid/models/internal_models.rb', line 210

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

.to_hash(payment) ⇒ Object



198
199
200
201
202
203
204
205
206
207
208
# File 'lib/eway_rapid/models/internal_models.rb', line 198

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