Class: Mondido::CreditCard::Transaction

Inherits:
BaseModel
  • Object
show all
Includes:
ActiveModel::Model, BaseBehaviour
Defined in:
lib/mondido/credit_card/transaction.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

all, #api_params, get, #update_from_response

Constructor Details

#initialize(attributes = {}) ⇒ Transaction

Returns a new instance of Transaction.



72
73
74
# File 'lib/mondido/credit_card/transaction.rb', line 72

def initialize(attributes={})
  super
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def amount
  @amount
end

#card_cvvObject

Returns the value of attribute card_cvv.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def card_cvv
  @card_cvv
end

#card_expiryObject

Returns the value of attribute card_expiry.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def card_expiry
  @card_expiry
end

#card_holderObject

Returns the value of attribute card_holder.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def card_holder
  @card_holder
end

#card_numberObject

Returns the value of attribute card_number.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def card_number
  @card_number
end

#card_typeObject

Returns the value of attribute card_type.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def card_type
  @card_type
end

#costObject

Returns the value of attribute cost.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def cost
  @cost
end

#created_atObject

Returns the value of attribute created_at.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def currency
  @currency
end

#customerObject

Returns the value of attribute customer.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def customer
  @customer
end

#customer_refObject

Returns the value of attribute customer_ref.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def customer_ref
  @customer_ref
end

#hashObject

Returns the value of attribute hash.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def hash
  @hash
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def id
  @id
end

#itemsObject

Returns the value of attribute items.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def items
  @items
end

#merchant_idObject

Returns the value of attribute merchant_id.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def merchant_id
  @merchant_id
end

#metadataObject

Returns the value of attribute metadata.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def 
  
end

#payment_detailsObject

Returns the value of attribute payment_details.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def payment_details
  @payment_details
end

#payment_refObject

Returns the value of attribute payment_ref.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def payment_ref
  @payment_ref
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def status
  @status
end

#stored_cardObject

Returns the value of attribute stored_card.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def stored_card
  @stored_card
end

#subscriptionObject

Returns the value of attribute subscription.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def subscription
  @subscription
end

#testObject

Returns the value of attribute test.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def test
  @test
end

#transaction_typeObject

Returns the value of attribute transaction_type.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def transaction_type
  @transaction_type
end

#vat_amountObject

Returns the value of attribute vat_amount.



7
8
9
# File 'lib/mondido/credit_card/transaction.rb', line 7

def vat_amount
  @vat_amount
end

Class Method Details

.create(attributes = {}) ⇒ Object



65
66
67
68
69
70
# File 'lib/mondido/credit_card/transaction.rb', line 65

def self.create(attributes={})
   = attributes[:metadata]        
   = .to_json if  && .respond_to?(:to_json)
  attributes[:metadata] = 
  super(attributes)
end

.delete(id) ⇒ Object



61
62
63
# File 'lib/mondido/credit_card/transaction.rb', line 61

def self.delete(id)
  raise Mondido::Exceptions::NotApplicable.new 'Can not delete Transaction'
end

Instance Method Details

#set_hash!Object



76
77
78
79
# File 'lib/mondido/credit_card/transaction.rb', line 76

def set_hash!
  unhashed = [Mondido::Credentials.merchant_id, payment_ref, customer_ref, amount, currency, Mondido::Credentials.secret].map(&:to_s)
  self.hash = Digest::MD5.hexdigest(unhashed.join)
end