Class: Vpago::AcledaV2::TransactionStatus
- Inherits:
-
Base
- Object
- Base
- Vpago::AcledaV2::TransactionStatus
show all
- Defined in:
- lib/vpago/acleda_v2/transaction_status.rb
Constant Summary
collapse
- FAILED_ERROR_DETAILS =
Terminal failure indicators in result.errorDetails. The PDFs only document
code 0 / "SUCCESS"; decline/expiry wording is conservative and should be
confirmed against real responses during UAT. Anything not success and not
terminal is treated as pending so the poller keeps trying.
%w[EXPIRED DECLINED CANCELLED FAILED REJECTED].freeze
Constants inherited
from Base
Base::CONTENT_TYPE_JSON, Base::PURCHASE_DESC
Instance Method Summary
collapse
Methods inherited from Base
#action_url, #amount, #app_scheme, #callback_url, #continue_success_url, #expiry_time, #get_txn_status_url, #hmac512, #initialize, #login_id, #merchant_id, #merchant_name, #open_session_hash, #open_session_url, #opr_device, #order_number, #parse_json, #password, #payment_method, #payment_number, #platform, #purchase_currency, #purchase_date, #secret, #txn_status_hash, #xpay_service_base_url
Instance Method Details
#call ⇒ Object
12
13
14
15
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 12
def call
@response = check_remote_status
self
end
|
#error_message ⇒ Object
29
30
31
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 29
def error_message
result['errorDetails']
end
|
#failed? ⇒ Boolean
37
38
39
40
41
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 37
def failed?
return false unless http_success?
FAILED_ERROR_DETAILS.include?(error_message.to_s.upcase)
end
|
#json_response ⇒ Object
17
18
19
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 17
def json_response
@json_response ||= parse_json(@response.body)
end
|
#pending? ⇒ Boolean
43
44
45
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 43
def pending?
!success? && !failed?
end
|
#result ⇒ Object
21
22
23
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 21
def result
json_response['result'] || {}
end
|
#result_code ⇒ Object
25
26
27
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 25
def result_code
result['code']
end
|
#success? ⇒ Boolean
33
34
35
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 33
def success?
http_success? && result_code == 0 && error_message == 'SUCCESS'
end
|