Class: Acc::CheckTransactionResponse
- Inherits:
-
Object
- Object
- Acc::CheckTransactionResponse
- Defined in:
- lib/acc/check_transaction_response.rb
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #data ⇒ Object
- #error? ⇒ Boolean
- #error_messages ⇒ Object
- #in_progress? ⇒ Boolean
- #in_progress_array_error? ⇒ Boolean
- #in_progress_error? ⇒ Boolean
-
#initialize(json_response) ⇒ CheckTransactionResponse
constructor
A new instance of CheckTransactionResponse.
- #order_error? ⇒ Boolean
- #raw_data ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(json_response) ⇒ CheckTransactionResponse
Returns a new instance of CheckTransactionResponse.
2 3 4 |
# File 'lib/acc/check_transaction_response.rb', line 2 def initialize json_response @response = json_response end |
Instance Method Details
#complete? ⇒ Boolean
14 15 16 |
# File 'lib/acc/check_transaction_response.rb', line 14 def complete? self.success? && @response['statusCode'] == 'COMPLETE' end |
#data ⇒ Object
43 44 45 |
# File 'lib/acc/check_transaction_response.rb', line 43 def data @response end |
#error? ⇒ Boolean
6 7 8 |
# File 'lib/acc/check_transaction_response.rb', line 6 def error? !error_response.nil? || ship_to_error? || order_error? end |
#error_messages ⇒ Object
34 35 36 37 |
# File 'lib/acc/check_transaction_response.rb', line 34 def = [] + [] + .delete_if { |msg| msg.nil? } end |
#in_progress? ⇒ Boolean
18 19 20 |
# File 'lib/acc/check_transaction_response.rb', line 18 def in_progress? error_response.kind_of?(Array) ? in_progress_array_error? : in_progress_error? end |
#in_progress_array_error? ⇒ Boolean
22 23 24 |
# File 'lib/acc/check_transaction_response.rb', line 22 def in_progress_array_error? !error_response.nil? && error_response.first['errorCode'] == 'DEP-ERR-4003' end |
#in_progress_error? ⇒ Boolean
26 27 28 |
# File 'lib/acc/check_transaction_response.rb', line 26 def in_progress_error? !error_response.nil? && error_response['errorCode'] == 'DEP-ERR-4003' end |
#order_error? ⇒ Boolean
10 11 12 |
# File 'lib/acc/check_transaction_response.rb', line 10 def order_error? @response['statusCode'] == 'ERROR' || @response['statusCode'] == 'COMPLETE_WITH_ERRORS' end |
#raw_data ⇒ Object
39 40 41 |
# File 'lib/acc/check_transaction_response.rb', line 39 def raw_data @response end |
#success? ⇒ Boolean
30 31 32 |
# File 'lib/acc/check_transaction_response.rb', line 30 def success? !self.error? end |