Class: PaynetEasy::PaynetEasyApi::PaymentData::PaymentTransaction

Inherits:
Data
  • Object
show all
Defined in:
lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb,
lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb

Constant Summary collapse

PROCESSOR_QUERY =

Payment transaction processed by payment query

'query'
PROCESSOR_CALLBACK =

Payment transaction processed by PaynetEasy callback

'callback'
STATUS_NEW =

Payment transaction is new

'new'
STATUS_PROCESSING =

Payment transaction is now processing

'processing'
STATUS_APPROVED =

Payment transaction approved

'approved'
STATUS_DECLINED =

Payment transaction declined by bank

'declined'
STATUS_FILTERED =

Payment transaction declined by PaynetEasy filters

'filtered'
STATUS_ERROR =

Payment transaction processed with error

'error'
@@allowed_processor_types =

All allowed callback types

[
  PROCESSOR_QUERY,
  PROCESSOR_CALLBACK
]
@@allowed_statuses =

All allowed payment transaction statuses

[
  STATUS_NEW,
  STATUS_PROCESSING,
  STATUS_APPROVED,
  STATUS_DECLINED,
  STATUS_FILTERED,
  STATUS_ERROR
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Data

#initialize

Constructor Details

This class inherits a constructor from PaynetEasy::PaynetEasyApi::PaymentData::Data

Instance Attribute Details

#errorsObject

Payment transaction processing errors



86
87
88
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 86

def errors
  @errors
end

#paymentObject

Payment transaction payment



76
77
78
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 76

def payment
  @payment
end

#processor_nameObject

Payment transaction processor name



66
67
68
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 66

def processor_name
  @processor_name
end

#processor_typeObject

Payment transaction processor type



61
62
63
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 61

def processor_type
  @processor_type
end

#query_configObject

Payment transaction query config



81
82
83
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 81

def query_config
  @query_config
end

#statusObject

Payment transaction status



71
72
73
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 71

def status
  @status
end

Instance Method Details

#add_error(error) ⇒ Object



174
175
176
177
178
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 174

def add_error(error)
  unless errors.include? error
    errors << error
  end
end

#approved?Boolean

True, if payment transaction approved

Returns:

  • (Boolean)


131
132
133
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 131

def approved?
  status == STATUS_APPROVED
end

#declined?Boolean

True, if payment transaction declined or filtered

Returns:

  • (Boolean)


136
137
138
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 136

def declined?
  [STATUS_DECLINED, STATUS_FILTERED].include? status
end

#error?Boolean

True, if error occurred when processing payment transaction by PaynetEasy gateway

Returns:

  • (Boolean)


141
142
143
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 141

def error?
  status == STATUS_ERROR
end

#finished?Boolean

True, if payment transaction processing is finished

Returns:

  • (Boolean)


146
147
148
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 146

def finished?
  !new? && !processing?
end

#has_errors?Boolean

Returns:

  • (Boolean)


180
181
182
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 180

def has_errors?
  errors.any?
end

#last_errorObject



184
185
186
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 184

def last_error
  errors.last if has_errors?
end

#new?Boolean

True, if payment transaction is new

Returns:

  • (Boolean)


121
122
123
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 121

def new?
  status == STATUS_NEW
end

#processing?Boolean

True, if payment transaction is now processing

Returns:

  • (Boolean)


126
127
128
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 126

def processing?
  status == STATUS_PROCESSING
end