class Mondido::CreditCard::Transaction

Attributes

amount[RW]
card_cvv[RW]
card_expiry[RW]
card_holder[RW]
card_number[RW]
card_type[RW]
cost[RW]
created_at[RW]
currency[RW]
customer[RW]
customer_ref[RW]
error[RW]
error_url[RW]
hash[RW]
href[RW]
id[RW]
items[RW]
merchant_id[RW]
metadata[RW]
payment_details[RW]
payment_ref[RW]
payment_request[RW]
plan_id[RW]
process[RW]
refund[RW]
status[RW]
store_card[RW]
stored_card[RW]
subscription[RW]
success_url[RW]
template_id[RW]
test[RW]
transaction_type[RW]
vat_amount[RW]
webhooks[RW]

Public Class Methods

create(attributes={}) click to toggle source
Calls superclass method Mondido::BaseModel::create
# File lib/mondido/credit_card/transaction.rb, line 77
def self.create(attributes={})
  ['metadata', 'webhooks'].each do |a|
    attribute = attributes[:"#{a}"]
    attribute = attribute.to_json if attribute && attribute.respond_to?(:to_json)
    attributes[:"#{a}"] = attribute
  end
  super(attributes)
end
delete(id) click to toggle source
# File lib/mondido/credit_card/transaction.rb, line 73
def self.delete(id)
  raise Mondido::Exceptions::NotApplicable.new 'Can not delete Transaction'
end
new(attributes={}) click to toggle source
Calls superclass method Mondido::BaseBehaviour::new
# File lib/mondido/credit_card/transaction.rb, line 86
def initialize(attributes={})
  super
end

Public Instance Methods

set_hash!() click to toggle source
# File lib/mondido/credit_card/transaction.rb, line 96
def set_hash!
  unhashed = [
    Mondido::Credentials.merchant_id,
    payment_ref,
    customer_ref,
    amount,
    currency,
    ( (test) ? "test" : "" ),
    Mondido::Credentials.secret
  ].map(&:to_s)
  self.hash = Digest::MD5.hexdigest(unhashed.join)
end
set_merchant_id!() click to toggle source
# File lib/mondido/credit_card/transaction.rb, line 90
def set_merchant_id!
  unless self.merchant_id
    self.merchant_id = Mondido::Credentials.merchant_id
  end
end