class Beaver::PaymentsV30

PaymentsV30 Model.

Attributes

amount[RW]

TODO: Write general description for this method @return [Integer]

amount_disputed[RW]

TODO: Write general description for this method @return [Integer]

amount_refunded[RW]

TODO: Write general description for this method @return [Integer]

api_version[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

auto_capture[RW]

TODO: Write general description for this method @return [Boolean]

capture_at[RW]

TODO: Write general description for this method @return [Integer]

create_time[RW]

TODO: Write general description for this method @return [Integer]

currency[RW]

TODO: Write general description for this method @return [CurrencyEnum]

custom_data[RW]

TODO: Write general description for this method @return [Object]

failure_reason[RW]

TODO: Write general description for this method @return [PaymentFailureReason]

fee_amount[RW]

TODO: Write general description for this method @return [Integer]

id[RW]

TODO: Write general description for this method @return [String]

initiated_by[RW]

Owner structure to be used in any resource where an account is the owner @return [InitiatedByRespEnum]

order[RW]

TODO: Write general description for this method @return [OrderNonExpanded]

owner[RW]

Owner structure to be used in any resource where an account is the owner @return [OwnerIsAccount]

path[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

payment_method[RW]

Owner structure to be used in any resource where an account is the owner @return [PaymentMethodNonExpanded]

pending_reasons[RW]

Owner structure to be used in any resource where an account is the owner @return [List of PaymentPendingReason]

reference_id[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

resource[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

status[RW]

Owner structure to be used in any resource where an account is the owner @return [Status3Enum]

txnr_app_fee[RW]

Owner structure to be used in any resource where an account is the owner @return [TransactionRecordNonExpanded]

txnr_merchant[RW]

Owner structure to be used in any resource where an account is the owner @return [TransactionRecordNonExpanded]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# File lib/beaver/models/payments_v30.rb, line 179
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash['amount']
  amount_refunded = hash['amount_refunded']
  amount_disputed = hash['amount_disputed']
  create_time = hash['create_time']
  currency = hash['currency']
  id = hash['id']
  owner = OwnerIsAccount.from_hash(hash['owner']) if hash['owner']
  path = hash['path']
  if hash['payment_method']
    payment_method = PaymentMethodNonExpanded.from_hash(hash['payment_method'])
  end
  resource = hash['resource']
  status = hash['status']
  initiated_by = hash['initiated_by']
  auto_capture = hash['auto_capture']
  capture_at = hash['capture_at']
  custom_data = hash['custom_data']
  failure_reason = PaymentFailureReason.from_hash(hash['failure_reason']) if
    hash['failure_reason']
  fee_amount = hash['fee_amount']
  order = OrderNonExpanded.from_hash(hash['order']) if hash['order']
  # Parameter is an array, so we need to iterate through it
  pending_reasons = nil
  unless hash['pending_reasons'].nil?
    pending_reasons = []
    hash['pending_reasons'].each do |structure|
      pending_reasons << (PaymentPendingReason.from_hash(structure) if structure)
    end
  end
  if hash['txnr_app_fee']
    txnr_app_fee = TransactionRecordNonExpanded.from_hash(hash['txnr_app_fee'])
  end
  if hash['txnr_merchant']
    txnr_merchant = TransactionRecordNonExpanded.from_hash(hash['txnr_merchant'])
  end
  api_version = hash['api_version']
  reference_id = hash['reference_id']

  # Create object from extracted values.
  PaymentsV30.new(amount,
                  amount_refunded,
                  amount_disputed,
                  create_time,
                  currency,
                  id,
                  owner,
                  path,
                  payment_method,
                  resource,
                  status,
                  initiated_by,
                  auto_capture,
                  capture_at,
                  custom_data,
                  failure_reason,
                  fee_amount,
                  order,
                  pending_reasons,
                  txnr_app_fee,
                  txnr_merchant,
                  api_version,
                  reference_id)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/payments_v30.rb, line 102
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['amount_refunded'] = 'amount_refunded'
  @_hash['amount_disputed'] = 'amount_disputed'
  @_hash['auto_capture'] = 'auto_capture'
  @_hash['capture_at'] = 'capture_at'
  @_hash['create_time'] = 'create_time'
  @_hash['currency'] = 'currency'
  @_hash['custom_data'] = 'custom_data'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash['fee_amount'] = 'fee_amount'
  @_hash['id'] = 'id'
  @_hash['order'] = 'order'
  @_hash['owner'] = 'owner'
  @_hash['path'] = 'path'
  @_hash['payment_method'] = 'payment_method'
  @_hash['pending_reasons'] = 'pending_reasons'
  @_hash['resource'] = 'resource'
  @_hash['status'] = 'status'
  @_hash['txnr_app_fee'] = 'txnr_app_fee'
  @_hash['txnr_merchant'] = 'txnr_merchant'
  @_hash['initiated_by'] = 'initiated_by'
  @_hash['api_version'] = 'api_version'
  @_hash['reference_id'] = 'reference_id'
  @_hash
end
new(amount = nil, amount_refunded = nil, amount_disputed = nil, create_time = nil, currency = nil, id = nil, owner = nil, path = nil, payment_method = nil, resource = nil, status = nil, initiated_by = nil, auto_capture = nil, capture_at = nil, custom_data = nil, failure_reason = nil, fee_amount = nil, order = nil, pending_reasons = nil, txnr_app_fee = nil, txnr_merchant = nil, api_version = nil, reference_id = nil) click to toggle source
# File lib/beaver/models/payments_v30.rb, line 130
def initialize(amount = nil,
               amount_refunded = nil,
               amount_disputed = nil,
               create_time = nil,
               currency = nil,
               id = nil,
               owner = nil,
               path = nil,
               payment_method = nil,
               resource = nil,
               status = nil,
               initiated_by = nil,
               auto_capture = nil,
               capture_at = nil,
               custom_data = nil,
               failure_reason = nil,
               fee_amount = nil,
               order = nil,
               pending_reasons = nil,
               txnr_app_fee = nil,
               txnr_merchant = nil,
               api_version = nil,
               reference_id = nil)
  @amount = amount
  @amount_refunded = amount_refunded
  @amount_disputed = amount_disputed
  @auto_capture = auto_capture
  @capture_at = capture_at
  @create_time = create_time
  @currency = currency
  @custom_data = custom_data
  @failure_reason = failure_reason
  @fee_amount = fee_amount
  @id = id
  @order = order
  @owner = owner
  @path = path
  @payment_method = payment_method
  @pending_reasons = pending_reasons
  @resource = resource
  @status = status
  @txnr_app_fee = txnr_app_fee
  @txnr_merchant = txnr_merchant
  @initiated_by = initiated_by
  @api_version = api_version
  @reference_id = reference_id
end