Class: PaynetEasy::PaynetEasyApi::PaymentData::PaymentTransaction
- 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
-
#errors ⇒ Object
Payment transaction processing errors.
-
#payment ⇒ Object
Payment transaction payment.
-
#processor_name ⇒ Object
Payment transaction processor name.
-
#processor_type ⇒ Object
Payment transaction processor type.
-
#query_config ⇒ Object
Payment transaction query config.
-
#status ⇒ Object
Payment transaction status.
Instance Method Summary collapse
- #add_error(error) ⇒ Object
-
#approved? ⇒ Boolean
True, if payment transaction approved.
-
#declined? ⇒ Boolean
True, if payment transaction declined or filtered.
-
#error? ⇒ Boolean
True, if error occurred when processing payment transaction by PaynetEasy gateway.
-
#finished? ⇒ Boolean
True, if payment transaction processing is finished.
- #has_errors? ⇒ Boolean
- #last_error ⇒ Object
-
#new? ⇒ Boolean
True, if payment transaction is new.
-
#processing? ⇒ Boolean
True, if payment transaction is now processing.
Methods inherited from Data
Constructor Details
This class inherits a constructor from PaynetEasy::PaynetEasyApi::PaymentData::Data
Instance Attribute Details
#errors ⇒ Object
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 |
#payment ⇒ Object
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_name ⇒ Object
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_type ⇒ Object
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_config ⇒ Object
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 |
#status ⇒ Object
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
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
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
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
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
180 181 182 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 180 def has_errors? errors.any? end |
#last_error ⇒ Object
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
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
126 127 128 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment_transaction.rb', line 126 def processing? status == STATUS_PROCESSING end |