Class: VaultedBilling::Transactions::Ipcommerce

Inherits:
VaultedBilling::Transaction
  • Object
show all
Defined in:
lib/vaulted_billing/termcap/transactions/ipcommerce.rb

Constant Summary collapse

CaptureStates =
%w(
  !! NotSet CannotCapture ReadyForCapture CapturePending 
  Captured CaptureDeclined InProcess CapturedUndoPermitted CapturePendingUndoPermitted 
  CaptureError CaptureUnknown BatchSent BatchSentUndoPermitted
).freeze
TransactionStates =
%w(
  !! NotSet Declined Verified Authorized 
  Adjusted Captured CaptureDeclined PartiallyCaptured Undone
  ReturnRequested PartialReturnRequested ReturnUndone Returned PartiallyReturned 
  InProcess ErrorValidation ErrorUnknown ErrorConnecting
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Ipcommerce

Returns a new instance of Ipcommerce.



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 45

def initialize(input)
  self.raw_result = input.to_s
  self.id = input['TransactionInformation']['TransactionId']
  self.amount = input['TransactionInformation']['Amount']
  self.approval_code = input['TransactionInformation']['ApprovalCode']
  self.captured_amount = input['TransactionInformation']['CapturedAmount']
  self.captured_state = CaptureStates[input['TransactionInformation']['CaptureState']]
  self.captured_state_id = input['TransactionInformation']['CaptureState']
  self.captured_status_message = input['TransactionInformation']['CaptureStatusMessage']          
  self.transaction_state_id = input['TransactionInformation']['TransactionState']
  self.transaction_state =TransactionStates[input['TransactionInformation']['TransactionState']]
  self.batch_id = input['TransactionInformation']['BatchId']
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



19
20
21
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 19

def amount
  @amount
end

#approval_codeObject

Returns the value of attribute approval_code.



20
21
22
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 20

def approval_code
  @approval_code
end

#batch_idObject

Returns the value of attribute batch_id.



27
28
29
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 27

def batch_id
  @batch_id
end

#captured_amountObject

Returns the value of attribute captured_amount.



21
22
23
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 21

def captured_amount
  @captured_amount
end

#captured_stateObject

Returns the value of attribute captured_state.



22
23
24
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 22

def captured_state
  @captured_state
end

#captured_state_idObject

Returns the value of attribute captured_state_id.



23
24
25
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 23

def captured_state_id
  @captured_state_id
end

#captured_status_messageObject

Returns the value of attribute captured_status_message.



24
25
26
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 24

def captured_status_message
  @captured_status_message
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 18

def id
  @id
end

#raw_resultObject

Returns the value of attribute raw_result.



17
18
19
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 17

def raw_result
  @raw_result
end

#transaction_stateObject

Returns the value of attribute transaction_state.



26
27
28
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 26

def transaction_state
  @transaction_state
end

#transaction_state_idObject

Returns the value of attribute transaction_state_id.



25
26
27
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 25

def transaction_state_id
  @transaction_state_id
end

Instance Method Details

#capture_failed?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 33

def capture_failed?
  %w(CaptureDeclined CaptureError).include?(captured_state)
end

#capture_pending?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 37

def capture_pending?
  %w(BatchSent InProcess).include?(captured_state)
end

#captured?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 29

def captured?
  %w(Captured).include?(captured_state)
end

#failed?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/vaulted_billing/termcap/transactions/ipcommerce.rb', line 41

def failed?
  %w(Declined CaptureDeclined ErrorValidation ErrorUnknown).include?(transaction_state)
end